Jump to content

increasing attribute iteratively in a simple manner


Vinz9

Recommended Posts

Hi,

Going back to Houdini after using Maya for sometime.

In a maya expression, at each frame I can query the current position, rotation... and then do whatever I want with it.

Or more simply put, I can write something like cube.translateX = cube.translateX + 1; (with a condition resetting tx on frame 1).

Now in Houdini, writing something like ch("tx") + 1 in the translateX of an object crashes Houdini :(

And in a VEX Sop, it seems I can't query the current position of the points, P and other attributes always return their initial value.

What I'm trying to do in a vex sop is : do something with the points if a certain condition is true and store the current position, and when the condition becomes false use the last stored position.

Do I need to go to chops or use the sop solver to do something like this ? I love chops, but having to cache attributes over the whole sequence is slow and memory intensive, and I've always found the sop solver a bit unstable and not easy to debug.

Would a python sop help me there ? Another way I thought about it to write a script to write keyframes but it's not really interactive :(

Thanks a lot

Vincent

Link to comment
Share on other sites

Houdini's expression language, unlike MEL, is functional rather than being imperative. What this means is that your expressions can only return values, never set values. Sometimes this is also called history-independent meaning that the expressions can be evaluated at any frame, without relying on previous calculations (or "history"). To do the equivalent of "cube.translateX = cube.translateX + 1", you probably just want "$F - 1 + <offset>" where <offset> is the starting value at frame 1.

If you want to use history, then you have to go to some sort of operator context that maintains history across time like CHOPs, POPs, or DOPs.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...