mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
Chore: Create plugin auto-apply settings (#5908)
* implemented default logic 'apply_settings' to auto-apply values * added docstring to 'apply_settings' * replace auto apply settings logic in maya * add missing quote Co-authored-by: Roy Nieterau <roy_nieterau@hotmail.com> --------- Co-authored-by: Roy Nieterau <roy_nieterau@hotmail.com>
This commit is contained in:
parent
05bbff0790
commit
b382b7c776
2 changed files with 89 additions and 20 deletions
|
|
@ -271,7 +271,7 @@ class MayaCreatorBase(object):
|
|||
@six.add_metaclass(ABCMeta)
|
||||
class MayaCreator(NewCreator, MayaCreatorBase):
|
||||
|
||||
settings_name = None
|
||||
settings_category = "maya"
|
||||
|
||||
def create(self, subset_name, instance_data, pre_create_data):
|
||||
|
||||
|
|
@ -317,24 +317,6 @@ class MayaCreator(NewCreator, MayaCreatorBase):
|
|||
default=True)
|
||||
]
|
||||
|
||||
def apply_settings(self, project_settings):
|
||||
"""Method called on initialization of plugin to apply settings."""
|
||||
|
||||
settings_name = self.settings_name
|
||||
if settings_name is None:
|
||||
settings_name = self.__class__.__name__
|
||||
|
||||
settings = project_settings["maya"]["create"]
|
||||
settings = settings.get(settings_name)
|
||||
if settings is None:
|
||||
self.log.debug(
|
||||
"No settings found for {}".format(self.__class__.__name__)
|
||||
)
|
||||
return
|
||||
|
||||
for key, value in settings.items():
|
||||
setattr(self, key, value)
|
||||
|
||||
|
||||
class MayaAutoCreator(AutoCreator, MayaCreatorBase):
|
||||
"""Automatically triggered creator for Maya.
|
||||
|
|
@ -343,6 +325,8 @@ class MayaAutoCreator(AutoCreator, MayaCreatorBase):
|
|||
any arguments.
|
||||
"""
|
||||
|
||||
settings_category = "maya"
|
||||
|
||||
def collect_instances(self):
|
||||
return self._default_collect_instances()
|
||||
|
||||
|
|
@ -360,6 +344,8 @@ class MayaHiddenCreator(HiddenCreator, MayaCreatorBase):
|
|||
arguments for 'create' method.
|
||||
"""
|
||||
|
||||
settings_category = "maya"
|
||||
|
||||
def create(self, *args, **kwargs):
|
||||
return MayaCreator.create(self, *args, **kwargs)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue