Skip to content

create_animation_pointcache

CreateAnimation

Bases: MayaHiddenCreator

Animation output for character rigs

We hide the animation creator from the UI since the creation of it is automated upon loading a rig. There's an inventory action to recreate it for loaded rigs if by chance someone deleted the animation instance.

Source code in client/ayon_maya/plugins/create/create_animation_pointcache.py
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
class CreateAnimation(plugin.MayaHiddenCreator):
    """Animation output for character rigs

    We hide the animation creator from the UI since the creation of it is
    automated upon loading a rig. There's an inventory action to recreate it
    for loaded rigs if by chance someone deleted the animation instance.
    """

    identifier = "io.openpype.creators.maya.animation"
    name = "animationDefault"
    label = "Animation"
    product_type = "animation"
    icon = "male"

    include_parent_hierarchy = False
    include_user_defined_attributes = False

    def read_instance_node(self, node):
        node_data = super(CreateAnimation, self).read_instance_node(node)
        node_data = convert_legacy_alembic_creator_attributes(
            node_data, "ExtractAnimation"
        )
        return node_data

    def get_instance_attr_defs(self):
        return _get_animation_attr_defs(self.create_context,
                                        self.include_user_defined_attributes,
                                        self.include_parent_hierarchy)

CreatePointCache

Bases: MayaCreator

Alembic pointcache for animated data

Source code in client/ayon_maya/plugins/create/create_animation_pointcache.py
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
class CreatePointCache(plugin.MayaCreator):
    """Alembic pointcache for animated data"""

    identifier = "io.openpype.creators.maya.pointcache"
    label = "Pointcache"
    product_type = "pointcache"
    icon = "gears"
    include_user_defined_attributes = False

    def read_instance_node(self, node):
        node_data = super(CreatePointCache, self).read_instance_node(node)
        node_data = convert_legacy_alembic_creator_attributes(
            node_data, "ExtractAlembic"
        )
        return node_data

    def get_instance_attr_defs(self):
        return _get_animation_attr_defs(self.create_context,
                                        self.include_user_defined_attributes)

    def create(self, product_name, instance_data, pre_create_data):
        instance = super(CreatePointCache, self).create(
            product_name, instance_data, pre_create_data
        )
        instance_node = instance.get("instance_node")

        # For Arnold standin proxy
        proxy_set = cmds.sets(name=instance_node + "_proxy_SET", empty=True)
        cmds.sets(proxy_set, forceElement=instance_node)

convert_legacy_alembic_creator_attributes(node_data, class_name)

This is a legacy transfer of creator attributes to publish attributes for ExtractAlembic/ExtractAnimation plugin.

Source code in client/ayon_maya/plugins/create/create_animation_pointcache.py
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
def convert_legacy_alembic_creator_attributes(node_data, class_name):
    """This is a legacy transfer of creator attributes to publish attributes
    for ExtractAlembic/ExtractAnimation plugin.
    """
    publish_attributes = node_data["publish_attributes"]

    if class_name in publish_attributes:
        return node_data

    attributes = [
        "attr",
        "attrPrefix",
        "visibleOnly",
        "writeColorSets",
        "writeFaceSets",
        "writeNormals",
        "renderableOnly",
        "visibleOnly",
        "worldSpace",
        "renderableOnly"
    ]
    plugin_attributes = {}
    for attr in attributes:
        if attr not in node_data["creator_attributes"]:
            continue
        value = node_data["creator_attributes"].pop(attr)

        plugin_attributes[attr] = value

    publish_attributes[class_name] = plugin_attributes

    return node_data