Alex Majewski
alexmajewski
About Me
専門知識
Developer
業界:
Advertising / Motion Graphics
Connect
LOCATION
Poznan,
Not Specified
ウェブサイト
Houdini Engine
Availability
Not Specified
Recent Forum Posts
Is it possible to execute Python before opening a hipfile? 2024年11月27日7:41
My goal is to check conditions when I open a hip file.
My hipfile has a JSON file next to it with info.
If I go to File > Open... and my current houdini session doesn't meet the conditions (i.e. the JSON file states Redshift is required and I don't have Redshift, or my houdini version is too low) it stops loading the file. And then executes more logic, maybe starts a new houdini process that meets the criteria.
Is there an event I can plug into? And how?
Edit:
After some digging, I see I probably need to use hou.hipFileEventType.BeforeLoad. But how do I stop the file from being loaded?
My hipfile has a JSON file next to it with info.
If I go to File > Open... and my current houdini session doesn't meet the conditions (i.e. the JSON file states Redshift is required and I don't have Redshift, or my houdini version is too low) it stops loading the file. And then executes more logic, maybe starts a new houdini process that meets the criteria.
Is there an event I can plug into? And how?
Edit:
After some digging, I see I probably need to use hou.hipFileEventType.BeforeLoad. But how do I stop the file from being loaded?
How to rename/remove/reparent prims with Python? 2024年11月21日5:45
Thanks goldleaf I did like you said with full success.
If anyone finds this post in the future, here's a minimal example of reparenting a prim (it requires the layer to be flattened first):
And to my understanding, if we plan to make more operations, we should add
Other ways and examples on reparenting, renaming or removing can be found in the USD Survival Guide, here. [lucascheller.github.io]
If anyone finds this post in the future, here's a minimal example of reparenting a prim (it requires the layer to be flattened first):
from pxr import Sdf node = hou.pwd() layer = node.editableLayer() cube_path = Sdf.Path("/Cube") new_cube_path = Sdf.Path("/Objects/Cube") edit = Sdf.BatchNamespaceEdit() edit.Add(cube_path, new_cube_path) if not layer.Apply(edit): raise Exception("Failed to apply layer edit!")
with Sdf.ChangeBlock():
before the
edit = Sdf.BatchNamespaceEdit()
Other ways and examples on reparenting, renaming or removing can be found in the USD Survival Guide, here. [lucascheller.github.io]
How to rename/remove/reparent prims with Python? 2024年11月20日9:18
How to do what Restructure Scene Graph LOP does, but with Python?