Set an attribute with the previous value of another attribute

   2038   7   1
User Avatar
Member
59 posts
Joined: April 2006
Offline
Hi,
I've been unsuccessfully trying timeshift and solver nodes to store the previous value of a detail attribute. Not the value on the previous frame, but the previous different value. From what I've read, I am quite sure Solver node is the way to go, but I cannot come up with a solution inside the solver. Any ideas?
Thanks!
User Avatar
Member
394 posts
Joined: Nov. 2016
Offline
What causes the change in the value?
User Avatar
Member
59 posts
Joined: April 2006
Offline
Here's a file with my setup. I have a camera animation and 10 fixed cameras. A detail attribute stores the best (closest angle) fixed camera compared to the camera animation. Then I have a trigger value (detail float) that switches to 1 every time “camera1” detail attribute changes its value. My ultimate goal is to make that 1.0 trigger value, fade to zero in (let's say) 5 frames, instead of going back to zero the next frame. So i can use it as a blending value, every time there is value change in the “camera1” detail attribute value.

Attachments:
valueFadeTrigger.hip (476.3 KB)

User Avatar
Member
7772 posts
Joined: Sept. 2011
Offline
When your logic allows the change in value, update ‘previous value’ attribute with the current value immediately before updating the value.

pseudocode:

if (trigger) {
   prev_cam = cam;
   cam = new_cam;
}
User Avatar
Member
59 posts
Joined: April 2006
Offline
Thanks for your reply, jsmack. But I am afraid that “cam” only gets evaluated in the “cam = new_cam” so I always get a 0 value for “prev_cam”
User Avatar
Member
394 posts
Joined: Nov. 2016
Offline
perpen
My ultimate goal is to make that 1.0 trigger value, fade to zero in (let's say) 5 frames, instead of going back to zero the next frame.

Here's a new scene with a solver that generates this. Does that help?

Attachments:
valueFadeTrigger_solver.hip (498.3 KB)

User Avatar
Member
59 posts
Joined: April 2006
Offline
This is exactly what I was trying to achieve last night until midnight Thanks a lot for your help!
User Avatar
Member
394 posts
Joined: Nov. 2016
Offline
Great, glad I could help!
  • Quick Links