def _apply_individual_grip(self, armature_object): _LOG.enter() for finger_number in [1, 2, 3, 4, 5]: self._create_grip_bone(finger_number, armature_object) grip_name = self._get_grip_bone_name_for_finger(finger_number) bpy.ops.object.mode_set(mode='EDIT', toggle=False) parent_name = self.get_immediate_parent_name_of_finger(finger_number) parent_bone = RigService.find_edit_bone_by_name(parent_name, armature_object) grip_bone = RigService.find_edit_bone_by_name(grip_name, armature_object) grip_bone.parent = parent_bone bpy.ops.object.mode_set(mode='OBJECT', toggle=False) bpy.ops.object.mode_set(mode='POSE', toggle=False) finger_segments = self.get_reverse_list_of_bones_in_finger(finger_number) for bone_name in finger_segments: constraint = RigService.add_copy_rotation_constraint_to_pose_bone(bone_name, grip_name, armature_object, copy_y=False, copy_z=False) constraint.influence = 1.0 / len(finger_segments) bone_name = finger_segments[-1] constraint = RigService.add_copy_rotation_constraint_to_pose_bone(bone_name, grip_name, armature_object, copy_x=False) if self.settings["hide_fk"]: self._hide_bones(armature_object, finger_segments)
def _apply_master_without_individual_for_finger(self, armature_object, finger_number): master_name = self._get_master_grip_bone_name() finger_segments = self.get_reverse_list_of_bones_in_finger(finger_number) for bone_name in finger_segments: constraint = RigService.add_copy_rotation_constraint_to_pose_bone(bone_name, master_name, armature_object, copy_y=False, copy_z=False) constraint.influence = 1.0 / len(finger_segments) bone_name = finger_segments[-1] constraint = RigService.add_copy_rotation_constraint_to_pose_bone(bone_name, master_name, armature_object, copy_x=False) if self.settings["hide_fk"]: self._hide_bones(armature_object, finger_segments)
def _apply_master_with_individual_for_finger(self, armature_object, finger_number): master_name = self._get_master_grip_bone_name() bone_name = self._get_grip_bone_name_for_finger(finger_number) constraint = RigService.add_copy_rotation_constraint_to_pose_bone(bone_name, master_name, armature_object) constraint.name = 'Add rotation' constraint.mix_mode = 'ADD'