Scripting to select Bundles and contents

   547   2   1
User Avatar
Member
18 posts
Joined: 2月 2015
Offline
Hi,

I'm trying to use a script to select a bundle's contents (given it's name) and makes them visible or hides them, but am finding hard to track down the right command as a bundles don't seem to live where most other accessible data lives i.e below "\".


Ultimately I want to make a script that only shows the objects that are visible for rendering in a selected ROP and it's really boring doing it manually.

After selecting a ROP, I'd like to run a script that:
1. Selects all the objects in all the bundles in a scene and hides them.
2. Selects the contents of bundles listed in the ROP's Force Objects Parameter Set and makes them visible.

Any help in accessing bundle data gratefully received.

Many thanks,

Adam.


I used to use Softimage which would log every command carried out in a window which made cobbling together scripts way easier but don't think there's a similar function in Houdini.



I used to use Softimage which would log every command carried out in a window which made cobbling together scripts way easier but don't think there's a similar function in Houdini.
User Avatar
Member
29 posts
Joined: 8月 2016
Offline
Maybe this hda can help you
https://www.youtube.com/watch?v=H2htQUxem-k [www.youtube.com]
User Avatar
Member
18 posts
Joined: 2月 2015
Offline
Thanks CoreSign, looks like there maybe some breadcrumbs there.

Think my problem is that I don't know how to get hold bundle as an Object to manipulate.
Very new to Houdini scripting so not sure how to get hold of some data.

I have the script below so far but I think this is the bit that is letting me down.

obj_node = hou.node(obj_name)

As a bundle isn't a node.





------------------------------------------------------
import hou

selected_nodes = hou.selectedNodes()
rop_node = selected_nodes

print(rop_node)

rs_objects_force = rop_node.parm("RS_objects_force")
object_list = rs_objects_force.eval().split()

# Select the objects listed in 'RS_Objects_Force'
for obj_name in object_list:
obj_node = hou.node(obj_name)
if obj_node:
obj_node.setSelected(True, clear_all_selected=False)

else:
print(f"Warning: Object '{obj_name}' not found in the scene.")

--------------------------------------------------------------
  • Quick Links