Blender Kitsu: fix episode's sequence creation #202

Merged
Nick Alberelli merged 2 commits from slumber/blender-studio-pipeline:fix-episode-sequence-creation into main 2024-01-16 17:41:37 +01:00
3 changed files with 11 additions and 3 deletions

View File

@ -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)

View File

@ -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

View File

@ -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[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), sequence_name, episode=None)
seq_dict = gazu.shot.new_sequence(
asdict(self),
sequence_name,
episode=episode_id)
return Sequence.from_dict(seq_dict)
# SHOT