コード例 #1
0
    def make_roll_mch_bones(self, foot, toe, heel):
        foot_bone = self.get_bone(foot)
        heel_bone = self.get_bone(heel)

        heel_middle = (heel_bone.head + heel_bone.tail) / 2

        result = self.copy_bone(foot,
                                make_derived_name(foot, 'mch', '_roll'),
                                scale=0.25)

        roll1 = self.copy_bone(toe,
                               make_derived_name(heel, 'mch', '_roll1'),
                               scale=0.3)
        roll2 = self.copy_bone(toe,
                               make_derived_name(heel, 'mch', '_roll2'),
                               scale=0.3)
        rock1 = self.copy_bone(heel, make_derived_name(heel, 'mch', '_rock1'))
        rock2 = self.copy_bone(heel, make_derived_name(heel, 'mch', '_rock2'))

        put_bone(self.obj, roll1, None, matrix=self.roll_matrix)
        put_bone(self.obj, roll2, heel_middle, matrix=self.roll_matrix)
        put_bone(self.obj,
                 rock1,
                 heel_bone.tail,
                 matrix=self.roll_matrix,
                 scale=0.5)
        put_bone(self.obj,
                 rock2,
                 heel_bone.head,
                 matrix=self.roll_matrix,
                 scale=0.5)

        return [rock2, rock1, roll2, roll1, result]
コード例 #2
0
    def generate_bones(self):
        if self.is_master_node:
            # Make control bone
            self._control_bone = self.make_master_bone()

            # Make mix parent if needed
            self.reparent_bones = {}

            if self.use_mix_parent:
                self.mix_parent_bone = self.make_bone(
                    make_derived_name(self._control_bone, 'mch',
                                      '_mix_parent'), 1 / 2)
            else:
                self.reparent_bones[id(self.node_parent)] = self._control_bone

            self.use_weak_parent = False

            # Make requested reparents
            for parent in self.reparent_requests:
                if id(parent) not in self.reparent_bones:
                    parent_name = self.parent_subrig_names[id(parent)]
                    self.reparent_bones[id(parent)] = self.make_bone(
                        make_derived_name(parent_name, 'mch', '_reparent'),
                        1 / 3)
                    self.use_weak_parent = self.has_weak_parent

            if self.use_weak_parent:
                self.weak_parent_bone = self.make_bone(
                    make_derived_name(self._control_bone, 'mch',
                                      '_weak_parent'), 1 / 2)
コード例 #3
0
ファイル: skin_eye.py プロジェクト: robcazin/angavrilov-rigs
    def make_mch_track_bones(self):
        org = self.bones.org
        mch = self.bones.mch

        mch.master = self.copy_bone(org, make_derived_name(org, 'mch'))
        mch.track = self.copy_bone(org,
                                   make_derived_name(org, 'mch', '_track'),
                                   scale=1 / 4)

        put_bone(self.obj, mch.track, self.get_bone(org).tail)
コード例 #4
0
 def make_hip_offset_bones(self):
     org = self.bones.org
     mch = self.bones.mch
     mch.hip_output = self.copy_bone(org[0],
                                     make_derived_name(
                                         org[0], 'mch', '.hip_output'),
                                     scale=0.25)
     mch.hip_offset = self.copy_bone(org[0],
                                     make_derived_name(
                                         org[0], 'mch', '.hip_offset'),
                                     scale=0.20)
コード例 #5
0
ファイル: shoulder.py プロジェクト: robcazin/angavrilov-rigs
 def make_ik_mch_chain(self):
     org = self.bones.org
     self.bones.mch.ik_tgt = self.copy_bone(org, make_derived_name(org, 'mch', '.ik_tgt'), scale=1/5)
     mch1 = self.copy_bone(org, make_derived_name(org, 'mch', '.ik'))
     mch2 = self.copy_bone(org, make_derived_name(org, 'mch', '.ik_end'))
     bone1 = self.get_bone(mch1)
     bone2 = self.get_bone(mch2)
     bone1.tail = bone2.head = bone1.head + Vector((0, 0, bone1.length))
     bone2.tail = bone2.head + Vector((1, 0, 0))
     bone1.roll = bone2.roll = 0
     bone2.use_inherit_scale = False
     self.bones.mch.ik = [ mch1, mch2 ]
コード例 #6
0
 def make_mch_tip_fix(self):
     if self.use_tip:
         org = self.bones.org[-1]
         parent = self.copy_bone(org,
                                 make_derived_name(org, 'mch',
                                                   '.fix.parent'),
                                 scale=0.8)
         self.get_bone(parent).use_inherit_scale = False
         self.bones.mch.tip_fix_parent = parent
         self.bones.mch.tip_fix = self.copy_bone(org,
                                                 make_derived_name(
                                                     org, 'mch', '.fix'),
                                                 scale=0.7)
コード例 #7
0
ファイル: basic.py プロジェクト: robcazin/angavrilov-rigs
    def make_constraint_mch_chain(self):
        org = self.bones.org[0]

        if self.has_constraints[0]:
            self.bones.mch.back = self.make_bone_copy(False,
                                                      make_derived_name(
                                                          org, 'mch', '.back'),
                                                      scale=0.5)
        if self.has_constraints[1]:
            self.bones.mch.front = self.make_bone_copy(True,
                                                       make_derived_name(
                                                           org, 'mch',
                                                           '.front'),
                                                       scale=0.5)
コード例 #8
0
ファイル: skin_eye.py プロジェクト: robcazin/angavrilov-rigs
    def make_deform_bone(self):
        org = self.bones.org
        deform = self.bones.deform
        deform.master = self.copy_bone(org,
                                       make_derived_name(
                                           org, 'def', '_master'),
                                       scale=3 / 2)

        if self.params.make_deform:
            deform.eye = self.copy_bone(org, make_derived_name(org, 'def'))
            deform.iris = self.copy_bone(org,
                                         make_derived_name(
                                             org, 'def', '_iris'),
                                         scale=1 / 2)
            put_bone(self.obj, deform.iris, self.get_bone(org).tail)
コード例 #9
0
 def make_control_bone(self, i, org, is_hip):
     name = self.copy_bone(org,
                           make_derived_name(org, 'ctrl', '_fk'),
                           parent=False)
     if is_hip:
         put_bone(self.obj, name, self.get_bone(name).tail)
     return name
コード例 #10
0
ファイル: basic.py プロジェクト: robcazin/angavrilov-rigs
 def make_master_control(self):
     if self.make_control:
         self.bones.ctrl.master = self.copy_bone(self.bones.org,
                                                 make_derived_name(
                                                     self.bones.org,
                                                     'ctrl'),
                                                 parent=True)
コード例 #11
0
 def make_ik_pivot_bone(self, orgs):
     name = self.copy_bone(orgs[2],
                           make_derived_name(orgs[2], 'ctrl', '_pivot_ik'))
     heel_bone = self.get_bone(self.bones.org.heel)
     heel_middle = (heel_bone.head + heel_bone.tail) / 2
     put_bone(self.obj, name, heel_middle, matrix=self.ik_matrix, scale=0.8)
     return name
コード例 #12
0
ファイル: skin_eye.py プロジェクト: robcazin/angavrilov-rigs
 def make_master_control(self):
     org = self.bones.org
     name = self.copy_bone(org,
                           make_derived_name(org, 'ctrl', '_master'),
                           parent=True)
     put_bone(self.obj, name, self.get_master_control_position())
     self.bones.ctrl.master = name
コード例 #13
0
    def init_control_nodes(self):
        org = self.bones.org
        name = make_derived_name(org, 'ctrl')

        self.control_node = node = ControlBoneNode(self, org, name, icon=ControlNodeIcon.CUSTOM, chain_end=ControlNodeEnd.START)

        node.hide_control = self.params.skin_anchor_hide
コード例 #14
0
    def generate_bones(self):
        self.mch_bones = []
        self.reuse_mch = False

        if self.copy_local or self.add_local or self.limit_distance:
            mch_name = make_derived_name(self.node.name, 'mch', '_poffset')

            if self.add_local:
                for key in self.add_local:
                    self.mch_bones.append(
                        self.node.make_bone(
                            mch_name,
                            1 / 4,
                            rig=self.rig,
                            orientation=self.add_orientations[key]))
            else:
                # Try piggybacking on the parent bone if allowed
                if not self.parent.is_parent_frozen:
                    bone = self.get_bone(self.parent.output_bone)
                    if (bone.head - self.node.point).length < 1e-5:
                        self.reuse_mch = True
                        self.mch_bones = [bone.name]
                        return

                self.mch_bones.append(
                    self.node.make_bone(mch_name, 1 / 4, rig=self.rig))
コード例 #15
0
ファイル: shoulder.py プロジェクト: robcazin/angavrilov-rigs
    def make_control_bone(self):
        org = self.bones.org
        name = make_derived_name(org, 'ctrl')
        self.bones.ctrl.master = self.copy_bone(org, name, parent=True)

        parent = self.get_bone_parent(org)
        if parent:
            SwitchParentBuilder(self.generator).register_parent(self, parent)
コード例 #16
0
ファイル: skin_eye.py プロジェクト: robcazin/angavrilov-rigs
 def make_master_control(self):
     name = self.new_bone(
         make_derived_name(self.get_common_rig_name(), 'ctrl', '_common'))
     bone = self.get_bone(name)
     bone.matrix = self.matrix
     bone.length = self.size
     bone.layers = self.get_master_control_layers()
     return name
コード例 #17
0
ファイル: super_palm.py プロジェクト: sobotka/blender-addons
    def make_master_control(self):
        orgs = self.bones.org

        self.bones.ctrl.master = self.copy_bone(orgs[-1], self.ctrl_name, parent=True)

        if self.make_secondary:
            second_name = make_derived_name(orgs[0], 'ctrl')
            self.bones.ctrl.secondary = self.copy_bone(orgs[0], second_name, parent=True)
コード例 #18
0
ファイル: super_palm.py プロジェクト: openartist/Bforartists
    def parent_bones(self):
        self.rig_parent_bone = self.get_bone_parent(self.bones.org[0])

        # Parent to the deform bone of the parent if exists
        def_bone = make_derived_name(self.rig_parent_bone, 'def')

        if def_bone in self.obj.data.bones:
            self.rig_parent_bone = def_bone
コード例 #19
0
    def make_master_bone(self):
        choice = self.find_master_name_node()
        name = choice.name_merged

        if self.hide_control:
            name = make_derived_name(name, 'mch')

        return choice.make_bone(name, 1)
コード例 #20
0
    def make_mch_shape_anchor_bone(self, i, org):
        name = self.copy_bone(org,
                              make_derived_name(org, 'mch', '_shape' + str(i)))

        if i == 0 and self.use_shape_only_location:
            pos = self.params.jiggle_shape_anchor.matrix_world.translation
            put_bone(self.obj, name, self.obj.matrix_world.inverted() @ pos)

        return name
コード例 #21
0
 def make_ik_spin_bone(self, orgs):
     name = self.copy_bone(orgs[2],
                           make_derived_name(orgs[2], 'ctrl', '_spin_ik'))
     put_bone(self.obj,
              name,
              self.get_bone(orgs[3]).head,
              matrix=self.ik_matrix,
              scale=0.5)
     return name
コード例 #22
0
 def make_last_tweak_offset_bone(self):
     org = self.bones.org
     mch = self.bones.mch
     mch.last_tweak_offset = self.copy_bone(org[-1],
                                            make_derived_name(
                                                org[-1], 'mch',
                                                '.end_offset'),
                                            scale=0.5)
     put_bone(self.obj, mch.last_tweak_offset, self.get_bone(org[-1]).tail)
コード例 #23
0
ファイル: limb_rigs.py プロジェクト: robcazin/angavrilov-rigs
    def make_mid_twist_mch_bone(self, orgs):
        if self.params.rotation_axis == 'automatic':
            return None

        name = self.copy_bone(
            orgs[0], make_derived_name(orgs[0], 'mch', '_ik_mid_twist'))
        axis = compute_chain_x_axis(self.obj, orgs[0:2])
        align_bone_x_axis(self.obj, name, axis)
        return name
コード例 #24
0
    def make_mch_lock_bones(self):
        org = self.bones.org
        mch = self.bones.mch

        self.arrange_child_chains()

        mch.lock = self.copy_bone(org, make_derived_name(org, 'mch', '_lock'), scale=1/2, parent=True)

        mch.top = map_list(self.make_mch_top_bone, range(self.num_layers), repeat(org))
        mch.bottom = map_list(self.make_mch_bottom_bone, range(self.num_layers), repeat(org))
        mch.middle = map_list(self.make_mch_middle_bone, range(self.num_layers), repeat(org))
コード例 #25
0
 def make_ik_control_bone(self, orgs):
     name = self.copy_bone(orgs[2],
                           make_derived_name(orgs[2], 'ctrl', '_ik'))
     if self.pivot_type == 'TOE':
         put_bone(self.obj,
                  name,
                  self.get_bone(name).tail,
                  matrix=self.ik_matrix)
     else:
         put_bone(self.obj, name, None, matrix=self.ik_matrix)
     return name
コード例 #26
0
    def generate_bones(self):
        self.output_bone = self.node.make_bone(make_derived_name(
            self.node.name, 'mch', '_arm'),
                                               1 / 4,
                                               rig=self.rig)

        self.rig.generator.disable_auto_parent(self.output_bone)

        if self.orientation:
            matrix = force_lazy(self.orientation).to_matrix().to_4x4()
            matrix.translation = self.node.point
            self.get_bone(self.output_bone).matrix = matrix
コード例 #27
0
    def make_mch_handle_bone(self, i, prev_node, node, next_node):
        name = self.copy_bone(node.org,
                              make_derived_name(node.name, 'mch', '_handle'))

        hstart = prev_node or node
        hend = next_node or node
        haxis = (hend.point - hstart.point).normalized()

        bone = self.get_bone(name)
        bone.tail = bone.head + haxis * self.length * 3 / 4

        align_bone_roll(self.obj, name, node.org)
        return name
コード例 #28
0
 def make_control_node(self, i, org, is_end):
     bone = self.get_bone(org)
     name = make_derived_name(org, 'ctrl', '_end' if is_end else '')
     pos = bone.tail if is_end else bone.head
     chain_end = ControlNodeEnd.START if i == 0 else ControlNodeEnd.END if is_end else ControlNodeEnd.MIDDLE
     return ControlBoneNode(
         self,
         org,
         name,
         point=pos,
         size=self.length / 3,
         index=i,
         allow_scale=self.use_scale,
         needs_reparent=self.use_reparent_handles,
         chain_end=chain_end,
     )
コード例 #29
0
    def get_final_control_node_rotation(self, node):
        bone_name = self.params.skin_control_orientation_bone

        if bone_name:
            try:
                org_name = make_derived_name(bone_name, 'org')

                if org_name not in self.obj.pose.bones:
                    org_name = bone_name

                return get_bone_quaternion(self.obj, org_name)

            except KeyError:
                self.raise_error('Could not find orientation bone {}',
                                 bone_name)

        else:
            return self.get_control_node_rotation(node)
コード例 #30
0
ファイル: limb_rigs.py プロジェクト: robcazin/angavrilov-rigs
 def make_middle_ik_mch_bone(self, i, org):
     return self.copy_bone(org, make_derived_name(org, 'mch', '_ik_mid'))