Cleanup: Use bool instead of int, rename variable

The "useDeform" argument was only passed as 1 or 0, so even though
there was an odd "< 0" comparison, it can be passed as a boolean.
This commit is contained in:
2021-06-30 16:41:53 -05:00
parent 17a67bf778
commit 4f3ec01101

View File

@@ -973,7 +973,7 @@ static Mesh *modifier_modify_mesh_and_geometry_set(ModifierData *md,
static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
Scene *scene,
Object *ob,
int useDeform,
const bool use_deform,
const bool need_mapping,
const CustomData_MeshMasks *dataMask,
const int index,
@@ -1068,7 +1068,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
BKE_modifiers_clear_errors(ob);
/* Apply all leading deform modifiers. */
if (useDeform) {
if (use_deform) {
for (; md; md = md->next, md_datamask = md_datamask->next) {
const ModifierTypeInfo *mti = BKE_modifier_get_info((ModifierType)md->type);
@@ -1076,7 +1076,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
continue;
}
if (useDeform < 0 && mti->dependsOnTime && mti->dependsOnTime(md)) {
if (mti->dependsOnTime && mti->dependsOnTime(md)) {
continue;
}
@@ -1128,7 +1128,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
continue;
}
if (mti->type == eModifierTypeType_OnlyDeform && !useDeform) {
if (mti->type == eModifierTypeType_OnlyDeform && !use_deform) {
continue;
}
@@ -1173,7 +1173,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
continue;
}
if (useDeform < 0 && mti->dependsOnTime && mti->dependsOnTime(md)) {
if (use_deform < 0 && mti->dependsOnTime && mti->dependsOnTime(md)) {
continue;
}
@@ -2162,7 +2162,7 @@ Mesh *mesh_create_eval_final(Depsgraph *depsgraph,
Mesh *final;
mesh_calc_modifiers(
depsgraph, scene, ob, 1, false, dataMask, -1, false, false, nullptr, &final, nullptr);
depsgraph, scene, ob, true, false, dataMask, -1, false, false, nullptr, &final, nullptr);
return final;
}
@@ -2176,7 +2176,7 @@ Mesh *mesh_create_eval_final_index_render(Depsgraph *depsgraph,
Mesh *final;
mesh_calc_modifiers(
depsgraph, scene, ob, 1, false, dataMask, index, false, false, nullptr, &final, nullptr);
depsgraph, scene, ob, true, false, dataMask, index, false, false, nullptr, &final, nullptr);
return final;
}
@@ -2189,7 +2189,7 @@ Mesh *mesh_create_eval_no_deform(Depsgraph *depsgraph,
Mesh *final;
mesh_calc_modifiers(
depsgraph, scene, ob, 0, false, dataMask, -1, false, false, nullptr, &final, nullptr);
depsgraph, scene, ob, false, false, dataMask, -1, false, false, nullptr, &final, nullptr);
return final;
}
@@ -2202,7 +2202,7 @@ Mesh *mesh_create_eval_no_deform_render(Depsgraph *depsgraph,
Mesh *final;
mesh_calc_modifiers(
depsgraph, scene, ob, 0, false, dataMask, -1, false, false, nullptr, &final, nullptr);
depsgraph, scene, ob, false, false, dataMask, -1, false, false, nullptr, &final, nullptr);
return final;
}