Blender Kitsu: Add Frame Range Pop-up #128
@ -257,45 +257,16 @@ def playblast_user_shading_settings(self, context, file_path):
|
|||||||
return output_path
|
return output_path
|
||||||
|
|
||||||
|
|
||||||
def draw_frame_range_failed_context(self, context):
|
def set_frame_range_in(frame_in: int) -> dict:
|
||||||
layout = self.layout
|
|
||||||
layout.alert = True
|
|
||||||
layout.label(text="Kitsu Context could not be detected from current file")
|
|
||||||
|
|
||||||
|
|
||||||
def draw_frame_range_warning(self, context):
|
|
||||||
active_shot = cache.shot_active_get()
|
|
||||||
layout = self.layout
|
|
||||||
layout.alert = True
|
|
||||||
layout.label(
|
|
||||||
text="Frame Range on server does not match the active shot. Please 'pull' the correct frame range from the server"
|
|
||||||
)
|
|
||||||
layout.label(
|
|
||||||
text=f" File Frame Range: {context.scene.frame_start}-{context.scene.frame_end}"
|
|
||||||
)
|
|
||||||
layout.label(
|
|
||||||
text=f' Server Frame Range: {int(active_shot.data["3d_start"])}-{int(active_shot.data["3d_start"]) + int(active_shot.nb_frames) - 1}'
|
|
||||||
)
|
|
||||||
|
|
||||||
layout.operator("kitsu.pull_frame_range", icon='TRIA_DOWN')
|
|
||||||
|
|
||||||
|
|
||||||
def set_frame_range_in(frame_in: int):
|
|
||||||
shot = cache.shot_active_pull_update()
|
shot = cache.shot_active_pull_update()
|
||||||
shot.data["3d_start"] = frame_in
|
shot.data["3d_start"] = frame_in
|
||||||
shot.update()
|
shot.update()
|
||||||
return shot
|
return shot
|
||||||
|
|
||||||
|
|
||||||
def get_frame_range():
|
def get_frame_range(): # TODO return type
|
||||||
active_shot = cache.shot_active_get()
|
active_shot = cache.shot_active_get()
|
||||||
if not active_shot:
|
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
|
return
|
||||||
|
|
||||||
# Pull update for shot.
|
# Pull update for shot.
|
||||||
@ -311,7 +282,7 @@ def get_frame_range():
|
|||||||
return frame_in, frame_out
|
return frame_in, frame_out
|
||||||
|
|
||||||
|
|
||||||
def check_frame_range():
|
def check_frame_range() -> bool:
|
||||||
"""
|
"""
|
||||||
Compare the current scene's frame range with that of the active shot on kitsu.
|
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
|
If there's a mismatch, set kitsu_error.frame_range -> True. This will enable
|
||||||
@ -327,11 +298,6 @@ def check_frame_range():
|
|||||||
frame_range_correct = True
|
frame_range_correct = True
|
||||||
return frame_range_correct
|
return frame_range_correct
|
||||||
|
|
||||||
bpy.context.window_manager.popup_menu(
|
|
||||||
draw_frame_range_warning,
|
|
||||||
title="Warning: Frame Range Error.",
|
|
||||||
icon='ERROR',
|
|
||||||
)
|
|
||||||
frame_range_correct = False
|
frame_range_correct = False
|
||||||
logger.warning("Current frame range is outdated!")
|
logger.warning("Current frame range is outdated!")
|
||||||
return frame_range_correct
|
return frame_range_correct
|
||||||
|
@ -440,9 +440,34 @@ def load_post_handler_init_version_model(dummy: Any) -> None:
|
|||||||
opsdata.init_playblast_file_model(bpy.context)
|
opsdata.init_playblast_file_model(bpy.context)
|
||||||
|
|
||||||
|
|
||||||
|
def draw_frame_range_warning(self, context):
|
||||||
|
active_shot = cache.shot_active_get()
|
||||||
|
layout = self.layout
|
||||||
|
layout.alert = True
|
||||||
|
layout.label(
|
||||||
|
text="Frame Range on server does not match the active shot. Please 'pull' the correct frame range from the server"
|
||||||
|
)
|
||||||
|
layout.label(
|
||||||
|
text=f" File Frame Range: {context.scene.frame_start}-{context.scene.frame_end}"
|
||||||
|
)
|
||||||
|
if active_shot:
|
||||||
|
layout.label(
|
||||||
|
text=f' Server Frame Range: {int(active_shot.data["3d_start"])}-{int(active_shot.data["3d_start"]) + int(active_shot.nb_frames) - 1}'
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
layout.label(text=f' Server Frame Range: not found')
|
||||||
|
|
||||||
|
layout.operator("kitsu.pull_frame_range", icon='TRIA_DOWN')
|
||||||
|
|
||||||
|
|
||||||
@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()
|
if not core.check_frame_range():
|
||||||
|
bpy.context.window_manager.popup_menu(
|
||||||
|
draw_frame_range_warning,
|
||||||
|
title="Warning: Frame Range Error.",
|
||||||
|
icon='ERROR',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@persistent
|
@persistent
|
||||||
|
Loading…
Reference in New Issue
Block a user