[Sidefx-houdini-list] general way of asking if a channel is animated?

Graham Thompson captainhammy at gmail.com
Thu Sep 2 13:52:24 EDT 2010


Really it all depends on what it is you want. If you want to know about whether the parm is going to be changing at times then isTimeDependent is definitely the way to go. If you just want to know if a parm is driven by a something then I'd use my function. Both similar but slightly different tasks that can't be solved with a single solution. You of course could write a function that combined the two different methods though. 



On Sep 2, 2010, at 7:51 AM, Pablo Giménez <pablogipi at gmail.com> wrote:

> 2010/9/2 Graham Thompson <captainhammy at gmail.com>:
>> I think I'd change up my previous code a little to get ride of return
>> inconsistencies between the two functions.
>> 
>> def isParmDriven(parm):
>>   """ Test to see if a parameter is driven by an animation
>>        channel, expression or CHOP override.
>>   """
>>   if parm.keyframes() or parm.overrideTrack():
>>       return True
>>   else:
>>       return False
> This is a good and clean snippet.
> But for me, in the cases I am using istimeDependent(), this function
> is just enough.
> The reason is that if I am picking up values from a channel I just
> only need to know if I have to pick it up just one time or for every
> frame.
> 
>> 
>> This way you always get a boolean result, as opposed to either a tuple
>> of hou.Keyframe or a single hou.Track object.  If you wanted to know
>> specifically what was driving the parm I'd write a getParmDriver()
>> function that would return like my first example, then test what I got
>> back.
>> 
>> On Thu, Sep 2, 2010 at 7:14 AM, Edward Lam <edward at sidefx.com> wrote:
>>> On 9/2/2010 9:59 AM, Graham Thompson wrote:
>>>> I think still think best way is to use keyframes().  If you need to
>>>> check against CHOPs overrides as well then you can also use
>>>> hou.Parm.overrideTrack().
>>>> 
>>>> def isParmDriven(parm):
>>>>      """ Test to see if a parameter is driven by an animation channel,
>>>> expression or CHOP override. """
>>>>      return parm.keyframes() or parm.overrideTrack()
>>>> 
>>>> Than function returns true in the case there is an expression,
>>>> animation or a CHOP is exporting to the channel.
>>> 
>>> I second this approach one wishes to know if a parm is "driven". This is
>>> distinctly different from what "isTimeDependent" means. As Pablo pointed
>>> out, "isTimeDependent" returns true if the given parameter might
>>> evaluate to a different value when time changes. If a parameter returns
>>> a constant value for all possible values of time, then it does NOT
>>> depend on time.
>>> 
>>> ASIDE: Houdini uses the concept of "time dependency" to determine if a
>>> node requires recooking when time changes. If a node is determined to
>>> NOT be time dependent, then the cooking engine is free to make
>>> optimizations by reusing cached data. However, since this concept is
>>> used for optimizations, it might err on the conservative side so that no
>>> stale data is used. ie. if time dependency cannot be definitely
>>> determined, isTimeDependent() will return True.
>>> 
>>> Regards,
>>> -Edward
>>> _______________________________________________
>>> Sidefx-houdini-list mailing list
>>> Sidefx-houdini-list at sidefx.com
>>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>> 
>> _______________________________________________
>> Sidefx-houdini-list mailing list
>> Sidefx-houdini-list at sidefx.com
>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>> 
> 
> 
> 
> -- 
> Un saludo
> Best Regards
> Pablo Giménez
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list



More information about the Sidefx-houdini-list mailing list