Last active
March 9, 2023 20:32
-
-
Save jamesrobinsonvfx/2d773b45c61452a592dc6fff28db6fbc to your computer and use it in GitHub Desktop.
Toggle Manual Mode in Houdini
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def toggle_manual(): | |
"""Toggle cook mode""" | |
current_mode = hou.updateModeSetting() | |
auto = (hou.updateMode.AutoUpdate, hou.updateMode.OnMouseUp) | |
toggle_cook = hou.shelves.tool("toggle_manual") | |
toggle_cook.setLabel("Auto Update") | |
if current_mode in auto: | |
hou.setUpdateMode(hou.updateMode.Manual) | |
toggle_cook.setIcon("MISC_cook") | |
elif current_mode == hou.updateMode.Manual: | |
hou.setUpdateMode(hou.updateMode.AutoUpdate) | |
toggle_cook.setIcon("BUTTONS_do_not") | |
toggle_cook.setLabel("Manual Mode") | |
with hou.undos.disabler(): | |
toggle_manual() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated to exclude this from the undo stack (super annoying when trying to debug something heavy!), and added John Hughes' nifty icon switching logic