summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Seibert <stan@mtrr.org>2012-01-21 17:12:47 -0500
committertlatorre <tlatorre@uchicago.edu>2021-05-09 08:42:38 -0700
commit4264a823b0458aa595424d47d51322c8600ce381 (patch)
treef693515e19a22ac93aa0f7052d5b1662fd985e78
parent68aeef463cbc77089a5e5294f20ffca61968fdd8 (diff)
downloadchroma-4264a823b0458aa595424d47d51322c8600ce381.tar.gz
chroma-4264a823b0458aa595424d47d51322c8600ce381.tar.bz2
chroma-4264a823b0458aa595424d47d51322c8600ce381.zip
Add list, copy, and remove commands to chroma-bvh
-rw-r--r--bin/chroma-bvh32
1 files changed, 28 insertions, 4 deletions
diff --git a/bin/chroma-bvh b/bin/chroma-bvh
index d0f0d5b..fcd20a8 100644
--- a/bin/chroma-bvh
+++ b/bin/chroma-bvh
@@ -28,8 +28,29 @@ def node_swap(cache, args):
geo_name, bvh_name = parse_bvh_id(args[0])
mesh_hash = cache.get_geometry_hash(geo_name)
bvh = cache.load_bvh(mesh_hash, bvh_name)
+
-def stat_cmd(cache, args):
+def list_cmd(cache, args):
+ geo_name = args[0]
+ mesh_hash = cache.get_geometry_hash(geo_name)
+ bvh_list = cache.list_bvh(mesh_hash)
+ print 'BVHs for %s (MD5=%s):' % (geo_name, mesh_hash)
+ print '\n'.join(bvh_list)
+
+def copy(cache, args):
+ geo_name, bvh_name = parse_bvh_id(args[0])
+ target_bvh_name = args[1]
+ mesh_hash = cache.get_geometry_hash(geo_name)
+ bvh = cache.load_bvh(mesh_hash, bvh_name)
+
+ cache.save_bvh(bvh, mesh_hash, target_bvh_name)
+
+def remove(cache, args):
+ geo_name, bvh_name = parse_bvh_id(args[0])
+ mesh_hash = cache.get_geometry_hash(geo_name)
+ cache.remove_bvh(mesh_hash, bvh_name)
+
+def stat(cache, args):
geo_name, bvh_name = parse_bvh_id(args[0])
mesh_hash = cache.get_geometry_hash(geo_name)
bvh = cache.load_bvh(mesh_hash, bvh_name)
@@ -54,9 +75,12 @@ def print_stat(geo_name, bvh_name, mesh_hash, bvh):
print ' % 3d) % 10s %s area = % 9e' % \
(i, len(layer), node_str, layer.area())
-commands = { 'node_swap' : node_swap,
- 'stat' : stat_cmd,
- }
+commands = {
+ 'stat' : stat,
+ 'list' : list_cmd,
+ 'copy' : copy,
+ 'remove' : remove,
+ }
def main():