Last active
October 18, 2021 08:27
-
-
Save maty974/c076ff829063f70db3d9 to your computer and use it in GitHub Desktop.
nuke update fbx knobs without popup message
This file contains 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
orig_node=nuke.selectedNode() | |
new_filepath="/path_dir/path_to_new_file.fbx" | |
# save current fbx take and node name knob | |
fbx_take=orig_node.knob("fbx_take_name").getValue() | |
fbx_node=orig_node.knob("fbx_node_name").getValue() | |
# set knob flag NO_KNOB_CHANGED to avoid popup message | |
orig_node.knob("file").setFlag(0x00020000) | |
orig_node.knob("reload").setFlag(0x00020000) | |
# set new values for file path | |
orig_node.knob("read_from_file").setValue(True) | |
orig_node.knob("file").setValue(new_filepath) | |
orig_node.knob("reload").execute() | |
# remove previously set flag NO_KNOB_CHANGED | |
orig_node.knob("reload").clearFlag(0x00020000) | |
orig_node.knob("file").clearFlag(0x00020000) | |
# restore value of fbx take and node name knob | |
orig_node.knob("fbx_take_name").setValue(int(fbx_take)) | |
orig_node.knob("fbx_node_name").setValue(int(fbx_node)) | |
# here is the trick to force Nuke node | |
# update his animation curves | |
orig_frame_rate=orig_node.knob("frame_rate").getValue() | |
orig_node.knob("frame_rate").setValue(12) | |
orig_node.knob("frame_rate").setValue(orig_frame_rate) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment