From af4c2b748da7feb0e60aa5d75fe38dfcc81636cb Mon Sep 17 00:00:00 2001 From: "s.martinez" Date: Mon, 15 Jan 2024 14:23:31 +0100 Subject: [PATCH 1/2] fix: episode sequence creation --- scripts-blender/addons/blender_kitsu/sqe/ops.py | 6 +++++- scripts-blender/addons/blender_kitsu/sqe/push.py | 1 + scripts-blender/addons/blender_kitsu/types.py | 7 +++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts-blender/addons/blender_kitsu/sqe/ops.py b/scripts-blender/addons/blender_kitsu/sqe/ops.py index 77008306..6829e1b7 100644 --- a/scripts-blender/addons/blender_kitsu/sqe/ops.py +++ b/scripts-blender/addons/blender_kitsu/sqe/ops.py @@ -338,6 +338,7 @@ class KITSU_OT_sqe_push_new_sequence(bpy.types.Operator): return {"CANCELLED"} project_active = cache.project_active_get() + episode_active = cache.episode_active_get() sequence = project_active.get_sequence_by_name(self.sequence_name) @@ -349,7 +350,10 @@ class KITSU_OT_sqe_push_new_sequence(bpy.types.Operator): return {"CANCELLED"} # Create sequence. - sequence = project_active.create_sequence(self.sequence_name) + sequence = project_active.create_sequence( + self.sequence_name, + episode_active.id if episode_active else None, + ) # Push sequence color. opsdata.push_sequence_color(context, sequence) diff --git a/scripts-blender/addons/blender_kitsu/sqe/push.py b/scripts-blender/addons/blender_kitsu/sqe/push.py index 66a60eb1..002fd2e2 100644 --- a/scripts-blender/addons/blender_kitsu/sqe/push.py +++ b/scripts-blender/addons/blender_kitsu/sqe/push.py @@ -85,6 +85,7 @@ def new_shot( def new_sequence(strip: bpy.types.Sequence, project: Project) -> Sequence: sequence = project.create_sequence( strip.kitsu.sequence_name, + strip.kitsu.episode_id ) logger.info( "Pushed create sequence: %s for project: %s", sequence.name, project.name diff --git a/scripts-blender/addons/blender_kitsu/types.py b/scripts-blender/addons/blender_kitsu/types.py index 5afc1809..6649bf51 100644 --- a/scripts-blender/addons/blender_kitsu/types.py +++ b/scripts-blender/addons/blender_kitsu/types.py @@ -319,9 +319,12 @@ class Project(Entity): ] return sorted(sequences, key=lambda x: x.name) - def create_sequence(self, sequence_name: str) -> Sequence: + def create_sequence(self, sequence_name: str, episode_id: Optional[Episode] = None) -> Sequence: # This function returns a seq dict even if seq already exists, it does not override. - seq_dict = gazu.shot.new_sequence(asdict(self), sequence_name, episode=None) + seq_dict = gazu.shot.new_sequence( + asdict(self), + sequence_name, + episode=episode_id) return Sequence.from_dict(seq_dict) # SHOT -- 2.30.2 From 7adb9acd8402ececda000c22d0ead2efc6bf0f4b Mon Sep 17 00:00:00 2001 From: "s.martinez" Date: Mon, 15 Jan 2024 14:26:13 +0100 Subject: [PATCH 2/2] fix: typing --- scripts-blender/addons/blender_kitsu/types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts-blender/addons/blender_kitsu/types.py b/scripts-blender/addons/blender_kitsu/types.py index 6649bf51..0230bc18 100644 --- a/scripts-blender/addons/blender_kitsu/types.py +++ b/scripts-blender/addons/blender_kitsu/types.py @@ -319,7 +319,7 @@ class Project(Entity): ] return sorted(sequences, key=lambda x: x.name) - def create_sequence(self, sequence_name: str, episode_id: Optional[Episode] = None) -> Sequence: + def create_sequence(self, sequence_name: str, episode_id: Optional[str] = None) -> Sequence: # This function returns a seq dict even if seq already exists, it does not override. seq_dict = gazu.shot.new_sequence( asdict(self), -- 2.30.2