Blender Kitsu: Move Render Review into Blender Kitsu #296
@ -34,43 +34,6 @@ def is_active_project() -> bool:
|
||||
return bool(cache.project_active_get())
|
||||
|
||||
|
||||
# TODO De-duplicate code from sqe create metastrip
|
||||
def create_metadata_strip(
|
||||
context: bpy.types.Context, strip: bpy.types.Sequence
|
||||
) -> bpy.types.MovieSequence:
|
||||
# Get frame range information from current strip.
|
||||
strip_range = range(strip.frame_final_start, strip.frame_final_end)
|
||||
channel = strip.channel + 1
|
||||
|
||||
addon_prefs = prefs.addon_prefs_get(context)
|
||||
# Create new metadata strip.
|
||||
metadata_strip = context.scene.sequence_editor.sequences.new_movie(
|
||||
f"{strip.name}_metadata-strip",
|
||||
addon_prefs.metadatastrip_file,
|
||||
strip.channel + 1,
|
||||
strip.frame_final_start,
|
||||
)
|
||||
|
||||
# Set blend alpha.
|
||||
metadata_strip.blend_alpha = 0
|
||||
|
||||
# Set frame in and out.
|
||||
metadata_strip.frame_final_start = strip.frame_final_start
|
||||
metadata_strip.frame_final_end = strip.frame_final_end
|
||||
# Metadata_strip.channel = strip.channel + 1.
|
||||
|
||||
# Init start frame offset.
|
||||
opsdata.init_start_frame_offset(metadata_strip)
|
||||
|
||||
logger.info(
|
||||
"%s created Metadata Strip: %s",
|
||||
strip.name,
|
||||
metadata_strip.name,
|
||||
)
|
||||
|
||||
return metadata_strip
|
||||
|
||||
|
||||
# TODO De-duplicate code from sqe code
|
||||
def link_strip_by_name(
|
||||
context: bpy.types.Context,
|
||||
|
@ -30,7 +30,7 @@ import bpy
|
||||
|
||||
from . import vars, opsdata, util, core
|
||||
from .. import prefs, cache
|
||||
|
||||
from ..sqe import opsdata as seq_opsdata
|
||||
from ..logger import LoggerFactory
|
||||
|
||||
from .exception import NoImageSequenceAvailableException
|
||||
@ -149,7 +149,19 @@ class RR_OT_sqe_create_review_session(bpy.types.Operator):
|
||||
sequence_name = shot_version_folders[0].parent.parent.parent.name
|
||||
|
||||
# Create metadata strip.
|
||||
metadata_strip = core.create_metadata_strip(context, strip_longest)
|
||||
metadata_strip = seq_opsdata.create_metadata_strip(
|
||||
context.scene,
|
||||
f"{strip_longest.name}_metadata-strip",
|
||||
strip_longest.channel + 1,
|
||||
strip_longest.frame_final_start,
|
||||
strip_longest.frame_final_end,
|
||||
)
|
||||
|
||||
logger.info(
|
||||
"%s created Metadata Strip: %s",
|
||||
strip_longest.name,
|
||||
metadata_strip.name,
|
||||
)
|
||||
|
||||
# Link metadata strip.
|
||||
core.link_strip_by_name(context, metadata_strip, shot_name, sequence_name)
|
||||
|
@ -1806,13 +1806,10 @@ class KITSU_OT_sqe_pull_edit(bpy.types.Operator):
|
||||
# TODO Refactor as this reuses code from KITSU_OT_sqe_create_metadata_strip
|
||||
if not strip:
|
||||
# Create new strip.
|
||||
strip = context.scene.sequence_editor.sequences.new_movie(
|
||||
shot.name,
|
||||
addon_prefs.metadatastrip_file,
|
||||
channel,
|
||||
frame_start,
|
||||
|
||||
strip = opsdata.create_metadata_strip(
|
||||
context.scene, shot.name, channel, frame_start, frame_end
|
||||
)
|
||||
strip.frame_final_end = frame_end
|
||||
|
||||
# Apply slip to match offset.
|
||||
self._apply_strip_slip_from_shot(context, strip, shot)
|
||||
@ -2011,25 +2008,17 @@ class KITSU_OT_sqe_create_metadata_strip(bpy.types.Operator):
|
||||
# Create new metadata strip.
|
||||
# TODO: frame range of metadata strip is 1000 which is problematic because it needs to fit
|
||||
# on the first try, EDIT: seems to work maybe per python overlaps of sequences possible?
|
||||
metadata_strip = context.scene.sequence_editor.sequences.new_movie(
|
||||
|
||||
metadata_strip = opsdata.create_metadata_strip(
|
||||
context.scene,
|
||||
f"{strip.name}{bkglobals.DELIMITER}metadata{bkglobals.SPACE_REPLACER}strip",
|
||||
addon_prefs.metadatastrip_file,
|
||||
strip.channel + 1,
|
||||
strip.frame_final_start,
|
||||
strip.frame_final_end,
|
||||
)
|
||||
|
||||
created.append(metadata_strip)
|
||||
|
||||
# Set blend alpha.
|
||||
metadata_strip.blend_alpha = 0
|
||||
|
||||
# Set frame in and out.
|
||||
metadata_strip.frame_final_start = strip.frame_final_start
|
||||
metadata_strip.frame_final_end = strip.frame_final_end
|
||||
metadata_strip.channel = strip.channel + 1
|
||||
|
||||
# Init start frame offst.
|
||||
opsdata.init_start_frame_offset(metadata_strip)
|
||||
|
||||
logger.info(
|
||||
"%s created metadata strip: %s",
|
||||
strip.name,
|
||||
|
@ -23,7 +23,7 @@ from pathlib import Path
|
||||
from typing import Any, Dict, List, Tuple, Union, Optional
|
||||
|
||||
import bpy
|
||||
from .. import bkglobals
|
||||
from .. import bkglobals, prefs
|
||||
from ..logger import LoggerFactory
|
||||
from ..types import Sequence, Task, TaskStatus, Shot, TaskType
|
||||
|
||||
@ -243,3 +243,25 @@ def push_sequence_color(context: bpy.types.Context, sequence: Sequence) -> None:
|
||||
else:
|
||||
sequence.update_data({"color": list(item.color)})
|
||||
logger.info("%s pushed sequence color", sequence.name)
|
||||
|
||||
|
||||
def create_metadata_strip(
|
||||
scene: bpy.types.Scene, name: str, channel, frame_start: int, frame_end: int
|
||||
) -> bpy.types.MovieSequence:
|
||||
|
||||
addon_prefs = prefs.addon_prefs_get(bpy.context)
|
||||
strip = scene.sequence_editor.sequences.new_movie(
|
||||
name,
|
||||
addon_prefs.metadatastrip_file,
|
||||
channel,
|
||||
frame_start,
|
||||
)
|
||||
|
||||
strip.frame_final_end = frame_end
|
||||
|
||||
# Set blend alpha.
|
||||
strip.blend_alpha = 0
|
||||
|
||||
init_start_frame_offset(strip)
|
||||
|
||||
return strip
|
||||
|
Loading…
Reference in New Issue
Block a user