mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 22:02:15 +01:00
attr plugins are not passed as argument on instance creation
This commit is contained in:
parent
ed61da911b
commit
4ead375a6f
4 changed files with 14 additions and 19 deletions
|
|
@ -17,7 +17,7 @@ class MyAutoCreator(AutoCreator):
|
|||
]
|
||||
return output
|
||||
|
||||
def collect_instances(self, attr_plugins=None):
|
||||
def collect_instances(self):
|
||||
for instance_data in pipeline.list_instances():
|
||||
creator_id = instance_data.get("creator_identifier")
|
||||
if creator_id is not None:
|
||||
|
|
@ -31,7 +31,7 @@ class MyAutoCreator(AutoCreator):
|
|||
elif instance_data["family"] == self.identifier:
|
||||
instance_data["creator_identifier"] = self.identifier
|
||||
instance = CreatedInstance.from_existing(
|
||||
instance_data, self, attr_plugins
|
||||
instance_data, self
|
||||
)
|
||||
self._add_instance_to_context(instance)
|
||||
|
||||
|
|
|
|||
|
|
@ -15,20 +15,20 @@ class TestCreatorOne(Creator):
|
|||
def get_icon(self):
|
||||
return resources.get_openpype_splash_filepath()
|
||||
|
||||
def collect_instances(self, attr_plugins):
|
||||
def collect_instances(self):
|
||||
for instance_data in pipeline.list_instances():
|
||||
instance = None
|
||||
creator_id = instance_data.get("creator_identifier")
|
||||
if creator_id is not None:
|
||||
if creator_id == self.identifier:
|
||||
instance = CreatedInstance.from_existing(
|
||||
instance_data, self, attr_plugins
|
||||
instance_data, self
|
||||
)
|
||||
|
||||
elif instance_data["family"] == self.identifier:
|
||||
instance_data["creator_identifier"] = self.identifier
|
||||
instance = CreatedInstance.from_existing(
|
||||
instance_data, self, attr_plugins
|
||||
instance_data, self
|
||||
)
|
||||
|
||||
if instance is not None:
|
||||
|
|
|
|||
|
|
@ -20,20 +20,20 @@ class TestCreatorTwo(Creator):
|
|||
self.log.info(new_instance.data)
|
||||
self._add_instance_to_context(new_instance)
|
||||
|
||||
def collect_instances(self, attr_plugins):
|
||||
def collect_instances(self):
|
||||
for instance_data in pipeline.list_instances():
|
||||
instance = None
|
||||
creator_id = instance_data.get("creator_identifier")
|
||||
if creator_id is not None:
|
||||
if creator_id == self.identifier:
|
||||
instance = CreatedInstance.from_existing(
|
||||
instance_data, self, attr_plugins
|
||||
instance_data, self
|
||||
)
|
||||
|
||||
elif instance_data["family"] == self.identifier:
|
||||
instance_data["creator_identifier"] = self.identifier
|
||||
instance = CreatedInstance.from_existing(
|
||||
instance_data, self, attr_plugins
|
||||
instance_data, self
|
||||
)
|
||||
|
||||
if instance is not None:
|
||||
|
|
|
|||
|
|
@ -344,7 +344,6 @@ class CreatedInstance:
|
|||
creator(BaseCreator): Creator responsible for instance.
|
||||
host(ModuleType): Host implementation loaded with
|
||||
`avalon.api.registered_host`.
|
||||
attr_plugins(list): List of attribute definitions of publish plugins.
|
||||
new(bool): Is instance new.
|
||||
"""
|
||||
# Keys that can't be changed or removed from data after loading using
|
||||
|
|
@ -361,8 +360,7 @@ class CreatedInstance:
|
|||
)
|
||||
|
||||
def __init__(
|
||||
self, family, subset_name, data, creator, host=None,
|
||||
attr_plugins=None, new=True
|
||||
self, family, subset_name, data, creator, host=None, new=True
|
||||
):
|
||||
if host is None:
|
||||
import avalon.api
|
||||
|
|
@ -416,8 +414,9 @@ class CreatedInstance:
|
|||
|
||||
# Stored publish specific attribute values
|
||||
# {<plugin name>: {key: value}}
|
||||
# - must be set using 'set_publish_plugins'
|
||||
self._data["publish_attributes"] = PublishAttributes(
|
||||
self, orig_publish_attributes, attr_plugins
|
||||
self, orig_publish_attributes, None
|
||||
)
|
||||
if data:
|
||||
self._data.update(data)
|
||||
|
|
@ -584,7 +583,7 @@ class CreatedInstance:
|
|||
|
||||
@classmethod
|
||||
def from_existing(
|
||||
cls, instance_data, creator, attr_plugins=None, host=None
|
||||
cls, instance_data, creator, host=None
|
||||
):
|
||||
"""Convert instance data from workfile to CreatedInstance."""
|
||||
instance_data = copy.deepcopy(instance_data)
|
||||
|
|
@ -595,8 +594,7 @@ class CreatedInstance:
|
|||
subset_name = instance_data.get("subset", None)
|
||||
|
||||
return cls(
|
||||
family, subset_name, instance_data, creator, host,
|
||||
attr_plugins, new=False
|
||||
family, subset_name, instance_data, creator, host, new=False
|
||||
)
|
||||
|
||||
def set_publish_plugins(self, attr_plugins):
|
||||
|
|
@ -821,10 +819,7 @@ class CreateContext:
|
|||
|
||||
# Collect instances
|
||||
for creator in self.creators.values():
|
||||
attr_plugins = self._get_publish_plugins_with_attr_for_family(
|
||||
creator.family
|
||||
)
|
||||
creator.collect_instances(attr_plugins)
|
||||
creator.collect_instances()
|
||||
|
||||
def execute_autocreators(self):
|
||||
"""Execute discovered AutoCreator plugins.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue