hello esteemed members of houdini,
i am trying to make a comparison to know if a node input is of type ObjNode or SopNode.
Here is my shell test code:
>>> a=hou.node('/obj/box_object1')
>>> b=hou.node('/obj/box_object1/box1')
>>> a.type()
<hou.NodeType for Object geo>
>>> b.type()
<hou.SopNodeType for Sop box>
here is my function code:
def modify_my_geometry(inputnode):
if (inputnode.type()==hou.SopNodeType):
print(“I can now access the inputnode.geometry() to modify it”)
else
print(“there is no geometry object here for me to modify”)
As you can see, i am trying to figure out if a geometry is present for me to add primitives ,points etc to it or modify existing.
Can you help me ?
compare to know if i am dealing with ObjNode or SopNode
2860 6 2- Guru Yogibear
- Member
- 3 posts
- Joined: Nov. 2014
- Offline
- PradeepBarua
- Member
- 443 posts
- Joined: Sept. 2012
- Offline
- Guru Yogibear
- Member
- 3 posts
- Joined: Nov. 2014
- Offline
- PradeepBarua
- Member
- 443 posts
- Joined: Sept. 2012
- Offline
- PradeepBarua
- Member
- 443 posts
- Joined: Sept. 2012
- Offline
- PradeepBarua
- Member
- 443 posts
- Joined: Sept. 2012
- Offline
- ajz3d
- Member
- 477 posts
- Joined: Aug. 2014
- Offline
yourNode = hou.node('/obj/geo/null1')
You can use Python's isinstance() built-in function:
isinstance(yourNode, hou.SopNode)
The above will return true if yourNode is an instance of a SopNode class, and false if it's not.
Type comparison will also work, although it ignores inheritance (shouldn't matter in this particular case):
type(yourNode) == hou.SopNode
You can use Python's isinstance() built-in function:
isinstance(yourNode, hou.SopNode)
The above will return true if yourNode is an instance of a SopNode class, and false if it's not.
Type comparison will also work, although it ignores inheritance (shouldn't matter in this particular case):
type(yourNode) == hou.SopNode
-
- Quick Links