Merge pull request #177 from aardschok/ANM-14

Improve validate fps
This commit is contained in:
Wijnand Koreman 2018-10-04 10:46:15 +02:00 committed by GitHub
commit 45f9c14666
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)