Blender Kitsu: Add Operator to Push Frame Start #98

Merged
Nick Alberelli merged 6 commits from feature/3d-offset-kitsu into main 2023-06-27 15:35:00 +02:00
3 changed files with 11 additions and 6 deletions
Showing only changes of commit b234e00dad - Show all commits

View File

@ -243,7 +243,8 @@ The animation tools will show up when you selected a `Task Type` with the name `
![image info](/media/addons/blender_kitsu/context_animation_tools.jpg)
>**Create Playblast**: Will create a openGL viewport render of the viewport from which the operator was executed and uploads it to Kitsu. The `+` button increments the version of the playblast. If you would override an older version you will see a warning before the filepath. The `directory` button will open a file browser in the playblast directory. The playblast will be uploaded to the `Animation` Task Type of the active shot that was set in the `Context Browser`. The web browser will be opened after the playblast and should point to the respective shot on Kitsu. <br/>
**Update Frame Range**: Will pull the frame range of the active shot from Kitsu and apply it to the scene. It will use the `['data']['3d_start]` attribute of the Kitsu shot. <br/>
**Push Frame Start**: Will Push the current scene's frame start to Kitsu. This will set the `['data']['3d_start]` attribute of the Kitsu shot.
**Pull Frame Range**: Will pull the frame range of the active shot from Kitsu and apply it to the scene. It will use read `['data']['3d_start]` attribute of the Kitsu shot. <br/>
**Update Output Collection**: Blender Studio Pipeline specific operator. <br/>
**Duplicate Collection**: Blender Studio Pipeline specific operator. <br/>
**Check Action Names**: Blender Studio Pipeline specific operator. <br/>

View File

@ -63,9 +63,9 @@ class KITSU_PT_vi3d_anim_tools(bpy.types.Panel):
row = box.row(align=True)
row.operator(
"kitsu.pull_frame_range",
icon="FILE_REFRESH",
icon="TRIA_DOWN",
)
row.operator("kitsu.push_frame_range", icon="EMPTY_SINGLE_ARROW", text="")
row.operator("kitsu.push_frame_range", icon="TRIA_UP", text="")
# Update output collection.
row = box.row(align=True)

View File

@ -349,10 +349,14 @@ class KITSU_OT_push_frame_range(bpy.types.Operator):
bl_options = {"REGISTER", "UNDO"}
bl_description = "Adjusts the start frame of animation file."
@classmethod
def poll(cls, context: bpy.types.Context) -> bool:
return bool(prefs.session_auth(context) and cache.shot_active_get())
def draw(self, context: bpy.types.Context) -> None:
layout = self.layout
col = layout.column(align=True)
col.label(text="Choose an offset value for this animation file's frame range.")
col.label(text="Set 3d_start using current scene frame start.")
col.label(text=f"New Frame Start: {context.scene.frame_start}", icon="ERROR")
def execute(self, context: bpy.types.Context) -> Set[str]:
@ -368,7 +372,7 @@ class KITSU_OT_push_frame_range(bpy.types.Operator):
class KITSU_OT_pull_frame_range(bpy.types.Operator):
bl_idname = "kitsu.pull_frame_range"
bl_label = "Update Frame Range"
bl_label = "Pull Frame Range"
bl_options = {"REGISTER", "UNDO"}
bl_description = (
"Pulls frame range of active shot from the server "
@ -385,7 +389,7 @@ class KITSU_OT_pull_frame_range(bpy.types.Operator):
if "3d_start" not in active_shot.data:
self.report(
{"ERROR"},
f"Failed to pull frame range. Shot {active_shot.name} missing '3d_start'",
f"Failed to pull frame range. Shot {active_shot.name} missing '3d_start'.",
)
return {"CANCELLED"}