Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make api.create able to run with one specific creator plugin #531

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
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
14 changes: 8 additions & 6 deletions avalon/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ def create(name, asset, family, options=None, data=None):
Arguments:
name (str): Name of subset
asset (str): Name of asset
family (str): Name of family
family (str, Creator): Name of family, or a Creator plugin class
options (dict, optional): Additional options from GUI
data (dict, optional): Additional data from GUI

Expand All @@ -878,12 +878,14 @@ 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 issubclass(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]

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