Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions avalon/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -878,12 +878,13 @@ def create(name, asset, family, options=None, data=None):

host = registered_host()

plugins = list()
for Plugin in discover(Creator):
has_family = family == Plugin.family
if isinstance(family, str):
Plugins = [P for P in discover(Creator) if family == P.family]
else:
Plugins = [family]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This got me wondering for a second what is going on here. Should this maybe be in reverse, something like this:

    if isinstance(family, Creator):
        # Allow passing in a specific Creator to run only that plug-in
        Plugins = [family]
    else:
        Plugins = [P for P in discover(Creator) if family == P.family]

Also makes the check more explicit to it being a Creator plug-in.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point !
Changed in commit ebcb78c
( note that the family has now changed to also accept a subclass of api.Creator, so it should be using issubclass ;) )

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well spotted!


if not has_family:
continue
plugins = list()
for Plugin in Plugins:

Plugin.log.info(
"Creating '%s' with '%s'" % (name, Plugin.__name__)
Expand Down
4 changes: 2 additions & 2 deletions avalon/tools/creator/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,13 +436,13 @@ def on_create(self):

subset_name = result.text()
asset = asset.text()
family = item.data(FamilyRole)
Plugin = item.data(PluginRole)
use_selection = self.data["Use Selection Checkbox"].isChecked()

try:
api.create(subset_name,
asset,
family,
Plugin,
options={"useSelection": use_selection})

except NameError as e:
Expand Down