jamesr Posted March 7, 2020 Share Posted March 7, 2020 (edited) Using instances() with hou.nodeType() to grab node instances is really nice. Does anyone know a way to grab all the instances for an operator type with a version string in the operator type name? ie. jamesr::myasset::2.00 Since the version is in the type name itself, it seems like you have to specify the version as well in order for it to work, ie hou.nodeType("jamesr::Object/myasset::2.00") instead of just hou.nodeType("jamesr::Object/myasset") I was hoping there must be, since you can create nodes without specifying the version like hou.node("/obj").createNode("jamesr::myasset") I've tried using hou.preferredNodeType(), but it still seems to required the version string as well. When testing it on a builtin node who has multiple definitions including a version string like "rainbow" with hou.preferredNodeType("Vop/rainbow") it works fine. I could always use a [x for x in hou.node("/obj").children() if "jamesr::myasset" in x.type().name()] type of thing, or get the node type from an existing node, but I was just wondering if it is possible this way. If anyone has any relevant posts I might have missed that I could check out, that would be great too. Thanks! Edited March 7, 2020 by jamesr Quote Link to comment Share on other sites More sharing options...
anim Posted March 7, 2020 Share Posted March 7, 2020 try this: import hou import nodesearch root = hou.node("/obj") matcher = nodesearch.NodeType("jamesr::myasset", hou.objNodeTypeCategory()) nodes = matcher.nodes(root, recursive=True) print nodes more info here: https://www.sidefx.com/docs/houdini/hom/nodesearch.html 1 2 Quote Link to comment Share on other sites More sharing options...
jamesr Posted March 8, 2020 Author Share Posted March 8, 2020 1 hour ago, anim said: more info here: https://www.sidefx.com/docs/houdini/hom/nodesearch.html Thank you, this is very useful! 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.