-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathframe_operators.py
30 lines (24 loc) · 1.18 KB
/
frame_operators.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from ..node_tree import UMOGReferenceHolder
import bpy
class UMOGSetSceneFrameRange(bpy.types.Operator):
"""Set playback/rendering frame range to simulation range"""
bl_idname = 'umog.frame_range'
bl_label = 'Set Scene Frame Range'
bl_options = {'REGISTER', 'UNDO'}
position : bpy.props.StringProperty(default="")
def execute(self, context):
tree = context.area.spaces.active.node_tree
if self.position == 'start': context.scene.frame_start = tree.properties.StartFrame
elif self.position == 'end': context.scene.frame_end = tree.properties.EndFrame
return {'FINISHED'}
class UMOGSetSceneCurrentFrame(bpy.types.Operator):
"""Set playback/rendering frame range to simulation range"""
bl_idname = 'umog.frame_jump'
bl_label = 'Set Scene Frame Range'
bl_options = {'REGISTER', 'UNDO'}
position : bpy.props.StringProperty(default="")
def execute(self, context):
tree = context.area.spaces.active.node_tree
if self.position == 'start': context.scene.frame_current = tree.properties.StartFrame
elif self.position == 'end': context.scene.frame_current = tree.properties.EndFrame
return {'FINISHED'}