I'm not sure you can get an attribute value at a certain time in python, you need to use a timeshift sop to cook a node at a certain time. Alternatively, you could use CHOPs to cook a sop for all time and then query the chop value at a time.
Thanks for the reply and suggestions. I'm quite new to python scripting in Houdini (and really Houdini overall) so forgive me if I'm asking the obvious.
1.If I were to go the CHOPS way, would it work something like this: - Fetch the object (fetch node?) - Add a TimeShift node and set the wanted frame - Read the value of a point (index) somehow?
2. In Houdini, is it suggested that you via Python add nodes, extract a values and then delete nodes? Instead of doing things directly with the API?
3. Any suggestions how to get the selected point indexes that I can then use in CHOPS?
I haven't tried CHOPS yet, but here's a sample code that seems to work. However, it only works if the TimeShift node exist, not if I create it via python. Any idea?
importtoolutilsimportnodesearchimporthouimportosdefget_points():selection=toolutils.sceneViewer().selectGeometry()node=selection.nodes()[0]selection=selection.selectionStrings()selection=list(selection)x=node.geometry().globPoints(selection[0])return(x,node)points,node=get_points()context=hou.node(os.path.dirname(node.path()))# If I have a already existing node everything works.#ts = hou.node("/obj/geo1/timeshift1")# This timeshift does not work.ts=context.createNode("timeshift")ts.setInput(0,node)ts.parm("frame").deleteAllKeyframes()ts.setDisplayFlag(True)ts.setRenderFlag(True)forframeinrange(1,25):ts.parm("frame").set(frame)forpinpoints:print(p.position())#ts.destroy()