summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorStan Seibert <stan@mtrr.org>2012-01-20 13:16:28 -0500
committertlatorre <tlatorre@uchicago.edu>2021-05-09 08:42:38 -0700
commit0b720e26a7fba043168f2c843c8db73d4e642ed3 (patch)
tree95b16807ecec0759268d9ad14a1c2abbcd9d7ce1 /bin
parentbf46d6b9f42330b42f4634ea6ac0e2b318942786 (diff)
downloadchroma-0b720e26a7fba043168f2c843c8db73d4e642ed3.tar.gz
chroma-0b720e26a7fba043168f2c843c8db73d4e642ed3.tar.bz2
chroma-0b720e26a7fba043168f2c843c8db73d4e642ed3.zip
Add another loader function that is useful for chroma-cam.
Note that rendering is still broken by the new BVH format.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/chroma-cam21
1 files changed, 4 insertions, 17 deletions
diff --git a/bin/chroma-cam b/bin/chroma-cam
index c75f28f..044cf31 100755
--- a/bin/chroma-cam
+++ b/bin/chroma-cam
@@ -6,9 +6,10 @@ if __name__ == '__main__':
import sys
import os
- from chroma import view, build, EventViewer
+ from chroma import view, EventViewer
from chroma import mesh_from_stl
from chroma.tools import enable_debug_on_crash
+ import chroma.loader
from chroma.log import logger, logging
logger.setLevel(logging.INFO)
@@ -28,24 +29,10 @@ if __name__ == '__main__':
size = [int(s) for s in options.resolution.split(',')]
- if os.path.exists(args[0]) and args[0].lower().endswith(('.stl', '.bz2')):
- obj = mesh_from_stl(args[0])
- else:
- module_name, function_name = args[0].rsplit('.', 1)
- orig_sys_path = list(sys.path)
- try:
- sys.path.append('.')
- module = __import__(module_name, fromlist=[function_name])
- sys.path = orig_sys_path
- except ImportError:
- sys.path = orig_sys_path
- raise
-
- obj = getattr(module, function_name)
+ geometry = chroma.loader.load_geometry_from_string(args[0])
if options.io_file is None:
- view(obj, size)
+ view(geometry, size)
else:
- geometry = build(obj)
viewer = EventViewer(geometry, options.io_file, size=size)
viewer.start()