Skip to content

rig_recreate_animation_instance

RecreateRigAnimationInstance

Bases: InventoryAction

Recreate animation publish instance for loaded rigs

Source code in client/ayon_maya/plugins/inventory/rig_recreate_animation_instance.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
class RecreateRigAnimationInstance(InventoryAction):
    """Recreate animation publish instance for loaded rigs"""

    label = "Recreate rig animation instance"
    icon = "wrench"
    color = "#888888"

    @staticmethod
    def is_compatible(container):
        return (
            container.get("loader") == "ReferenceLoader"
            and container.get("name", "").startswith("rig")
        )

    def process(self, containers):
        project_name = get_current_project_name()
        repre_ids = {
            container["representation"]
            for container in containers
        }
        contexts_by_repre_id = get_representation_contexts_by_ids(
            project_name, repre_ids
        )

        for container in containers:
            # todo: delete an existing entry if it exist or skip creation

            namespace = container["namespace"]
            repre_id = container["representation"]
            context = contexts_by_repre_id[repre_id]
            nodes = get_container_members(container)

            create_rig_animation_instance(nodes, context, namespace)