
Houdini meaning code#
But what if you want your python code to live in a hip? Make a shelf, r.click on it, new tool, python away. If it's python code just for you, making a shelf button is probably the easiest way. Maya's script editor allows this, I wanted a similar thing in Houdini. The python console in Houdini is a live command line, which is great for some things, but doesn't allow you to enter multi-line code easily. setAttribValue ( "s", seconds ) Make a general python input windowĭownload scene: File:python_code_window.hip total_seconds () seconds /= duration point. strptime ( t, fmt ) seconds = ( t - start ). strptime ( end, fmt ) duration = ( end - start ). I've used an attrib promote to get the min and max values stored as detail attributes.įrom datetime import datetime as dt fmt = '%Y-%m- %d T%H:%M:%S. That's gonna be some awkward string manipulation in vex, but its something python can handle pretty easily with its datetime module. You import data that has time values stored as a string like 'T19:04:06.900', and you want to convert that to regular seconds. Here's an example of why you might need this. attribValue ( "Cd" ) # Set an attribute for point in geo. iterPoints ()) # get a point attribute for point in geo. attribValue ( 'tmin' ) # Get for point in geo. Point, "id", 0.0 ) # Get a detail attribute start = geo. This is like a 'attribute create sop', so only do this once, not while looping over geometry! # the default value sets the type, so 1.0 is a float, but 1 is an int. There's no implicit parallel processing here, so you usually have to setup a loop of some kind to read all the points or write all the points. A python sop is handy for esoteric things like reading in odd file formats and converting directly to geometry, or processing odd string and time formats into something more vex friendly for later on. Remember a python sop is like a wrangle, only obtuse.

