Specify playhead

   2265   6   1
User Avatar
Member
100 posts
Joined: 8月 2014
Offline
I think this should be simple but I am perhaps missing the obvious.

Basically what I want to do is have an attribute drive what frame the scene “playhead” is on. I have a digital asset that when you move the gui slider to 4, I want the scene playhead to jump to frame 4.

I have several timeshift nodes in my scene so I would like to not to use one, since it will likely throw off all of the other timeshift nodes downstream.

What I have currently is a Hscript node.. and the fcur command. But other than punching in a number.. ie fcur 4 .. I have not been able to replace the 4 with a attribute/varibable.. ie .. fcur detail(“../frame”, “frame”, 0) .. and get a result or fcur $theframeiwant and get a result.

Any ideas?
User Avatar
Member
8845 posts
Joined: 7月 2007
Offline
you can achieve it by using parameter callback, that would set playbar to desired value as soon as you edit the parm, if that's what you want

however
- callback will not be called if the value change is due to expression driving the parameter
- the value of the parm will not be changed if you change playbar manually

Attachments:
setPlaybarFromParm.hip (41.7 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
100 posts
Joined: 8月 2014
Offline
Thanks yet again Tomas for your help!

I'll check this out, it sounds like this might work fine for what I need.

I have been experimenting with using a timeshift(many) and isolating the other timeshifts in the graph so they are not affected. Its about 90% working, still a bug in there.

I think if I can get this callback approach to work though, it gets me back to the clean and 100% working method I built the graph around and tested with where I was manually moving the playhead.

Thanks again.
User Avatar
Member
100 posts
Joined: 8月 2014
Offline
Is there some sort of “echo commands” window in Houdini I have not found? that would show what is firing when a gui button is clicked.

I would like to also emulate the functionality of the “step forward”, and “step backward”, + and - buttons next to the timeline. I have a step size of 9 frames at the moment.

I have not found a hou.stepforward() etc yet.
User Avatar
Member
100 posts
Joined: 8月 2014
Offline
- callback will not be called if the value change is due to expression driving the parameter

^ This is a drag. Any way around this?
User Avatar
Member
8845 posts
Joined: 7月 2007
Offline
Kfinla
- callback will not be called if the value change is due to expression driving the parameter

^ This is a drag. Any way around this?

yes,

you can include the callback code directly in the expression
or in another parm that references your frame parm, so that you can really decide what to use to drive your parm

the downside of that method is
- code may be called more times than you may expect, which may not be a big deal
- since you want to use it to override actual playbar it will interfere with regular playbar controls, so they may stop working
- you can't make it dependent on time so the expression you use to drive your parm has to be completely time independent as the time depends on playbar, so if you use for example $F+1, it will set your playbar to next frame, that will force the expression to evaluate again, which will advance the playbar, so it would go forever until you hit esc
- on top of that if you have more instances of your asset, each will try to override the playbar with it's own value, so only last one will win, which in theory can be very random

overall, I don't think it's a good idea to make live asset constantly overriding playbar. Maybe if you describe your actual problem you may get a better solution, this seems very hacky approach

but here is the file, even though I don't recommend using this approach

Attachments:
setPlaybarFrom_expression_bruteforce.hip (42.1 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
100 posts
Joined: 8月 2014
Offline
Thanks Tomas, that “hack” actually works well for what I am doing. Granted the Esc key and manual update got a lot of use while I got things setup and into a stable place.

I had totally forgotten how to concatenate strings with fcur.

To briefly try to explain what I am doing; essentially I am storing different bits of data as well as different versions of that same data at different points in time.
So the fcur “hack” lets me jump to a specific piece of data, as well as a specific iteration of that data using a simple formula that takes both the data type I want, and the iteration i want.. and spiting out what frame that is.
  • Quick Links