maya uses settings from context instead of presets

This commit is contained in:
Milan Kolar 2020-12-04 18:08:12 +01:00
parent 63ec81b132
commit 4a300e0b08
15 changed files with 617 additions and 514 deletions

View file

@ -202,7 +202,7 @@ class CreateRender(avalon.maya.Creator):
"""Load Muster credentials.
Load Muster credentials from file and set ``MUSTER_USER``,
``MUSTER_PASSWORD``, ``MUSTER_REST_URL`` is loaded from presets.
``MUSTER_PASSWORD``, ``MUSTER_REST_URL`` is loaded from settings.
Raises:
RuntimeError: If loaded credentials are invalid.

View file

@ -15,7 +15,7 @@ class CreateRenderSetup(avalon.maya.Creator):
super(CreateRenderSetup, self).__init__(*args, **kwargs)
# here we can pre-create renderSetup layers, possibly utlizing
# presets for it.
# settings for it.
# _____
# / __\__

View file

@ -102,10 +102,11 @@ class ExtractCameraMayaScene(pype.api.Extractor):
def process(self, instance):
"""Plugin entry point."""
# get settings
ext_mapping = (instance.context.data["presets"]["maya"]
.get("ext_mapping")) # noqa: E501
ext_mapping = (
instance.context.data["project_settings"]["maya"]["ext_mapping"]
)
if ext_mapping:
self.log.info("Looking in presets for scene type ...")
self.log.info("Looking in settings for scene type ...")
# use extension mapping for first family found
for family in self.families:
try:

View file

@ -24,9 +24,11 @@ class ExtractMayaSceneRaw(pype.api.Extractor):
def process(self, instance):
"""Plugin entry point."""
ext_mapping = instance.context.data["presets"]["maya"].get("ext_mapping") # noqa: E501
ext_mapping = (
instance.context.data["project_settings"]["maya"]["ext_mapping"]
)
if ext_mapping:
self.log.info("Looking in presets for scene type ...")
self.log.info("Looking in settings for scene type ...")
# use extension mapping for first family found
for family in self.families:
try:

View file

@ -31,9 +31,11 @@ class ExtractModel(pype.api.Extractor):
def process(self, instance):
"""Plugin entry point."""
ext_mapping = instance.context.data["presets"]["maya"].get("ext_mapping") # noqa: E501
ext_mapping = (
instance.context.data["project_settings"]["maya"]["ext_mapping"]
)
if ext_mapping:
self.log.info("Looking in presets for scene type ...")
self.log.info("Looking in settings for scene type ...")
# use extension mapping for first family found
for family in self.families:
try:

View file

@ -43,7 +43,9 @@ class ExtractPlayblast(pype.api.Extractor):
# get cameras
camera = instance.data['review_camera']
capture_preset = instance.context.data['presets']['maya']['capture']
capture_preset = (
instance.context.data['project_settings']['maya']['capture']
)
try:
preset = lib.load_capture_preset(data=capture_preset)

View file

@ -18,9 +18,11 @@ class ExtractRig(pype.api.Extractor):
def process(self, instance):
"""Plugin entry point."""
ext_mapping = instance.context.data["presets"]["maya"].get("ext_mapping") # noqa: E501
ext_mapping = (
instance.context.data["project_settings"]["maya"]["ext_mapping"]
)
if ext_mapping:
self.log.info("Looking in presets for scene type ...")
self.log.info("Looking in settings for scene type ...")
# use extension mapping for first family found
for family in self.families:
try:

View file

@ -33,7 +33,10 @@ class ExtractThumbnail(pype.api.Extractor):
camera = instance.data['review_camera']
capture_preset = ""
capture_preset = instance.context.data['presets']['maya']['capture']
capture_preset = (
instance.context.data["project_settings"]['maya']['capture']
)
try:
preset = lib.load_capture_preset(data=capture_preset)
except:

View file

@ -101,9 +101,11 @@ class ExtractYetiRig(pype.api.Extractor):
def process(self, instance):
"""Plugin entry point."""
ext_mapping = instance.context.data["presets"]["maya"].get("ext_mapping") # noqa: E501
ext_mapping = (
instance.context.data["project_settings"]["maya"]["ext_mapping"]
)
if ext_mapping:
self.log.info("Looking in presets for scene type ...")
self.log.info("Looking in settings for scene type ...")
# use extension mapping for first family found
for family in self.families:
try:

View file

@ -153,7 +153,7 @@ class MayaSubmitMuster(pyblish.api.InstancePlugin):
def _load_credentials(self):
"""
Load Muster credentials from file and set `MUSTER_USER`,
`MUSTER_PASSWORD`, `MUSTER_REST_URL` is loaded from presets.
`MUSTER_PASSWORD`, `MUSTER_REST_URL` is loaded from settings.
.. todo::

View file

@ -22,9 +22,12 @@ class ValidateAttributes(pyblish.api.ContextPlugin):
actions = [pype.api.RepairContextAction]
optional = True
attributes = None
def process(self, context):
# Check for preset existence.
if not context.data["presets"]["maya"].get("attributes"):
if not self.attributes:
return
invalid = self.get_invalid(context, compute=True)
@ -43,7 +46,6 @@ class ValidateAttributes(pyblish.api.ContextPlugin):
@classmethod
def get_invalid_attributes(cls, context):
presets = context.data["presets"]["maya"]["attributes"]
invalid_attributes = []
for instance in context:
# Filter publisable instances.
@ -53,23 +55,23 @@ class ValidateAttributes(pyblish.api.ContextPlugin):
# Filter families.
families = [instance.data["family"]]
families += instance.data.get("families", [])
families = list(set(families) & set(presets.keys()))
families = list(set(families) & set(self.attributes.keys()))
if not families:
continue
# Get all attributes to validate.
attributes = {}
for family in families:
for preset in presets[family]:
for preset in self.attributes[family]:
[node_name, attribute_name] = preset.split(".")
try:
attributes[node_name].update(
{attribute_name: presets[family][preset]}
{attribute_name: self.attributes[family][preset]}
)
except KeyError:
attributes.update({
node_name: {
attribute_name: presets[family][preset]
attribute_name: self.attributes[family][preset]
}
})

View file

@ -58,7 +58,7 @@ class ValidateMusterConnection(pyblish.api.ContextPlugin):
def _load_credentials(self):
"""
Load Muster credentials from file and set `MUSTER_USER`,
`MUSTER_PASSWORD`, `MUSTER_REST_URL` is loaded from presets.
`MUSTER_PASSWORD`, `MUSTER_REST_URL` is loaded from settings.
.. todo::

View file

@ -1,5 +1,5 @@
{
"maya_capture": {
"capture": {
"Codec": {
"compression": "jpg",
"format": "image",
@ -107,6 +107,7 @@
"overscan": 1.0
}
},
"ext_mapping": {},
"publish": {
"CollectMayaRender": {
"sync_workfile_version": false

View file

@ -134,7 +134,13 @@
"type": "boolean",
"key": "enabled",
"label": "Enabled"
}]
},
{
"type": "raw-json",
"key": "attributes",
"label": "Attributes"
}
]
},
{
"type": "splitter"