Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2017-11-19 15:16:14 +0300
committerJulian Eisel <eiseljulian@gmail.com>2017-11-19 15:16:14 +0300
commit7f96323cd001bc7555d0f145027e3bbbbc1462b8 (patch)
tree842a4ac4095be5c22bd0a505612c731351839a29 /source/blender/editors/armature/armature_select.c
parent4de142e0b7ba014a3e1e41672600aa38465f2454 (diff)
parent3133d2d58c391544a48342860120336e2a0f944e (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/armature/armature_select.c')
-rw-r--r--source/blender/editors/armature/armature_select.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c
index 49619e13065..2c3c8ef4541 100644
--- a/source/blender/editors/armature/armature_select.c
+++ b/source/blender/editors/armature/armature_select.c
@@ -38,7 +38,7 @@
#include "BLI_string_utils.h"
#include "BKE_context.h"
-//#include "BKE_deform.h"
+#include "BKE_action.h"
#include "BKE_report.h"
#include "BIF_gl.h"
@@ -807,6 +807,7 @@ enum {
SIMEDBONE_PREFIX,
SIMEDBONE_SUFFIX,
SIMEDBONE_LAYER,
+ SIMEDBONE_SHAPE,
};
static const EnumPropertyItem prop_similar_types[] = {
@@ -818,6 +819,7 @@ static const EnumPropertyItem prop_similar_types[] = {
{SIMEDBONE_PREFIX, "PREFIX", 0, "Prefix", ""},
{SIMEDBONE_SUFFIX, "SUFFIX", 0, "Suffix", ""},
{SIMEDBONE_LAYER, "LAYER", 0, "Layer", ""},
+ {SIMEDBONE_SHAPE, "SHAPE", 0, "Shape", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -920,7 +922,27 @@ static void select_similar_suffix(bArmature *arm, EditBone *ebone_act)
}
}
-static void is_ancestor(EditBone * bone, EditBone * ancestor)
+/** Use for matching any pose channel data. */
+static void select_similar_data_pchan(
+ bArmature *arm, Object *obj, EditBone *ebone_active,
+ const size_t bytes_size, const int offset)
+{
+ const bPoseChannel *pchan_active = BKE_pose_channel_find_name(obj->pose, ebone_active->name);
+ const char *data_active = (const char *)POINTER_OFFSET(pchan_active, offset);
+ for (EditBone *ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+ if (EBONE_SELECTABLE(arm, ebone)) {
+ const bPoseChannel *pchan = BKE_pose_channel_find_name(obj->pose, ebone->name);
+ if (pchan) {
+ const char *data_test = (const char *)POINTER_OFFSET(pchan, offset);
+ if (memcmp(data_active, data_test, bytes_size) == 0) {
+ ED_armature_ebone_select_set(ebone, true);
+ }
+ }
+ }
+ }
+}
+
+static void is_ancestor(EditBone *bone, EditBone *ancestor)
{
if (bone->temp.ebone == ancestor || bone->temp.ebone == NULL)
return;
@@ -1012,6 +1034,11 @@ static int armature_select_similar_exec(bContext *C, wmOperator *op)
case SIMEDBONE_LAYER:
select_similar_layer(arm, ebone_act);
break;
+ case SIMEDBONE_SHAPE:
+ select_similar_data_pchan(
+ arm, obedit, ebone_act,
+ sizeof(void *), offsetof(bPoseChannel, custom));
+ break;
}
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);