Houdini FX
POPs
Random Spin: // The following makes it random: axis = rand(@id) - set(0.5, 0.5, 0.5); spinspee...
Python
Fun Shelf Scripts
Version up sops that have a "version" parm - I use this to version up a lot of exports in tops or...
PythonModule Scripts
Get houdini version: hver = hou.applicationVersionString().rpartition('.')[0]
Move Files
import os,hou, shutil selected = hou.selectedNodes() for x in selected: if x.parm("env_map...
split by group
import hou selected = hou.selectedNodes()[0] groups = [g.name() for g in selected.geometry().pr...
Update frame range from file
def grabFrames(self): import os plate = self.parm("backplate").eval() if not plate...
OnCreated scripts
OnCreated Script to set name, color, shape of node: cachename = hou.ui.readInput("Enter cache na...
Bake Camera from Alembic
import hou obj = hou.node("/obj") ocam = hou.node(hou.ui.selectNode(node_type_filter=hou.no...
Get frame range from alembic
import _alembic_hom_extensions as ahe; import hou; anode = hou.pwd(); cam = anode.parm("camera")....
Example On Node Buttons
This is how a button on a non-adminned node needs to be laid out: import hou ; do something ;...
Send to Tops
import hou nodes = hou.selectedNodes() topnet = hou.node("/obj/topnet1") if not topnet: ...
Set Frame Range without Script
import hou; anode = hou.pwd(); start = anode.parm("framemin").eval(); end = anode.parm("framem...
ROP
PostRender open MPLAY: import os; img_path = "`chs("picture")`".replace("$F", "\*"); os.system("...
Pull version from hipname
Can be used in a parameter. Returns a integer. import hou, re version = re.findall('_v\d+', hou...
Get Frame Size of Image File
node= hou.pwd(); bg=node.parm("image").eval(); res=hou.imageResolution(bg); node.parm("framesizex...
Create Agent from built in mocap rig - Simple
This will take a test mocap rig 3 built in to houdini, create an agent, add agent clips from the ...
Send selected nodes to new object (fancy way to create object merges)
import hou nodes = hou.selectedNodes() destnode = hou.node(hou.ui.selectNode(title="select dest...
Send nodes to new alembic export
import hou nodes = hou.selectedNodes() destnode = hou.node("/obj/EXPORT") if not destnode: ...
TOPs - symlink output file of parent
exportFile = str(work_item.expectedInputFiles[0]) dir = os.path.dirname(exportFile) newFile ...
VEX
Camera Stuff
auto focus, get distance from object and camera: vlength(vtorigin(“/obj/geo1”, “/obj/cam1”))
Points
divide points into 3 equal parts: i@part = floor(fit(rand(@ptnum+.258), 0, 1, 0, 2.9)); poin...
If then statements
If the pscale is greater than .4 then set it to .2, if not set it to its current pscale @pscale ...
Transforms and Junk
1. transforms to attribute matrix: p@orient = quaternion(3@transform); v@scale = cracktransform...
Orientation
Get transform and orientation from camera: string camera = "/obj/alembicarchive1/Camera2/CameraS...
Spiral
#include "math.h" #include "voplib.h" float easeOutCirc ( float t ) { return sqrt ( 1 -...
Links
Big resource: https://lex.ikoon.cz/vex-snippets/
Expressions
Switch by Normal: if(point("../resample3", 0, "N", 2)<0, 0, 1)