Shalinar Posted April 10, 2017 Share Posted April 10, 2017 (edited) I'm developing a setup using a Python SOP and came across some behavior that I cannot account for. In my example scene, you'll see that I just have a cube appended with a Python SOP. Enable the Python SOP to see what happens. Inside the Python SOP I'm just getting the parent node (the cube), then trying two different things: 1) append a transform node to the Python SOP, and 2) append a transform node to the cube. The first succeeds, the second fails due to "invalid node type name", and it spawns multiple transform nodes. Here's the code: node = hou.pwd() parent = node.parent() # This works just fine: node.createOutputNode("xform") # This fails due to "Invalid Node Type": parent.createOutputNode("xform") So the first issue is why does createOutputNode from a parent node fail? The error raised is "Invalid node type name", but that doesn't make sense because the same node type name is valid when using createOutputNode from the current node. The second issue is why do multiple transform nodes get spawned from a single createOutputNode? EDIT: Only a single transform node spawns when the parent.createOutputNode line is removed, so I believe the second issue is due to the Python SOP re-evaluating the failing code multiple times, each time spawning another successful transform node from the Python SOP. createOutputNode_example.hip Edited April 10, 2017 by Shalinar Quote Link to comment Share on other sites More sharing options...
graham Posted April 10, 2017 Share Posted April 10, 2017 The issue is that the parent node is in fact /obj/example. In the case of Houdini the parent node is the node that contains an operator, not an input node. Since the parent is an Object it fails because there is no xform node at the object level. As you mentioned the multiple nodes in the SOP level are a result of the node cooking multiple times, most likely when MMB on it for errors, etc. Quote Link to comment Share on other sites More sharing options...
Shalinar Posted April 10, 2017 Author Share Posted April 10, 2017 Ah my mistake, "parent" refers to the obj-level container, not the input node. Printing "parent" in my case was misleading because the parent name was the same as the input node's name. Code fixed to: input = node.inputs()[0] input.createOutputNode("xform") Quote Link to comment Share on other sites More sharing options...
Shalinar Posted April 10, 2017 Author Share Posted April 10, 2017 Just now, graham said: The issue is that the parent node is in fact /obj/example. In the case of Houdini the parent node is the node that contains an operator, not an input node. Since the parent is an Object it fails because there is no xform node at the object level. As you mentioned the multiple nodes in the SOP level are a result of the node cooking multiple times, most likely when MMB on it for errors, etc. Thanks Graham, figured out my mistake right as you posted haha Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.