Maya: Refactor Create Animation to new publisher

This commit is contained in:
Roy Nieterau 2023-01-27 00:38:32 +01:00
parent 9b180bc8d6
commit e57b7aaf17

View file

@ -2,48 +2,74 @@ from openpype.hosts.maya.api import (
lib,
plugin
)
from openpype.lib import (
BoolDef,
TextDef
)
class CreateAnimation(plugin.Creator):
class CreateAnimation(plugin.MayaCreator):
"""Animation output for character rigs"""
name = "animationDefault"
identifier = "io.openpype.creators.maya.animation"
label = "Animation"
family = "animation"
icon = "male"
write_color_sets = False
write_face_sets = False
def __init__(self, *args, **kwargs):
super(CreateAnimation, self).__init__(*args, **kwargs)
# TODO: Would be great if we could visually hide this from the creator
# by default but do allow to generate it through code.
# create an ordered dict with the existing data first
def get_instance_attr_defs(self):
# get basic animation data : start / end / handles / steps
for key, value in lib.collect_animation_data().items():
self.data[key] = value
defs = lib.collect_animation_defs()
# Write vertex colors with the geometry.
self.data["writeColorSets"] = self.write_color_sets
self.data["writeFaceSets"] = self.write_face_sets
# Include only renderable visible shapes.
# Skips locators and empty transforms
self.data["renderableOnly"] = False
# Include only nodes that are visible at least once during the
# frame range.
self.data["visibleOnly"] = False
# Include the groups above the out_SET content
self.data["includeParentHierarchy"] = False # Include parent groups
# Default to exporting world-space
self.data["worldSpace"] = True
defs.extend([
BoolDef("writeColorSets",
label="Write vertex colors",
tooltip="Write vertex colors with the geometry",
default=self.write_color_sets),
BoolDef("writeFaceSets",
label="Write face sets",
tooltip="Write face sets with the geometry",
default=self.write_face_sets),
BoolDef("writeNormals",
label="Write normals",
tooltip="Write normals with the deforming geometry",
default=True),
BoolDef("renderableOnly",
label="Renderable Only",
tooltip="Only export renderable visible shapes",
default=False),
BoolDef("visibleOnly",
label="Visible Only",
tooltip="Only export dag objects visible during "
"frame range",
default=False),
BoolDef("includeParentHierarchy",
label="Include Parent Hierarchy",
tooltip="Whether to include parent hierarchy of nodes in "
"the publish instance",
default=False),
BoolDef("worldSpace",
label="World-Space Export",
default=True),
TextDef("attr",
label="Custom Attributes",
default="",
placeholder="attr1, attr2"),
TextDef("attrPrefix",
label="Custom Attributes Prefix",
placeholder="prefix1, prefix2")
])
# TODO: Implement these on a Deadline plug-in instead?
"""
# Default to not send to farm.
self.data["farm"] = False
self.data["priority"] = 50
"""
# Default to write normals.
self.data["writeNormals"] = True
return defs