Blender Kitsu: Fix Frame Range Warning #126
@ -232,6 +232,31 @@ class KITSU_property_group_scene(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):
|
||||
active_shot = cache.shot_active_get()
|
||||
@ -241,6 +266,8 @@ class KITSU_property_group_error(bpy.types.PropertyGroup):
|
||||
name="Frame Range Error",
|
||||
description="Indicates if the scene frame range does not match the one in Kitsu",
|
||||
default=False,
|
||||
get=check_frame_range,
|
||||
options=set(),
|
||||
)
|
||||
kitsu_context: bpy.props.BoolProperty( # type: ignore
|
||||
name="Kitsu Context not Found",
|
||||
|
Loading…
Reference in New Issue
Block a user