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:
authorCampbell Barton <ideasman42@gmail.com>2020-06-05 09:12:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-06-05 09:12:22 +0300
commit0aa2c10ad1934e63c185bc98fbc68d43293d6faa (patch)
tree43745af9766ffef7653ceafc3ea8e0d30f073d2f
parent8b347fc2cdc67d73255623c5e86994fbba767d64 (diff)
Cleanup: remove braces from previous commit (no functional changes)
-rw-r--r--source/blender/editors/armature/armature_select.c248
1 files changed, 120 insertions, 128 deletions
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c
index 08b285a9163..4b8bbe39a16 100644
--- a/source/blender/editors/armature/armature_select.c
+++ b/source/blender/editors/armature/armature_select.c
@@ -184,78 +184,74 @@ static void *ed_armature_pick_bone_from_selectbuffer_impl(const bool is_editmode
for (i = 0; i < hits; i++) {
hitresult = buffer[3 + (i * 4)];
- {
- if (hitresult & BONESEL_ANY) { /* to avoid including objects in selection */
- Base *base = NULL;
- bool sel;
-
- hitresult &= ~(BONESEL_ANY);
- /* Determine what the current bone is */
- if (is_editmode == false) {
- base = ED_armature_base_and_pchan_from_select_buffer(
- bases, bases_len, hitresult, &pchan);
- if (pchan != NULL) {
- if (findunsel) {
- sel = (pchan->bone->flag & BONE_SELECTED);
- }
- else {
- sel = !(pchan->bone->flag & BONE_SELECTED);
- }
-
- data = pchan;
+ if (hitresult & BONESEL_ANY) { /* to avoid including objects in selection */
+ Base *base = NULL;
+ bool sel;
+
+ hitresult &= ~(BONESEL_ANY);
+ /* Determine what the current bone is */
+ if (is_editmode == false) {
+ base = ED_armature_base_and_pchan_from_select_buffer(bases, bases_len, hitresult, &pchan);
+ if (pchan != NULL) {
+ if (findunsel) {
+ sel = (pchan->bone->flag & BONE_SELECTED);
}
else {
- data = NULL;
- sel = 0;
+ sel = !(pchan->bone->flag & BONE_SELECTED);
}
+
+ data = pchan;
}
else {
- base = ED_armature_base_and_ebone_from_select_buffer(
- bases, bases_len, hitresult, &ebone);
- if (findunsel) {
- sel = (ebone->flag & BONE_SELECTED);
+ data = NULL;
+ sel = 0;
+ }
+ }
+ else {
+ base = ED_armature_base_and_ebone_from_select_buffer(bases, bases_len, hitresult, &ebone);
+ if (findunsel) {
+ sel = (ebone->flag & BONE_SELECTED);
+ }
+ else {
+ sel = !(ebone->flag & BONE_SELECTED);
+ }
+
+ data = ebone;
+ }
+
+ if (data) {
+ if (sel) {
+ if (do_nearest) {
+ if (minsel > buffer[4 * i + 1]) {
+ firstSel = data;
+ firstSel_base = base;
+ minsel = buffer[4 * i + 1];
+ }
}
else {
- sel = !(ebone->flag & BONE_SELECTED);
+ if (!firstSel) {
+ firstSel = data;
+ firstSel_base = base;
+ }
+ takeNext = 1;
}
-
- data = ebone;
}
-
- if (data) {
- if (sel) {
- if (do_nearest) {
- if (minsel > buffer[4 * i + 1]) {
- firstSel = data;
- firstSel_base = base;
- minsel = buffer[4 * i + 1];
- }
- }
- else {
- if (!firstSel) {
- firstSel = data;
- firstSel_base = base;
- }
- takeNext = 1;
+ else {
+ if (do_nearest) {
+ if (minunsel > buffer[4 * i + 1]) {
+ firstunSel = data;
+ firstunSel_base = base;
+ minunsel = buffer[4 * i + 1];
}
}
else {
- if (do_nearest) {
- if (minunsel > buffer[4 * i + 1]) {
- firstunSel = data;
- firstunSel_base = base;
- minunsel = buffer[4 * i + 1];
- }
+ if (!firstunSel) {
+ firstunSel = data;
+ firstunSel_base = base;
}
- else {
- if (!firstunSel) {
- firstunSel = data;
- firstunSel_base = base;
- }
- if (takeNext) {
- *r_base = base;
- return data;
- }
+ if (takeNext) {
+ *r_base = base;
+ return data;
}
}
}
@@ -732,11 +728,9 @@ cache_end:
/* See if there are any selected bones in this group */
if (hits > 0) {
if (hits == 1) {
- {
- result_bias.hitresult = buffer[3];
- result_bias.base = ED_armature_base_and_ebone_from_select_buffer(
- bases, bases_len, result_bias.hitresult, &result_bias.ebone);
- }
+ result_bias.hitresult = buffer[3];
+ result_bias.base = ED_armature_base_and_ebone_from_select_buffer(
+ bases, bases_len, result_bias.hitresult, &result_bias.ebone);
}
else {
int bias_max = INT_MIN;
@@ -774,84 +768,82 @@ cache_end:
for (int i = 0; i < hits; i++) {
const uint hitresult = buffer[3 + (i * 4)];
+
+ Base *base = NULL;
+ EditBone *ebone;
+ base = ED_armature_base_and_ebone_from_select_buffer(bases, bases_len, hitresult, &ebone);
+ /* If this fails, selection code is setting the selection ID's incorrectly. */
+ BLI_assert(base && ebone);
+
+ /* Prioritized selection. */
{
- Base *base = NULL;
- EditBone *ebone;
- base = ED_armature_base_and_ebone_from_select_buffer(
- bases, bases_len, hitresult, &ebone);
- /* If this fails, selection code is setting the selection ID's incorrectly. */
- BLI_assert(base && ebone);
-
- /* Prioritized selection. */
- {
- int bias;
- /* clicks on bone points get advantage */
- if (hitresult & (BONESEL_ROOT | BONESEL_TIP)) {
- /* but also the unselected one */
- if (findunsel) {
- if ((hitresult & BONESEL_ROOT) && (ebone->flag & BONE_ROOTSEL) == 0) {
- bias = 4;
- }
- else if ((hitresult & BONESEL_TIP) && (ebone->flag & BONE_TIPSEL) == 0) {
- bias = 4;
- }
- else {
- bias = 3;
- }
+ int bias;
+ /* clicks on bone points get advantage */
+ if (hitresult & (BONESEL_ROOT | BONESEL_TIP)) {
+ /* but also the unselected one */
+ if (findunsel) {
+ if ((hitresult & BONESEL_ROOT) && (ebone->flag & BONE_ROOTSEL) == 0) {
+ bias = 4;
}
- else {
+ else if ((hitresult & BONESEL_TIP) && (ebone->flag & BONE_TIPSEL) == 0) {
bias = 4;
}
+ else {
+ bias = 3;
+ }
}
else {
- /* bone found */
- if (findunsel) {
- if ((ebone->flag & BONE_SELECTED) == 0) {
- bias = 2;
- }
- else {
- bias = 1;
- }
+ bias = 4;
+ }
+ }
+ else {
+ /* bone found */
+ if (findunsel) {
+ if ((ebone->flag & BONE_SELECTED) == 0) {
+ bias = 2;
}
else {
- bias = 2;
+ bias = 1;
}
}
+ else {
+ bias = 2;
+ }
+ }
- if (bias > bias_max) {
- bias_max = bias;
+ if (bias > bias_max) {
+ bias_max = bias;
- result_bias.hitresult = hitresult;
- result_bias.base = base;
- result_bias.ebone = ebone;
- }
+ result_bias.hitresult = hitresult;
+ result_bias.base = base;
+ result_bias.ebone = ebone;
}
+ }
- /* Cycle selected items (objects & bones). */
- if (use_cycle) {
- cycle_order.test.ob = hitresult & 0xFFFF;
- cycle_order.test.bone = (hitresult & ~BONESEL_ANY) >> 16;
- if (ebone == ebone_active_orig) {
- BLI_assert(cycle_order.test.ob == cycle_order.offset.ob);
- BLI_assert(cycle_order.test.bone == cycle_order.offset.bone);
- }
- /* Subtraction as a single value is needed to support cycling through bones
- * from multiple objects. So once the last bone is selected,
- * the bits for the bone index wrap into the object,
- * causing the next object to be stepped onto. */
- cycle_order.test.as_u32 -= cycle_order.offset.as_u32;
-
- /* Even though this logic avoids stepping onto the active bone,
- * always set the 'best' value for the first time.
- * Otherwise ensure the value is the smallest it can be,
- * relative to the active bone, as long as it's not the active bone. */
- if ((cycle_order.best.as_u32 == 0) ||
- (cycle_order.test.as_u32 && (cycle_order.test.as_u32 < cycle_order.best.as_u32))) {
- cycle_order.best = cycle_order.test;
- result_cycle.hitresult = hitresult;
- result_cycle.base = base;
- result_cycle.ebone = ebone;
- }
+ /* Cycle selected items (objects & bones). */
+ if (use_cycle) {
+ cycle_order.test.ob = hitresult & 0xFFFF;
+ cycle_order.test.bone = (hitresult & ~BONESEL_ANY) >> 16;
+ if (ebone == ebone_active_orig) {
+ BLI_assert(cycle_order.test.ob == cycle_order.offset.ob);
+ BLI_assert(cycle_order.test.bone == cycle_order.offset.bone);
+ }
+ /* Subtraction as a single value is needed to support cycling through bones
+ * from multiple objects. So once the last bone is selected,
+ * the bits for the bone index wrap into the object,
+ * causing the next object to be stepped onto. */
+ cycle_order.test.as_u32 -= cycle_order.offset.as_u32;
+
+ /* Even though this logic avoids stepping onto the active bone,
+ * always set the 'best' value for the first time.
+ * Otherwise ensure the value is the smallest it can be,
+ * relative to the active bone, as long as it's not the active bone. */
+ if ((cycle_order.best.as_u32 == 0) ||
+ (cycle_order.test.as_u32 && (cycle_order.test.as_u32 < cycle_order.best.as_u32))) {
+ cycle_order.best = cycle_order.test;
+ result_cycle.hitresult = hitresult;
+ result_cycle.base = base;
+ result_cycle.ebone = ebone;
}
}
}