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 ee5d706609 - Show all commits

View File

@ -445,46 +445,7 @@ def load_post_handler_init_version_model(dummy: Any) -> None:
@persistent @persistent
def load_post_handler_check_frame_range(dummy: Any) -> None: def load_post_handler_check_frame_range(dummy: Any) -> None:
""" core.check_frame_range()
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:
logger.warning("Active Shot was not found on server.")
bpy.context.window_manager.popup_menu(
draw_frame_range_failed_context,
title="Warning: Kitsu Context Failed.",
icon='ERROR',
)
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
bpy.context.window_manager.popup_menu(
draw_frame_range_warning,
title="Warning: Frame Range Error.",
icon='ERROR',
)
logger.warning("Current frame range is outdated!")
@persistent @persistent