diff --git a/scripts-blender/addons/blender_kitsu/README.md b/scripts-blender/addons/blender_kitsu/README.md index 4a7f10cd..172a9c6c 100644 --- a/scripts-blender/addons/blender_kitsu/README.md +++ b/scripts-blender/addons/blender_kitsu/README.md @@ -132,7 +132,7 @@ This will import a metastrip.mp4 (1000 frame black video) file which is saved in 3.3 Type in the name of the new shot in the `Shot` field - 3.4 Execute the `Submit New Shot` operator in the `Push` Panel (Will warn you if the shot already exists on Kitsu) + 3.4 Execute the `Submit New Shot` operator in the `Push` Panel (Will warn you if the shot already exists on Kitsu). This operator can optionally populate each 'Shot' with a task set to the project's default task status. >**Note**: Most of the operator are selection sensitive. So you can do these operations for a batch of sequence strips. If you have nothing selected it will usually try to operate on all strips in the sequence editor.
![image info](/media/addons/blender_kitsu/sqe_init_selection.jpg) diff --git a/scripts-blender/addons/blender_kitsu/sqe/ops.py b/scripts-blender/addons/blender_kitsu/sqe/ops.py index 9bd1949d..eef15b14 100644 --- a/scripts-blender/addons/blender_kitsu/sqe/ops.py +++ b/scripts-blender/addons/blender_kitsu/sqe/ops.py @@ -152,6 +152,7 @@ class KITSU_OT_sqe_push_new_shot(bpy.types.Operator): bl_description = "Creates a new shot for each selected sequence strip on server. Checks if shot already exists" confirm: bpy.props.BoolProperty(name="confirm") + add_tasks: bpy.props.BoolProperty(name="Add Default Tasks") @classmethod def poll(cls, context: bpy.types.Context) -> bool: @@ -238,7 +239,7 @@ class KITSU_OT_sqe_push_new_shot(bpy.types.Operator): opsdata.push_sequence_color(context, seq) # Push update to shot. - shot = push.new_shot(strip, seq, project_active) + shot = push.new_shot(strip, seq, project_active, add_tasks=self.add_tasks) pull.shot_meta(strip, shot) succeeded.append(strip) @@ -307,6 +308,7 @@ class KITSU_OT_sqe_push_new_shot(bpy.types.Operator): text="Submit %s to server. Will skip shots if they already exist" % (noun.lower()), ) + col.prop(self, "add_tasks", text="Add Tasks with the default status to shot(s)") class KITSU_OT_sqe_push_new_sequence(bpy.types.Operator): diff --git a/scripts-blender/addons/blender_kitsu/sqe/push.py b/scripts-blender/addons/blender_kitsu/sqe/push.py index a8acd4af..254f8641 100644 --- a/scripts-blender/addons/blender_kitsu/sqe/push.py +++ b/scripts-blender/addons/blender_kitsu/sqe/push.py @@ -25,6 +25,7 @@ import bpy from blender_kitsu import bkglobals from blender_kitsu.types import Sequence, Project, Shot from blender_kitsu.logger import LoggerFactory +import gazu logger = LoggerFactory.getLogger() @@ -60,9 +61,7 @@ def shot_meta(strip: bpy.types.Sequence, shot: Shot) -> None: def new_shot( - strip: bpy.types.Sequence, - sequence: Sequence, - project: Project, + strip: bpy.types.Sequence, sequence: Sequence, project: Project, add_tasks=False ) -> Shot: frame_range = (strip.frame_final_start, strip.frame_final_end) shot = project.create_shot( @@ -75,6 +74,10 @@ def new_shot( "fps": bkglobals.FPS, }, ) + + if add_tasks: + create_intial_tasks(shot, project) + # Update description, no option to pass that on create. if strip.kitsu.shot_description: shot.description = strip.kitsu.shot_description @@ -105,3 +108,10 @@ def delete_shot(strip: bpy.types.Sequence, shot: Shot) -> str: ) strip.kitsu.clear() return result + + +def create_intial_tasks(shot: Shot, project: Project): + shot_entity = gazu.shot.get_shot(shot.id) + for task_type in gazu.task.all_task_types_for_project(project.id): + if task_type["for_entity"] == "Shot": + gazu.task.new_task(shot_entity, task_type)