kunz Difference between revisions of "Houdini Python Cookbook"

Difference between revisions of "Houdini Python Cookbook"

From kunz
Line 25: Line 25:
for e in os.environ:
for e in os.environ:
     print(e, os.environ[e])
     print(e, os.environ[e])
</syntaxhighlight>
Increment number at the end of a text string.  This is the algorithm used by Houdini to generate uniquely named child nodes inside a network.
<syntaxhighlight lang='Python'>
hou.text.incrementNumberedString( hou.getenv('HIPNAME') )
</syntaxhighlight>
</syntaxhighlight>

Revision as of 09:19, 10 August 2022

Force the entire scene to cook (all nodes)

for node in hou.node("/").allSubChildren():
    node.cook(force=True)

Print the full path of the current Houdini scene

print(hou.hipFile.path())

Get the version numbers in the filename

hou.hscript('echo -n `opdigits($HIPNAME)`')

What platform is Houdini running on?

hou.applicationPlatformInfo()

List all the environment variables

import os
for e in os.environ:
    print(e, os.environ[e])

Increment number at the end of a text string. This is the algorithm used by Houdini to generate uniquely named child nodes inside a network.

hou.text.incrementNumberedString( hou.getenv('HIPNAME') )