frame(full_precision=False)
→ float
Note that this function is equivalent to Hscript’s $FF
variable. If you
want hscript’s $F
variable, use hou.intFrame(), which rounds the frame
to the nearest integer.
To enable fractional frames, turn off the Integer Frame Values in the Global Animation Options dialog.
This function rounds its output to 6 digits after the decimal point, just like
Hscript’s $FF
variable does. To disable this rounding, pass True
for the
‹full_precision› parameter. Note, though, that because a Python float may not
be able to precisely represent a floating point value, and because Python does
not round numbers when it displays them, the frame number might end with
9999999999999 or 0000000000001 when you print it to the Python shell. When you
convert the number to a string, though, Python will round the value.
>>> 2.759 2.7589999999999999 >>> 2.757 2.7570000000000001 >>> str(2.759) '2.759'
If Houdini is on a fractional frame and you
do not want the rounded value, use hou.timeToFrame(hou.time())
.
>>> hou.setFrame(13.193) >>> hou.frame() 13.193 >>> hou.timeToFrame(hou.time()) 13.192999839782715 >>> hou.setFrame(2.759) >>> hou.frame() 2.7589999999999999 >>> int(hou.frame()) 2 >>> hou.intFrame() 3
See also |