hou.phm() in event handlers

phm() → hou.HDAModule

“This shortcut lets you write hou.phm() instead of hou.pwd().hdaModule(). You are most likely to use this shortcut from event handlers, button callbacks, and menu generation scripts in digital assets.”

It is Houdini’s Help.
But phm() and hou.pwd().hdaModule() do not work in event handlers.

Use instead in event handlers:


Pre-render create directory

Custom parameter (shader_node) with path to node with filename parameter (if You use it in shader etc.):


Pre-render script to create non-existent directory:

import os
path = hou.pwd().parm('shader_node').evalAsString()
dirName = os.path.dirname(hou.node(path).parm('filename').evalAsString())
if not os.path.exists(dirName):

Scale Packed Geometries

This is a simple VEX code that allows you to change the size of objects:

matrix3 xform = primintrinsic(0, "transform", @primnum);
scale(xform, chf("scale"));
setprimintrinsic(0, "transform", @primnum, xform);