Merge branch 'develop' into enchancement/OP-2630_acescg_maya

# Conflicts:
#	openpype/hosts/maya/api/lib_renderproducts.py
This commit is contained in:
Toke Stuart Jepsen 2023-02-23 15:57:06 +00:00
commit f22ece7357
138 changed files with 4763 additions and 1783 deletions

View file

@ -1390,6 +1390,8 @@ class CreateContext:
self.autocreators = {}
# Manual creators
self.manual_creators = {}
# Creators that are disabled
self.disabled_creators = {}
self.convertors_plugins = {}
self.convertor_items_by_id = {}
@ -1667,6 +1669,7 @@ class CreateContext:
# Discover and prepare creators
creators = {}
disabled_creators = {}
autocreators = {}
manual_creators = {}
report = discover_creator_plugins(return_report=True)
@ -1703,6 +1706,9 @@ class CreateContext:
self,
self.headless
)
if not creator.enabled:
disabled_creators[creator_identifier] = creator
continue
creators[creator_identifier] = creator
if isinstance(creator, AutoCreator):
autocreators[creator_identifier] = creator
@ -1713,6 +1719,7 @@ class CreateContext:
self.manual_creators = manual_creators
self.creators = creators
self.disabled_creators = disabled_creators
def _reset_convertor_plugins(self):
convertors_plugins = {}

View file

@ -79,6 +79,10 @@ class SubsetConvertorPlugin(object):
self._log = Logger.get_logger(self.__class__.__name__)
return self._log
@property
def host(self):
return self._create_context.host
@abstractproperty
def identifier(self):
"""Converted identifier.

View file

@ -70,7 +70,8 @@ def get_subset_name(
host_name=None,
default_template=None,
dynamic_data=None,
project_settings=None
project_settings=None,
family_filter=None,
):
"""Calculate subset name based on passed context and OpenPype settings.
@ -82,23 +83,35 @@ def get_subset_name(
That's main reason why so many arguments are required to calculate subset
name.
Option to pass family filter was added for special cases when creator or
automated publishing require special subset name template which would be
hard to maintain using its family value.
Why not just pass the right family? -> Family is also used as fill
value and for filtering of publish plugins.
Todos:
Find better filtering options to avoid requirement of
argument 'family_filter'.
Args:
family (str): Instance family.
variant (str): In most of the cases it is user input during creation.
task_name (str): Task name on which context is instance created.
asset_doc (dict): Queried asset document with its tasks in data.
Used to get task type.
project_name (str): Name of project on which is instance created.
Important for project settings that are loaded.
host_name (str): One of filtering criteria for template profile
filters.
default_template (str): Default template if any profile does not match
passed context. Constant 'DEFAULT_SUBSET_TEMPLATE' is used if
is not passed.
dynamic_data (dict): Dynamic data specific for a creator which creates
instance.
project_settings (Union[Dict[str, Any], None]): Prepared settings for
project. Settings are queried if not passed.
project_name (Optional[str]): Name of project on which is instance
created. Important for project settings that are loaded.
host_name (Optional[str]): One of filtering criteria for template
profile filters.
default_template (Optional[str]): Default template if any profile does
not match passed context. Constant 'DEFAULT_SUBSET_TEMPLATE'
is used if is not passed.
dynamic_data (Optional[Dict[str, Any]]): Dynamic data specific for
a creator which creates instance.
project_settings (Optional[Union[Dict[str, Any]]]): Prepared settings
for project. Settings are queried if not passed.
family_filter (Optional[str]): Use different family for subset template
filtering. Value of 'family' is used when not passed.
"""
if not family:
@ -119,7 +132,7 @@ def get_subset_name(
template = get_subset_name_template(
project_name,
family,
family_filter or family,
task_name,
task_type,
host_name,

View file

@ -12,6 +12,7 @@ import pyblish.api
from openpype.lib import (
Logger,
import_filepath,
filter_profiles
)
from openpype.settings import (
@ -301,12 +302,8 @@ def publish_plugins_discover(paths=None):
if not mod_ext == ".py":
continue
module = types.ModuleType(mod_name)
module.__file__ = abspath
try:
with open(abspath, "rb") as f:
six.exec_(f.read(), module.__dict__)
module = import_filepath(abspath, mod_name)
# Store reference to original module, to avoid
# garbage collection from collecting it's global
@ -683,6 +680,12 @@ def get_publish_repre_path(instance, repre, only_published=False):
staging_dir = repre.get("stagingDir")
if not staging_dir:
staging_dir = get_instance_staging_dir(instance)
# Expand the staging dir path in case it's been stored with the root
# template syntax
anatomy = instance.context.data["anatomy"]
staging_dir = anatomy.fill_root(staging_dir)
src_path = os.path.normpath(os.path.join(staging_dir, filename))
if os.path.exists(src_path):
return src_path