trayp: processing PR comments

This commit is contained in:
Jakub Jezek 2022-07-21 11:56:20 +02:00
parent 516f9eea6d
commit dc7856e919
No known key found for this signature in database
GPG key ID: 730D7C02726179A7
6 changed files with 37 additions and 53 deletions

View file

@ -5,7 +5,7 @@ from openpype.client import get_asset_by_id
from openpype.pipeline.create import CreatorError
class ShotMetadataSover:
class ShotMetadataSolver:
"""Collecting hierarchy context from `parents` and `hierarchy` data
present in `clip` family instances coming from the request json data file
@ -22,12 +22,18 @@ class ShotMetadataSover:
shot_hierarchy = None
shot_add_tasks = None
def __init__(self, creator_settings, logger):
self.clip_name_tokenizer = creator_settings["clip_name_tokenizer"]
self.shot_rename = creator_settings["shot_rename"]
self.shot_hierarchy = creator_settings["shot_hierarchy"]
self.shot_add_tasks = creator_settings["shot_add_tasks"]
def __init__(
self,
clip_name_tokenizer,
shot_rename,
shot_hierarchy,
shot_add_tasks,
logger
):
self.clip_name_tokenizer = clip_name_tokenizer
self.shot_rename = shot_rename
self.shot_hierarchy = shot_hierarchy
self.shot_add_tasks = shot_add_tasks
self.log = logger
def _rename_template(self, data):

View file

@ -11,7 +11,7 @@ from openpype.hosts.traypublisher.api.plugin import (
HiddenTrayPublishCreator
)
from openpype.hosts.traypublisher.api.editorial import (
ShotMetadataSover
ShotMetadataSolver
)
from openpype.pipeline import CreatedInstance
@ -65,13 +65,6 @@ CLIP_ATTR_DEFS = [
class EditorialClipInstanceCreatorBase(HiddenTrayPublishCreator):
host_name = "traypublisher"
def __init__(
self, project_settings, *args, **kwargs
):
super(EditorialClipInstanceCreatorBase, self).__init__(
project_settings, *args, **kwargs
)
def create(self, instance_data, source_data=None):
self.log.info(f"instance_data: {instance_data}")
subset_name = instance_data["subset"]
@ -106,13 +99,6 @@ class EditorialShotInstanceCreator(EditorialClipInstanceCreatorBase):
family = "shot"
label = "Editorial Shot"
def __init__(
self, project_settings, *args, **kwargs
):
super(EditorialShotInstanceCreator, self).__init__(
project_settings, *args, **kwargs
)
def get_instance_attr_defs(self):
attr_defs = [
TextDef(
@ -123,44 +109,24 @@ class EditorialShotInstanceCreator(EditorialClipInstanceCreatorBase):
attr_defs.extend(CLIP_ATTR_DEFS)
return attr_defs
class EditorialPlateInstanceCreator(EditorialClipInstanceCreatorBase):
identifier = "editorial_plate"
family = "plate"
label = "Editorial Plate"
def __init__(
self, project_settings, *args, **kwargs
):
super(EditorialPlateInstanceCreator, self).__init__(
project_settings, *args, **kwargs
)
class EditorialAudioInstanceCreator(EditorialClipInstanceCreatorBase):
identifier = "editorial_audio"
family = "audio"
label = "Editorial Audio"
def __init__(
self, project_settings, *args, **kwargs
):
super(EditorialAudioInstanceCreator, self).__init__(
project_settings, *args, **kwargs
)
class EditorialReviewInstanceCreator(EditorialClipInstanceCreatorBase):
identifier = "editorial_review"
family = "review"
label = "Editorial Review"
def __init__(
self, project_settings, *args, **kwargs
):
super(EditorialReviewInstanceCreator, self).__init__(
project_settings, *args, **kwargs
)
class EditorialSimpleCreator(TrayPublishCreator):
@ -188,8 +154,19 @@ or updating already created. Publishing will create OTIO file.
)
# get this creator settings by identifier
self._creator_settings = editorial_creators.get(self.identifier)
self._shot_metadata_solver = ShotMetadataSover(
self._creator_settings, self.log)
clip_name_tokenizer = self._creator_settings["clip_name_tokenizer"]
shot_rename = self._creator_settings["shot_rename"]
shot_hierarchy = self._creator_settings["shot_hierarchy"]
shot_add_tasks = self._creator_settings["shot_add_tasks"]
self._shot_metadata_solver = ShotMetadataSolver(
clip_name_tokenizer,
shot_rename,
shot_hierarchy,
shot_add_tasks,
self.log
)
# try to set main attributes from settings
if self._creator_settings.get("default_variants"):
@ -717,4 +694,4 @@ or updating already created. Publishing will create OTIO file.
attr_defs.append(UISeparatorDef())
attr_defs.extend(CLIP_ATTR_DEFS)
return attr_defs
return attr_defs

View file

@ -1,5 +1,4 @@
import os
from pprint import pformat
from openpype.api import get_project_settings, Logger
log = Logger.get_logger(__name__)
@ -16,8 +15,6 @@ def initialize():
global_variables = globals()
for item in simple_creators:
log.debug(pformat(item))
dynamic_plugin = SettingsCreator.from_settings(item)
global_variables[dynamic_plugin.__name__] = dynamic_plugin

View file

@ -13,7 +13,13 @@ class CollectClipInstance(pyblish.api.InstancePlugin):
def process(self, instance):
creator_identifier = instance.data["creator_identifier"]
if "editorial" not in creator_identifier:
if (
creator_identifier not in [
"editorial_plate",
"editorial_audio",
"editorial_review"
]
):
return
instance.data["families"].append("clip")

View file

@ -1,5 +1,3 @@
import os
import pyblish.api

View file

@ -166,4 +166,4 @@ class CollectShotInstance(pyblish.api.InstancePlugin):
else:
new_dict[key] = ex_dict[key]
return new_dict
return new_dict