Manually place imported .cpio files in Python

   177   1   2
User Avatar
Member
34 posts
Joined: Dec. 2014
Offline
Hello,

I'm trying to make a script that allows you to import the .cpio files and at the moment you just import them and they place automatically down in the same position they were when first saved. Is there an easy way to rather than instantly place the nodes, attach them to the mouse then allow the users place it themselves just like when you create a new node.

I've seen it done at previous VFX companies but for the life of me I can't find the hou function.

Thanks
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
You generally need to manage things that are selected and use the utils functions to handle things like in the following example:

https://github.com/captainhammy/Houdini-Toolbox/blob/0af66d3820a9cb46080c3ea3922a60e044896139/python/houdini_toolbox/ui/paste/utils.py#L84 [github.com]

There's a bunch of specific stuff for a GUI/workflow, but it's mostly irrelevant. source.load_items(parent) is really just calling parent.loadItemsFromFile({path to your cpio file}). When Houdini loads items from the file they will be loaded and set as selected, then the nodegraphutils.moveItemsToLocation(editor, pos, mousepos) call uses the supplied positions to move the items.
Edited by graham - April 30, 2024 12:28:55
Graham Thompson, Technical Artist @ Rockstar Games
  • Quick Links