Cleanup: reduce variable scopes

This commit is contained in:
2020-09-09 16:35:20 +02:00
parent 42e3eb8854
commit f8aad78830
25 changed files with 204 additions and 355 deletions

View File

@@ -101,13 +101,12 @@ bool BKE_object_data_transfer_get_dttypes_capacity(const int dtdata_types,
bool *r_advanced_mixing,
bool *r_threshold)
{
int i;
bool ret = false;
*r_advanced_mixing = false;
*r_threshold = false;
for (i = 0; (i < DT_TYPE_MAX) && !(ret && *r_advanced_mixing && *r_threshold); i++) {
for (int i = 0; (i < DT_TYPE_MAX) && !(ret && *r_advanced_mixing && *r_threshold); i++) {
const int dtdata_type = 1 << i;
if (!(dtdata_types & dtdata_type)) {
@@ -451,9 +450,7 @@ static void data_transfer_interp_char(const CustomDataTransferLayerMap *laymap,
float val_src = 0.0f;
const float val_dst = (float)(*data_dst) / 255.0f;
int i;
for (i = count; i--;) {
for (int i = count; i--;) {
val_src += ((float)(*data_src[i]) / 255.0f) * weights[i];
}
@@ -1254,7 +1251,6 @@ void BKE_object_data_transfer_layout(struct Depsgraph *depsgraph,
{
Mesh *me_src;
Mesh *me_dst;
int i;
const bool use_create = true; /* We always create needed layers here. */
@@ -1272,7 +1268,7 @@ void BKE_object_data_transfer_layout(struct Depsgraph *depsgraph,
}
/* Check all possible data types. */
for (i = 0; i < DT_TYPE_MAX; i++) {
for (int i = 0; i < DT_TYPE_MAX; i++) {
const int dtdata_type = 1 << i;
int cddata_type;
int fromlayers, tolayers, fromto_idx;
@@ -1410,7 +1406,6 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph,
Mesh *me_src;
/* Assumed always true if not using an evaluated mesh as destination. */
bool dirty_nors_dst = true;
int i;
MDeformVert *mdef = NULL;
int vg_idx = -1;
@@ -1478,7 +1473,7 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph,
/* Check all possible data types.
* Note item mappings and dest mix weights are cached. */
for (i = 0; i < DT_TYPE_MAX; i++) {
for (int i = 0; i < DT_TYPE_MAX; i++) {
const int dtdata_type = 1 << i;
int cddata_type;
int fromlayers, tolayers, fromto_idx;
@@ -1850,7 +1845,7 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph,
data_transfer_dtdata_type_postprocess(ob_src, ob_dst, me_src, me_dst, dtdata_type, changed);
}
for (i = 0; i < DATAMAX; i++) {
for (int i = 0; i < DATAMAX; i++) {
BKE_mesh_remap_free(&geom_map[i]);
MEM_SAFE_FREE(weights[i]);
}