Len
May 12, 2009 10:57:41
Hello all.
I've had a heck of a time getting something (apparently) simple to work and would appreciate any pointers:
I'm trying to display the elapsed seconds on my animation using a COP Network.
Using $T in the Text field produces too many significant digits so I was trying to find a way to get, say %3.2f (in sprintf talk). That is, tenth and hundredth places.
My great idea was to use hou.time() in the following:
“%3.2f”%hou.time()
I had a bit of an issue getting this to work at first since I seemed to need a keyframe that didn't exist at first.
But, after adding a keyframe at 1 and using this (along with switching the interpreter to python from hscript) it did work in the viewer.
But..the renders hung on the first frame.
Moving to version 10 seemed to fix this but then certain frames were getting garbled.
I also found that the file would hang upon loading “some” of the time.
In conclusion: Lots of weird issues springing up after adding this font node with that expression. Switched to XP and same issues, more or less.
Any thoughts?
I'm going to just leave it as frames or look for a formatting solution in HScript for now but I really am dismayed to bump into such trouble on such a simple part of my project and not have much of an idea of how to fix it or why it's happening.
The OSX console showed “No Drawable” during the file load hanging.
System: Macbook Pro, Houdini 9.5.379 and 10.0.249.5, Windows XP (32) and OSX (both versions, both OSes).
Thanks!
Len
May 12, 2009 11:08:33
I found a solution that will work for me:
Avoiding python entirely, I can use:
`round($T*100)/100`
I still wonder why the python route caused such trouble?
Is it something about using python in a string expression?
Hmm…
edward
May 13, 2009 15:33:57
You can't use python with backticks on string parameters. You have to create a channel on your string parameter, change its language to python, and then use your python expression.
Len
May 13, 2009 15:46:49
When you say “create a channel on my string parameter”, do you mean create a keyframe on the existing text parameter or something else?
I wasn't using back ticks with python. I just returned to back tick expressions when my python code made things go haywire as per my original post.
Thanks for your idea.
goldfarb
May 13, 2009 16:15:41
Len
May 15, 2009 10:22:26
Thanks for the link, Michael, that WAS handy.
So, I still wonder how Python can effectively replace this (since I thought it was the future), but here's what I'm going with for an HScript solution that works nicely:
time: `padzero(trunc(2,$F/$FPS))`:`padzero(2,$F%$FPS)`
edward
May 15, 2009 16:42:23
len
When you say “create a channel on my string parameter”, do you mean create a keyframe on the existing text parameter or something else?
I mean: go to frame 1, then right-click on the parameter and choose Channels and Keyframes > Set Keyframe
tallen
Nov. 17, 2024 21:57:39
adding minutes:
time: `padzero(trunc(2,$F/($FPS*60))%60)`:`padzero(trunc(2,$F/$FPS)%60)`:`padzero(2,$F%$FPS)`