Search - User list
Full Version: Formatting Time in Font COP
Root » Houdini Indie and Apprentice » Formatting Time in Font COP
Len
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
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
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
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
you may want to have a look at this:
http://www.sidefx.com/index.php?option=com_content&task=view&id=1500&Itemid=132 [sidefx.com]
04 Building a Time Code -
Len
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
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
adding minutes:

time: `padzero(trunc(2,$F/($FPS*60))%60)`:`padzero(trunc(2,$F/$FPS)%60)`:`padzero(2,$F%$FPS)`
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB