Friday, December 14, 2018

Nuke: Cant believe I forgot this... First frame last frame

nuke.knob('root.first_frame')
nuke.knob('root.last_frame')
yup. I know. Oh and it returns a string btw. I have NO idea why. Like really. Why..?

Saturday, July 14, 2018

Houville :: Alembic transform theft

Now that I'm typing this I'll probably not forget it. If I don't post this, I'll definitely forget it.
//Alembic packed info put onto existing geo.
matrix abc = primintrinsic(1,'packedfulltransform',0);
P *= abc;


This is kind of messed up, but handy if you want to freeze geo, affect it, but then have it resume animation from an incoming abc transform animation. Input 1 is the frozen and tweaked geo, 2 is the animated abc and 3 is the abc frozen on the same frame as 1.
//Alembic packed info from static frame subtracted out, then a the animated one put back in/
matrix abc = primintrinsic(1,'packedfulltransform',0);
matrix abcRef = primintrinsic(2,'packedfulltransform',0);

P *= invert(abcRef) * abc;

Friday, June 29, 2018

Houville :: Looping RBD Sims



So the concept here was run a sim, reverse it and blend the two together so that the beginning and the end are the same.

Pretty logical right?

Well as you can see from the top gif, when the blend back occurred, chunks would squish through themselves to resolve the different orientations.

After a bit of messing around I realised rather than deal with the chunks, just keep the point data from the sim and use a for-each loop to copy each chunk back onto the corresponding point afterwards.  This resolved the squish but then there was a pop as the orientation attribute was not blended by the blendShape SOP.

The way around that was to use a wrangle that blended @P with a lerp, and then did exactly the same with the @orient attribute.

Plugging that in to the for-each copy chunks loop made everything work as expected :)

Sunday, April 15, 2018

Houville :: Get selections from Scene Views

This is one of those obvious needs that ends up being a frustrating "how do you even..?"

In Houdini 16.5 and up it's pretty simple:
import toolutils
sv = toolutils.sceneView()
str(hou.SceneViewer.currentGeometrySelection(sv))


However in 16.0 it's a bit more fiddly as currentGeometrySelection doesnt exist. hicon:/SVGIcons.index?book.svg
import toolutils
selection = toolutils.sceneViewer().selectGeometry() ## this annoyingly unselects your selection
print selection
## lets also get this in the clipboard so we can past it in a node.
Here's a good reference: https://www.sidefx.com/forum/topic/30353/
As is this in the docs: http://www.sidefx.com/docs/houdini/hom/tool_script.html