Simple math calculations in input fields.

   576   3   0
User Avatar
Member
8 posts
Joined: 11月 2024
オフライン
Houdini is still new to me. I don't know of any program where you can't do simple calculations in input fields.

For example, in the timeline. Let's say I'm on frame 76 and want to jump 18 frames ahead. It doesn't work to put + 18 after 76.
I have to calculate it myself and override 76 with 94.

Could it be that this isn't possible in Houdini? Or is there a trick?

This only seems to work in the Animation Editor when I want to move keyframes.
User Avatar
Member
5103 posts
Joined: 2月 2012
オフライン
Hi,

You can't do this in every parameter field. But if you really need this feature, your best bet is to create a simple python script that shows a popup field where you could type an offset like 5, or -10 then use that value to change the current time.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
8 posts
Joined: 11月 2024
オフライン
Thanks for the reply. This could be a possibility. However, I'm still overwhelmed by python scripts. I'm currently learning the basics of VEX.
User Avatar
Member
152 posts
Joined: 8月 2012
オフライン
Here's a shelf tool script:

# UI for user to input pos/neg int
input = hou.ui.readInput(
        "Enter an integer value to offset current Frame by", 
        buttons=("Update", "Cancel"), 
        close_choice=1, 
        title="Enter a number")

try:
    # Validate value
    frame_offset = int(input[1])
except ValueError:
    print("Please enter a valid integer")
else:
    # Function
    current_frame = hou.intFrame()
    new_frame = current_frame + frame_offset
    
    # OPTIONAL: Handle wrapping around playback range
    playback_range = hou.playbar.playbackRange()
    if new_frame < playback_range[0]:
        new_frame = (playback_range[1] + 1) - (playback_range[0] - new_frame)
    if new_frame > playback_range[1]:
        new_frame = (playback_range[0] - 1) + (new_frame - playback_range[1])
    # Update
    hou.setFrame(new_frame)
    
  • Quick Links