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

Commit

Permalink
read studio scene type config on extracting look
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlatwe committed Sep 23, 2021
1 parent da3d4d0 commit da7dda6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions openpype/hosts/maya/plugins/inventory/import_modelrender.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class ImportModelRender(api.InventoryAction):
icon = "industry"
color = "#55DDAA"

scene_type = "meta.render.ma"
scene_type_regex = "meta.render.m[ab]"
look_data_type = "meta.render.json"

@staticmethod
Expand Down Expand Up @@ -58,7 +58,7 @@ def assign_model_render_by_version(self, nodes, version_id):
look_repr = io.find_one({
"type": "representation",
"parent": version_id,
"name": self.scene_type,
"name": {"$regex": self.scene_type_regex},
})
if not look_repr:
print("No model render sets for this model version..")
Expand Down
21 changes: 16 additions & 5 deletions openpype/hosts/maya/plugins/publish/extract_look.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ def no_workspace_dir():


class ExtractLook(openpype.api.Extractor):
"""Extract Look (Maya Ascii + JSON)
"""Extract Look (Maya Scene + JSON)
Only extracts the sets (shadingEngines and alike) alongside a .json file
that stores it relationships for the sets and "attribute" data for the
instance members.
"""

label = "Extract Look (Maya ASCII + JSON)"
label = "Extract Look (Maya Scene + JSON)"
hosts = ["maya"]
families = ["look"]
order = pyblish.api.ExtractorOrder + 0.2
Expand Down Expand Up @@ -177,13 +177,17 @@ def get_maya_scene_type(self, instance):
# no preset found
pass

return "mayaAscii" if self.scene_type == "ma" else "mayaBinary"

def process(self, instance):
"""Plugin entry point.
Args:
instance: Instance to process.
"""
_scene_type = self.get_maya_scene_type(instance)

# Define extract output file path
dir_path = self.staging_dir(instance)
maya_fname = "{0}.{1}".format(instance.name, self.scene_type)
Expand All @@ -197,7 +201,7 @@ def process(self, instance):

# Remove all members of the sets so they are not included in the
# exported file by accident
self.log.info("Extract sets (Maya ASCII) ...")
self.log.info("Extract sets (%s) ..." % _scene_type)
lookdata = instance.data["lookData"]
relationships = lookdata["relationships"]
sets = relationships.keys()
Expand All @@ -224,7 +228,7 @@ def process(self, instance):
cmds.file(
maya_path,
force=True,
typ="mayaAscii",
typ=_scene_type,
exportSelected=True,
preserveReferences=False,
channels=True,
Expand Down Expand Up @@ -498,5 +502,12 @@ class ExtractModelRenderSets(ExtractLook):
label = "Model Render Sets"
hosts = ["maya"]
families = ["model"]
scene_type = "meta.render.ma"
scene_type_prefix = "meta.render."
look_data_type = "meta.render.json"

def get_maya_scene_type(self, instance):
typ = super(ExtractModelRenderSets, self).get_maya_scene_type(instance)
# add prefix
self.scene_type = self.scene_type_prefix + self.scene_type

return typ

0 comments on commit da7dda6

Please sign in to comment.