Skip to content

Commit

Permalink
Merge pull request #89 from rdb/master
Browse files Browse the repository at this point in the history
Prefer panda3d._rplight module over own native modules
  • Loading branch information
tobspr committed Jan 10, 2018
2 parents 3e7266d + 670d82d commit 87b2768
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
8 changes: 6 additions & 2 deletions rpcore/native/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@

# If the module was built, use it, otherwise use the python wrappers
if NATIVE_CXX_LOADED:
RPObject.global_debug("CORE", "Using native core module")
from rpcore.native import native_ as _native_module # pylint: disable=wrong-import-position
try:
from panda3d import _rplight as _native_module # pylint: disable=wrong-import-position
RPObject.global_debug("CORE", "Using panda3d-supplied core module")
except ImportError:
RPObject.global_debug("CORE", "Using native core module")
from rpcore.native import native_ as _native_module # pylint: disable=wrong-import-position
else:
from rpcore import pynative as _native_module # pylint: disable=wrong-import-position
RPObject.global_debug("CORE", "Using simulated python-wrapper module")
Expand Down
15 changes: 14 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,17 @@ def check_panda_version():
"(you can also build from source).")
error("Panda3D version outdated")

def check_panda_rplight():
""" Checks whether Panda3D provides the rpcore native module. """

try:
from panda3d import _rplight
return True
except ImportError:
pass

return False

def setup():
""" Main setup routine """

Expand Down Expand Up @@ -237,8 +248,10 @@ def setup():
exec_python_file("data/setup/check_requirements.py",
troubleshoot="https://github.com/tobspr/RenderPipeline/wiki/Setup-Troubleshooting#requirements-check")

if check_panda_rplight():
write_flag("rpcore/native/use_cxx.flag", True)

if not CMD_ARGS.skip_native:
elif not CMD_ARGS.skip_native:
query = ("The C++ modules of the pipeline are faster and produce better \n"
"results, but we will have to compile them. As alternative, \n"
"a Python fallback is used, which is slower and produces worse \n"
Expand Down

0 comments on commit 87b2768

Please sign in to comment.