What is Houdini's equivalent to Maya's objExists()

   3056   3   1
User Avatar
Member
10 posts
Joined: Jan. 2015
Offline
Converting some Maya scripts to Houdini, but can't seem to find Houdini's equivalent to Maya's objExists(). Anyone here know what i can use to replace objExist()? Thanks
User Avatar
Member
1390 posts
Joined: July 2005
Offline
Since Houdini scene has a structure of (nested) directories you have to rely on recursive search to find object in any of subdirectories (subnets in Houdini lingua) similarly to searching files on disk.

So instead of usual:
hou.node(“/obj”).glob(“box*”) –> for multi /obj/box1 /obj/box2
you would rather use:
hou.node(“/”).recursiveGlob(“box*”, filter=hou.nodeTypeFilter.NoFilter) –> /obj/box1 /obj/geo/box1 /shop/box_material etc

More help:
http://www.sidefx.com/docs/houdini15.0/hom/hou/Node [sidefx.com]

hope this helps,
skk.
User Avatar
Member
10 posts
Joined: Jan. 2015
Offline
Thanks SYmek I tried what you said and a few others from the link you gave me,but did not work. Here is the last piece at the end of code that I need to convert out of the 1998 lines. I did not write the code just converting it.Symek can you take a look please?





mc = hou

if mc.objExists('HDR_IMG'):
renderResolutionValue = mc.getAttr('HDR_IMG.renderResolution')
else:
renderResolutionValue = 2
if mc.objExists('HDR_IMG'):
renderQualityValue = mc.getAttr('HDR_IMG.qualityPreset')
else:
renderQualityValue = 2
if mc.objExists('HDR_IMG'):
plateModeValue = mc.getAttr('HDR_IMG.plateMode')
else:
plateModeValue = 1
if mc.objExists('HDR_IMG'):
envModeValue = mc.getAttr('HDR_IMG.envMode')
else:
envModeValue = 1
if mc.objExists('HDR_IMG'):
colorMappingModeValue = mc.getAttr('HDR_IMG.cmMode')
else:
colorMappingModeValue = 2
User Avatar
Member
1799 posts
Joined: Oct. 2010
Offline
If you know the actual full name of your object, you can use this

If hou.node(“someNodePath”) != None:

Do something….

Which is a bit more pythonesque
-G
  • Quick Links