mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 05:42:15 +01:00
added execution of autocreators
This commit is contained in:
parent
8131613bfa
commit
d4de5d396e
2 changed files with 24 additions and 1 deletions
|
|
@ -6,7 +6,10 @@ import inspect
|
|||
from uuid import uuid4
|
||||
|
||||
from ..lib import UnknownDef
|
||||
from .creator_plugins import BaseCreator
|
||||
from .creator_plugins import (
|
||||
BaseCreator,
|
||||
AutoCreator
|
||||
)
|
||||
|
||||
from openpype.api import (
|
||||
get_system_settings,
|
||||
|
|
@ -591,6 +594,8 @@ class CreateContext:
|
|||
self.reset_context_data()
|
||||
self.reset_instances()
|
||||
|
||||
self.execute_autocreators()
|
||||
|
||||
def reset_plugins(self):
|
||||
import avalon.api
|
||||
import pyblish.logic
|
||||
|
|
@ -734,6 +739,23 @@ class CreateContext:
|
|||
|
||||
self.instances = instances
|
||||
|
||||
def execute_autocreators(self):
|
||||
for creator in self.get_autocreators():
|
||||
try:
|
||||
creator.create()
|
||||
except Exception:
|
||||
msg = (
|
||||
"Failed to run AutoCreator with family \"{}\" ({})."
|
||||
).format(creator.family, inspect.getfile(creator.__class__))
|
||||
self.log.warning(msg, exc_info=True)
|
||||
|
||||
def get_autocreators(self):
|
||||
autocreators = []
|
||||
for creator in self.creators.values():
|
||||
if isinstance(creator, AutoCreator):
|
||||
autocreators.append(creator)
|
||||
return autocreators
|
||||
|
||||
def save_changes(self):
|
||||
if not self.host_is_valid:
|
||||
missing_methods = self.get_host_misssing_methods(self.host)
|
||||
|
|
|
|||
|
|
@ -484,6 +484,7 @@ class PublisherController:
|
|||
# Publish part must be resetted after plugins
|
||||
self._reset_publish()
|
||||
self._reset_instances()
|
||||
self.create_context.execute_autocreators()
|
||||
|
||||
def _reset_plugins(self):
|
||||
"""Reset to initial state."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue