Commit: bf38981ba3a7946cab0e8eef93053cc17c02223c
Author: Campbell Barton
Date: Mon Mar 30 07:32:33 2015 +1100
Branches: temp-modifier-deltamush-experimental
https://developer.blender.org/rBbf38981ba3a7946cab0e8eef93053cc17c02223c
rename boundverts -> positions_num
===================================================================
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/writefile.c
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/modifiers/intern/MOD_deltamush.c
===================================================================
diff --git a/source/blender/blenloader/intern/readfile.c
b/source/blender/blenloader/intern/readfile.c
index 2f00727..124a0ca 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4955,13 +4955,13 @@ static void direct_link_modifiers(FileData *fd,
ListBase *lb)
if (dmmd->deltas) {
dmmd->deltas = newdataadr(fd, dmmd->deltas);
if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
- BLI_endian_switch_float_array((float
*)dmmd->deltas, dmmd->boundverts * 3);
+ BLI_endian_switch_float_array((float
*)dmmd->deltas, dmmd->positions_num * 3);
}
}
if (dmmd->positions) {
dmmd->positions = newdataadr(fd,
dmmd->positions);
if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
- BLI_endian_switch_float_array((float
*)dmmd->positions, dmmd->boundverts * 3);
+ BLI_endian_switch_float_array((float
*)dmmd->positions, dmmd->positions_num * 3);
}
}
}
diff --git a/source/blender/blenloader/intern/writefile.c
b/source/blender/blenloader/intern/writefile.c
index e30cc9b..f188d93 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1624,10 +1624,10 @@ static void write_modifiers(WriteData *wd, ListBase
*modbase)
DeltaMushModifierData *dmmd =
(DeltaMushModifierData*)md;
if (dmmd->deltas) {
- writedata(wd, DATA, sizeof(float[3]) *
dmmd->boundverts, dmmd->deltas);
+ writedata(wd, DATA, sizeof(float[3]) *
dmmd->positions_num, dmmd->deltas);
}
if (dmmd->positions) {
- writedata(wd, DATA, sizeof(float[3]) *
dmmd->boundverts, dmmd->positions);
+ writedata(wd, DATA, sizeof(float[3]) *
dmmd->positions_num, dmmd->positions);
}
}
}
diff --git a/source/blender/makesdna/DNA_modifier_types.h
b/source/blender/makesdna/DNA_modifier_types.h
index ce0857d..7cbf23f 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1298,7 +1298,7 @@ typedef struct DeltaMushModifierData {
char defgrp_name[64]; /* MAX_VGROUP_NAME */
short repeat, flag;
- unsigned int boundverts, pad;
+ unsigned int positions_num, pad;
} DeltaMushModifierData;
/* Delta Mush modifier flags */
diff --git a/source/blender/modifiers/intern/MOD_deltamush.c
b/source/blender/modifiers/intern/MOD_deltamush.c
index e5277d8..ab04118 100644
--- a/source/blender/modifiers/intern/MOD_deltamush.c
+++ b/source/blender/modifiers/intern/MOD_deltamush.c
@@ -74,9 +74,9 @@ static void initData(ModifierData *md)
DeltaMushModifierData *dmmd = (DeltaMushModifierData *)md;
dmmd->flag = MOD_DELTAMUSH_PIN_BOUNDARY;
- dmmd->boundverts = 0;
dmmd->deltas = NULL;
dmmd->positions = NULL;
+ dmmd->positions_num = 0;
dmmd->lambda = 0.5f;
dmmd->repeat = 5;
dmmd->defgrp_name[0] = '\0';
@@ -112,7 +112,7 @@ static void freeBind(DeltaMushModifierData * dmmd)
dmmd->positions = NULL;
}
- dmmd->boundverts = 0;
+ dmmd->positions_num = 0;
}
@@ -609,7 +609,7 @@ static void calc_deltas(
unsigned int i;
tangent_spaces = MEM_callocN((size_t)(numVerts) * sizeof(float[3][3]),
"delta mush tangents");
- dmmd->boundverts = numVerts;
+ dmmd->positions_num = numVerts;
/* allocate deltas if they have not yet been allocated, otheriwse we
will just write over them */
if (!dmmd->deltas) {
dmmd->deltas = MEM_mallocN((size_t)numVerts * sizeof(float[3]),
"delta mush deltas");
@@ -656,18 +656,19 @@ static void deltamushmodifier_do(
return;
}
- /* if rest positions not are defined, set them */
+ /* if rest positions not are defined, set them (only run during bind) */
if (!dmmd->positions) {
dmmd->positions = MEM_dupallocN(vertexCos);
- dmmd->boundverts = numVerts;
+ dmmd->positions_num = numVerts;
if (!dmmd->positions) {
return;
}
}
/* If the number of verts has changed, the bind is invalid, so we do
nothing */
- if (dmmd->boundverts != numVerts) {
- modifier_setError(md, "Verts changed from %d to %d",
dmmd->boundverts, numVerts);
+ if (dmmd->positions_num != numVerts) {
+ modifier_setError(md, "Verts changed from %d to %d",
dmmd->positions_num, numVerts);
+ MEM_SAFE_FREE(dmmd->deltas);
return;
}
@@ -677,7 +678,7 @@ static void deltamushmodifier_do(
}
/* this could be a check, but at this point it _must_ be valid */
- BLI_assert(dmmd->boundverts == numVerts && dmmd->deltas);
+ BLI_assert(dmmd->positions_num == numVerts && dmmd->deltas);
#ifdef DEBUG_TIME
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs