Skip to content

create_animation

Create an animation asset.

CreateAnimation

Bases: BlenderCreator

Animation output for character rig

Source code in client/ayon_blender/plugins/create/create_animation.py
 6
 7
 8
 9
10
11
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
class CreateAnimation(plugin.BlenderCreator):
    """Animation output for character rig"""

    identifier = "io.ayon.creators.blender.animation"
    label = "Animation"
    description = __doc__
    product_type = "animation"
    icon = "male"

    def create(
        self, product_name: str, instance_data: dict, pre_create_data: dict
    ):
        # Run parent create method
        collection = super().create(
            product_name, instance_data, pre_create_data
        )

        if pre_create_data.get("use_selection"):
            selected_objects = lib.get_selection()
            for selected_object in selected_objects:
                collection.objects.link(selected_object)

            selected_collections = lib.get_selected_collections()
            for selected_collection in selected_collections:
                collection.children.link(selected_collection)
        elif pre_create_data.get("asset_group"):
            # Use for Load Blend automated creation of animation instances
            # upon loading rig files
            obj = pre_create_data.get("asset_group")
            collection.objects.link(obj)

        return collection

    def get_instance_attr_defs(self):
        defs = lib.collect_animation_defs(self.create_context,
                                          step=False)
        return defs