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

General: Plugin settings handled by plugins #3623

Merged

Conversation

iLLiCiTiT
Copy link
Member

Brief description

Loader and creator settings are handled by plugins.

Description

LoaderPlugin and LegacyCreator have new classmethod apply_settings which by default contains logic from openpype.lib.set_plugin_attributes_from_settings.

Function filter_pyblish_plugins which apply settings for pyblish plugins was moved to openpype.pipeline.publish.lib. For pyblish plugins was added ability to implement classmethod def apply_settings(cls, project_settings, system_settings) too. Can customize how settings are applied on a plugin. This is optional. If method is not implemented the "automated" approach is used as before - this option was added to be able handle some cases when path location of plugin does not exactly match settings path. Functions in lib were marked as deprecated.

Testing notes:

  1. Settings on loader plugins are applied
  2. Settings on creator plugins are applied
  3. Settings on publish plugins are applied
    E.g. in Maya, Nuke, ...

@ynbot
Copy link
Contributor

ynbot commented Aug 5, 2022

Task linked: OP-3679 Plugin settings handled by plugins

@iLLiCiTiT iLLiCiTiT self-assigned this Aug 5, 2022
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)
Copy link

Choose a reason for hiding this comment

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

Do not call setattr with a constant attribute value, it is not any safer than normal property access.

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)
Copy link

Choose a reason for hiding this comment

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

Do not call setattr with a constant attribute value, it is not any safer than normal property access.

Copy link
Member

@64qam 64qam left a comment

Choose a reason for hiding this comment

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

Tested in Nuke, AE, PS and all looked ok

@iLLiCiTiT iLLiCiTiT merged commit 3ffa995 into develop Aug 5, 2022
@iLLiCiTiT iLLiCiTiT deleted the feature/OP-3679_Plugin-settings-handled-by-plugins branch August 5, 2022 16:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: refactor Structural changes not affecting functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants