aboutsummaryrefslogtreecommitdiff
path: root/scripts/artv2/components/arm.py
blob: 02ad7fa62973a2ac5af9d1346dee203c8191addf (plain) (blame)
1
2
3
4
5
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
43
44
45
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# -*- coding: utf-8 -*-
"""
:author:
    Jeremy Ernst
:description:
    This module contains the class for defining the arm component. The arm component consists of at minimum, 3 joints:
    the upperarm, lowerarm, and hand. There are also options for 3 twist joints in the upper and lower arm areas.
"""

import artv2.components.base_components.base_component as base


class Arm(base.ART_Component):
    """
    This class is define and creates the arm component. The arm component consists of at minimum, 3 joints:
    the shoulder, elbow, and wrist. There are also options for 3 twist joints in the upper and lower arm areas.
    """

    nice_name = "Arm"
    category = "Limbs"
    base_name = "arm"
    has_sides = True
    can_overwrite_names = True
    joint_mover_file = "resources\\rigging_guides\\arm.ma"
    mirror_table = {"translateX": -1, "translateY": -1, "translateZ": -1, "rotateX": 1, "rotateY": 1, "rotateZ": 1}

    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def _add_metadata(self, network_node, prefix, suffix):

        super(Arm, self)._add_metadata(network_node, prefix, suffix)

        network_node.unlock()

        network_node.addAttr("num_upperarm_twists", min=0, max=3, dv=0, keyable=False)
        network_node.addAttr("num_lowerarm_twists", min=0, max=3, dv=0, keyable=False)

        network_node.num_upperarm_twists.set(lock=True)
        network_node.num_lowerarm_twists.set(lock=True)

        network_node.lock()

    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    @property
    def num_upperarm_twists(self):
        """
        This property holds the number (int) of upperarm twist joints that the module will create or has.

        example usage:
            .. code-block:: python

                arm_inst = arm.Arm()
                arm_inst.num_upperarm_twists = 2

        :return: Number of upperarm twist joints the module has.
        :rtype: int
        """

        return self.network_node.num_upperarm_twists.get()

    @num_upperarm_twists.setter
    def num_upperarm_twists(self, new_number):

        self.set_twist_joints("num_upperarm_twists", new_number, 0, 3, "_upperarm_twist_0")

    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    @property
    def num_lowerarm_twists(self):
        """
        This property holds the number (int) of lowerarm twist joints that the module will create or has.

        example usage:
            .. code-block:: python

                arm_inst = arm.Arm()
                arm_inst.num_lowerarm_twists = 2

        :return: Number of lowerarm twist joints the module has.
        :rtype: int
        """

        return self.network_node.num_lowerarm_twists.get()

    @num_lowerarm_twists.setter
    def num_lowerarm_twists(self, new_number):

        self.set_twist_joints("num_lowerarm_twists", new_number, 0, 3, "_lowerarm_twist_0")