Blender Kitsu: Fix Frame Range Warning #126
@ -407,9 +407,6 @@ class KITSU_OT_pull_frame_range(bpy.types.Operator):
|
||||
context.scene.frame_start = frame_in
|
||||
context.scene.frame_end = frame_out
|
||||
|
||||
# Update error prop.
|
||||
context.scene.kitsu_error.frame_range = False
|
||||
|
||||
# Log.
|
||||
self.report({"INFO"}, f"Updated frame range {frame_in} - {frame_out}")
|
||||
return {"FINISHED"}
|
||||
@ -443,39 +440,6 @@ def load_post_handler_init_version_model(dummy: Any) -> None:
|
||||
opsdata.init_playblast_file_model(bpy.context)
|
||||
|
||||
|
||||
@persistent
|
||||
def load_post_handler_check_frame_range(dummy: Any) -> None:
|
||||
"""
|
||||
Compare the current scene's frame range with that of the active shot on kitsu.
|
||||
If there's a mismatch, set kitsu_error.frame_range -> True. This will enable
|
||||
a warning in the Animation Tools Tab UI.
|
||||
"""
|
||||
active_shot = cache.shot_active_get()
|
||||
if not active_shot:
|
||||
return
|
||||
|
||||
# Pull update for shot.
|
||||
cache.shot_active_pull_update()
|
||||
|
||||
if "3d_start" not in active_shot.data:
|
||||
logger.warning(
|
||||
"Failed to check frame range. Shot %s missing '3d_start' attribute on server",
|
||||
active_shot.name,
|
||||
)
|
||||
return
|
||||
frame_in = int(active_shot.data["3d_start"])
|
||||
frame_out = int(active_shot.data["3d_start"]) + int(active_shot.nb_frames) - 1
|
||||
if (
|
||||
frame_in == bpy.context.scene.frame_start
|
||||
and frame_out == bpy.context.scene.frame_end
|
||||
):
|
||||
bpy.context.scene.kitsu_error.frame_range = False
|
||||
return
|
||||
|
||||
bpy.context.scene.kitsu_error.frame_range = True
|
||||
logger.warning("Current frame range is outdated!")
|
||||
|
||||
|
||||
@persistent
|
||||
def save_pre_handler_clean_overrides(dummy: Any) -> None:
|
||||
"""
|
||||
@ -517,16 +481,12 @@ def register():
|
||||
|
||||
# Handlers.
|
||||
bpy.app.handlers.load_post.append(load_post_handler_init_version_model)
|
||||
bpy.app.handlers.load_post.append(load_post_handler_check_frame_range)
|
||||
|
||||
bpy.app.handlers.save_pre.append(save_pre_handler_clean_overrides)
|
||||
|
||||
|
||||
def unregister():
|
||||
# Clear handlers.
|
||||
bpy.app.handlers.load_post.remove(load_post_handler_check_frame_range)
|
||||
bpy.app.handlers.load_post.remove(load_post_handler_init_version_model)
|
||||
|
||||
bpy.app.handlers.save_pre.remove(save_pre_handler_clean_overrides)
|
||||
|
||||
for cls in reversed(classes):
|
||||
|
Loading…
Reference in New Issue
Block a user