Skip to content

Commit

Permalink
maya uses settings from context instead of presets
Browse files Browse the repository at this point in the history
  • Loading branch information
mkolar committed Dec 4, 2020
1 parent 63ec81b commit 4a300e0
Show file tree
Hide file tree
Showing 15 changed files with 617 additions and 514 deletions.
2 changes: 1 addition & 1 deletion pype/plugins/maya/create/create_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def _load_credentials(self):
"""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.
Expand Down
2 changes: 1 addition & 1 deletion pype/plugins/maya/create/create_rendersetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, *args, **kwargs):
super(CreateRenderSetup, self).__init__(*args, **kwargs)

# here we can pre-create renderSetup layers, possibly utlizing
# presets for it.
# settings for it.

# _____
# / __\__
Expand Down
7 changes: 4 additions & 3 deletions pype/plugins/maya/publish/extract_camera_mayaScene.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions pype/plugins/maya/publish/extract_maya_scene_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions pype/plugins/maya/publish/extract_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion pype/plugins/maya/publish/extract_playblast.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ def process(self, instance):

# 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)
Expand Down
6 changes: 4 additions & 2 deletions pype/plugins/maya/publish/extract_rig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion pype/plugins/maya/publish/extract_thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ def process(self, instance):
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:
Expand Down
6 changes: 4 additions & 2 deletions pype/plugins/maya/publish/extract_yeti_rig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pype/plugins/maya/publish/submit_maya_muster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down
14 changes: 8 additions & 6 deletions pype/plugins/maya/publish/validate_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -43,7 +46,6 @@ def get_invalid(cls, context, compute=False):

@classmethod
def get_invalid_attributes(cls, context):
presets = context.data["presets"]["maya"]["attributes"]
invalid_attributes = []
for instance in context:
# Filter publisable instances.
Expand All @@ -53,23 +55,23 @@ def get_invalid_attributes(cls, context):
# 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]
}
})

Expand Down
2 changes: 1 addition & 1 deletion pype/plugins/maya/publish/validate_muster_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def process(self, context):
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::
Expand Down
3 changes: 2 additions & 1 deletion pype/settings/defaults/project_settings/maya.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"maya_capture": {
"capture": {
"Codec": {
"compression": "jpg",
"format": "image",
Expand Down Expand Up @@ -107,6 +107,7 @@
"overscan": 1.0
}
},
"ext_mapping": {},
"publish": {
"CollectMayaRender": {
"sync_workfile_version": false
Expand Down
Loading

0 comments on commit 4a300e0

Please sign in to comment.