Exemple #1
0
    def add_bones_bone(self, context, rig):
        # Add bones then set their defaults
        root = self.get_root(rig)
        prev_bones = self.get_prev_bones(rig)
        bone = rig.data.edit_bones.new('Bone')
        bone.parent = root

        bone.translate(
            Vector(
                utils.multiply_list(
                    Get.cursor(context).location,
                    rig.matrix_world.inverted().to_scale(
                    ),  # Get the transforms for the unscaled rig
                )) - rig.matrix_world.to_translation())

        # Use the original bone size (unscaled by the rig)
        bone.tail = bone.head + Vector(
            utils.multiply_list(
                Vector((0, 0, 0.1)),
                rig.matrix_world.inverted().to_scale(),
            )) - rig.matrix_world.to_translation()

        bone = str(bone.name)

        # Switch back to Pose mode and setup pose bones
        Set.mode(context, 'POSE', rig)

        bone = rig.data.bones[bone]
        rig.data.bones.active = bone
        Set.select(bone)
Exemple #2
0
 def rotation_quaternion(context, x):
     Get.cursor(context).rotation_quaternion = x
Exemple #3
0
 def rotation_mode(context, x):
     Get.cursor(context).rotation_mode = x
Exemple #4
0
 def rotation_euler(context, x):
     Get.cursor(context).rotation_euler = x
Exemple #5
0
 def rotation_axis_angle(context, x):
     Get.cursor(context).rotation_axis_angle = x
Exemple #6
0
 def location(context, x):
     Get.cursor(context).location = x