Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/armature/pose_select.c
| Show All 20 Lines | |||||
| * \ingroup edarmature | * \ingroup edarmature | ||||
| */ | */ | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "DNA_anim_types.h" | #include "DNA_anim_types.h" | ||||
| #include "DNA_armature_types.h" | #include "DNA_armature_types.h" | ||||
| #include "DNA_constraint_types.h" | #include "DNA_constraint_types.h" | ||||
| #include "DNA_gpencil_modifier_types.h" | |||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "BLI_blenlib.h" | #include "BLI_blenlib.h" | ||||
| #include "BKE_action.h" | #include "BKE_action.h" | ||||
| ▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | bool ED_armature_pose_select_pick_with_buffer(ViewLayer *view_layer, | ||||
| if ((nearBone) && !(nearBone->flag & BONE_UNSELECTABLE)) { | if ((nearBone) && !(nearBone->flag & BONE_UNSELECTABLE)) { | ||||
| bArmature *arm = ob->data; | bArmature *arm = ob->data; | ||||
| /* since we do unified select, we don't shift+select a bone if the | /* since we do unified select, we don't shift+select a bone if the | ||||
| * armature object was not active yet. | * armature object was not active yet. | ||||
| * note, special exception for armature mode so we can do multi-select | * note, special exception for armature mode so we can do multi-select | ||||
| * we could check for multi-select explicitly but think its fine to | * we could check for multi-select explicitly but think its fine to | ||||
| * always give predictable behavior in weight paint mode - campbell */ | * always give predictable behavior in weight paint mode - campbell */ | ||||
| if ((ob_act == NULL) || ((ob_act != ob) && (ob_act->mode & OB_MODE_WEIGHT_PAINT) == 0)) { | if ((ob_act == NULL) || | ||||
| ((ob_act != ob) && !ELEM(ob_act->mode, OB_MODE_WEIGHT_PAINT, OB_MODE_WEIGHT_GPENCIL))) { | |||||
| /* when we are entering into posemode via toggle-select, | /* when we are entering into posemode via toggle-select, | ||||
| * from another active object - always select the bone. */ | * from another active object - always select the bone. */ | ||||
| if (!extend && !deselect && toggle) { | if (!extend && !deselect && toggle) { | ||||
| /* re-select below */ | /* re-select below */ | ||||
| nearBone->flag &= ~BONE_SELECTED; | nearBone->flag &= ~BONE_SELECTED; | ||||
| } | } | ||||
| } | } | ||||
| Show All 36 Lines | else { | ||||
| nearBone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); | nearBone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); | ||||
| arm->act_bone = nearBone; | arm->act_bone = nearBone; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (ob_act) { | if (ob_act) { | ||||
| /* in weightpaint we select the associated vertex group too */ | /* in weightpaint we select the associated vertex group too */ | ||||
| if (ob_act->mode & OB_MODE_WEIGHT_PAINT) { | if (ELEM(ob_act->mode, OB_MODE_WEIGHT_PAINT, OB_MODE_WEIGHT_GPENCIL)) { | ||||
| if (nearBone == arm->act_bone) { | if (nearBone == arm->act_bone) { | ||||
| ED_vgroup_select_by_name(ob_act, nearBone->name); | ED_vgroup_select_by_name(ob_act, nearBone->name); | ||||
| DEG_id_tag_update(&ob_act->id, ID_RECALC_GEOMETRY); | DEG_id_tag_update(&ob_act->id, ID_RECALC_GEOMETRY); | ||||
| } | } | ||||
| } | } | ||||
| /* if there are some dependencies for visualizing armature state | /* if there are some dependencies for visualizing armature state | ||||
| * (e.g. Mask Modifier in 'Armature' mode), force update | * (e.g. Mask Modifier in 'Armature' mode), force update | ||||
| */ | */ | ||||
| Show All 19 Lines | |||||
| * This function de-selects all other objects, and selects the new base. | * This function de-selects all other objects, and selects the new base. | ||||
| * It can't be set to the active object because we need | * It can't be set to the active object because we need | ||||
| * to keep this set to the weight paint object. | * to keep this set to the weight paint object. | ||||
| */ | */ | ||||
| void ED_armature_pose_select_in_wpaint_mode(ViewLayer *view_layer, Base *base_select) | void ED_armature_pose_select_in_wpaint_mode(ViewLayer *view_layer, Base *base_select) | ||||
| { | { | ||||
| BLI_assert(base_select && (base_select->object->type == OB_ARMATURE)); | BLI_assert(base_select && (base_select->object->type == OB_ARMATURE)); | ||||
| Object *ob_active = OBACT(view_layer); | Object *ob_active = OBACT(view_layer); | ||||
| BLI_assert(ob_active && (ob_active->mode & OB_MODE_WEIGHT_PAINT)); | BLI_assert(ob_active && ELEM(ob_active->mode, OB_MODE_WEIGHT_PAINT, OB_MODE_WEIGHT_GPENCIL)); | ||||
| VirtualModifierData virtualModifierData; | VirtualModifierData virtualModifierData; | ||||
| ModifierData *md = BKE_modifiers_get_virtual_modifierlist(ob_active, &virtualModifierData); | ModifierData *md = BKE_modifiers_get_virtual_modifierlist(ob_active, &virtualModifierData); | ||||
| for (; md; md = md->next) { | for (; md; md = md->next) { | ||||
| if (md->type == eModifierType_Armature) { | |||||
| if (md->type == eGpencilModifierType_Armature) { | |||||
| ArmatureGpencilModifierData *agmd = (ArmatureGpencilModifierData *)md; | |||||
| Object *ob_arm = agmd->object; | |||||
| if (ob_arm != NULL) { | |||||
| Base *base_arm = BKE_view_layer_base_find(view_layer, ob_arm); | |||||
| if ((base_arm != NULL) && (base_arm != base_select) && (base_arm->flag & BASE_SELECTED)) { | |||||
| ED_object_base_select(base_arm, BA_DESELECT); | |||||
| } | |||||
| } | |||||
| } | |||||
| else if (md->type == eModifierType_Armature) { | |||||
| ArmatureModifierData *amd = (ArmatureModifierData *)md; | ArmatureModifierData *amd = (ArmatureModifierData *)md; | ||||
| Object *ob_arm = amd->object; | Object *ob_arm = amd->object; | ||||
| if (ob_arm != NULL) { | if (ob_arm != NULL) { | ||||
| Base *base_arm = BKE_view_layer_base_find(view_layer, ob_arm); | Base *base_arm = BKE_view_layer_base_find(view_layer, ob_arm); | ||||
| if ((base_arm != NULL) && (base_arm != base_select) && (base_arm->flag & BASE_SELECTED)) { | if ((base_arm != NULL) && (base_arm != base_select) && (base_arm->flag & BASE_SELECTED)) { | ||||
| ED_object_base_select(base_arm, BA_DESELECT); | ED_object_base_select(base_arm, BA_DESELECT); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 986 Lines • Show Last 20 Lines | |||||