Cleanup: use bool instead of int for a boolean array

This commit is contained in:
Campbell Barton
2024-08-23 13:16:26 +10:00
parent 878b52c072
commit a4667fbb3d
4 changed files with 12 additions and 12 deletions

View File

@@ -197,7 +197,7 @@ static void envelope_bone_weighting(Object *ob,
bDeformGroup **dgroupflip,
float (*root)[3],
float (*tip)[3],
const int *selected,
const bool *selected,
float scale)
{
using namespace blender;
@@ -226,7 +226,7 @@ static void envelope_bone_weighting(Object *ob,
/* for each skinnable bone */
for (int j = 0; j < numbones; j++) {
if (!selected[j]) {
if (selected[j] == false) {
continue;
}
@@ -290,7 +290,7 @@ static void add_verts_to_dgroups(ReportList *reports,
Mesh *mesh;
Mat4 bbone_array[MAX_BBONE_SUBDIV], *bbone = nullptr;
float(*root)[3], (*tip)[3], (*verts)[3];
int *selected;
bool *selected;
int numbones, vertsfilled = 0, segments = 0;
const bool wpmode = (ob->mode & OB_MODE_WEIGHT_PAINT);
struct {
@@ -338,7 +338,7 @@ static void add_verts_to_dgroups(ReportList *reports,
* global coords */
root = static_cast<float(*)[3]>(MEM_callocN(sizeof(float[3]) * numbones, "root"));
tip = static_cast<float(*)[3]>(MEM_callocN(sizeof(float[3]) * numbones, "tip"));
selected = static_cast<int *>(MEM_callocN(sizeof(int) * numbones, "selected"));
selected = static_cast<bool *>(MEM_callocN(sizeof(bool) * numbones, "selected"));
for (int j = 0; j < numbones; j++) {
bone = bonelist[j];
@@ -383,11 +383,11 @@ static void add_verts_to_dgroups(ReportList *reports,
/* set selected */
if (wpmode) {
if (ANIM_bone_in_visible_collection(arm, bone) && (bone->flag & BONE_SELECTED)) {
selected[j] = 1;
selected[j] = true;
}
}
else {
selected[j] = 1;
selected[j] = true;
}
/* find flipped group */

View File

@@ -635,7 +635,7 @@ void heat_bone_weighting(Object *ob,
bDeformGroup **dgroupflip,
float (*root)[3],
float (*tip)[3],
const int *selected,
const bool *selected,
const char **r_error_str)
{
using namespace blender;
@@ -722,7 +722,7 @@ void heat_bone_weighting(Object *ob,
/* compute weights per bone */
for (j = 0; j < numbones; j++) {
if (!selected[j]) {
if (selected[j] == false) {
continue;
}

View File

@@ -46,7 +46,7 @@ void heat_bone_weighting(struct Object *ob,
struct bDeformGroup **dgroupflip,
float (*root)[3],
float (*tip)[3],
const int *selected,
const bool *selected,
const char **r_error_str);
#ifdef RIGID_DEFORM

View File

@@ -259,7 +259,7 @@ static void gpencil_add_verts_to_dgroups(
Mat4 bbone_array[MAX_BBONE_SUBDIV], *bbone = nullptr;
float(*root)[3], (*tip)[3], (*verts)[3];
float *radsqr;
int *selected;
bool *selected;
float weight;
int numbones, i, j, segments = 0;
struct {
@@ -301,7 +301,7 @@ static void gpencil_add_verts_to_dgroups(
* global coords */
root = static_cast<float(*)[3]>(MEM_callocN(sizeof(float[3]) * numbones, "root"));
tip = static_cast<float(*)[3]>(MEM_callocN(sizeof(float[3]) * numbones, "tip"));
selected = static_cast<int *>(MEM_callocN(sizeof(int) * numbones, "selected"));
selected = static_cast<bool *>(MEM_callocN(sizeof(bool) * numbones, "selected"));
radsqr = static_cast<float *>(MEM_callocN(sizeof(float) * numbones, "radsqr"));
for (j = 0; j < numbones; j++) {
@@ -341,7 +341,7 @@ static void gpencil_add_verts_to_dgroups(
mul_m4_v3(ob_arm->object_to_world().ptr(), root[j]);
mul_m4_v3(ob_arm->object_to_world().ptr(), tip[j]);
selected[j] = 1;
selected[j] = true;
/* calculate radius squared */
radsqr[j] = len_squared_v3v3(root[j], tip[j]) * ratio;