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 #5553 from ynput/enhancement/remove-system-setting…
Browse files Browse the repository at this point in the history
…s-requirement

Chore: Create plugin does not expect system settings
  • Loading branch information
iLLiCiTiT authored Sep 5, 2023
2 parents c08190c + 35074e8 commit 2b2209c
Show file tree
Hide file tree
Showing 21 changed files with 58 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def remove_instances(self, instances):
api.get_stub().rename_item(comp_id,
new_comp_name)

def apply_settings(self, project_settings, system_settings):
def apply_settings(self, project_settings):
plugin_settings = (
project_settings["aftereffects"]["create"]["RenderCreator"]
)
Expand Down
10 changes: 1 addition & 9 deletions openpype/hosts/fusion/plugins/create/create_saver.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ class CreateSaver(NewCreator):
instance_attributes = [
"reviewable"
]
default_variants = [
"Main",
"Mask"
]

# TODO: This should be renamed together with Nuke so it is aligned
temp_rendering_path_template = (
Expand Down Expand Up @@ -250,11 +246,7 @@ def _get_reviewable_bool(self):
label="Review",
)

def apply_settings(
self,
project_settings,
system_settings
):
def apply_settings(self, project_settings):
"""Method called on initialization of plugin to apply settings."""

# plugin settings
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/houdini/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def get_network_categories(self):
"""
return [hou.ropNodeTypeCategory()]

def apply_settings(self, project_settings, system_settings):
def apply_settings(self, project_settings):
"""Method called on initialization of plugin to apply settings."""

settings_name = self.settings_name
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/maya/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def get_pre_create_attr_defs(self):
default=True)
]

def apply_settings(self, project_settings, system_settings):
def apply_settings(self, project_settings):
"""Method called on initialization of plugin to apply settings."""

settings_name = self.settings_name
Expand Down
6 changes: 2 additions & 4 deletions openpype/hosts/maya/plugins/create/create_animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,8 @@ def get_instance_attr_defs(self):

return defs

def apply_settings(self, project_settings, system_settings):
super(CreateAnimation, self).apply_settings(
project_settings, system_settings
)
def apply_settings(self, project_settings):
super(CreateAnimation, self).apply_settings(project_settings)
# Hardcoding creator to be enabled due to existing settings would
# disable the creator causing the creator plugin to not be
# discoverable.
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/maya/plugins/create/create_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CreateRenderlayer(plugin.RenderlayerCreator):
render_settings = {}

@classmethod
def apply_settings(cls, project_settings, system_settings):
def apply_settings(cls, project_settings):
cls.render_settings = project_settings["maya"]["RenderSettings"]

def create(self, subset_name, instance_data, pre_create_data):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CreateUnrealSkeletalMesh(plugin.MayaCreator):
# Defined in settings
joint_hints = set()

def apply_settings(self, project_settings, system_settings):
def apply_settings(self, project_settings):
"""Apply project settings to creator"""
settings = (
project_settings["maya"]["create"]["CreateUnrealSkeletalMesh"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CreateUnrealStaticMesh(plugin.MayaCreator):
# Defined in settings
collision_prefixes = []

def apply_settings(self, project_settings, system_settings):
def apply_settings(self, project_settings):
"""Apply project settings to creator"""
settings = project_settings["maya"]["create"]["CreateUnrealStaticMesh"]
self.collision_prefixes = settings["collision_prefixes"]
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/maya/plugins/create/create_vrayscene.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CreateVRayScene(plugin.RenderlayerCreator):
singleton_node_name = "vraysceneMain"

@classmethod
def apply_settings(cls, project_settings, system_settings):
def apply_settings(cls, project_settings):
cls.render_settings = project_settings["maya"]["RenderSettings"]

def create(self, subset_name, instance_data, pre_create_data):
Expand Down
6 changes: 1 addition & 5 deletions openpype/hosts/nuke/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,7 @@ def create(self, subset_name, instance_data, pre_create_data):
sys.exc_info()[2]
)

def apply_settings(
self,
project_settings,
system_settings
):
def apply_settings(self, project_settings):
"""Method called on initialization of plugin to apply settings."""

# plugin settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def get_instance_attr_defs(self):
)
]

def apply_settings(self, project_settings, system_settings):
def apply_settings(self, project_settings):
plugin_settings = (
project_settings["photoshop"]["create"]["AutoImageCreator"]
)
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/photoshop/plugins/create/create_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def get_instance_attr_defs(self):
)
]

def apply_settings(self, project_settings, system_settings):
def apply_settings(self, project_settings):
plugin_settings = (
project_settings["photoshop"]["create"]["ImageCreator"]
)
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/photoshop/plugins/create/create_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_detail_description(self):
it will get recreated in next publish either way).
"""

def apply_settings(self, project_settings, system_settings):
def apply_settings(self, project_settings):
plugin_settings = (
project_settings["photoshop"]["create"]["ReviewCreator"]
)
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/photoshop/plugins/create/create_workfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def get_detail_description(self):
in next publish automatically).
"""

def apply_settings(self, project_settings, system_settings):
def apply_settings(self, project_settings):
plugin_settings = (
project_settings["photoshop"]["create"]["WorkfileCreator"]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class BatchMovieCreator(TrayPublishCreator):
# Position batch creator after simple creators
order = 110

def apply_settings(self, project_settings, system_settings):
def apply_settings(self, project_settings):
creator_settings = (
project_settings["traypublisher"]["create"]["BatchMovieCreator"]
)
Expand Down
8 changes: 4 additions & 4 deletions openpype/hosts/tvpaint/plugins/create/create_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class CreateRenderlayer(TVPaintCreator):
# - Mark by default instance for review
mark_for_review = True

def apply_settings(self, project_settings, system_settings):
def apply_settings(self, project_settings):
plugin_settings = (
project_settings["tvpaint"]["create"]["create_render_layer"]
)
Expand Down Expand Up @@ -387,7 +387,7 @@ class CreateRenderPass(TVPaintCreator):
# Settings
mark_for_review = True

def apply_settings(self, project_settings, system_settings):
def apply_settings(self, project_settings):
plugin_settings = (
project_settings["tvpaint"]["create"]["create_render_pass"]
)
Expand Down Expand Up @@ -690,7 +690,7 @@ class TVPaintAutoDetectRenderCreator(TVPaintCreator):
group_idx_offset = 10
group_idx_padding = 3

def apply_settings(self, project_settings, system_settings):
def apply_settings(self, project_settings):
plugin_settings = (
project_settings
["tvpaint"]
Expand Down Expand Up @@ -1029,7 +1029,7 @@ class TVPaintSceneRenderCreator(TVPaintAutoCreator):
mark_for_review = True
active_on_create = False

def apply_settings(self, project_settings, system_settings):
def apply_settings(self, project_settings):
plugin_settings = (
project_settings["tvpaint"]["create"]["create_render_scene"]
)
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/tvpaint/plugins/create/create_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TVPaintReviewCreator(TVPaintAutoCreator):
# Settings
active_on_create = True

def apply_settings(self, project_settings, system_settings):
def apply_settings(self, project_settings):
plugin_settings = (
project_settings["tvpaint"]["create"]["create_review"]
)
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/tvpaint/plugins/create/create_workfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TVPaintWorkfileCreator(TVPaintAutoCreator):
label = "Workfile"
icon = "fa.file-o"

def apply_settings(self, project_settings, system_settings):
def apply_settings(self, project_settings):
plugin_settings = (
project_settings["tvpaint"]["create"]["create_workfile"]
)
Expand Down
4 changes: 2 additions & 2 deletions openpype/lib/python_module_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ def is_func_signature_supported(func, *args, **kwargs):
Args:
func (function): A function where the signature should be tested.
*args (tuple[Any]): Positional arguments for function signature.
**kwargs (dict[str, Any]): Keyword arguments for function signature.
*args (Any): Positional arguments for function signature.
**kwargs (Any): Keyword arguments for function signature.
Returns:
bool: Function can pass in arguments.
Expand Down
3 changes: 2 additions & 1 deletion openpype/pipeline/create/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,7 @@ def _reset_creator_plugins(self):
self.creator_discover_result = report
for creator_class in report.plugins:
if inspect.isabstract(creator_class):
self.log.info(
self.log.debug(
"Skipping abstract Creator {}".format(str(creator_class))
)
continue
Expand Down Expand Up @@ -1804,6 +1804,7 @@ def _reset_creator_plugins(self):
self,
self.headless
)

if not creator.enabled:
disabled_creators[creator_identifier] = creator
continue
Expand Down
44 changes: 32 additions & 12 deletions openpype/pipeline/create/creator_plugins.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import copy
import collections

from abc import (
ABCMeta,
abstractmethod,
abstractproperty
)
from abc import ABCMeta, abstractmethod

import six

from openpype.settings import get_system_settings, get_project_settings
from openpype.lib import Logger
from openpype.lib import Logger, is_func_signature_supported
from openpype.pipeline.plugin_discover import (
discover,
register_plugin,
Expand Down Expand Up @@ -84,7 +80,8 @@ def log(self):
def host(self):
return self._create_context.host

@abstractproperty
@property
@abstractmethod
def identifier(self):
"""Converted identifier.
Expand Down Expand Up @@ -161,7 +158,6 @@ class BaseCreator:
Args:
project_settings (Dict[str, Any]): Project settings.
system_settings (Dict[str, Any]): System settings.
create_context (CreateContext): Context which initialized creator.
headless (bool): Running in headless mode.
"""
Expand Down Expand Up @@ -208,10 +204,33 @@ def __init__(
# - we may use UI inside processing this attribute should be checked
self.headless = headless

self.apply_settings(project_settings, system_settings)
expect_system_settings = False
if is_func_signature_supported(
self.apply_settings, project_settings
):
self.apply_settings(project_settings)
else:
expect_system_settings = True
# Backwards compatibility for system settings
self.apply_settings(project_settings, system_settings)

init_overriden = self.__class__.__init__ is not BaseCreator.__init__
if init_overriden or expect_system_settings:
self.log.warning((
"WARNING: Source - Create plugin {}."
" System settings argument will not be passed to"
" '__init__' and 'apply_settings' methods in future versions"
" of OpenPype. Planned version to drop the support"
" is 3.16.6 or 3.17.0. Please contact Ynput core team if you"
" need to keep system settings."
).format(self.__class__.__name__))

def apply_settings(self, project_settings):
"""Method called on initialization of plugin to apply settings.
def apply_settings(self, project_settings, system_settings):
"""Method called on initialization of plugin to apply settings."""
Args:
project_settings (dict[str, Any]): Project settings.
"""

pass

Expand All @@ -224,7 +243,8 @@ def identifier(self):

return self.family

@abstractproperty
@property
@abstractmethod
def family(self):
"""Family that plugin represents."""

Expand Down

0 comments on commit 2b2209c

Please sign in to comment.