Jump to content

Macros and hotkeys in Houdini


Recommended Posts

Hey there. 

I would like to record a series of UI commands and replay them via a hotkey.
Coming from Modo I have macros in mind but not sure what is the equivalent of that in Houdini. Can someone point me in a right direction? 

For now as a very simple example:
I just want to have the F1 key assigned to "Restart playback from first frame" so essentially Stop > Go back to frame 1 > Play. Right now this would be Shift Up, then Up which is inconvenient and requires two hands. 
Hitting F1 would be tremendously useful during tweaking my simulations.

Thanks!
Kristof

Link to comment
Share on other sites

Ohh yesss! Exactly what I wanted. 

Here's the code, I'll just leave it here as a solution in case anyone stumbles accross this:
 

def outputPlaybarEvent(event_type, frame):
    if event_type == hou.playbarEvent.FrameChanged and frame == 1:
        print event_type
        hou.playbar.play()
        hou.playbar.removeEventCallback(outputPlaybarEvent)

    return False
hou.playbar.addEventCallback(outputPlaybarEvent)         
hou.setFrame(1) 

 

Link to comment
Share on other sites

You could even make it a start/stop toggle:

def outputPlaybarEvent(event_type, frame):
    if event_type == hou.playbarEvent.FrameChanged and frame == 1:
        #print event_type
        hou.playbar.play()
        hou.playbar.removeEventCallback(outputPlaybarEvent)

    return False
    
if not hou.playbar.isPlaying():
    hou.playbar.addEventCallback(outputPlaybarEvent)         
    hou.setFrame(1)
else:
    hou.playbar.stop()

 

Edited by garf
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...