VEX: split string and convert to integer

September 20, 2018

//Split @anotherAttribute based on ‘_’ string myString[] = split(s@anotherAttribute, “_”); //Use last element as attribute value s@tempString = myString[-1]; //convert string to integer i@myIntegerFromString = atoi(s@tempString);

VEX: Bend Wrangle

September 14, 2018

Taken from https://tosinakinwoye.com/2017/01/23/houdini-vex-snippets/ //Input is a line //Resample SOP on line for more points //Activate curveu attrib in resample SOP //Remap curveu to shape of bend @curveu=chramp(“ramp”,@curveu); float bamt = chf(“bend_amt”); //bend amount vector benddir = chv(“bend_dir”); //bend direction @P+= benddir * bamt * @curveu;

Houdini Python: Find/Replace Parameter Expression

January 18, 2018

A little script to find/replace strings in selected nodes’, parameter expressions: import hou sel = hou.selectedNodes() dialog = hou.ui.readMultiInput('Find/Replace In Expression', input_labels=['Find: ', 'Replace: ',], buttons=("Find/Replace", "Cancel"), severity=hou.severityType.ImportantMessage, title='Find/Replace', close_choice=1) find = dialog[1][0] replace = dialog[1][1] if dialog[0] == 0: for n in sel: for parms in n.parms(): try: newString = str(parms.eval()).replace(find, replace) parms.set(newString) except: … Read More

VEX: SOP Rotation

May 24, 2017

f@speed = fit01(rand(@ptnum), ch('minSpeed'), ch('maxSpeed')); float angle = (ch('angle')+@ptnum)*@speed; vector axis = sample_direction_uniform(rand(@ptnum*ch('seed'))); @orient = quaternion(angle, axis);