Cleanup: use "num" as a variable suffix

This commit is contained in:
Campbell Barton
2024-07-23 15:49:28 +10:00
parent c46679c108
commit f1febee83f
6 changed files with 37 additions and 37 deletions

View File

@@ -666,8 +666,8 @@ static void COLLECTION_OT_exporter_export(wmOperatorType *ot)
}
struct CollectionExportStats {
int num_successful_exports = 0;
int num_collections = 0;
int successful_exports_num = 0;
int collections_num = 0;
};
static int collection_export(bContext *C,
@@ -676,7 +676,7 @@ static int collection_export(bContext *C,
CollectionExportStats &stats)
{
ListBase *exporters = &collection->exporters;
int num_files = 0;
int files_num = 0;
LISTBASE_FOREACH (CollectionExport *, data, exporters) {
if (collection_exporter_export(C, op, data, collection, false) != OPERATOR_FINISHED) {
@@ -684,13 +684,13 @@ static int collection_export(bContext *C,
return OPERATOR_CANCELLED;
}
else {
num_files++;
files_num++;
}
}
if (num_files) {
stats.num_successful_exports += num_files;
stats.num_collections++;
if (files_num) {
stats.successful_exports_num += files_num;
stats.collections_num++;
}
return OPERATOR_FINISHED;
}
@@ -703,11 +703,11 @@ static int collection_io_export_all_exec(bContext *C, wmOperator *op)
/* Only report if nothing was cancelled along the way. We don't want this UI report to happen
* over-top any reports from the actual failures. */
if (result == OPERATOR_FINISHED && stats.num_successful_exports > 0) {
if (result == OPERATOR_FINISHED && stats.successful_exports_num > 0) {
BKE_reportf(op->reports,
RPT_INFO,
"Exported %d files from collection '%s'",
stats.num_successful_exports,
stats.successful_exports_num,
collection->id.name + 2);
}
@@ -769,12 +769,12 @@ static int wm_collection_export_all_exec(bContext *C, wmOperator *op)
/* Only report if nothing was cancelled along the way. We don't want this UI report to happen
* over-top any reports from the actual failures. */
if (stats.num_successful_exports > 0) {
if (stats.successful_exports_num > 0) {
BKE_reportf(op->reports,
RPT_INFO,
"Exported %d files from %d collections",
stats.num_successful_exports,
stats.num_collections);
stats.successful_exports_num,
stats.collections_num);
}
return OPERATOR_FINISHED;

View File

@@ -255,21 +255,21 @@ static void set_constraint_nth_target(bConstraint *con,
{
ListBase targets = {nullptr, nullptr};
bConstraintTarget *ct;
int num_targets, i;
int targets_num, i;
if (BKE_constraint_targets_get(con, &targets)) {
num_targets = BLI_listbase_count(&targets);
targets_num = BLI_listbase_count(&targets);
if (index < 0) {
if (abs(index) < num_targets) {
index = num_targets - abs(index);
if (abs(index) < targets_num) {
index = targets_num - abs(index);
}
else {
index = num_targets - 1;
index = targets_num - 1;
}
}
else if (index >= num_targets) {
index = num_targets - 1;
else if (index >= targets_num) {
index = targets_num - 1;
}
for (ct = static_cast<bConstraintTarget *>(targets.first), i = 0; ct; ct = ct->next, i++) {

View File

@@ -111,11 +111,11 @@ static void dt_add_vcol_layers(const CustomData *cdata,
continue;
}
int num_data = CustomData_number_of_layers(cdata, type);
int data_num = CustomData_number_of_layers(cdata, type);
RNA_enum_item_add_separator(r_item, r_totitem);
for (int j = 0; j < num_data; j++) {
for (int j = 0; j < data_num; j++) {
EnumPropertyItem tmp_item = {0};
tmp_item.value = idx++;
tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(cdata, type, j);
@@ -188,11 +188,11 @@ static const EnumPropertyItem *dt_layers_select_src_itemf(bContext *C,
*r_free = true;
return item;
}
int num_data = CustomData_number_of_layers(&mesh_eval->corner_data, CD_PROP_FLOAT2);
int data_num = CustomData_number_of_layers(&mesh_eval->corner_data, CD_PROP_FLOAT2);
RNA_enum_item_add_separator(&item, &totitem);
for (int i = 0; i < num_data; i++) {
for (int i = 0; i < data_num; i++) {
tmp_item.value = i;
tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(
&mesh_eval->corner_data, CD_PROP_FLOAT2, i);

View File

@@ -192,8 +192,8 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
}
else {
BPoint *bp = nu->bp;
const int num_points = nu->pntsu * nu->pntsv;
for (int nurb_index = 0; nurb_index < num_points; nurb_index++, bp++, curr_index++) {
const int points_num = nu->pntsu * nu->pntsv;
for (int nurb_index = 0; nurb_index < points_num; nurb_index++, bp++, curr_index++) {
if (bp->f1 & SELECT) {
if (par1 == INDEX_UNSET) {
par1 = curr_index;
@@ -218,10 +218,10 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
else if (obedit->type == OB_LATTICE) {
Lattice *lt = static_cast<Lattice *>(obedit->data);
const int num_points = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv *
const int points_num = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv *
lt->editlatt->latt->pntsw;
BPoint *bp = lt->editlatt->latt->def;
for (int curr_index = 0; curr_index < num_points; curr_index++, bp++) {
for (int curr_index = 0; curr_index < points_num; curr_index++, bp++) {
if (bp->f1 & SELECT) {
if (par1 == INDEX_UNSET) {
par1 = curr_index;

View File

@@ -1021,22 +1021,22 @@ static bool quadriflow_check(bContext *C, wmOperator *op)
area = BKE_mesh_calc_area(static_cast<const Mesh *>(ob->data));
RNA_float_set(op->ptr, "mesh_area", area);
}
int num_faces;
int faces_num;
float edge_len = RNA_float_get(op->ptr, "target_edge_length");
num_faces = area / (edge_len * edge_len);
RNA_int_set(op->ptr, "target_faces", num_faces);
faces_num = area / (edge_len * edge_len);
RNA_int_set(op->ptr, "target_faces", faces_num);
}
else if (mode == QUADRIFLOW_REMESH_RATIO) {
Object *ob = CTX_data_active_object(C);
Mesh *mesh = static_cast<Mesh *>(ob->data);
int num_faces;
int faces_num;
float ratio = RNA_float_get(op->ptr, "target_ratio");
num_faces = mesh->faces_num * ratio;
faces_num = mesh->faces_num * ratio;
RNA_int_set(op->ptr, "target_faces", num_faces);
RNA_int_set(op->ptr, "target_faces", faces_num);
}
return true;

View File

@@ -580,18 +580,18 @@ static Array<Object *> sorted_selected_editable_objects(bContext *C)
/* Count all objects, but also tag all the selected ones. */
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
int num_objects = 0;
int objects_num = 0;
CTX_DATA_BEGIN (C, Object *, object, selected_editable_objects) {
object->id.tag |= LIB_TAG_DOIT;
num_objects++;
objects_num++;
}
CTX_DATA_END;
if (num_objects == 0) {
if (objects_num == 0) {
return {};
}
/* Append all the objects. */
Array<Object *> sorted_objects(num_objects);
Array<Object *> sorted_objects(objects_num);
int object_index = 0;
CTX_DATA_BEGIN (C, Object *, object, selected_editable_objects) {
if ((object->id.tag & LIB_TAG_DOIT) == 0) {