Blender Kitsu: Add Frame Range Pop-up #128

Merged
Nick Alberelli merged 18 commits from :fix/frame-range-popup into main 2023-07-19 17:32:39 +02:00
Showing only changes of commit 85823f7e60 - Show all commits

View File

@ -348,6 +348,8 @@ class KITSU_OT_push_frame_range(bpy.types.Operator):
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
bl_description = "Adjusts the start frame of animation file." bl_description = "Adjusts the start frame of animation file."
frame_start = None
@classmethod @classmethod
def poll(cls, context: bpy.types.Context) -> bool: def poll(cls, context: bpy.types.Context) -> bool:
return bool(prefs.session_auth(context) and cache.shot_active_get()) return bool(prefs.session_auth(context) and cache.shot_active_get())
@ -356,16 +358,22 @@ class KITSU_OT_push_frame_range(bpy.types.Operator):
layout = self.layout layout = self.layout
col = layout.column(align=True) col = layout.column(align=True)
col.label(text="Set 3d_start using current scene frame start.") col.label(text="Set 3d_start using current scene frame start.")
col.label(text=f"New Frame Start: {context.scene.frame_start}", icon="ERROR") col.label(text=f"New Frame Start: {self.frame_start}", icon="ERROR")
def execute(self, context: bpy.types.Context) -> Set[str]: def execute(self, context: bpy.types.Context) -> Set[str]:
shot = cache.shot_active_pull_update() core.set_frame_range_in(self.frame_start)
shot.data["3d_start"] = context.scene.frame_start self.report({"INFO"}, f"Updated frame range offset {self.frame_start}")
shot.update()
self.report({"INFO"}, f"Updated frame range offset {context.scene.frame_start}")
return {"FINISHED"} return {"FINISHED"}
def invoke(self, context: bpy.types.Context, event: bpy.types.Event) -> Set[str]: def invoke(self, context: bpy.types.Context, event: bpy.types.Event) -> Set[str]:
self.frame_start = context.scene.frame_start
frame_in, _ = core.get_frame_range()
if frame_in == self.frame_start:
self.report(
{"INFO"},
f"Sever's 'Frame In' already matches current Scene's 'Frame Start' {self.frame_start}",
)
return {"FINISHED"}
return context.window_manager.invoke_props_dialog(self, width=500) return context.window_manager.invoke_props_dialog(self, width=500)