jonp Posted December 4, 2016 Share Posted December 4, 2016 Maybe I'm missing it, as I only searched for about 10 minutes, but how does one determine if a node is of type hou.RopNode? For example, the rop_alembic SOP node is of type "rop_alembic", but its category is "Sop". How do I determine that it's actually a render node? One possible answer is to do this: is_rop = hasattr(node, 'render') ...but that can give false positives. -Jon Quote Link to comment Share on other sites More sharing options...
Atom Posted December 4, 2016 Share Posted December 4, 2016 The term "rop" does appear in the type. You can string search for it. Or simply try to reference a common known parameter only on the ROP. If it errors out it is not a ROP. Quote Link to comment Share on other sites More sharing options...
jonp Posted December 4, 2016 Author Share Posted December 4, 2016 That is true, but when I try to access 'geometry()' on that node, it will raise an error that mentions it being a 'hou.RopNode' class! How do I get to that type definition myself? That seems like the magic bullet. Quote Link to comment Share on other sites More sharing options...
f1480187 Posted December 4, 2016 Share Posted December 4, 2016 (edited) There is misleading collision between Python types and Houdini operator types. In Houdini terms (by calling hou.Node.type() method), rop_geometry is a Sop node, also true inside Operator Type Manager window: In Python terms, this node will be an instance of hou.RopNode, no matter where it is: isinstance(node, hou.RopNode) type(node) == hou.RopNode Before now, I was sure that every node within one network will be same type for both Houdini and Python. Edited December 4, 2016 by f1480187 Quote Link to comment Share on other sites More sharing options...
jonp Posted December 4, 2016 Author Share Posted December 4, 2016 Yes! isinstance() or type(). Guess I wasn't being idiomatic enough in my thinking. Thanks! 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.