diff --git a/colorbleed/maya/lib.py b/colorbleed/maya/lib.py index 2ea618c178..d4b0b8aa73 100644 --- a/colorbleed/maya/lib.py +++ b/colorbleed/maya/lib.py @@ -1404,9 +1404,29 @@ def set_scene_fps(fps, update=True): else: raise ValueError("Unsupported FPS value: `%s`" % fps) + # Get time slider current state + start_frame = cmds.playbackOptions(query=True, minTime=True) + end_frame = cmds.playbackOptions(query=True, maxTime=True) + + # Get animation data + animation_start = cmds.playbackOptions(query=True, animationStartTime=True) + animation_end = cmds.playbackOptions(query=True, animationEndTime=True) + + current_frame = cmds.currentTime(query=True) + log.info("Updating FPS to '{}'".format(unit)) cmds.currentUnit(time=unit, updateAnimation=update) + # Set time slider data back to previous state + cmds.playbackOptions(edit=True, minTime=start_frame) + cmds.playbackOptions(edit=True, maxTime=end_frame) + + # Set animation data + cmds.playbackOptions(edit=True, animationStartTime=animation_start) + cmds.playbackOptions(edit=True, animationEndTime=animation_end) + + cmds.currentTime(current_frame, edit=True, update=True) + # Force file stated to 'modified' cmds.file(modified=True)