mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
Move to attribute defs
This commit is contained in:
parent
187b4087ec
commit
8bd8dc1af7
2 changed files with 18 additions and 13 deletions
|
|
@ -1,5 +1,4 @@
|
|||
from openpype.hosts.maya.api import plugin
|
||||
from openpype.lib import BoolDef
|
||||
|
||||
|
||||
class CreateMayaScene(plugin.MayaCreator):
|
||||
|
|
@ -10,12 +9,3 @@ class CreateMayaScene(plugin.MayaCreator):
|
|||
label = "Maya Scene"
|
||||
family = "mayaScene"
|
||||
icon = "file-archive-o"
|
||||
|
||||
def get_instance_attr_defs(self):
|
||||
return [
|
||||
BoolDef(
|
||||
"preserve_references",
|
||||
label="Preserve References",
|
||||
default=True
|
||||
)
|
||||
]
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ from maya import cmds
|
|||
|
||||
from openpype.hosts.maya.api.lib import maintained_selection
|
||||
from openpype.pipeline import AVALON_CONTAINER_ID, publish
|
||||
from openpype.pipeline.publish import OpenPypePyblishPluginMixin
|
||||
from openpype.lib import BoolDef
|
||||
|
||||
|
||||
class ExtractMayaSceneRaw(publish.Extractor):
|
||||
|
|
@ -23,6 +25,16 @@ class ExtractMayaSceneRaw(publish.Extractor):
|
|||
"camerarig"]
|
||||
scene_type = "ma"
|
||||
|
||||
@classmethod
|
||||
def get_attribute_defs(cls):
|
||||
return [
|
||||
BoolDef(
|
||||
"preserve_references",
|
||||
label="Preserve References",
|
||||
default=True
|
||||
)
|
||||
]
|
||||
|
||||
def process(self, instance):
|
||||
"""Plugin entry point."""
|
||||
ext_mapping = (
|
||||
|
|
@ -64,15 +76,18 @@ class ExtractMayaSceneRaw(publish.Extractor):
|
|||
|
||||
# Perform extraction
|
||||
self.log.debug("Performing extraction ...")
|
||||
attribute_values = self.get_attr_values_from_data(
|
||||
instance.data
|
||||
)
|
||||
with maintained_selection():
|
||||
cmds.select(selection, noExpand=True)
|
||||
cmds.file(path,
|
||||
force=True,
|
||||
typ="mayaAscii" if self.scene_type == "ma" else "mayaBinary", # noqa: E501
|
||||
exportSelected=True,
|
||||
preserveReferences=instance.data.get(
|
||||
"creator_attributes", {}
|
||||
).get("preserve_references", True),
|
||||
preserveReferences=attribute_values[
|
||||
"preserve_references"
|
||||
],
|
||||
constructionHistory=True,
|
||||
shader=True,
|
||||
constraints=True,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue