load plugins settings from the new structure

This commit is contained in:
Milan Kolar 2021-02-16 14:33:00 +01:00
parent 88b7d8dbcf
commit bec4c28e55

View file

@ -31,20 +31,25 @@ def filter_pyblish_plugins(plugins):
host = api.current_host()
presets = get_project_settings(os.environ['AVALON_PROJECT']) or {}
# skip if there are no presets to process
if not presets:
return
# iterate over plugins
for plugin in plugins[:]:
# skip if there are no presets to process
if not presets:
continue
file = os.path.normpath(inspect.getsourcefile(plugin))
file = os.path.normpath(file)
# host determined from path
host_from_file = file.split(os.path.sep)[-3:-2][0]
host_from_file = file.split(os.path.sep)[-4:-3][0]
plugin_kind = file.split(os.path.sep)[-2:-1][0]
# TODO: change after all plugins are moved one level up
if host_from_file == "plugins":
host_from_file = "global"
try:
config_data = presets[host]["publish"][plugin.__name__]
except KeyError:
@ -54,7 +59,10 @@ def filter_pyblish_plugins(plugins):
continue
for option, value in config_data.items():
log.info("host_from_file: {}".format(host_from_file))
if option == "enabled" and value is False:
log.info("PLUGIN: {}".format(plugin.__name__))
log.info('removing plugin {}'.format(plugin.__name__))
plugins.remove(plugin)
else: