Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4310 from ynput/bugfix/loaders_can_be_disabled
Browse files Browse the repository at this point in the history
General: Loader and Creator plugins can be disabled
  • Loading branch information
iLLiCiTiT authored Jan 17, 2023
2 parents ce60dc5 + 72ff721 commit 72ae9f1
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions openpype/pipeline/create/legacy_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class LegacyCreator(object):
family = None
defaults = None
maintain_selection = True
enabled = True

dynamic_subset_keys = []

Expand Down Expand Up @@ -76,11 +77,10 @@ def apply_settings(cls, project_settings, system_settings):
print(">>> We have preset for {}".format(plugin_name))
for option, value in plugin_settings.items():
if option == "enabled" and value is False:
setattr(cls, "active", False)
print(" - is disabled by preset")
else:
setattr(cls, option, value)
print(" - setting `{}`: `{}`".format(option, value))
setattr(cls, option, value)

def process(self):
pass
Expand Down
4 changes: 2 additions & 2 deletions openpype/pipeline/load/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class LoaderPlugin(list):
representations = list()
order = 0
is_multiple_contexts_compatible = False
enabled = True

options = []

Expand Down Expand Up @@ -73,11 +74,10 @@ def apply_settings(cls, project_settings, system_settings):
print(">>> We have preset for {}".format(plugin_name))
for option, value in plugin_settings.items():
if option == "enabled" and value is False:
setattr(cls, "active", False)
print(" - is disabled by preset")
else:
setattr(cls, option, value)
print(" - setting `{}`: `{}`".format(option, value))
setattr(cls, option, value)

@classmethod
def get_representations(cls):
Expand Down
2 changes: 2 additions & 0 deletions openpype/pipeline/workfile/build_workfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ def build_workfile(self):
# Prepare available loaders
loaders_by_name = {}
for loader in discover_loader_plugins():
if not loader.enabled:
continue
loader_name = loader.__name__
if loader_name in loaders_by_name:
raise KeyError(
Expand Down
2 changes: 2 additions & 0 deletions openpype/pipeline/workfile/workfile_template_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ def get_creators_by_name(self):
if self._creators_by_name is None:
self._creators_by_name = {}
for creator in discover_legacy_creator_plugins():
if not creator.enabled:
continue
creator_name = creator.__name__
if creator_name in self._creators_by_name:
raise KeyError(
Expand Down
2 changes: 2 additions & 0 deletions openpype/tools/creator/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def reset(self):
items = []
creators = discover_legacy_creator_plugins()
for creator in creators:
if not creator.enabled:
continue
item_id = str(uuid.uuid4())
self._creators_by_id[item_id] = creator

Expand Down
4 changes: 4 additions & 0 deletions openpype/tools/loader/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ def on_context_menu(self, point):
repre_loaders = []
subset_loaders = []
for loader in available_loaders:
if not loader.enabled:
continue
# Skip if its a SubsetLoader.
if issubclass(loader, SubsetLoaderPlugin):
subset_loaders.append(loader)
Expand Down Expand Up @@ -1352,6 +1354,8 @@ def on_context_menu(self, point):

filtered_loaders = []
for loader in available_loaders:
if not loader.enabled:
continue
# Skip subset loaders
if issubclass(loader, SubsetLoaderPlugin):
continue
Expand Down

0 comments on commit 72ae9f1

Please sign in to comment.