[Sidefx-houdini-list] Get time from CH_Manager rather than OP_Context in HDK, why?

Edward Lam edward at sidefx.com
Thu Jul 28 15:03:08 EDT 2011

Hi Pablo,

On 28/07/2011 1:33 PM, Pablo Giménez wrote:
> BTW how can I get the current time using only CH_Manager, I am now
> using: now = context.myTime + chman->getGlobalStart(); But I havent
> seen any method in CH_Manager to get the same values as
> context.myTime

That is wrong. I think you're misinterpreting what those functions 
return. OP_Context::getTime() returns your the *absolute* time in 
seconds. Houdini generally deals with times as absolute values in 
seconds except in a few cases internal to CH_Channel/CH_Segment. So it 
is _incorrect_ to add OP_Context::getTime() to CH_Manager::getGlobalStart().

The corresponding CH_Manager function to OP_Context::getTime() should be
CH_Manager::getEvaluateTime(). Note however though that the caller is
free to specify a different context time than the global time.
Therefore, it is recommended to always use OP_Context::getTime()
whenever possible.

Note that CH_Manager's getGlobalStart()/getGlobalEnd() returns the 
values (in seconds, Houdini only deals with evaluation time values in 
seconds) corresponding to the frame range in Houdini's Global Animation
options dialog.

> Well more issues I have with frames and time. I am using all of this
>  to set the start time of a particle system. Seems that no matter
> what frame range you have, frame 1 is time 0.

This is due to legacy reasons.

> What happens is that if you set start frame in a POP Network to be
> 0, the sim begins on frame 1, even if your frame range is something
> like [-10, 100].

The POP network uses the global animation frame start (ie.
CH_Manager::getGlobalStart()) to determine when to "reset". ie. where it
will _not_ continue cooking from the previous state. When the POP
network "resets", it will cook starting from the specified start time 
minus preroll.

So if your global animation frame range is [-10, 100] while your POP 
network uses start time of 0 (frame 1), it will do the following:
   - Reset at frame -10
   - Do nothing until frame 1, at which time it starts cooking
This situation can easily be tested with a simple POP network and a 
default Location POP.

Best Regards,

More information about the Sidefx-houdini-list mailing list