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:

kwargs['node'].hdaModule().foo()

Pre-render create directory

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

`opfullpath("/obj/geo_heating/shopnet/material_bake/heating_pc_v001")`

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):
    os.makedirs(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);