mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34: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.hosts.maya.api import plugin
|
||||||
from openpype.lib import BoolDef
|
|
||||||
|
|
||||||
|
|
||||||
class CreateMayaScene(plugin.MayaCreator):
|
class CreateMayaScene(plugin.MayaCreator):
|
||||||
|
|
@ -10,12 +9,3 @@ class CreateMayaScene(plugin.MayaCreator):
|
||||||
label = "Maya Scene"
|
label = "Maya Scene"
|
||||||
family = "mayaScene"
|
family = "mayaScene"
|
||||||
icon = "file-archive-o"
|
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.hosts.maya.api.lib import maintained_selection
|
||||||
from openpype.pipeline import AVALON_CONTAINER_ID, publish
|
from openpype.pipeline import AVALON_CONTAINER_ID, publish
|
||||||
|
from openpype.pipeline.publish import OpenPypePyblishPluginMixin
|
||||||
|
from openpype.lib import BoolDef
|
||||||
|
|
||||||
|
|
||||||
class ExtractMayaSceneRaw(publish.Extractor):
|
class ExtractMayaSceneRaw(publish.Extractor):
|
||||||
|
|
@ -23,6 +25,16 @@ class ExtractMayaSceneRaw(publish.Extractor):
|
||||||
"camerarig"]
|
"camerarig"]
|
||||||
scene_type = "ma"
|
scene_type = "ma"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_attribute_defs(cls):
|
||||||
|
return [
|
||||||
|
BoolDef(
|
||||||
|
"preserve_references",
|
||||||
|
label="Preserve References",
|
||||||
|
default=True
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
def process(self, instance):
|
def process(self, instance):
|
||||||
"""Plugin entry point."""
|
"""Plugin entry point."""
|
||||||
ext_mapping = (
|
ext_mapping = (
|
||||||
|
|
@ -64,15 +76,18 @@ class ExtractMayaSceneRaw(publish.Extractor):
|
||||||
|
|
||||||
# Perform extraction
|
# Perform extraction
|
||||||
self.log.debug("Performing extraction ...")
|
self.log.debug("Performing extraction ...")
|
||||||
|
attribute_values = self.get_attr_values_from_data(
|
||||||
|
instance.data
|
||||||
|
)
|
||||||
with maintained_selection():
|
with maintained_selection():
|
||||||
cmds.select(selection, noExpand=True)
|
cmds.select(selection, noExpand=True)
|
||||||
cmds.file(path,
|
cmds.file(path,
|
||||||
force=True,
|
force=True,
|
||||||
typ="mayaAscii" if self.scene_type == "ma" else "mayaBinary", # noqa: E501
|
typ="mayaAscii" if self.scene_type == "ma" else "mayaBinary", # noqa: E501
|
||||||
exportSelected=True,
|
exportSelected=True,
|
||||||
preserveReferences=instance.data.get(
|
preserveReferences=attribute_values[
|
||||||
"creator_attributes", {}
|
"preserve_references"
|
||||||
).get("preserve_references", True),
|
],
|
||||||
constructionHistory=True,
|
constructionHistory=True,
|
||||||
shader=True,
|
shader=True,
|
||||||
constraints=True,
|
constraints=True,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue