From 1968dc465edcf26dc53f8d749d94d51e79b21fc0 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 12 Aug 2019 12:31:21 +0200 Subject: [PATCH 1/3] presets are loaded only once instead of loading for each plugin --- pype/lib.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pype/lib.py b/pype/lib.py index 7009743c97..3b8b0fee21 100644 --- a/pype/lib.py +++ b/pype/lib.py @@ -467,10 +467,14 @@ def filter_pyblish_plugins(plugins): host = api.current_host() + presets = config.get_presets().get('plugins', {}).get(host, {}).get( + "publish", {} + ) + # iterate over plugins for plugin in plugins[:]: try: - config_data = config.get_presets()['plugins'][host]["publish"][plugin.__name__] # noqa: E501 + config_data = presets[plugin.__name__] # noqa: E501 except KeyError: continue From c32be3c197f4c424e326f77a9fe4b0daa5c7ec39 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 12 Aug 2019 12:32:07 +0200 Subject: [PATCH 2/3] skip processing if presets dict is empty --- pype/lib.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pype/lib.py b/pype/lib.py index 3b8b0fee21..fde5b96b85 100644 --- a/pype/lib.py +++ b/pype/lib.py @@ -473,6 +473,10 @@ def filter_pyblish_plugins(plugins): # iterate over plugins for plugin in plugins[:]: + # skip if there are no presets to process + if not presets: + continue + try: config_data = presets[plugin.__name__] # noqa: E501 except KeyError: From 3de2141b16c39205b5552e3beca6f90107661a75 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 12 Aug 2019 12:32:24 +0200 Subject: [PATCH 3/3] remove already processed plugins from presets dict --- pype/lib.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pype/lib.py b/pype/lib.py index fde5b96b85..6eee38f6d8 100644 --- a/pype/lib.py +++ b/pype/lib.py @@ -491,3 +491,7 @@ def filter_pyblish_plugins(plugins): option, value, plugin.__name__)) setattr(plugin, option, value) + + # Remove already processed plugins from dictionary + # WARNING Requires plugins with unique names + presets.pop(plugin.__name__)