Python Equivalent to Hscript $FSTART and $FEND

   6083   6   2
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
Hi,

I was hoping if anyone would know the answer as in post title.

I've tried playing around with hou.frame() but haven't had any luck.

Because at the moment with wave nodes - the option of using start/end in the drop down parameter of channel range does not work ( current bug waiting to be fixed ).

In a previous post awong suggested as a work around I use:

# Start
($FSTART-1)/ch(“rate”)
# End
$FEND/ch(“rate”)

However, this wave node is part of a digital asset that is being used in relation to many other digital assets and I cannot change expression language just for this workaround because all the other code is in python.

So I need to be able to control the start and stop in python.

Any help is appreciated.

Thank you
User Avatar
Member
2529 posts
Joined: June 2008
Offline
Houdini Tricks website suggests you can execute a python function to convert a hScript variable to a result.

http://houdinitricks.com/post/119009659799/quicktip-python-parameter-expressions-part-1 [houdinitricks.com]

hscriptExpression(“$F”)

Another site with some Houdini code on the topic.
https://sites.google.com/site/fujitarium/Houdini/expressions-by-python-houdini [sites.google.com]
Using Houdini Indie 20.0
Ubuntu 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
Thanks very much Enivob.

This works just as I needed.

In case some newbies are following I'm just going to include the code I used that works with expression language set for Python.

(hscriptExpression(“$FSTART”) + 50)/ch(“rate”):

With frame range set from 1 to 240 and a change rate of 24 this code starts movement at frame 53 ( I know it should start at 52 but that detail isn't important for me to look into at the moment although I suspect with the division of “rate” at 24 that perhaps there is some rounding going on that doesn't let it kick in until one frame later.

(hscriptExpression(“$FEND”) - 140)/ch(“rate”):

This end code stops movement at frame 100.

Thanks again Enivob.
User Avatar
Member
8525 posts
Joined: July 2007
Offline
just for completness, here is the direct python equivalent:

$FSTART, $FEND:
hou.playbar.timelineRange()
$RFSTART, $RFEND:
hou.playbar.playbackRange()
and since there is one frame offset while converting between frames/time, you can use hou.frameToTime() or hou.timeToFrame():
hou.frameToTime(hou.playbar.playbackRange())
hou.frameToTime(hou.playbar.playbackRange())
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
Hi tamte,

Great, more options to work with. Thanks for this.

I found .playbackRange and .setPlaybackRange in the help files but for some reason .timelinerange is not there. I guess it's deprecated.
User Avatar
Member
1904 posts
Joined: Nov. 2006
Online
The timelineRange() function was a new addition for Houdini 15 so most definitely not deprecated. It simply does not appear to be documented, which with the new help server probably means not show up. Sadly there does not seem to be a corresponding setTimelineRange() function
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
Thanks for this info graham.
  • Quick Links