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:
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/MOD_modifiertypes.h5
-rw-r--r--source/blender/modifiers/intern/MOD_armature.c7
-rw-r--r--source/blender/modifiers/intern/MOD_array.c11
-rw-r--r--source/blender/modifiers/intern/MOD_boolean.c5
-rw-r--r--source/blender/modifiers/intern/MOD_cloth.c2
-rw-r--r--source/blender/modifiers/intern/MOD_curve.c7
-rw-r--r--source/blender/modifiers/intern/MOD_datatransfer.c52
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c5
-rw-r--r--source/blender/modifiers/intern/MOD_explode.c5
-rw-r--r--source/blender/modifiers/intern/MOD_hook.c118
-rw-r--r--source/blender/modifiers/intern/MOD_lattice.c7
-rw-r--r--source/blender/modifiers/intern/MOD_mask.cc13
-rw-r--r--source/blender/modifiers/intern/MOD_meshcache_mdd.c33
-rw-r--r--source/blender/modifiers/intern/MOD_meshcache_pc2.c31
-rw-r--r--source/blender/modifiers/intern/MOD_meshcache_util.h5
-rw-r--r--source/blender/modifiers/intern/MOD_meshsequencecache.c22
-rw-r--r--source/blender/modifiers/intern/MOD_normal_edit.c4
-rw-r--r--source/blender/modifiers/intern/MOD_ocean.c34
-rw-r--r--source/blender/modifiers/intern/MOD_particleinstance.c9
-rw-r--r--source/blender/modifiers/intern/MOD_screw.c4
-rw-r--r--source/blender/modifiers/intern/MOD_shrinkwrap.c2
-rw-r--r--source/blender/modifiers/intern/MOD_simulation.cc38
-rw-r--r--source/blender/modifiers/intern/MOD_skin.c19
-rw-r--r--source/blender/modifiers/intern/MOD_solidify_extrude.c10
-rw-r--r--source/blender/modifiers/intern/MOD_solidify_nonmanifold.c11
-rw-r--r--source/blender/modifiers/intern/MOD_solidify_util.h5
-rw-r--r--source/blender/modifiers/intern/MOD_surfacedeform.c9
-rw-r--r--source/blender/modifiers/intern/MOD_ui_common.c7
-rw-r--r--source/blender/modifiers/intern/MOD_ui_common.h5
-rw-r--r--source/blender/modifiers/intern/MOD_util.c7
-rw-r--r--source/blender/modifiers/intern/MOD_util.h4
-rw-r--r--source/blender/modifiers/intern/MOD_uvproject.c2
-rw-r--r--source/blender/modifiers/intern/MOD_uvwarp.c8
-rw-r--r--source/blender/modifiers/intern/MOD_warp.c7
-rw-r--r--source/blender/modifiers/intern/MOD_weighted_normal.c3
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.c4
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.h4
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgedit.c4
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgmix.c19
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgproximity.c2
-rw-r--r--source/blender/modifiers/intern/MOD_weld.c63
41 files changed, 352 insertions, 260 deletions
diff --git a/source/blender/modifiers/MOD_modifiertypes.h b/source/blender/modifiers/MOD_modifiertypes.h
index ba676bbe459..b011abf336d 100644
--- a/source/blender/modifiers/MOD_modifiertypes.h
+++ b/source/blender/modifiers/MOD_modifiertypes.h
@@ -18,8 +18,7 @@
* \ingroup modifiers
*/
-#ifndef __MOD_MODIFIERTYPES_H__
-#define __MOD_MODIFIERTYPES_H__
+#pragma once
#include "BKE_modifier.h"
@@ -94,5 +93,3 @@ void modifier_type_init(ModifierTypeInfo *types[]);
#ifdef __cplusplus
}
#endif
-
-#endif /* __MOD_MODIFIERTYPES_H__ */
diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c
index b62c03d1b03..e7f47a09d95 100644
--- a/source/blender/modifiers/intern/MOD_armature.c
+++ b/source/blender/modifiers/intern/MOD_armature.c
@@ -165,10 +165,15 @@ static void deformVerts(ModifierData *md,
static void deformVertsEM(ModifierData *md,
const ModifierEvalContext *ctx,
struct BMEditMesh *em,
- Mesh *UNUSED(mesh),
+ Mesh *mesh,
float (*vertexCos)[3],
int numVerts)
{
+ if (mesh != NULL) {
+ deformVerts(md, ctx, mesh, vertexCos, numVerts);
+ return;
+ }
+
ArmatureModifierData *amd = (ArmatureModifierData *)md;
MOD_previous_vcos_store(md, vertexCos); /* if next modifier needs original vertices */
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index 48d69f8e02c..1c98cec915e 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -139,12 +139,11 @@ static int svert_sum_cmp(const void *e1, const void *e2)
if (sv1->sum_co > sv2->sum_co) {
return 1;
}
- else if (sv1->sum_co < sv2->sum_co) {
+ if (sv1->sum_co < sv2->sum_co) {
return -1;
}
- else {
- return 0;
- }
+
+ return 0;
}
static void svert_from_mvert(SortVertsElem *sv,
@@ -826,10 +825,10 @@ static bool isDisabled(const struct Scene *UNUSED(scene),
if (amd->curve_ob && amd->curve_ob->type != OB_CURVE) {
return true;
}
- else if (amd->start_cap && amd->start_cap->type != OB_MESH) {
+ if (amd->start_cap && amd->start_cap->type != OB_MESH) {
return true;
}
- else if (amd->end_cap && amd->end_cap->type != OB_MESH) {
+ if (amd->end_cap && amd->end_cap->type != OB_MESH) {
return true;
}
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index 1d39aa786a5..08fd7fb229d 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -44,6 +44,7 @@
#include "BKE_lib_query.h"
#include "BKE_material.h"
#include "BKE_mesh.h"
+#include "BKE_mesh_wrapper.h"
#include "BKE_modifier.h"
#include "BKE_screen.h"
@@ -180,6 +181,10 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
if (mesh_other) {
Object *object = ctx->object;
+ /* XXX This is utterly non-optimal, we may go from a bmesh to a mesh back to a bmesh!
+ * But for 2.90 better not try to be smart here. */
+ BKE_mesh_wrapper_ensure_mdata(mesh_other);
+
/* when one of objects is empty (has got no faces) we could speed up
* calculation a bit returning one of objects' derived meshes (or empty one)
* Returning mesh is depended on modifiers operation (sergey) */
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c
index f3ee14e0206..0cd3430f009 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -121,7 +121,7 @@ static void deformVerts(ModifierData *md,
&mesh_src->vdata, CD_CLOTH_ORCO, CD_CALLOC, NULL, mesh_src->totvert);
}
- memcpy(layerorco, kb->data, sizeof(float) * 3 * numVerts);
+ memcpy(layerorco, kb->data, sizeof(float[3]) * numVerts);
}
}
diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c
index 760e4717b6d..42adf305ee9 100644
--- a/source/blender/modifiers/intern/MOD_curve.c
+++ b/source/blender/modifiers/intern/MOD_curve.c
@@ -150,10 +150,15 @@ static void deformVerts(ModifierData *md,
static void deformVertsEM(ModifierData *md,
const ModifierEvalContext *ctx,
BMEditMesh *em,
- Mesh *UNUSED(mesh),
+ Mesh *mesh,
float (*vertexCos)[3],
int numVerts)
{
+ if (mesh != NULL) {
+ deformVerts(md, ctx, mesh, vertexCos, numVerts);
+ return;
+ }
+
CurveModifierData *cmd = (CurveModifierData *)md;
bool use_dverts = false;
int defgrp_index = -1;
diff --git a/source/blender/modifiers/intern/MOD_datatransfer.c b/source/blender/modifiers/intern/MOD_datatransfer.c
index 0b205ec4fc5..c8f49694a2f 100644
--- a/source/blender/modifiers/intern/MOD_datatransfer.c
+++ b/source/blender/modifiers/intern/MOD_datatransfer.c
@@ -204,32 +204,36 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
BKE_reports_init(&reports, RPT_STORE);
/* Note: no islands precision for now here. */
- BKE_object_data_transfer_ex(ctx->depsgraph,
- scene,
- ob_source,
- ctx->object,
- result,
- dtmd->data_types,
- false,
- dtmd->vmap_mode,
- dtmd->emap_mode,
- dtmd->lmap_mode,
- dtmd->pmap_mode,
- space_transform,
- false,
- max_dist,
- dtmd->map_ray_radius,
- 0.0f,
- dtmd->layers_select_src,
- dtmd->layers_select_dst,
- dtmd->mix_mode,
- dtmd->mix_factor,
- dtmd->defgrp_name,
- invert_vgroup,
- &reports);
+ if (BKE_object_data_transfer_ex(ctx->depsgraph,
+ scene,
+ ob_source,
+ ctx->object,
+ result,
+ dtmd->data_types,
+ false,
+ dtmd->vmap_mode,
+ dtmd->emap_mode,
+ dtmd->lmap_mode,
+ dtmd->pmap_mode,
+ space_transform,
+ false,
+ max_dist,
+ dtmd->map_ray_radius,
+ 0.0f,
+ dtmd->layers_select_src,
+ dtmd->layers_select_dst,
+ dtmd->mix_mode,
+ dtmd->mix_factor,
+ dtmd->defgrp_name,
+ invert_vgroup,
+ &reports)) {
+ result->runtime.is_original = false;
+ }
if (BKE_reports_contain(&reports, RPT_ERROR)) {
- BKE_modifier_set_error(md, "%s", BKE_reports_string(&reports, RPT_ERROR));
+ const char *report_str = BKE_reports_string(&reports, RPT_ERROR);
+ BKE_modifier_set_error(md, "%s", report_str);
+ MEM_freeN((void *)report_str);
}
else if ((dtmd->data_types & DT_TYPE_LNOR) && !(me->flag & ME_AUTOSMOOTH)) {
BKE_modifier_set_error((ModifierData *)dtmd, "Enable 'Auto Smooth' in Object Data Properties");
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 9b9dd0a079c..191623112bb 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -103,9 +103,8 @@ static bool dependsOnTime(ModifierData *md)
if (dmd->texture) {
return BKE_texture_dependsOnTime(dmd->texture);
}
- else {
- return false;
- }
+
+ return false;
}
static bool dependsOnNormals(ModifierData *md)
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c
index 4e46e135b72..d520cccf0a2 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -1180,9 +1180,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
BKE_id_free(NULL, split_m);
return explode;
}
- else {
- return explodeMesh(emd, psmd, ctx, scene, mesh);
- }
+
+ return explodeMesh(emd, psmd, ctx, scene, mesh);
}
return mesh;
}
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index c8cfc07562f..86592245368 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -23,6 +23,7 @@
#include "BLI_utildefines.h"
+#include "BLI_bitmap.h"
#include "BLI_math.h"
#include "BLT_translation.h"
@@ -40,6 +41,7 @@
#include "BKE_lib_id.h"
#include "BKE_lib_query.h"
#include "BKE_mesh.h"
+#include "BKE_mesh_wrapper.h"
#include "BKE_modifier.h"
#include "BKE_screen.h"
@@ -139,7 +141,10 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
struct HookData_cb {
float (*vertexCos)[3];
- MDeformVert *dvert;
+ /**
+ * When anything other than -1, use deform groups.
+ * This is not the same as checking `dvert` for NULL when we have edit-meshes.
+ */
int defgrp_index;
struct CurveMapping *curfalloff;
@@ -160,13 +165,27 @@ struct HookData_cb {
bool invert_vgroup;
};
+static BLI_bitmap *hook_index_array_to_bitmap(HookModifierData *hmd, const int numVerts)
+{
+ BLI_bitmap *indexar_used = BLI_BITMAP_NEW(numVerts, __func__);
+ int i;
+ int *index_pt;
+ for (i = 0, index_pt = hmd->indexar; i < hmd->totindex; i++, index_pt++) {
+ const int j = *index_pt;
+ if (j < numVerts) {
+ BLI_BITMAP_ENABLE(indexar_used, i);
+ }
+ }
+ return indexar_used;
+}
+
static float hook_falloff(const struct HookData_cb *hd, const float len_sq)
{
BLI_assert(hd->falloff_sq);
if (len_sq > hd->falloff_sq) {
return 0.0f;
}
- else if (len_sq > 0.0f) {
+ if (len_sq > 0.0f) {
float fac;
if (hd->falloff_type == eHook_Falloff_Const) {
@@ -226,7 +245,7 @@ static float hook_falloff(const struct HookData_cb *hd, const float len_sq)
}
}
-static void hook_co_apply(struct HookData_cb *hd, const int j)
+static void hook_co_apply(struct HookData_cb *hd, int j, const MDeformVert *dv)
{
float *co = hd->vertexCos[j];
float fac;
@@ -250,9 +269,9 @@ static void hook_co_apply(struct HookData_cb *hd, const int j)
}
if (fac) {
- if (hd->dvert) {
- fac *= hd->invert_vgroup ? 1.0f - BKE_defvert_find_weight(&hd->dvert[j], hd->defgrp_index) :
- BKE_defvert_find_weight(&hd->dvert[j], hd->defgrp_index);
+ if (dv != NULL) {
+ fac *= hd->invert_vgroup ? 1.0f - BKE_defvert_find_weight(dv, hd->defgrp_index) :
+ BKE_defvert_find_weight(dv, hd->defgrp_index);
}
if (fac) {
@@ -267,6 +286,7 @@ static void deformVerts_do(HookModifierData *hmd,
const ModifierEvalContext *UNUSED(ctx),
Object *ob,
Mesh *mesh,
+ BMEditMesh *em,
float (*vertexCos)[3],
int numVerts)
{
@@ -274,6 +294,7 @@ static void deformVerts_do(HookModifierData *hmd,
bPoseChannel *pchan = BKE_pose_channel_find_name(ob_target->pose, hmd->subtarget);
float dmat[4][4];
int i, *index_pt;
+ MDeformVert *dvert;
struct HookData_cb hd;
const bool invert_vgroup = (hmd->flag & MOD_HOOK_INVERT_VGROUP) != 0;
@@ -283,12 +304,21 @@ static void deformVerts_do(HookModifierData *hmd,
}
if (hmd->curfalloff) {
- BKE_curvemapping_initialize(hmd->curfalloff);
+ BKE_curvemapping_init(hmd->curfalloff);
}
/* Generic data needed for applying per-vertex calculations (initialize all members) */
hd.vertexCos = vertexCos;
- MOD_get_vgroup(ob, mesh, hmd->name, &hd.dvert, &hd.defgrp_index);
+
+ MOD_get_vgroup(ob, mesh, hmd->name, &dvert, &hd.defgrp_index);
+ int cd_dvert_offset = -1;
+
+ if ((em != NULL) && (hd.defgrp_index != -1)) {
+ cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT);
+ if (cd_dvert_offset == -1) {
+ hd.defgrp_index = -1;
+ }
+ }
hd.curfalloff = hmd->curfalloff;
@@ -337,32 +367,62 @@ static void deformVerts_do(HookModifierData *hmd,
}
else if (hmd->indexar) { /* vertex indices? */
const int *origindex_ar;
-
/* if mesh is present and has original index data, use it */
if (mesh && (origindex_ar = CustomData_get_layer(&mesh->vdata, CD_ORIGINDEX))) {
- for (i = 0, index_pt = hmd->indexar; i < hmd->totindex; i++, index_pt++) {
- if (*index_pt < numVerts) {
- int j;
-
- for (j = 0; j < numVerts; j++) {
- if (origindex_ar[j] == *index_pt) {
- hook_co_apply(&hd, j);
- }
- }
+ int numVerts_orig = numVerts;
+ if (ob->type == OB_MESH) {
+ const Mesh *me_orig = ob->data;
+ numVerts_orig = me_orig->totvert;
+ }
+ BLI_bitmap *indexar_used = hook_index_array_to_bitmap(hmd, numVerts_orig);
+ for (i = 0; i < numVerts; i++) {
+ int i_orig = origindex_ar[i];
+ BLI_assert(i_orig < numVerts_orig);
+ if (BLI_BITMAP_TEST(indexar_used, i_orig)) {
+ hook_co_apply(&hd, i, dvert ? &dvert[i] : NULL);
}
}
+ MEM_freeN(indexar_used);
}
else { /* missing mesh or ORIGINDEX */
- for (i = 0, index_pt = hmd->indexar; i < hmd->totindex; i++, index_pt++) {
- if (*index_pt < numVerts) {
- hook_co_apply(&hd, *index_pt);
+ if ((em != NULL) && (hd.defgrp_index != -1)) {
+ BLI_assert(em->bm->totvert == numVerts);
+ BLI_bitmap *indexar_used = hook_index_array_to_bitmap(hmd, numVerts);
+ BMIter iter;
+ BMVert *v;
+ BM_ITER_MESH_INDEX (v, &iter, em->bm, BM_VERTS_OF_MESH, i) {
+ if (BLI_BITMAP_TEST(indexar_used, i)) {
+ const MDeformVert *dv = BM_ELEM_CD_GET_VOID_P(v, cd_dvert_offset);
+ hook_co_apply(&hd, i, dv);
+ }
+ }
+ MEM_freeN(indexar_used);
+ }
+ else {
+ for (i = 0, index_pt = hmd->indexar; i < hmd->totindex; i++, index_pt++) {
+ const int j = *index_pt;
+ if (j < numVerts) {
+ hook_co_apply(&hd, j, dvert ? &dvert[j] : NULL);
+ }
}
}
}
}
- else if (hd.dvert) { /* vertex group hook */
- for (i = 0; i < numVerts; i++) {
- hook_co_apply(&hd, i);
+ else if (hd.defgrp_index != -1) { /* vertex group hook */
+ if (em != NULL) {
+ BLI_assert(em->bm->totvert == numVerts);
+ BMIter iter;
+ BMVert *v;
+ BM_ITER_MESH_INDEX (v, &iter, em->bm, BM_VERTS_OF_MESH, i) {
+ const MDeformVert *dv = BM_ELEM_CD_GET_VOID_P(v, cd_dvert_offset);
+ hook_co_apply(&hd, i, dv);
+ }
+ }
+ else {
+ BLI_assert(dvert != NULL);
+ for (i = 0; i < numVerts; i++) {
+ hook_co_apply(&hd, i, &dvert[i]);
+ }
}
}
}
@@ -376,7 +436,7 @@ static void deformVerts(struct ModifierData *md,
HookModifierData *hmd = (HookModifierData *)md;
Mesh *mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false);
- deformVerts_do(hmd, ctx, ctx->object, mesh_src, vertexCos, numVerts);
+ deformVerts_do(hmd, ctx, ctx->object, mesh_src, NULL, vertexCos, numVerts);
if (!ELEM(mesh_src, NULL, mesh)) {
BKE_id_free(NULL, mesh_src);
@@ -391,14 +451,8 @@ static void deformVertsEM(struct ModifierData *md,
int numVerts)
{
HookModifierData *hmd = (HookModifierData *)md;
- Mesh *mesh_src = MOD_deform_mesh_eval_get(
- ctx->object, editData, mesh, NULL, numVerts, false, false);
-
- deformVerts_do(hmd, ctx, ctx->object, mesh_src, vertexCos, numVerts);
- if (!ELEM(mesh_src, NULL, mesh)) {
- BKE_id_free(NULL, mesh_src);
- }
+ deformVerts_do(hmd, ctx, ctx->object, mesh, mesh ? NULL : editData, vertexCos, numVerts);
}
static void panel_draw(const bContext *C, Panel *panel)
diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c
index b1a9258ec51..bf891c4938b 100644
--- a/source/blender/modifiers/intern/MOD_lattice.c
+++ b/source/blender/modifiers/intern/MOD_lattice.c
@@ -130,10 +130,15 @@ static void deformVerts(ModifierData *md,
static void deformVertsEM(ModifierData *md,
const ModifierEvalContext *ctx,
struct BMEditMesh *em,
- struct Mesh *UNUSED(mesh),
+ struct Mesh *mesh,
float (*vertexCos)[3],
int numVerts)
{
+ if (mesh != NULL) {
+ deformVerts(md, ctx, mesh, vertexCos, numVerts);
+ return;
+ }
+
LatticeModifierData *lmd = (LatticeModifierData *)md;
MOD_previous_vcos_store(md, vertexCos); /* if next modifier needs original vertices */
diff --git a/source/blender/modifiers/intern/MOD_mask.cc b/source/blender/modifiers/intern/MOD_mask.cc
index 93fb7749392..c173ab52ce8 100644
--- a/source/blender/modifiers/intern/MOD_mask.cc
+++ b/source/blender/modifiers/intern/MOD_mask.cc
@@ -44,12 +44,7 @@
#include "BKE_lib_query.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
-
-/* SpaceType struct has a member called 'new' which obviously conflicts with C++
- * so temporarily redefining the new keyword to make it compile. */
-#define new extern_new
#include "BKE_screen.h"
-#undef new
#include "UI_interface.h"
#include "UI_resources.h"
@@ -82,13 +77,13 @@ static void requiredDataMask(Object *UNUSED(ob),
static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, void *userData)
{
- MaskModifierData *mmd = (MaskModifierData *)md;
+ MaskModifierData *mmd = reinterpret_cast<MaskModifierData *>(md);
walk(userData, ob, &mmd->ob_arm, IDWALK_CB_NOP);
}
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
- MaskModifierData *mmd = (MaskModifierData *)md;
+ MaskModifierData *mmd = reinterpret_cast<MaskModifierData *>(md);
if (mmd->ob_arm) {
bArmature *arm = (bArmature *)mmd->ob_arm->data;
/* Tag relationship in depsgraph, but also on the armature. */
@@ -311,7 +306,7 @@ static void copy_masked_polys_to_new_mesh(const Mesh &src_mesh,
*/
static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
{
- MaskModifierData *mmd = (MaskModifierData *)md;
+ MaskModifierData *mmd = reinterpret_cast<MaskModifierData *>(md);
Object *ob = ctx->object;
const bool invert_mask = mmd->flag & MOD_MASK_INV;
@@ -393,7 +388,7 @@ static bool isDisabled(const struct Scene *UNUSED(scene),
ModifierData *md,
bool UNUSED(useRenderParams))
{
- MaskModifierData *mmd = (MaskModifierData *)md;
+ MaskModifierData *mmd = reinterpret_cast<MaskModifierData *>(md);
/* The object type check is only needed here in case we have a placeholder
* object assigned (because the library containing the armature is missing).
diff --git a/source/blender/modifiers/intern/MOD_meshcache_mdd.c b/source/blender/modifiers/intern/MOD_meshcache_mdd.c
index 60376f61708..cb150976ff5 100644
--- a/source/blender/modifiers/intern/MOD_meshcache_mdd.c
+++ b/source/blender/modifiers/intern/MOD_meshcache_mdd.c
@@ -160,7 +160,7 @@ bool MOD_meshcache_read_mdd_index(FILE *fp,
return false;
}
- if (BLI_fseek(fp, sizeof(float) * 3 * index * mdd_head.verts_tot, SEEK_CUR) != 0) {
+ if (BLI_fseek(fp, sizeof(float[3]) * index * mdd_head.verts_tot, SEEK_CUR) != 0) {
*err_str = "Failed to seek frame";
return false;
}
@@ -170,7 +170,7 @@ bool MOD_meshcache_read_mdd_index(FILE *fp,
float *vco = *vertexCos;
uint i;
for (i = mdd_head.verts_tot; i != 0; i--, vco += 3) {
- fread(vco, sizeof(float) * 3, 1, fp);
+ fread(vco, sizeof(float[3]), 1, fp);
# ifdef __LITTLE_ENDIAN__
BLI_endian_switch_float(vco + 0);
@@ -180,7 +180,7 @@ bool MOD_meshcache_read_mdd_index(FILE *fp,
}
#else
/* no blending */
- if (!fread(vertexCos, sizeof(float) * 3, mdd_head.verts_tot, f)) {
+ if (!fread(vertexCos, sizeof(float[3]), mdd_head.verts_tot, f)) {
*err_str = errno ? strerror(errno) : "Failed to read frame";
return false;
}
@@ -195,7 +195,7 @@ bool MOD_meshcache_read_mdd_index(FILE *fp,
uint i;
for (i = mdd_head.verts_tot; i != 0; i--, vco += 3) {
float tvec[3];
- fread(tvec, sizeof(float) * 3, 1, fp);
+ fread(tvec, sizeof(float[3]), 1, fp);
#ifdef __LITTLE_ENDIAN__
BLI_endian_switch_float(tvec + 0);
@@ -238,22 +238,19 @@ bool MOD_meshcache_read_mdd_frame(FILE *fp,
MOD_meshcache_read_mdd_index(fp, vertexCos, verts_tot, index_range[0], 1.0f, err_str)) {
return true;
}
- else {
- return false;
- }
+
+ return false;
}
- else {
- /* read both and interpolate */
- if ((BLI_fseek(fp, 0, SEEK_SET) == 0) &&
- MOD_meshcache_read_mdd_index(fp, vertexCos, verts_tot, index_range[0], 1.0f, err_str) &&
- (BLI_fseek(fp, 0, SEEK_SET) == 0) &&
- MOD_meshcache_read_mdd_index(fp, vertexCos, verts_tot, index_range[1], factor, err_str)) {
- return true;
- }
- else {
- return false;
- }
+
+ /* read both and interpolate */
+ if ((BLI_fseek(fp, 0, SEEK_SET) == 0) &&
+ MOD_meshcache_read_mdd_index(fp, vertexCos, verts_tot, index_range[0], 1.0f, err_str) &&
+ (BLI_fseek(fp, 0, SEEK_SET) == 0) &&
+ MOD_meshcache_read_mdd_index(fp, vertexCos, verts_tot, index_range[1], factor, err_str)) {
+ return true;
}
+
+ return false;
}
bool MOD_meshcache_read_mdd_times(const char *filepath,
diff --git a/source/blender/modifiers/intern/MOD_meshcache_pc2.c b/source/blender/modifiers/intern/MOD_meshcache_pc2.c
index 60011458c67..120d1d6d71a 100644
--- a/source/blender/modifiers/intern/MOD_meshcache_pc2.c
+++ b/source/blender/modifiers/intern/MOD_meshcache_pc2.c
@@ -146,7 +146,7 @@ bool MOD_meshcache_read_pc2_index(FILE *fp,
return false;
}
- if (BLI_fseek(fp, sizeof(float) * 3 * index * pc2_head.verts_tot, SEEK_CUR) != 0) {
+ if (BLI_fseek(fp, sizeof(float[3]) * index * pc2_head.verts_tot, SEEK_CUR) != 0) {
*err_str = "Failed to seek frame";
return false;
}
@@ -155,7 +155,7 @@ bool MOD_meshcache_read_pc2_index(FILE *fp,
float *vco = *vertexCos;
uint i;
for (i = pc2_head.verts_tot; i != 0; i--, vco += 3) {
- fread(vco, sizeof(float) * 3, 1, fp);
+ fread(vco, sizeof(float[3]), 1, fp);
#ifdef __BIG_ENDIAN__
BLI_endian_switch_float(vco + 0);
@@ -170,7 +170,7 @@ bool MOD_meshcache_read_pc2_index(FILE *fp,
uint i;
for (i = pc2_head.verts_tot; i != 0; i--, vco += 3) {
float tvec[3];
- fread(tvec, sizeof(float) * 3, 1, fp);
+ fread(tvec, sizeof(float[3]), 1, fp);
#ifdef __BIG_ENDIAN__
BLI_endian_switch_float(tvec + 0);
@@ -213,22 +213,19 @@ bool MOD_meshcache_read_pc2_frame(FILE *fp,
MOD_meshcache_read_pc2_index(fp, vertexCos, verts_tot, index_range[0], 1.0f, err_str)) {
return true;
}
- else {
- return false;
- }
+
+ return false;
}
- else {
- /* read both and interpolate */
- if ((BLI_fseek(fp, 0, SEEK_SET) == 0) &&
- MOD_meshcache_read_pc2_index(fp, vertexCos, verts_tot, index_range[0], 1.0f, err_str) &&
- (BLI_fseek(fp, 0, SEEK_SET) == 0) &&
- MOD_meshcache_read_pc2_index(fp, vertexCos, verts_tot, index_range[1], factor, err_str)) {
- return true;
- }
- else {
- return false;
- }
+
+ /* read both and interpolate */
+ if ((BLI_fseek(fp, 0, SEEK_SET) == 0) &&
+ MOD_meshcache_read_pc2_index(fp, vertexCos, verts_tot, index_range[0], 1.0f, err_str) &&
+ (BLI_fseek(fp, 0, SEEK_SET) == 0) &&
+ MOD_meshcache_read_pc2_index(fp, vertexCos, verts_tot, index_range[1], factor, err_str)) {
+ return true;
}
+
+ return false;
}
bool MOD_meshcache_read_pc2_times(const char *filepath,
diff --git a/source/blender/modifiers/intern/MOD_meshcache_util.h b/source/blender/modifiers/intern/MOD_meshcache_util.h
index 0a6c0e73632..74131099e3c 100644
--- a/source/blender/modifiers/intern/MOD_meshcache_util.h
+++ b/source/blender/modifiers/intern/MOD_meshcache_util.h
@@ -18,8 +18,7 @@
* \ingroup modifiers
*/
-#ifndef __MOD_MESHCACHE_UTIL_H__
-#define __MOD_MESHCACHE_UTIL_H__
+#pragma once
/* MOD_meshcache_mdd.c */
bool MOD_meshcache_read_mdd_index(FILE *fp,
@@ -73,5 +72,3 @@ void MOD_meshcache_calc_range(const float frame,
float *r_factor);
#define FRAME_SNAP_EPS 0.0001f
-
-#endif /* __MOD_MESHCACHE_UTIL_H__ */
diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c
index 8f6676dd0b2..5513e6b4971 100644
--- a/source/blender/modifiers/intern/MOD_meshsequencecache.c
+++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c
@@ -33,6 +33,8 @@
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
+#include "MEM_guardedalloc.h"
+
#include "BKE_cachefile.h"
#include "BKE_context.h"
#include "BKE_lib_query.h"
@@ -65,6 +67,9 @@ static void initData(ModifierData *md)
mcmd->cache_file = NULL;
mcmd->object_path[0] = '\0';
mcmd->read_flag = MOD_MESHSEQ_READ_ALL;
+ mcmd->velocity_scale = 1.0f;
+ mcmd->vertex_velocities = NULL;
+ mcmd->num_vertices = 0;
mcmd->reader = NULL;
mcmd->reader_object_path[0] = '\0';
@@ -91,6 +96,10 @@ static void freeData(ModifierData *md)
mcmd->reader_object_path[0] = '\0';
BKE_cachefile_reader_free(mcmd->cache_file, &mcmd->reader);
}
+
+ if (mcmd->vertex_velocities) {
+ MEM_freeN(mcmd->vertex_velocities);
+ }
}
static bool isDisabled(const struct Scene *UNUSED(scene),
@@ -154,6 +163,17 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
Mesh *result = ABC_read_mesh(mcmd->reader, ctx->object, mesh, time, &err_str, mcmd->read_flag);
+ mcmd->velocity_delta = 1.0f;
+ if (mcmd->cache_file->velocity_unit == CACHEFILE_VELOCITY_UNIT_SECOND) {
+ mcmd->velocity_delta /= FPS;
+ }
+
+ mcmd->last_lookup_time = time;
+
+ if (result != NULL) {
+ mcmd->num_vertices = result->totvert;
+ }
+
if (err_str) {
BKE_modifier_set_error(md, "%s", err_str);
}
@@ -221,6 +241,8 @@ static void panel_draw(const bContext *C, Panel *panel)
uiItemR(layout, &ptr, "read_data", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
}
+ uiItemR(layout, &ptr, "velocity_scale", 0, NULL, ICON_NONE);
+
modifier_panel_end(layout, &ptr);
}
diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c b/source/blender/modifiers/intern/MOD_normal_edit.c
index 7039b24cfc6..f22ece11726 100644
--- a/source/blender/modifiers/intern/MOD_normal_edit.c
+++ b/source/blender/modifiers/intern/MOD_normal_edit.c
@@ -472,7 +472,7 @@ static bool is_valid_target(NormalEditModifierData *enmd)
if (enmd->mode == MOD_NORMALEDIT_MODE_RADIAL) {
return true;
}
- else if ((enmd->mode == MOD_NORMALEDIT_MODE_DIRECTIONAL) && enmd->target) {
+ if ((enmd->mode == MOD_NORMALEDIT_MODE_DIRECTIONAL) && enmd->target) {
return true;
}
BKE_modifier_set_error((ModifierData *)enmd, "Invalid target settings");
@@ -637,6 +637,8 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd,
CustomData_free_layers(pdata, CD_NORMAL, num_polys);
MEM_SAFE_FREE(loopnors);
+ result->runtime.is_original = false;
+
return result;
}
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index 6374f081581..7b31886a220 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -59,7 +59,7 @@
#include "MOD_ui_common.h"
#ifdef WITH_OCEANSIM
-static void init_cache_data(Object *ob, struct OceanModifierData *omd)
+static void init_cache_data(Object *ob, struct OceanModifierData *omd, const int resolution)
{
const char *relbase = BKE_modifier_path_relbase_from_global(ob);
@@ -71,7 +71,7 @@ static void init_cache_data(Object *ob, struct OceanModifierData *omd)
omd->chop_amount,
omd->foam_coverage,
omd->foam_fade,
- omd->resolution);
+ resolution);
}
static void simulate_ocean_modifier(struct OceanModifierData *omd)
@@ -87,7 +87,11 @@ static void initData(ModifierData *md)
#ifdef WITH_OCEANSIM
OceanModifierData *omd = (OceanModifierData *)md;
+ /* Render resolution */
omd->resolution = 7;
+ /* Display resolution for the non-render case */
+ omd->viewport_resolution = 7;
+
omd->spatial_size = 50;
omd->wave_alignment = 0.0;
@@ -126,7 +130,7 @@ static void initData(ModifierData *md)
omd->spraylayername[0] = '\0'; /* layer name empty by default */
omd->ocean = BKE_ocean_add();
- BKE_ocean_init_from_modifier(omd->ocean, omd);
+ BKE_ocean_init_from_modifier(omd->ocean, omd, omd->viewport_resolution);
simulate_ocean_modifier(omd);
#else /* WITH_OCEANSIM */
/* unused */
@@ -164,7 +168,7 @@ static void copyData(const ModifierData *md, ModifierData *target, const int fla
tomd->oceancache = NULL;
tomd->ocean = BKE_ocean_add();
- BKE_ocean_init_from_modifier(tomd->ocean, tomd);
+ BKE_ocean_init_from_modifier(tomd->ocean, tomd, tomd->viewport_resolution);
simulate_ocean_modifier(tomd);
#else /* WITH_OCEANSIM */
/* unused */
@@ -288,7 +292,7 @@ static void generate_ocean_geometry_uvs(void *__restrict userdata,
}
}
-static Mesh *generate_ocean_geometry(OceanModifierData *omd, Mesh *mesh_orig)
+static Mesh *generate_ocean_geometry(OceanModifierData *omd, Mesh *mesh_orig, const int resolution)
{
Mesh *result;
@@ -297,10 +301,10 @@ static Mesh *generate_ocean_geometry(OceanModifierData *omd, Mesh *mesh_orig)
int num_verts;
int num_polys;
- const bool use_threading = omd->resolution > 4;
+ const bool use_threading = resolution > 4;
- gogd.rx = omd->resolution * omd->resolution;
- gogd.ry = omd->resolution * omd->resolution;
+ gogd.rx = resolution * resolution;
+ gogd.ry = resolution * resolution;
gogd.res_x = gogd.rx * omd->repeat_x;
gogd.res_y = gogd.ry * omd->repeat_y;
@@ -362,6 +366,9 @@ static Mesh *doOcean(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mes
Mesh *result = NULL;
OceanResult ocr;
+ const int resolution = (ctx->flag & MOD_APPLY_RENDER) ? omd->resolution :
+ omd->viewport_resolution;
+
MVert *mverts;
int cfra_for_cache;
@@ -383,7 +390,7 @@ static Mesh *doOcean(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mes
/* do ocean simulation */
if (omd->cached == true) {
if (!omd->oceancache) {
- init_cache_data(ob, omd);
+ init_cache_data(ob, omd, resolution);
}
BKE_ocean_simulate_cache(omd->oceancache, cfra_scene);
}
@@ -393,12 +400,12 @@ static Mesh *doOcean(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mes
* This function is only called on an original object when applying the modifier
* using the 'Apply Modifier' button, and thus it is not called frequently for
* simulation. */
- allocated_ocean |= BKE_ocean_ensure(omd);
+ allocated_ocean |= BKE_ocean_ensure(omd, resolution);
simulate_ocean_modifier(omd);
}
if (omd->geometry_mode == MOD_OCEAN_GEOM_GENERATE) {
- result = generate_ocean_geometry(omd, mesh);
+ result = generate_ocean_geometry(omd, mesh, resolution);
BKE_mesh_ensure_normals(result);
}
else if (omd->geometry_mode == MOD_OCEAN_GEOM_DISPLACE) {
@@ -558,7 +565,10 @@ static void panel_draw(const bContext *C, Panel *panel)
uiItemR(sub, &ptr, "repeat_x", 0, IFACE_("Repeat X"), ICON_NONE);
uiItemR(sub, &ptr, "repeat_y", 0, IFACE_("Y"), ICON_NONE);
}
- uiItemR(col, &ptr, "resolution", 0, NULL, ICON_NONE);
+
+ sub = uiLayoutColumn(col, true);
+ uiItemR(sub, &ptr, "viewport_resolution", 0, IFACE_("Resolution Viewport"), ICON_NONE);
+ uiItemR(sub, &ptr, "resolution", 0, IFACE_("Render"), ICON_NONE);
uiItemR(col, &ptr, "time", 0, NULL, ICON_NONE);
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c
index dd881f1ac74..d3d2f891929 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -198,12 +198,11 @@ static bool particle_skip(ParticleInstanceModifierData *pimd, ParticleSystem *ps
if (maxp > minp) {
return randp < minp || randp >= maxp;
}
- else if (maxp < minp) {
+ if (maxp < minp) {
return randp < minp && randp >= maxp;
}
- else {
- return true;
- }
+
+ return true;
return false;
}
@@ -443,7 +442,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
float angle = 2.0f * M_PI *
(pimd->rotation +
pimd->random_rotation * (psys_frand(psys, 19957323 + p) - 0.5f));
- float eul[3] = {0.0f, 0.0f, angle};
+ const float eul[3] = {0.0f, 0.0f, angle};
float rot[4];
eul_to_quat(rot, eul);
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index b9bb7add811..3bb7ecd43f4 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -301,7 +301,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
float totlen = len_v3(mtx_tx[3]);
if (totlen != 0.0f) {
- float zero[3] = {0.0f, 0.0f, 0.0f};
+ const float zero[3] = {0.0f, 0.0f, 0.0f};
float cp[3];
screw_ofs = closest_to_line_v3(cp, mtx_tx[3], zero, axis_vec);
}
@@ -412,7 +412,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
CustomData_copy_data(&mesh->vdata, &result->vdata, 0, 0, (int)totvert);
if (mloopuv_layers_tot) {
- float zero_co[3] = {0};
+ const float zero_co[3] = {0};
plane_from_point_normal_v3(uv_axis_plane, zero_co, axis_vec);
}
diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c
index a5f6be04a08..c40fbffc506 100644
--- a/source/blender/modifiers/intern/MOD_shrinkwrap.c
+++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c
@@ -96,7 +96,7 @@ static bool isDisabled(const struct Scene *UNUSED(scene),
if (!smd->target || smd->target->type != OB_MESH) {
return true;
}
- else if (smd->auxTarget && smd->auxTarget->type != OB_MESH) {
+ if (smd->auxTarget && smd->auxTarget->type != OB_MESH) {
return true;
}
return false;
diff --git a/source/blender/modifiers/intern/MOD_simulation.cc b/source/blender/modifiers/intern/MOD_simulation.cc
index 85d9b47a861..99cd582f37d 100644
--- a/source/blender/modifiers/intern/MOD_simulation.cc
+++ b/source/blender/modifiers/intern/MOD_simulation.cc
@@ -46,16 +46,11 @@
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_pointcloud.h"
+#include "BKE_screen.h"
#include "BKE_simulation.h"
#include "BLO_read_write.h"
-/* SpaceType struct has a member called 'new' which obviously conflicts with C++
- * so temporarily redefining the new keyword to make it compile. */
-#define new extern_new
-#include "BKE_screen.h"
-#undef new
-
#include "UI_interface.h"
#include "UI_resources.h"
@@ -71,7 +66,7 @@ using blender::float3;
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
- SimulationModifierData *smd = (SimulationModifierData *)md;
+ SimulationModifierData *smd = reinterpret_cast<SimulationModifierData *>(md);
if (smd->simulation) {
DEG_add_simulation_relation(ctx->node, smd->simulation, "Accessed Simulation");
}
@@ -79,7 +74,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData)
{
- SimulationModifierData *smd = (SimulationModifierData *)md;
+ SimulationModifierData *smd = reinterpret_cast<SimulationModifierData *>(md);
walk(userData, ob, (ID **)&smd->simulation, IDWALK_CB_USER);
}
@@ -87,21 +82,22 @@ static bool isDisabled(const struct Scene *UNUSED(scene),
ModifierData *md,
bool UNUSED(useRenderParams))
{
- SimulationModifierData *smd = (SimulationModifierData *)md;
+ SimulationModifierData *smd = reinterpret_cast<SimulationModifierData *>(md);
return smd->simulation == nullptr;
}
static const ParticleSimulationState *find_particle_state(SimulationModifierData *smd)
{
- return (const ParticleSimulationState *)BKE_simulation_state_try_find_by_name_and_type(
- smd->simulation, smd->data_path, SIM_TYPE_NAME_PARTICLE_SIMULATION);
+ return reinterpret_cast<const ParticleSimulationState *>(
+ BKE_simulation_state_try_find_by_name_and_type(
+ smd->simulation, smd->data_path, SIM_TYPE_NAME_PARTICLE_SIMULATION));
}
static PointCloud *modifyPointCloud(ModifierData *md,
const ModifierEvalContext *UNUSED(ctx),
PointCloud *input_pointcloud)
{
- SimulationModifierData *smd = (SimulationModifierData *)md;
+ SimulationModifierData *smd = reinterpret_cast<SimulationModifierData *>(md);
const ParticleSimulationState *state = find_particle_state(smd);
if (state == nullptr) {
return input_pointcloud;
@@ -112,12 +108,14 @@ static PointCloud *modifyPointCloud(ModifierData *md,
return pointcloud;
}
- const float3 *positions = (const float3 *)CustomData_get_layer_named(
- &state->attributes, CD_PROP_FLOAT3, "Position");
+ const float3 *positions = static_cast<const float3 *>(
+ CustomData_get_layer_named(&state->attributes, CD_PROP_FLOAT3, "Position"));
+ const float *radii = static_cast<const float *>(
+ CustomData_get_layer_named(&state->attributes, CD_PROP_FLOAT, "Radius"));
memcpy(pointcloud->co, positions, sizeof(float3) * state->tot_particles);
for (int i = 0; i < state->tot_particles; i++) {
- pointcloud->radius[i] = 0.03f;
+ pointcloud->radius[i] = radii[i];
}
return pointcloud;
@@ -147,20 +145,20 @@ static void panelRegister(ARegionType *region_type)
static void blendWrite(BlendWriter *writer, const ModifierData *md)
{
- const SimulationModifierData *smd = (const SimulationModifierData *)md;
+ const SimulationModifierData *smd = reinterpret_cast<const SimulationModifierData *>(md);
BLO_write_string(writer, smd->data_path);
}
static void blendRead(BlendDataReader *reader, ModifierData *md)
{
- SimulationModifierData *smd = (SimulationModifierData *)md;
+ SimulationModifierData *smd = reinterpret_cast<SimulationModifierData *>(md);
BLO_read_data_address(reader, &smd->data_path);
}
static void copyData(const ModifierData *md, ModifierData *target, const int flag)
{
- const SimulationModifierData *smd = (const SimulationModifierData *)md;
- SimulationModifierData *tsmd = (SimulationModifierData *)target;
+ const SimulationModifierData *smd = reinterpret_cast<const SimulationModifierData *>(md);
+ SimulationModifierData *tsmd = reinterpret_cast<SimulationModifierData *>(target);
BKE_modifier_copydata_generic(md, target, flag);
if (smd->data_path != nullptr) {
@@ -170,7 +168,7 @@ static void copyData(const ModifierData *md, ModifierData *target, const int fla
static void freeData(ModifierData *md)
{
- SimulationModifierData *smd = (SimulationModifierData *)md;
+ SimulationModifierData *smd = reinterpret_cast<SimulationModifierData *>(md);
if (smd->data_path) {
MEM_freeN(smd->data_path);
}
diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c
index 8f0174fe6d9..797d9e9e251 100644
--- a/source/blender/modifiers/intern/MOD_skin.c
+++ b/source/blender/modifiers/intern/MOD_skin.c
@@ -222,9 +222,8 @@ static bool skin_frame_find_contained_faces(const Frame *frame, BMFace *fill_fac
if (diag) {
return BM_edge_face_pair(diag, &fill_faces[0], &fill_faces[1]);
}
- else {
- return false;
- }
+
+ return false;
}
/* Returns true if hull is successfully built, false otherwise */
@@ -460,7 +459,7 @@ static void node_frames_init(SkinNode *nf, int totframe)
}
static void create_frame(
- Frame *frame, const float co[3], const float radius[2], float mat[3][3], float offset)
+ Frame *frame, const float co[3], const float radius[2], const float mat[3][3], float offset)
{
float rx[3], ry[3], rz[3];
int i;
@@ -773,6 +772,11 @@ static EMat *build_edge_mats(const MVertSkin *vs,
*has_valid_root = true;
}
+ else if (totedge == 0) {
+ /* Vertex-only mesh is valid, mark valid root as well (will display error otherwise). */
+ *has_valid_root = true;
+ break;
+ }
}
}
@@ -814,9 +818,8 @@ static int calc_edge_subdivisions(const MVert *mvert,
if (v1_branch && v2_branch) {
return 2;
}
- else {
- return 0;
- }
+
+ return 0;
}
avg_radius = half_v2(evs[0]->radius) + half_v2(evs[1]->radius);
@@ -1278,7 +1281,7 @@ static void skin_choose_quad_bridge_order(BMVert *a[4], BMVert *b[4], int best_o
if (len < shortest_len) {
shortest_len = len;
- memcpy(best_order, orders[i], sizeof(int) * 4);
+ memcpy(best_order, orders[i], sizeof(int[4]));
}
}
}
diff --git a/source/blender/modifiers/intern/MOD_solidify_extrude.c b/source/blender/modifiers/intern/MOD_solidify_extrude.c
index 7e5e4ecd9d3..818327e120b 100644
--- a/source/blender/modifiers/intern/MOD_solidify_extrude.c
+++ b/source/blender/modifiers/intern/MOD_solidify_extrude.c
@@ -182,7 +182,7 @@ static void mesh_calc_hq_normal(Mesh *mesh, float (*poly_nors)[3], float (*r_ver
/* -------------------------------------------------------------------- */
/** \name Main Solidify Function
* \{ */
-
+/* NOLINTNEXTLINE: readability-function-size */
Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
{
Mesh *result;
@@ -355,7 +355,7 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex
}
if (smd->flag & MOD_SOLIDIFY_NORMAL_CALC) {
- vert_nors = MEM_calloc_arrayN(numVerts, 3 * sizeof(float), "mod_solid_vno_hq");
+ vert_nors = MEM_calloc_arrayN(numVerts, sizeof(float[3]), "mod_solid_vno_hq");
mesh_calc_hq_normal(mesh, poly_nors, vert_nors);
}
@@ -726,13 +726,13 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex
#endif
/* same as EM_solidify() in editmesh_lib.c */
float *vert_angles = MEM_calloc_arrayN(
- numVerts, 2 * sizeof(float), "mod_solid_pair"); /* 2 in 1 */
+ numVerts, sizeof(float[2]), "mod_solid_pair"); /* 2 in 1 */
float *vert_accum = vert_angles + numVerts;
uint vidx;
uint i;
if (vert_nors == NULL) {
- vert_nors = MEM_malloc_arrayN(numVerts, 3 * sizeof(float), "mod_solid_vno");
+ vert_nors = MEM_malloc_arrayN(numVerts, sizeof(float[3]), "mod_solid_vno");
for (i = 0, mv = mvert; i < numVerts; i++, mv++) {
normal_short_to_float_v3(vert_nors[i], mv->no);
}
@@ -1044,7 +1044,7 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex
const bool do_side_normals = !(result->runtime.cd_dirty_vert & CD_MASK_NORMAL);
/* annoying to allocate these since we only need the edge verts, */
float(*edge_vert_nos)[3] = do_side_normals ?
- MEM_calloc_arrayN(numVerts, 3 * sizeof(float), __func__) :
+ MEM_calloc_arrayN(numVerts, sizeof(float[3]), __func__) :
NULL;
float nor[3];
#endif
diff --git a/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c b/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c
index 423a6b4458a..1e0269617ec 100644
--- a/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c
+++ b/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c
@@ -132,6 +132,7 @@ static int comp_float_int_pair(const void *a, const void *b)
return (int)(x->angle > y->angle) - (int)(x->angle < y->angle);
}
+/* NOLINTNEXTLINE: readability-function-size */
Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
const ModifierEvalContext *ctx,
Mesh *mesh)
@@ -479,12 +480,12 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
old_edge_vert_ref->edges_len++;
break;
}
- else if (vm[orig_medge[edge].v1] == vs[1 - j]) {
+ if (vm[orig_medge[edge].v1] == vs[1 - j]) {
invalid_edge_index = edge + 1;
invalid_edge_reversed = (j == 0);
break;
}
- else if (vm[orig_medge[edge].v2] == vs[1 - j]) {
+ if (vm[orig_medge[edge].v2] == vs[1 - j]) {
invalid_edge_index = edge + 1;
invalid_edge_reversed = (j == 1);
break;
@@ -936,7 +937,7 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
}
break;
}
- else if (edge->faces[0] == eg_track_faces[0]) {
+ if (edge->faces[0] == eg_track_faces[0]) {
insert_at_start = true;
eg_track_faces[0] = edge->faces[1];
found_edge = edge;
@@ -945,14 +946,14 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
}
break;
}
- else if (edge->faces[1] != NULL) {
+ if (edge->faces[1] != NULL) {
if (edge->faces[1] == eg_track_faces[1]) {
insert_at_start = false;
eg_track_faces[1] = edge->faces[0];
found_edge = edge;
break;
}
- else if (edge->faces[1] == eg_track_faces[0]) {
+ if (edge->faces[1] == eg_track_faces[0]) {
insert_at_start = true;
eg_track_faces[0] = edge->faces[0];
found_edge = edge;
diff --git a/source/blender/modifiers/intern/MOD_solidify_util.h b/source/blender/modifiers/intern/MOD_solidify_util.h
index 6ab4734c451..e9f0709f7ea 100644
--- a/source/blender/modifiers/intern/MOD_solidify_util.h
+++ b/source/blender/modifiers/intern/MOD_solidify_util.h
@@ -18,8 +18,7 @@
* \ingroup modifiers
*/
-#ifndef __MOD_SOLIDIFY_UTIL_H__
-#define __MOD_SOLIDIFY_UTIL_H__
+#pragma once
/* MOD_solidify_extrude.c */
Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md,
@@ -30,5 +29,3 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md,
Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
const ModifierEvalContext *ctx,
Mesh *mesh);
-
-#endif /* __MOD_SOLIDIFY_UTIL_H__ */
diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c
index 6a0e82a686b..962e93be215 100644
--- a/source/blender/modifiers/intern/MOD_surfacedeform.c
+++ b/source/blender/modifiers/intern/MOD_surfacedeform.c
@@ -372,9 +372,8 @@ BLI_INLINE uint nearestVert(SDefBindCalcData *const data, const float point_co[3
len_squared_v3v3(point_co, data->targetCos[edge->v2])) {
return edge->v1;
}
- else {
- return edge->v2;
- }
+
+ return edge->v2;
}
BLI_INLINE int isPolyValid(const float coords[][2], const uint nr)
@@ -450,7 +449,7 @@ BLI_INLINE SDefBindWeightData *computeBindWeights(SDefBindCalcData *const data,
SDefBindWeightData *bwdata;
SDefBindPoly *bpoly;
- float world[3] = {0.0f, 0.0f, 1.0f};
+ const float world[3] = {0.0f, 0.0f, 1.0f};
float avg_point_dist = 0.0f;
float tot_weight = 0.0f;
int inf_weight_flags = 0;
@@ -1283,7 +1282,7 @@ static void surfacedeformModifier_do(ModifierData *md,
BKE_modifier_set_error(md, "Vertices changed from %u to %u", smd->numverts, numverts);
return;
}
- else if (smd->numpoly != tnumpoly) {
+ if (smd->numpoly != tnumpoly) {
BKE_modifier_set_error(md, "Target polygons changed from %u to %u", smd->numpoly, tnumpoly);
return;
}
diff --git a/source/blender/modifiers/intern/MOD_ui_common.c b/source/blender/modifiers/intern/MOD_ui_common.c
index 01b9e972086..8de4b042eb3 100644
--- a/source/blender/modifiers/intern/MOD_ui_common.c
+++ b/source/blender/modifiers/intern/MOD_ui_common.c
@@ -179,12 +179,11 @@ static int modifier_is_simulation(ModifierData *md)
return 1;
}
/* Particle Tab */
- else if (md->type == eModifierType_ParticleSystem) {
+ if (md->type == eModifierType_ParticleSystem) {
return 2;
}
- else {
- return 0;
- }
+
+ return 0;
}
static bool modifier_can_delete(ModifierData *md)
diff --git a/source/blender/modifiers/intern/MOD_ui_common.h b/source/blender/modifiers/intern/MOD_ui_common.h
index 59c0fe1c413..cac8806a2bf 100644
--- a/source/blender/modifiers/intern/MOD_ui_common.h
+++ b/source/blender/modifiers/intern/MOD_ui_common.h
@@ -18,8 +18,7 @@
* \ingroup modifiers
*/
-#ifndef __MOD_UI_COMMON_H__
-#define __MOD_UI_COMMON_H__
+#pragma once
/* so modifier types match their defines */
#include "MOD_modifiertypes.h"
@@ -66,5 +65,3 @@ struct PanelType *modifier_subpanel_register(struct ARegionType *region_type,
#ifdef __cplusplus
}
#endif
-
-#endif /* __MOD_UI_COMMON_H__ */
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c
index c6dff375109..179996d5acf 100644
--- a/source/blender/modifiers/intern/MOD_util.c
+++ b/source/blender/modifiers/intern/MOD_util.c
@@ -143,10 +143,9 @@ void MOD_get_texture_coords(MappingInfoModifierData *dmd,
MEM_freeN(done);
return;
}
- else {
- /* if there are no UVs, default to local */
- texmapping = MOD_DISP_MAP_LOCAL;
- }
+
+ /* if there are no UVs, default to local */
+ texmapping = MOD_DISP_MAP_LOCAL;
}
MVert *mv = mesh->mvert;
diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h
index a05e25d204c..05a24b92242 100644
--- a/source/blender/modifiers/intern/MOD_util.h
+++ b/source/blender/modifiers/intern/MOD_util.h
@@ -18,8 +18,7 @@
* \ingroup modifiers
*/
-#ifndef __MOD_UTIL_H__
-#define __MOD_UTIL_H__
+#pragma once
/* so modifier types match their defines */
#include "MOD_modifiertypes.h"
@@ -60,4 +59,3 @@ void MOD_depsgraph_update_object_bone_relation(struct DepsNodeHandle *node,
struct Object *object,
const char *bonename,
const char *description);
-#endif /* __MOD_UTIL_H__ */
diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c
index 6f261f9f67a..361c778bb95 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.c
+++ b/source/blender/modifiers/intern/MOD_uvproject.c
@@ -308,6 +308,8 @@ static Mesh *uvprojectModifier_do(UVProjectModifierData *umd,
}
}
+ mesh->runtime.is_original = false;
+
/* Mark tessellated CD layers as dirty. */
mesh->runtime.cd_dirty_vert |= CD_MASK_TESSLOOPNORMAL;
diff --git a/source/blender/modifiers/intern/MOD_uvwarp.c b/source/blender/modifiers/intern/MOD_uvwarp.c
index 4aca3c28ed8..05224e1ffaa 100644
--- a/source/blender/modifiers/intern/MOD_uvwarp.c
+++ b/source/blender/modifiers/intern/MOD_uvwarp.c
@@ -49,7 +49,9 @@
#include "MOD_ui_common.h"
#include "MOD_util.h"
-static void uv_warp_from_mat4_pair(float uv_dst[2], const float uv_src[2], float warp_mat[4][4])
+static void uv_warp_from_mat4_pair(float uv_dst[2],
+ const float uv_src[2],
+ const float warp_mat[4][4])
{
float tuv[3] = {0.0f};
@@ -185,7 +187,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
mul_m4_m4m4(warp_mat, mat_cent, warp_mat);
}
- int shuf_indices[4] = {axis_u, axis_v, -1, 3};
+ const int shuf_indices[4] = {axis_u, axis_v, -1, 3};
shuffle_m4(shuf_mat, shuf_indices);
mul_m4_m4m4(warp_mat, shuf_mat, warp_mat);
transpose_m4(shuf_mat);
@@ -233,6 +235,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
/* XXX TODO is this still needed? */
// me_eval->dirty |= DM_DIRTY_TESS_CDLAYERS;
+ mesh->runtime.is_original = false;
+
return mesh;
}
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c
index cbe774e91da..45252fed031 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -123,9 +123,8 @@ static bool dependsOnTime(ModifierData *md)
if (wmd->texture) {
return BKE_texture_dependsOnTime(wmd->texture);
}
- else {
- return false;
- }
+
+ return false;
}
static void freeData(ModifierData *md)
@@ -236,7 +235,7 @@ static void warpModifier_do(WarpModifierData *wmd,
}
if (wmd->curfalloff) {
- BKE_curvemapping_initialize(wmd->curfalloff);
+ BKE_curvemapping_init(wmd->curfalloff);
}
invert_m4_m4(obinv, ob->obmat);
diff --git a/source/blender/modifiers/intern/MOD_weighted_normal.c b/source/blender/modifiers/intern/MOD_weighted_normal.c
index f174b6d5aa4..744bab02c56 100644
--- a/source/blender/modifiers/intern/MOD_weighted_normal.c
+++ b/source/blender/modifiers/intern/MOD_weighted_normal.c
@@ -677,6 +677,9 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
/* Currently Modifier stack assumes there is no poly normal data passed around... */
CustomData_free_layers(pdata, CD_NORMAL, numPolys);
+
+ result->runtime.is_original = false;
+
return result;
}
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index 54d3aa46344..4ee1f9f669a 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -83,7 +83,7 @@ void weightvg_do_map(
}
if (cmap && falloff_type == MOD_WVG_MAPPING_CURVE) {
- BKE_curvemapping_initialize(cmap);
+ BKE_curvemapping_init(cmap);
}
/* Map each weight (vertex) to its new value, accordingly to the chosen mode. */
@@ -382,4 +382,4 @@ void weightvg_ui_common(const bContext *C, PointerRNA *ob_ptr, PointerRNA *ptr,
}
}
}
-} \ No newline at end of file
+}
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.h b/source/blender/modifiers/intern/MOD_weightvg_util.h
index 725574dc0a5..c00acd27d38 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.h
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.h
@@ -21,8 +21,7 @@
* \ingroup modifiers
*/
-#ifndef __MOD_WEIGHTVG_UTIL_H__
-#define __MOD_WEIGHTVG_UTIL_H__
+#pragma once
struct CurveMapping;
struct MDeformVert;
@@ -92,4 +91,3 @@ void weightvg_update_vg(struct MDeformVert *dvert,
const bool do_normalize);
void weightvg_ui_common(const bContext *C, PointerRNA *ob_ptr, PointerRNA *ptr, uiLayout *layout);
-#endif /* __MOD_WEIGHTVG_UTIL_H__ */
diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c
index 8039856172a..4f67fd88d4e 100644
--- a/source/blender/modifiers/intern/MOD_weightvgedit.c
+++ b/source/blender/modifiers/intern/MOD_weightvgedit.c
@@ -72,7 +72,7 @@ static void initData(ModifierData *md)
wmd->default_weight = 0.0f;
wmd->cmap_curve = BKE_curvemapping_add(1, 0.0, 0.0, 1.0, 1.0);
- BKE_curvemapping_initialize(wmd->cmap_curve);
+ BKE_curvemapping_init(wmd->cmap_curve);
wmd->rem_threshold = 0.01f;
wmd->add_threshold = 0.01f;
@@ -312,6 +312,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
MEM_freeN(new_w);
MEM_freeN(dw);
+ mesh->runtime.is_original = false;
+
/* Return the vgroup-modified mesh. */
return mesh;
}
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c
index d1c618df68b..649481a7023 100644
--- a/source/blender/modifiers/intern/MOD_weightvgmix.c
+++ b/source/blender/modifiers/intern/MOD_weightvgmix.c
@@ -95,16 +95,16 @@ static float mix_weight(float weight, float weight2, char mix_mode)
if (mix_mode == MOD_WVG_MIX_SET) {
return weight2;
}
- else if (mix_mode == MOD_WVG_MIX_ADD) {
+ if (mix_mode == MOD_WVG_MIX_ADD) {
return (weight + weight2);
}
- else if (mix_mode == MOD_WVG_MIX_SUB) {
+ if (mix_mode == MOD_WVG_MIX_SUB) {
return (weight - weight2);
}
- else if (mix_mode == MOD_WVG_MIX_MUL) {
+ if (mix_mode == MOD_WVG_MIX_MUL) {
return (weight * weight2);
}
- else if (mix_mode == MOD_WVG_MIX_DIV) {
+ if (mix_mode == MOD_WVG_MIX_DIV) {
/* Avoid dividing by zero (or really small values). */
if (weight2 < 0.0f && weight2 > -MOD_WVG_ZEROFLOOR) {
weight2 = -MOD_WVG_ZEROFLOOR;
@@ -114,15 +114,14 @@ static float mix_weight(float weight, float weight2, char mix_mode)
}
return (weight / weight2);
}
- else if (mix_mode == MOD_WVG_MIX_DIF) {
+ if (mix_mode == MOD_WVG_MIX_DIF) {
return (weight < weight2 ? weight2 - weight : weight - weight2);
}
- else if (mix_mode == MOD_WVG_MIX_AVG) {
+ if (mix_mode == MOD_WVG_MIX_AVG) {
return (weight + weight2) * 0.5f;
}
- else {
- return weight2;
- }
+
+ return weight2;
}
/**************************************
@@ -456,6 +455,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
MEM_freeN(dw2);
MEM_SAFE_FREE(indices);
+ mesh->runtime.is_original = false;
+
/* Return the vgroup-modified mesh. */
return mesh;
}
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index 0668a7a086f..b23eb997f61 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -637,6 +637,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
TIMEIT_END(perf);
#endif
+ mesh->runtime.is_original = false;
+
/* Return the vgroup-modified mesh. */
return mesh;
}
diff --git a/source/blender/modifiers/intern/MOD_weld.c b/source/blender/modifiers/intern/MOD_weld.c
index cf92da1b0e6..a89209f5dbb 100644
--- a/source/blender/modifiers/intern/MOD_weld.c
+++ b/source/blender/modifiers/intern/MOD_weld.c
@@ -1850,23 +1850,22 @@ static Mesh *weldModifier_doWeld(WeldModifierData *wmd, const ModifierEvalContex
&iter, wp, weld_mesh.wloop, mloop, weld_mesh.loop_map, group_buffer)) {
continue;
}
- else {
- if (wp->poly_dst != OUT_OF_CONTEXT) {
- continue;
- }
- while (weld_iter_loop_of_poly_next(&iter)) {
- customdata_weld(&mesh->ldata, &result->ldata, group_buffer, iter.group_len, loop_cur);
- uint v = vert_final[iter.v];
- uint e = edge_final[iter.e];
- r_ml->v = v;
- r_ml->e = e;
- r_ml++;
- loop_cur++;
- if (iter.type) {
- result->medge[e].flag &= ~ME_LOOSEEDGE;
- }
- BLI_assert((result->medge[e].flag & ME_LOOSEEDGE) == 0);
+
+ if (wp->poly_dst != OUT_OF_CONTEXT) {
+ continue;
+ }
+ while (weld_iter_loop_of_poly_next(&iter)) {
+ customdata_weld(&mesh->ldata, &result->ldata, group_buffer, iter.group_len, loop_cur);
+ uint v = vert_final[iter.v];
+ uint e = edge_final[iter.e];
+ r_ml->v = v;
+ r_ml->e = e;
+ r_ml++;
+ loop_cur++;
+ if (iter.type) {
+ result->medge[e].flag &= ~ME_LOOSEEDGE;
}
+ BLI_assert((result->medge[e].flag & ME_LOOSEEDGE) == 0);
}
}
@@ -1885,24 +1884,24 @@ static Mesh *weldModifier_doWeld(WeldModifierData *wmd, const ModifierEvalContex
&iter, wp, weld_mesh.wloop, mloop, weld_mesh.loop_map, group_buffer)) {
continue;
}
- else {
- if (wp->poly_dst != OUT_OF_CONTEXT) {
- continue;
- }
- while (weld_iter_loop_of_poly_next(&iter)) {
- customdata_weld(&mesh->ldata, &result->ldata, group_buffer, iter.group_len, loop_cur);
- uint v = vert_final[iter.v];
- uint e = edge_final[iter.e];
- r_ml->v = v;
- r_ml->e = e;
- r_ml++;
- loop_cur++;
- if (iter.type) {
- result->medge[e].flag &= ~ME_LOOSEEDGE;
- }
- BLI_assert((result->medge[e].flag & ME_LOOSEEDGE) == 0);
+
+ if (wp->poly_dst != OUT_OF_CONTEXT) {
+ continue;
+ }
+ while (weld_iter_loop_of_poly_next(&iter)) {
+ customdata_weld(&mesh->ldata, &result->ldata, group_buffer, iter.group_len, loop_cur);
+ uint v = vert_final[iter.v];
+ uint e = edge_final[iter.e];
+ r_ml->v = v;
+ r_ml->e = e;
+ r_ml++;
+ loop_cur++;
+ if (iter.type) {
+ result->medge[e].flag &= ~ME_LOOSEEDGE;
}
+ BLI_assert((result->medge[e].flag & ME_LOOSEEDGE) == 0);
}
+
r_mp->loopstart = loop_start;
r_mp->totloop = loop_cur - loop_start;
r_mp++;