mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
* OP-5656 - added auto creator for review in PS Review instance should be togglable. Review instance needs to be created for non publisher based workflows. * OP-5656 - refactored names * OP-5656 - refactored names * OP-5656 - new auto creator for flat image In old version flat image was created if no instances were created. Explicit auto creator added for clarity. Standardization of state of plugins * OP-5656 - updated according to auto image creator Subset template should be used from autocreator and not be separate. * OP-5656 - fix proper creator name * OP-5656 - fix log message * OP-5656 - fix use enable state * OP-5656 - fix formatting * OP-5656 - add review toggle to image instance For special cases where each image should have separate review. * OP-5656 - fix description * OP-5656 - fix not present asset and task in instance context * OP-5656 - refactor - both auto creators should use same class Provided separate description. * OP-5656 - fix - propagate review to families Image and auto image could have now review flag. Bottom logic is only for Webpublisher. * OP-5656 - fix - rename review files to avaid collision Image family produces jpg and png, jpg review would clash with name. It should be replaced by 'jpg_jpg'. * OP-5656 - fix - limit additional auto created only on WP In artist based publishing auto image would be created by auto creator (if enabled). Artist might want to disable image creation. * OP-5656 - added mark_for_review flag to Publish tab * OP-5656 - fixes for auto creator * OP-5656 - fixe - outputDef not needed outputDef should contain dict of output definition. In PS it doesn't make sense as it has separate extract_review without output definitions. * OP-5656 - added persistency of changes to auto creators Changes as enabling/disabling, changing review flag should persist. * OP-5656 - added documentation for admins * OP-5656 - added link to new documentation for admins * OP-5656 - Hound * OP-5656 - Hound * OP-5656 - fix shared families list * OP-5656 - added default variant for review and workfile creator For workfile Main was default variant, "" was for review. * OP-5656 - fix - use values from Settings * OP-5656 - fix - use original name of review for main review family outputName cannot be in repre or file would have ..._jpg.jpg * OP-5656 - refactor - standardized settings Active by default denotes if created instance is active (eg. publishable) when created. * OP-5656 - fixes for skipping collecting auto_image data["ids"] are necessary for extracting. Members are physical layers in image, ids are "virtual" items, won't get grouped into real image instance. * OP-5656 - reworked auto collectors This allows to use automatic test for proper testing. * OP-5656 - added automatic tests * OP-5656 - fixes for auto collectors * OP-5656 - removed unnecessary collector Logic moved to auto collectors. * OP-5656 - Hound
80 lines
2.9 KiB
Python
80 lines
2.9 KiB
Python
import openpype.hosts.photoshop.api as api
|
|
from openpype.client import get_asset_by_name
|
|
from openpype.pipeline import (
|
|
AutoCreator,
|
|
CreatedInstance
|
|
)
|
|
from openpype.hosts.photoshop.api.pipeline import cache_and_get_instances
|
|
|
|
|
|
class PSAutoCreator(AutoCreator):
|
|
"""Generic autocreator to extend."""
|
|
def get_instance_attr_defs(self):
|
|
return []
|
|
|
|
def collect_instances(self):
|
|
for instance_data in cache_and_get_instances(self):
|
|
creator_id = instance_data.get("creator_identifier")
|
|
|
|
if creator_id == self.identifier:
|
|
instance = CreatedInstance.from_existing(
|
|
instance_data, self
|
|
)
|
|
self._add_instance_to_context(instance)
|
|
|
|
def update_instances(self, update_list):
|
|
self.log.debug("update_list:: {}".format(update_list))
|
|
for created_inst, _changes in update_list:
|
|
api.stub().imprint(created_inst.get("instance_id"),
|
|
created_inst.data_to_store())
|
|
|
|
def create(self, options=None):
|
|
existing_instance = None
|
|
for instance in self.create_context.instances:
|
|
if instance.family == self.family:
|
|
existing_instance = instance
|
|
break
|
|
|
|
context = self.create_context
|
|
project_name = context.get_current_project_name()
|
|
asset_name = context.get_current_asset_name()
|
|
task_name = context.get_current_task_name()
|
|
host_name = context.host_name
|
|
if existing_instance is None:
|
|
asset_doc = get_asset_by_name(project_name, asset_name)
|
|
subset_name = self.get_subset_name(
|
|
self.default_variant, task_name, asset_doc,
|
|
project_name, host_name
|
|
)
|
|
data = {
|
|
"asset": asset_name,
|
|
"task": task_name,
|
|
"variant": self.default_variant
|
|
}
|
|
data.update(self.get_dynamic_data(
|
|
self.default_variant, task_name, asset_doc,
|
|
project_name, host_name, None
|
|
))
|
|
|
|
if not self.active_on_create:
|
|
data["active"] = False
|
|
|
|
new_instance = CreatedInstance(
|
|
self.family, subset_name, data, self
|
|
)
|
|
self._add_instance_to_context(new_instance)
|
|
api.stub().imprint(new_instance.get("instance_id"),
|
|
new_instance.data_to_store())
|
|
|
|
elif (
|
|
existing_instance["asset"] != asset_name
|
|
or existing_instance["task"] != task_name
|
|
):
|
|
asset_doc = get_asset_by_name(project_name, asset_name)
|
|
subset_name = self.get_subset_name(
|
|
self.default_variant, task_name, asset_doc,
|
|
project_name, host_name
|
|
)
|
|
existing_instance["asset"] = asset_name
|
|
existing_instance["task"] = task_name
|
|
existing_instance["subset"] = subset_name
|