Blender Kitsu: Add Frame Range Pop-up #128
@ -383,23 +383,10 @@ class KITSU_OT_pull_frame_range(bpy.types.Operator):
|
|||||||
return bool(prefs.session_auth(context) and cache.shot_active_get())
|
return bool(prefs.session_auth(context) and cache.shot_active_get())
|
||||||
|
|
||||||
def execute(self, context: bpy.types.Context) -> Set[str]:
|
def execute(self, context: bpy.types.Context) -> Set[str]:
|
||||||
active_shot = cache.shot_active_pull_update()
|
frame_in, frame_out = core.get_frame_range()
|
||||||
|
|
||||||
if "3d_start" not in active_shot.data:
|
|
||||||
self.report(
|
|
||||||
{"ERROR"},
|
|
||||||
f"Failed to pull frame range. Shot {active_shot.name} missing '3d_start'.",
|
|
||||||
)
|
|
||||||
return {"CANCELLED"}
|
|
||||||
|
|
||||||
frame_in = int(active_shot.data["3d_start"])
|
|
||||||
frame_out = int(active_shot.data["3d_start"]) + int(active_shot.nb_frames) - 1
|
|
||||||
|
|
||||||
# Check if current frame range matches the one for active shot.
|
# Check if current frame range matches the one for active shot.
|
||||||
if (
|
if core.check_frame_range():
|
||||||
frame_in == context.scene.frame_start
|
|
||||||
and frame_out == context.scene.frame_end
|
|
||||||
):
|
|
||||||
self.report({"INFO"}, f"Frame range already up to date")
|
self.report({"INFO"}, f"Frame range already up to date")
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
@ -407,9 +394,11 @@ class KITSU_OT_pull_frame_range(bpy.types.Operator):
|
|||||||
context.scene.frame_start = frame_in
|
context.scene.frame_start = frame_in
|
||||||
context.scene.frame_end = frame_out
|
context.scene.frame_end = frame_out
|
||||||
|
|
||||||
# Update error prop.
|
if not core.check_frame_range():
|
||||||
context.scene.kitsu_error.frame_range = False
|
self.report(
|
||||||
|
{"ERROR"}, f"Failed to update frame range to {frame_in} - {frame_out}"
|
||||||
|
)
|
||||||
|
return {"CANCELLED"}
|
||||||
# Log.
|
# Log.
|
||||||
self.report({"INFO"}, f"Updated frame range {frame_in} - {frame_out}")
|
self.report({"INFO"}, f"Updated frame range {frame_in} - {frame_out}")
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
Loading…
Reference in New Issue
Block a user