Merge branch 'develop' into 1600-collect-versions-loaded-in-scene-fails-in-unreal-due-to-lack-of-name-key-in-containers

This commit is contained in:
Roy Nieterau 2025-12-12 22:41:35 +01:00 committed by GitHub
commit 7e1720d740
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 2 deletions

View file

@ -146,7 +146,15 @@ class BaseCreator(ABC):
project_settings (dict[str, Any]): Project settings.
create_context (CreateContext): Context which initialized creator.
headless (bool): Running in headless mode.
"""
# Attribute 'skip_discovery' is used during discovery phase to skip
# plugins, which can be used to mark base plugins that should not be
# considered as plugins "to use". The discovery logic does NOT use
# the attribute value from parent classes. Each base class has to define
# the attribute again.
skip_discovery = True
# Label shown in UI
label = None
group_label = None
@ -642,7 +650,7 @@ class Creator(BaseCreator):
Creation requires prepared product name and instance data.
"""
skip_discovery = True
# GUI Purposes
# - default_variants may not be used if `get_default_variants`
# is overridden
@ -931,6 +939,8 @@ class Creator(BaseCreator):
class HiddenCreator(BaseCreator):
skip_discovery = True
@abstractmethod
def create(self, instance_data, source_data):
pass
@ -941,6 +951,7 @@ class AutoCreator(BaseCreator):
Can be used e.g. for `workfile`.
"""
skip_discovery = True
def remove_instances(self, instances):
"""Skip removal."""

View file

@ -21,6 +21,13 @@ from .utils import get_representation_path_from_context
class LoaderPlugin(list):
"""Load representation into host application"""
# Attribute 'skip_discovery' is used during discovery phase to skip
# plugins, which can be used to mark base plugins that should not be
# considered as plugins "to use". The discovery logic does NOT use
# the attribute value from parent classes. Each base class has to define
# the attribute again.
skip_discovery = True
product_types: set[str] = set()
product_base_types: Optional[set[str]] = None
representations = set()

View file

@ -138,7 +138,14 @@ def discover_plugins(
for item in modules:
filepath, module = item
result.add_module(module)
all_plugins.extend(classes_from_module(base_class, module))
for cls in classes_from_module(base_class, module):
if cls is base_class:
continue
# Class has defined 'skip_discovery = True'
skip_discovery = cls.__dict__.get("skip_discovery")
if skip_discovery is True:
continue
all_plugins.append(cls)
if base_class not in ignored_classes:
ignored_classes.append(base_class)