Exemplo n.º 1
0
    def replace_guides(self):
        """
        replaces the guide joints with the actual bound joints.
        :return: <tuple> bound joint array.
        """
        if self.if_guides_exist():
            positions = self.get_guide_positions()
            self.finished_joints = ()

            for name, jnt_array, pos_array in zip(self.names,
                                                  self.guide_joints,
                                                  positions):
                # remove the existing guides
                object_utils.remove_node(jnt_array)

                # set the positions gathered from the guide joints
                self.finished_joints += joint_utils.create_joint(
                    name,
                    num_joints=len(pos_array),
                    prefix_name=self.prefix_name,
                    use_position=pos_array,
                    bound_joint=True,
                    as_strings=True),

                # parent the replaced joints
                if len(self.finished_joints) > 1:
                    object_utils.do_parent(self.finished_joints[-1],
                                           self.finished_joints[-2])

            # set the guide joints to zero
            self.guide_joints = []
Exemplo n.º 2
0
    def create_guides(self):
        """
        creates a guide joint object.
        :return: <str> bool.
        """
        self.guide_joints = ()

        # get the positions for the middle joint
        positions = ([0.0, 0.0, 0.0], [2.0, 0.0, -1.0], [4.0, 0.0, 0.0])

        # create the hand joint
        idx = 0
        for name, pos in zip(self.names, positions):
            # create the guide joints
            self.guide_joints += joint_utils.create_joint(
                num_joints=1,
                name=name,
                guide_joint=True,
                prefix_name=self.prefix_name,
                as_strings=True,
                use_position=pos)[0],

            if len(self.guide_joints) > 1:
                # parent the guide joints
                object_utils.do_parent(self.guide_joints[idx],
                                       self.guide_joints[idx - 1])
            idx += 1
        joint_utils.orient_joints(self.guide_joints,
                                  primary_axis=self.forward_axis)
        joint_utils.zero_joint_orient(self.guide_joints[-1])
Exemplo n.º 3
0
    def create_joints(self, positions, suffix="bnd"):
        """
        create bind joints at positions.
        :param positions: <tuple> positions array.
        :param suffix: <str> suffix name.
        :return: <tuple> bind joints
        """
        bind_joints = ()
        # create the arm joint
        idx = 0
        for name, pos in zip(self.names, positions):
            bind_joints += joint_utils.create_joint(
                num_joints=1,
                name=name,
                suffix_name=suffix,
                prefix_name=self.prefix_name,
                as_strings=True,
                use_position=pos)[0],

            if len(bind_joints) > 1:
                # parent the guide joints
                object_utils.do_parent(bind_joints[idx], bind_joints[idx - 1])

            # we must freeze the rotational transformations for the ik handle to work properly.
            joint_utils.freeze_transformations(bind_joints[idx],
                                               rotate=True,
                                               translate=False,
                                               scale=False)
            # if len(positions) - 1 == idx:
            #     joint_utils.zero_joint_orient(bind_joints[-1])
            idx += 1
        return bind_joints
Exemplo n.º 4
0
    def create_guides(self):
        """
        creates a guide joint object.
        :return: <str> joint object name.
        """
        self.guide_joints = ()

        # get the positions for the middle joint
        hand_position = joint_utils.get_joint_positions(self.number_of_joints)
        mid_positions = joint_utils.get_joint_positions(self.number_of_joints, z=1.0)
        indx_positions = joint_utils.get_joint_positions(self.number_of_joints, x=1.0, z=1.0)
        thumb_positions = joint_utils.get_joint_positions(self.number_of_joints, x=2.0, z=1.0)
        ring_positions = joint_utils.get_joint_positions(self.number_of_joints, x=-1.0, z=1.0)
        pinky_positions = joint_utils.get_joint_positions(self.number_of_joints, x=-2.0, z=1.0)

        positions = (hand_position, mid_positions, indx_positions, thumb_positions, ring_positions, pinky_positions)

        # create the hand joint
        for name, jnt_num, pos in zip(self.names, self.joints_num, positions):
            self.guide_joints += joint_utils.create_joint(
                num_joints=jnt_num, name=name, guide_joint=True,
                prefix_name=self.prefix_name, as_strings=True, use_position=pos),

        for idx in xrange(1, len(self.guide_joints)):
            object_utils.do_parent(self.guide_joints[idx][0], self.guide_joints[0][0])
Exemplo n.º 5
0
 def create_guides(self):
     """
     creates a guide joint object.
     :return: <str> joint object name.
     """
     jnt_name = joint_utils.create_joint(name=self.name,
                                         guide_joint=True,
                                         prefix_name=self.prefix_name,
                                         as_strings=True)
     self.guide_joints.append(jnt_name[0])
Exemplo n.º 6
0
 def create_guides(self):
     """
     creates a guide joint object.
     :return: <str> joint object name.
     """
     positions = joint_utils.get_joint_positions(self.number_of_bones)
     self.guide_joints = joint_utils.create_joint(
         num_joints=self.number_of_bones,
         name=self.name,
         guide_joint=True,
         prefix_name=self.prefix_name,
         as_strings=True,
         use_position=positions)
Exemplo n.º 7
0
 def replace_guides(self):
     """
     replaces the guide joints with the actual bound joints.
     :return: <tuple> bound joint array.
     """
     if self.if_guides_exist():
         positions = self.get_guide_positions()
         object_utils.remove_node(self.guide_joints)
         self.guide_joints = []
         return joint_utils.create_joint(self.name,
                                         prefix_name=self.prefix_name,
                                         num_joints=len(positions),
                                         use_position=positions,
                                         bound_joint=True,
                                         as_strings=True),
Exemplo n.º 8
0
 def replace_guides(self):
     """
     replaces the guide joints with the actual bound joints.
     :return: <tuple> bound joint array.
     """
     self.finished_joints = ()
     if self.if_guides_exist():
         positions = self.get_guide_positions()
         object_utils.remove_node(self.guide_joints)
         for position in positions:
             self.finished_joints += joint_utils.create_joint(
                 self.name,
                 prefix_name=self.prefix_name,
                 use_position=position,
                 bound_joint=True,
                 as_strings=True)[0],
         self.guide_joints = []
Exemplo n.º 9
0
    def create_guides(self):
        """
        creates a guide joint object.
        :return: <str> joint object name.
        """
        self.guide_joints = ()

        # get the positions for the middle joint
        positions = ([0.0, 1.0, 0.0], [0.0, 0.0, 2.0], [0.0, 0.0, 3.0])

        # create the hand joint
        for name, pos in zip(self.names, positions):
            self.guide_joints += joint_utils.create_joint(
                num_joints=1,
                name=name,
                guide_joint=True,
                prefix_name=self.prefix_name,
                as_strings=True,
                use_position=pos),

        for idx in xrange(1, len(self.guide_joints)):
            object_utils.do_parent(self.guide_joints[idx],
                                   self.guide_joints[idx - 1])