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/intern/MOD_laplaciandeform.c')
-rw-r--r--source/blender/modifiers/intern/MOD_laplaciandeform.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c
index 8c297f11f7d..a484b4d8147 100644
--- a/source/blender/modifiers/intern/MOD_laplaciandeform.c
+++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c
@@ -31,6 +31,7 @@
#include "BLT_translation.h"
+#include "DNA_defaults.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_screen_types.h"
@@ -665,8 +666,7 @@ static void LaplacianDeformModifier_do(
sysdif = isSystemDifferent(lmd, ob, mesh, numVerts);
sys = lmd->cache_system;
if (sysdif) {
- if (sysdif == LAPDEFORM_SYSTEM_ONLY_CHANGE_ANCHORS ||
- sysdif == LAPDEFORM_SYSTEM_ONLY_CHANGE_GROUP) {
+ if (ELEM(sysdif, LAPDEFORM_SYSTEM_ONLY_CHANGE_ANCHORS, LAPDEFORM_SYSTEM_ONLY_CHANGE_GROUP)) {
filevertexCos = MEM_malloc_arrayN(numVerts, sizeof(float[3]), "TempModDeformCoordinates");
memcpy(filevertexCos, lmd->vertexco, sizeof(float[3]) * numVerts);
MEM_SAFE_FREE(lmd->vertexco);
@@ -683,14 +683,15 @@ static void LaplacianDeformModifier_do(
else {
if (sysdif == LAPDEFORM_SYSTEM_CHANGE_VERTEXES) {
BKE_modifier_set_error(
- &lmd->modifier, "Vertices changed from %d to %d", lmd->total_verts, numVerts);
+ ob, &lmd->modifier, "Vertices changed from %d to %d", lmd->total_verts, numVerts);
}
else if (sysdif == LAPDEFORM_SYSTEM_CHANGE_EDGES) {
BKE_modifier_set_error(
- &lmd->modifier, "Edges changed from %d to %d", sys->total_edges, mesh->totedge);
+ ob, &lmd->modifier, "Edges changed from %d to %d", sys->total_edges, mesh->totedge);
}
else if (sysdif == LAPDEFORM_SYSTEM_CHANGE_NOT_VALID_GROUP) {
- BKE_modifier_set_error(&lmd->modifier,
+ BKE_modifier_set_error(ob,
+ &lmd->modifier,
"Vertex group '%s' is not valid, or maybe empty",
sys->anchor_grp_name);
}
@@ -703,8 +704,10 @@ static void LaplacianDeformModifier_do(
}
else {
if (!isValidVertexGroup(lmd, ob, mesh)) {
- BKE_modifier_set_error(
- &lmd->modifier, "Vertex group '%s' is not valid, or maybe empty", lmd->anchor_grp_name);
+ BKE_modifier_set_error(ob,
+ &lmd->modifier,
+ "Vertex group '%s' is not valid, or maybe empty",
+ lmd->anchor_grp_name);
lmd->flag &= ~MOD_LAPLACIANDEFORM_BIND;
}
else if (lmd->total_verts > 0 && lmd->total_verts == numVerts) {
@@ -724,19 +727,17 @@ static void LaplacianDeformModifier_do(
}
}
if (sys && sys->is_matrix_computed && !sys->has_solution) {
- BKE_modifier_set_error(&lmd->modifier, "The system did not find a solution");
+ BKE_modifier_set_error(ob, &lmd->modifier, "The system did not find a solution");
}
}
static void initData(ModifierData *md)
{
LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md;
- lmd->anchor_grp_name[0] = '\0';
- lmd->total_verts = 0;
- lmd->repeat = 1;
- lmd->vertexco = NULL;
- lmd->cache_system = NULL;
- lmd->flag = 0;
+
+ BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(lmd, modifier));
+
+ MEMCPY_STRUCT_AFTER(lmd, DNA_struct_default_get(LaplacianDeformModifierData), modifier);
}
static void copyData(const ModifierData *md, ModifierData *target, const int flag)
@@ -875,8 +876,10 @@ ModifierTypeInfo modifierType_LaplacianDeform = {
/* name */ "LaplacianDeform",
/* structName */ "LaplacianDeformModifierData",
/* structSize */ sizeof(LaplacianDeformModifierData),
+ /* srna */ &RNA_LaplacianDeformModifier,
/* type */ eModifierTypeType_OnlyDeform,
/* flags */ eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_SupportsEditmode,
+ /* icon */ ICON_MOD_MESHDEFORM,
/* copyData */ copyData,
/* deformVerts */ deformVerts,
@@ -895,7 +898,6 @@ ModifierTypeInfo modifierType_LaplacianDeform = {
/* updateDepsgraph */ NULL,
/* dependsOnTime */ NULL,
/* dependsOnNormals */ NULL,
- /* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
/* foreachTexLink */ NULL,
/* freeRuntimeData */ NULL,