Blender Kitsu: Fix Frame Range Warning #126

Closed
Nick Alberelli wants to merge 6 commits from (deleted):fix/frame-range-warning into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit 4fc69271b6 - Show all commits

View File

@ -232,6 +232,31 @@ class KITSU_property_group_scene(bpy.types.PropertyGroup):
class KITSU_property_group_error(bpy.types.PropertyGroup): class KITSU_property_group_error(bpy.types.PropertyGroup):
"""""" """"""
def check_frame_range(self):
"""
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 True
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 True
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
):
return False
logger.warning("Current frame range is outdated!")
return True
def check_kitsu_context(self): def check_kitsu_context(self):
active_shot = cache.shot_active_get() active_shot = cache.shot_active_get()
@ -241,6 +266,8 @@ class KITSU_property_group_error(bpy.types.PropertyGroup):
name="Frame Range Error", name="Frame Range Error",
description="Indicates if the scene frame range does not match the one in Kitsu", description="Indicates if the scene frame range does not match the one in Kitsu",
default=False, default=False,
get=check_frame_range,
options=set(),
) )
kitsu_context: bpy.props.BoolProperty( # type: ignore kitsu_context: bpy.props.BoolProperty( # type: ignore
name="Kitsu Context not Found", name="Kitsu Context not Found",