diff options
author | Joseph Eagar <joeedh@gmail.com> | 2011-04-15 05:19:13 +0400 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2011-04-15 05:19:13 +0400 |
commit | c98148a963d37fc2f25e125afeb4cf21df6fbf14 (patch) | |
tree | 691a051e27f08e35bf09d35b6fb9c88e4c37b8d2 /source/blender/modifiers/intern | |
parent | 0bba684d08952d0be822f3906ffb2a03b2674cc2 (diff) | |
parent | fa63c297753636c149fbb1a3877d9b3d93601357 (diff) |
=bmesh= merge from trunk at r36153
Diffstat (limited to 'source/blender/modifiers/intern')
34 files changed, 603 insertions, 401 deletions
diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index 097438cf5a2..27b10f7cbe4 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -194,15 +194,15 @@ ModifierTypeInfo modifierType_Armature = { /* deformMatrices */ deformMatrices, /* deformVertsEM */ deformVertsEM, /* deformMatricesEM */ deformMatricesEM, - /* applyModifier */ 0, - /* applyModifierEM */ 0, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, - /* freeData */ 0, + /* freeData */ NULL, /* isDisabled */ isDisabled, /* updateDepgraph */ updateDepgraph, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, - /* foreachIDLink */ 0, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 51fbfc54840..54b3d12ad01 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -548,19 +548,19 @@ ModifierTypeInfo modifierType_Array = { | eModifierTypeFlag_AcceptsCVs, /* copyData */ copyData, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, /* applyModifierEM */ applyModifierEM, /* initData */ initData, - /* requiredDataMask */ 0, - /* freeData */ 0, - /* isDisabled */ 0, + /* requiredDataMask */ NULL, + /* freeData */ NULL, + /* isDisabled */ NULL, /* updateDepgraph */ updateDepgraph, - /* dependsOnTime */ 0, - /* dependsOnNormal */ 0, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, - /* foreachIDLink */ 0, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 8d34fdcb10e..b952e92de4e 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -137,19 +137,19 @@ ModifierTypeInfo modifierType_Bevel = { | eModifierTypeFlag_EnableInEditmode, /* copyData */ copyData, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, /* applyModifierEM */ applyModifierEM, /* initData */ initData, /* requiredDataMask */ requiredDataMask, - /* freeData */ 0, - /* isDisabled */ 0, - /* updateDepgraph */ 0, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, + /* freeData */ NULL, + /* isDisabled */ NULL, + /* updateDepgraph */ NULL, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index d4be9d3d03a..ec6387f44af 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -34,6 +34,7 @@ * \ingroup modifiers */ +#include <stdio.h> #include "DNA_object_types.h" @@ -144,19 +145,19 @@ ModifierTypeInfo modifierType_Boolean = { | eModifierTypeFlag_UsesPointCache, /* copyData */ copyData, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, - /* applyModifierEM */ 0, - /* initData */ 0, + /* applyModifierEM */ NULL, + /* initData */ NULL, /* requiredDataMask */ requiredDataMask, - /* freeData */ 0, + /* freeData */ NULL, /* isDisabled */ isDisabled, /* updateDepgraph */ updateDepgraph, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, - /* foreachIDLink */ 0, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index e2a54648623..b2817aa11ea 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -114,7 +114,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } else { frac = BKE_curframe(md->scene) - bmd->start / bmd->length; } - CLAMP(frac, 0.0, 1.0); + CLAMP(frac, 0.0f, 1.0f); numFaces = dm->getNumTessFaces(dm) * frac; numEdges = dm->getNumEdges(dm) * frac; diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index 68e9e173ee6..5cb352ef482 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -427,9 +427,9 @@ static void cuboid_do( } if (has_radius) { - if (fabs(tmp_co[0]) > cmd->radius || - fabs(tmp_co[1]) > cmd->radius || - fabs(tmp_co[2]) > cmd->radius) continue; + if (fabsf(tmp_co[0]) > cmd->radius || + fabsf(tmp_co[1]) > cmd->radius || + fabsf(tmp_co[2]) > cmd->radius) continue; } for (j = 0; j < dvert[i].totweight; ++j) { @@ -479,7 +479,7 @@ static void cuboid_do( /* ok, now we know which coordinate of the vertex to use */ - if (fabs(tmp_co[coord]) < FLT_EPSILON) /* avoid division by zero */ + if (fabsf(tmp_co[coord]) < FLT_EPSILON) /* avoid division by zero */ continue; /* finally, this is the factor we wanted, to project the vertex @@ -523,9 +523,9 @@ static void cuboid_do( } if (has_radius) { - if (fabs(tmp_co[0]) > cmd->radius || - fabs(tmp_co[1]) > cmd->radius || - fabs(tmp_co[2]) > cmd->radius) continue; + if (fabsf(tmp_co[0]) > cmd->radius || + fabsf(tmp_co[1]) > cmd->radius || + fabsf(tmp_co[2]) > cmd->radius) continue; } octant = 0; @@ -550,7 +550,7 @@ static void cuboid_do( coord = 2; } - if (fabs(tmp_co[coord]) < FLT_EPSILON) + if (fabsf(tmp_co[coord]) < FLT_EPSILON) continue; fbb = apex[coord] / tmp_co[coord]; @@ -624,18 +624,18 @@ ModifierTypeInfo modifierType_Cast = { /* copyData */ copyData, /* deformVerts */ deformVerts, - /* deformMatrices */ 0, + /* deformMatrices */ NULL, /* deformVertsEM */ deformVertsEM, - /* deformMatricesEM */ 0, - /* applyModifier */ 0, - /* applyModifierEM */ 0, + /* deformMatricesEM */ NULL, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, - /* freeData */ 0, + /* freeData */ NULL, /* isDisabled */ isDisabled, /* updateDepgraph */ updateDepgraph, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, - /* foreachIDLink */ 0, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 999349dca7f..30ddb3f7b9c 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -201,19 +201,19 @@ ModifierTypeInfo modifierType_Cloth = { | eModifierTypeFlag_Single, /* copyData */ copyData, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, - /* applyModifierEM */ 0, + /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, /* freeData */ freeData, - /* isDisabled */ 0, + /* isDisabled */ NULL, /* updateDepgraph */ updateDepgraph, /* dependsOnTime */ dependsOnTime, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 07b35cdf334..315361ff227 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -64,7 +64,7 @@ static void initData(ModifierData *md) collmd->current_x = NULL; collmd->current_xnew = NULL; collmd->current_v = NULL; - collmd->time = -1000; + collmd->time_x = collmd->time_xnew = -1000; collmd->numverts = 0; collmd->bvhtree = NULL; } @@ -95,7 +95,7 @@ static void freeData(ModifierData *md) collmd->current_x = NULL; collmd->current_xnew = NULL; collmd->current_v = NULL; - collmd->time = -1000; + collmd->time_x = collmd->time_xnew = -1000; collmd->numverts = 0; collmd->bvhtree = NULL; collmd->mfaces = NULL; @@ -139,11 +139,11 @@ static void deformVerts(ModifierData *md, Object *ob, current_time = BKE_curframe(md->scene); if(G.rt > 0) - printf("current_time %f, collmd->time %f\n", current_time, collmd->time); + printf("current_time %f, collmd->time_xnew %f\n", current_time, collmd->time_xnew); numverts = dm->getNumVerts ( dm ); - if((current_time > collmd->time)|| (BKE_ptcache_get_continue_physics())) + if((current_time > collmd->time_xnew)|| (BKE_ptcache_get_continue_physics())) { unsigned int i; @@ -151,7 +151,7 @@ static void deformVerts(ModifierData *md, Object *ob, if(collmd->x && (numverts != collmd->numverts)) freeData((ModifierData *)collmd); - if(collmd->time == -1000) // first time + if(collmd->time_xnew == -1000) // first time { collmd->x = dm->dupVertArray(dm); // frame start position @@ -174,7 +174,7 @@ static void deformVerts(ModifierData *md, Object *ob, // create bounding box hierarchy collmd->bvhtree = bvhtree_build_from_mvert(collmd->mfaces, collmd->numfaces, collmd->x, numverts, ob->pd->pdef_sboft); - collmd->time = current_time; + collmd->time_x = collmd->time_xnew = current_time; } else if(numverts == collmd->numverts) { @@ -182,6 +182,7 @@ static void deformVerts(ModifierData *md, Object *ob, tempVert = collmd->x; collmd->x = collmd->xnew; collmd->xnew = tempVert; + collmd->time_x = collmd->time_xnew; memcpy(collmd->xnew, dm->getVertArray(dm), numverts*sizeof(MVert)); @@ -216,7 +217,7 @@ static void deformVerts(ModifierData *md, Object *ob, bvhtree_update_from_mvert ( collmd->bvhtree, collmd->mfaces, collmd->numfaces, collmd->current_x, collmd->current_xnew, collmd->numverts, 1 ); } - collmd->time = current_time; + collmd->time_xnew = current_time; } else if(numverts != collmd->numverts) { @@ -224,7 +225,7 @@ static void deformVerts(ModifierData *md, Object *ob, } } - else if(current_time < collmd->time) + else if(current_time < collmd->time_xnew) { freeData((ModifierData *)collmd); } @@ -250,20 +251,20 @@ ModifierTypeInfo modifierType_Collision = { /* flags */ eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_Single, - /* copyData */ 0, + /* copyData */ NULL, /* deformVerts */ deformVerts, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, - /* applyModifier */ 0, - /* applyModifierEM */ 0, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, /* initData */ initData, - /* requiredDataMask */ 0, + /* requiredDataMask */ NULL, /* freeData */ freeData, - /* isDisabled */ 0, - /* updateDepgraph */ 0, + /* isDisabled */ NULL, + /* updateDepgraph */ NULL, /* dependsOnTime */ dependsOnTime, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index 8b8273aab62..da793287520 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -148,18 +148,18 @@ ModifierTypeInfo modifierType_Curve = { /* copyData */ copyData, /* deformVerts */ deformVerts, - /* deformMatrices */ 0, + /* deformMatrices */ NULL, /* deformVertsEM */ deformVertsEM, - /* deformMatricesEM */ 0, - /* applyModifier */ 0, - /* applyModifierEM */ 0, + /* deformMatricesEM */ NULL, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, - /* freeData */ 0, + /* freeData */ NULL, /* isDisabled */ isDisabled, /* updateDepgraph */ updateDepgraph, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, - /* foreachIDLink */ 0, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index 4eae988f92f..22c43d5e46a 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -208,19 +208,19 @@ ModifierTypeInfo modifierType_Decimate = { /* type */ eModifierTypeType_Nonconstructive, /* flags */ eModifierTypeFlag_AcceptsMesh, /* copyData */ copyData, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, - /* applyModifierEM */ 0, + /* applyModifierEM */ NULL, /* initData */ initData, - /* requiredDataMask */ 0, - /* freeData */ 0, - /* isDisabled */ 0, - /* updateDepgraph */ 0, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, + /* requiredDataMask */ NULL, + /* freeData */ NULL, + /* isDisabled */ NULL, + /* updateDepgraph */ NULL, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 6ae5c14d5ef..3ac615d2fc7 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -362,14 +362,14 @@ ModifierTypeInfo modifierType_Displace = { /* copyData */ copyData, /* deformVerts */ deformVerts, - /* deformMatrices */ 0, + /* deformMatrices */ NULL, /* deformVertsEM */ deformVertsEM, - /* deformMatricesEM */ 0, - /* applyModifier */ 0, - /* applyModifierEM */ 0, + /* deformMatricesEM */ NULL, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, - /* freeData */ 0, + /* freeData */ NULL, /* isDisabled */ isDisabled, /* updateDepgraph */ updateDepgraph, /* dependsOnTime */ dependsOnTime, diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index bbb314cc085..c98905a8be1 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -323,10 +323,189 @@ DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd) vu = etags[ml->e].v1user; vu2 = etags[ml->e].v2user; +<<<<<<< .working if (vu) medge[ml->e].v1 = vu->v; if (vu2) medge[ml->e].v2 = vu2->v; +======= +/* finds another sharp edge which uses vert, by traversing faces around the + * vert until it does one of the following: + * - hits a loose edge (the edge is returned) + * - hits a sharp edge (the edge is returned) + * - returns to the start edge (NULL is returned) + */ +static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge, LinkNode **visited_faces) +{ + SmoothFace *face = NULL; + SmoothEdge *edge2 = NULL; + /* holds the edges we've seen so we can avoid looping indefinitely */ + LinkNode *visited_edges = NULL; +#ifdef EDGESPLIT_DEBUG_1 + printf("=== START === find_other_sharp_edge(edge = %4d, vert = %4d)\n", + edge->newIndex, vert->newIndex); +#endif + + /* get a face on which to start */ + if(edge->faces) face = edge->faces->link; + else return NULL; + + /* record this edge as visited */ + BLI_linklist_prepend(&visited_edges, edge); + + /* get the next edge */ + edge2 = other_edge(face, vert, edge); + + /* record this face as visited */ + if(visited_faces) + BLI_linklist_prepend(visited_faces, face); + + /* search until we hit a loose edge or a sharp edge or an edge we've + * seen before + */ + while(face && !edge_is_sharp(edge2) + && !linklist_contains(visited_edges, edge2)) { +#ifdef EDGESPLIT_DEBUG_3 + printf("current face %4d; current edge %4d\n", face->newIndex, + edge2->newIndex); +#endif + /* get the next face */ + face = other_face(edge2, face); + + /* if face == NULL, edge2 is a loose edge */ + if(face) { + /* record this face as visited */ + if(visited_faces) + BLI_linklist_prepend(visited_faces, face); + + /* record this edge as visited */ + BLI_linklist_prepend(&visited_edges, edge2); + + /* get the next edge */ + edge2 = other_edge(face, vert, edge2); +#ifdef EDGESPLIT_DEBUG_3 + printf("next face %4d; next edge %4d\n", + face->newIndex, edge2->newIndex); + } else { + printf("loose edge: %4d\n", edge2->newIndex); +#endif + } + } + + /* either we came back to the start edge or we found a sharp/loose edge */ + if(linklist_contains(visited_edges, edge2)) + /* we came back to the start edge */ + edge2 = NULL; + + BLI_linklist_free(visited_edges, NULL); + +#ifdef EDGESPLIT_DEBUG_1 + printf("=== END === find_other_sharp_edge(edge = %4d, vert = %4d), " + "returning edge %d\n", + edge->newIndex, vert->newIndex, edge2 ? edge2->newIndex : -1); +#endif + return edge2; +} + +static void split_single_vert(SmoothVert *vert, SmoothFace *face, + SmoothMesh *mesh) +{ + SmoothVert *copy_vert; + ReplaceData repdata; + + copy_vert = smoothvert_copy(vert, mesh); + + if(copy_vert == NULL) { + /* bug [#26316], this prevents a segfault + * but this still needs fixing */ + return; + } + + repdata.find = vert; + repdata.replace = copy_vert; + face_replace_vert(face, &repdata); +} + +typedef struct PropagateEdge { + struct PropagateEdge *next, *prev; + SmoothEdge *edge; + SmoothVert *vert; +} PropagateEdge; + +static void push_propagate_stack(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh) +{ + PropagateEdge *pedge = mesh->reusestack.first; + + if(pedge) { + BLI_remlink(&mesh->reusestack, pedge); + } + else { + if(!mesh->arena) { + mesh->arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "edgesplit arena"); + BLI_memarena_use_calloc(mesh->arena); + } + + pedge = BLI_memarena_alloc(mesh->arena, sizeof(PropagateEdge)); + } + + pedge->edge = edge; + pedge->vert = vert; + BLI_addhead(&mesh->propagatestack, pedge); +} + +static void pop_propagate_stack(SmoothEdge **edge, SmoothVert **vert, SmoothMesh *mesh) +{ + PropagateEdge *pedge = mesh->propagatestack.first; + + if(pedge) { + *edge = pedge->edge; + *vert = pedge->vert; + BLI_remlink(&mesh->propagatestack, pedge); + BLI_addhead(&mesh->reusestack, pedge); + } + else { + *edge = NULL; + *vert = NULL; + } +} + +static void split_edge(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh); + +static void propagate_split(SmoothEdge *edge, SmoothVert *vert, + SmoothMesh *mesh) +{ + SmoothEdge *edge2; + LinkNode *visited_faces = NULL; +#ifdef EDGESPLIT_DEBUG_1 + printf("=== START === propagate_split(edge = %4d, vert = %4d)\n", + edge->newIndex, vert->newIndex); +#endif + + edge2 = find_other_sharp_edge(vert, edge, &visited_faces); + + if(!edge2) { + /* didn't find a sharp or loose edge, so we've hit a dead end */ + } else if(!edge_is_loose(edge2)) { + /* edge2 is not loose, so it must be sharp */ + if(edge_is_loose(edge)) { + /* edge is loose, so we can split edge2 at this vert */ + split_edge(edge2, vert, mesh); + } else if(edge_is_sharp(edge)) { + /* both edges are sharp, so we can split the pair at vert */ + split_edge(edge, vert, mesh); + } else { + /* edge is not sharp, so try to split edge2 at its other vert */ + split_edge(edge2, other_vert(edge2, vert), mesh); + } + } else { /* edge2 is loose */ + if(edge_is_loose(edge)) { + SmoothVert *vert2; + ReplaceData repdata; + + /* can't split edge, what should we do with vert? */ + if(linklist_subset(vert->faces, visited_faces)) { + /* vert has only one fan of faces attached; don't split it */ +>>>>>>> .merge-right.r36153 } else { etags[ml->e].used = 1; @@ -384,7 +563,6 @@ DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd) return cddm; } - static void initData(ModifierData *md) { EdgeSplitModifierData *emd = (EdgeSplitModifierData*) md; @@ -447,19 +625,19 @@ ModifierTypeInfo modifierType_EdgeSplit = { | eModifierTypeFlag_EnableInEditmode, /* copyData */ copyData, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, /* applyModifierEM */ applyModifierEM, /* initData */ initData, - /* requiredDataMask */ 0, - /* freeData */ 0, - /* isDisabled */ 0, - /* updateDepgraph */ 0, - /* dependsOnTime */ 0, - /* dependsOnNormal */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, + /* requiredDataMask */ NULL, + /* freeData */ NULL, + /* isDisabled */ NULL, + /* updateDepgraph */ NULL, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 04687958efd..f448331d37f 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -62,7 +62,7 @@ static void initData(ModifierData *md) { ExplodeModifierData *emd= (ExplodeModifierData*) md; - emd->facepa=0; + emd->facepa= NULL; emd->flag |= eExplodeFlag_Unborn+eExplodeFlag_Alive+eExplodeFlag_Dead; } static void freeData(ModifierData *md) @@ -76,7 +76,7 @@ static void copyData(ModifierData *md, ModifierData *target) ExplodeModifierData *emd= (ExplodeModifierData*) md; ExplodeModifierData *temd= (ExplodeModifierData*) target; - temd->facepa = 0; + temd->facepa = NULL; temd->flag = emd->flag; temd->protect = emd->protect; temd->vgroup = emd->vgroup; @@ -101,12 +101,12 @@ static void createFacepa(ExplodeModifierData *emd, DerivedMesh *dm) { ParticleSystem *psys=psmd->psys; - MFace *fa=0, *mface=0; - MVert *mvert = 0; + MFace *fa=NULL, *mface=NULL; + MVert *mvert = NULL; ParticleData *pa; KDTree *tree; float center[3], co[3]; - int *facepa=0,*vertpa=0,totvert=0,totface=0,totpart=0; + int *facepa=NULL,*vertpa=NULL,totvert=0,totface=0,totpart=0; int i,p,v1,v2,v3,v4=0; mvert = dm->getVertArray(dm); @@ -148,7 +148,7 @@ static void createFacepa(ExplodeModifierData *emd, /* make tree of emitter locations */ tree=BLI_kdtree_new(totpart); for(p=0,pa=psys->particles; p<totpart; p++,pa++){ - psys_particle_on_dm(psmd->dm,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,0,0,0,0,0); + psys_particle_on_emitter(psmd,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,NULL,NULL,NULL,NULL,NULL); BLI_kdtree_insert(tree, p, co, NULL); } BLI_kdtree_balance(tree); @@ -191,14 +191,14 @@ static int edgecut_get(EdgeHash *edgehash, int v1, int v2) } -const short add_faces[24] = { +static const short add_faces[24] = { 0, 0, 0, 2, 0, 1, 2, 2, 0, 2, 1, 2, 2, 2, 2, 3, 0, 0, 0, 1, 0, 1, 1, 2 }; -MFace *get_dface(DerivedMesh *dm, DerivedMesh *split, int cur, int i, MFace *mf) +static MFace *get_dface(DerivedMesh *dm, DerivedMesh *split, int cur, int i, MFace *mf) { MFace *df = CDDM_get_tessface(split, cur); DM_copy_face_data(dm, split, i, cur, 1); @@ -518,14 +518,13 @@ static void remap_faces_23(DerivedMesh *dm, DerivedMesh *split, MFace *mf, int * static void remap_uvs_23(DerivedMesh *dm, DerivedMesh *split, int numlayer, int i, int cur, int c0, int c1, int c2) { - MTFace *mf, *df1, *df2, *df3; + MTFace *mf, *df1, *df2; int l; for(l=0; l<numlayer; l++) { mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l); df1 = mf+cur; df2 = df1 + 1; - df3 = df1 + 2; mf = CustomData_get_layer_n(&dm->faceData, CD_MTFACE, l); mf += i; @@ -779,14 +778,14 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, DerivedMesh *to_explode) { DerivedMesh *explode, *dm=to_explode; - MFace *mf=0, *mface; + MFace *mf= NULL, *mface; ParticleSettings *part=psmd->psys->part; - ParticleSimulationData sim= {0}; + ParticleSimulationData sim= {NULL}; ParticleData *pa=NULL, *pars=psmd->psys->particles; ParticleKey state; EdgeHash *vertpahash; EdgeHashIterator *ehi; - float *vertco=0, imat[4][4]; + float *vertco= NULL, imat[4][4]; float loc0[3], nor[3]; float cfra; /* float timestep; */ @@ -873,7 +872,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, pa= pars+i; /* get particle state */ - psys_particle_on_emitter(psmd,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc0,nor,0,0,0,0); + psys_particle_on_emitter(psmd,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc0,nor,NULL,NULL,NULL,NULL); mul_m4_v3(ob->obmat,loc0); state.time=cfra; @@ -967,7 +966,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, static ParticleSystemModifierData * findPrecedingParticlesystem(Object *ob, ModifierData *emd) { ModifierData *md; - ParticleSystemModifierData *psmd=0; + ParticleSystemModifierData *psmd= NULL; for (md=ob->modifiers.first; emd!=md; md=md->next){ if(md->type==eModifierType_ParticleSystem) @@ -987,12 +986,12 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob, if(psmd){ ParticleSystem * psys=psmd->psys; - if(psys==0 || psys->totpart==0) return derivedData; - if(psys->part==0 || psys->particles==0) return derivedData; - if(psmd->dm==0) return derivedData; + if(psys==NULL || psys->totpart==0) return derivedData; + if(psys->part==NULL || psys->particles==NULL) return derivedData; + if(psmd->dm==NULL) return derivedData; /* 1. find faces to be exploded if needed */ - if(emd->facepa==0 + if(emd->facepa == NULL || psmd->flag&eParticleSystemFlag_Pars || emd->flag&eExplodeFlag_CalcFaces || MEM_allocN_len(emd->facepa)/sizeof(int) != dm->getNumTessFaces(dm)) @@ -1030,19 +1029,19 @@ ModifierTypeInfo modifierType_Explode = { /* type */ eModifierTypeType_Nonconstructive, /* flags */ eModifierTypeFlag_AcceptsMesh, /* copyData */ copyData, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, - /* applyModifierEM */ 0, + /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, /* freeData */ freeData, - /* isDisabled */ 0, - /* updateDepgraph */ 0, + /* isDisabled */ NULL, + /* updateDepgraph */ NULL, /* dependsOnTime */ dependsOnTime, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c index 1cce9863ccc..354dc33ffe0 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim.c +++ b/source/blender/modifiers/intern/MOD_fluidsim.c @@ -147,19 +147,19 @@ ModifierTypeInfo modifierType_Fluidsim = { | eModifierTypeFlag_Single, /* copyData */ copyData, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, - /* applyModifierEM */ 0, + /* applyModifierEM */ NULL, /* initData */ initData, - /* requiredDataMask */ 0, + /* requiredDataMask */ NULL, /* freeData */ freeData, - /* isDisabled */ 0, + /* isDisabled */ NULL, /* updateDepgraph */ updateDepgraph, /* dependsOnTime */ dependsOnTime, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index dae1ac0cac6..7f79f74e7b6 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -136,8 +136,8 @@ static float hook_falloff(float *co_1, float *co_2, const float falloff_squared, if(len_squared > falloff_squared) { return 0.0f; } - else if(len_squared > 0.0) { - return fac * (1.0 - (len_squared / falloff_squared)); + else if(len_squared > 0.0f) { + return fac * (1.0f - (len_squared / falloff_squared)); } } @@ -289,18 +289,18 @@ ModifierTypeInfo modifierType_Hook = { | eModifierTypeFlag_SupportsEditmode, /* copyData */ copyData, /* deformVerts */ deformVerts, - /* deformMatrices */ 0, + /* deformMatrices */ NULL, /* deformVertsEM */ deformVertsEM, - /* deformMatricesEM */ 0, - /* applyModifier */ 0, - /* applyModifierEM */ 0, + /* deformMatricesEM */ NULL, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, /* freeData */ freeData, /* isDisabled */ isDisabled, /* updateDepgraph */ updateDepgraph, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, - /* foreachIDLink */ 0, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index 8d57846f335..0d7c0f1509c 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -142,18 +142,18 @@ ModifierTypeInfo modifierType_Lattice = { | eModifierTypeFlag_SupportsEditmode, /* copyData */ copyData, /* deformVerts */ deformVerts, - /* deformMatrices */ 0, + /* deformMatrices */ NULL, /* deformVertsEM */ deformVertsEM, - /* deformMatricesEM */ 0, - /* applyModifier */ 0, - /* applyModifierEM */ 0, - /* initData */ 0, + /* deformMatricesEM */ NULL, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, + /* initData */ NULL, /* requiredDataMask */ requiredDataMask, - /* freeData */ 0, + /* freeData */ NULL, /* isDisabled */ isDisabled, /* updateDepgraph */ updateDepgraph, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, - /* foreachIDLink */ 0, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index 7b969f9322e..6f0bb27b208 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -408,19 +408,19 @@ ModifierTypeInfo modifierType_Mask = { /* flags */ eModifierTypeFlag_AcceptsMesh|eModifierTypeFlag_SupportsMapping|eModifierTypeFlag_SupportsEditmode, /* copyData */ copyData, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, - /* applyModifierEM */ 0, - /* initData */ 0, + /* applyModifierEM */ NULL, + /* initData */ NULL, /* requiredDataMask */ requiredDataMask, - /* freeData */ 0, - /* isDisabled */ 0, + /* freeData */ NULL, + /* isDisabled */ NULL, /* updateDepgraph */ updateDepgraph, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, - /* foreachIDLink */ 0, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index a34eff6120c..890121fdd44 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -377,7 +377,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, dm->release(dm); } -#define MESHDEFORM_MIN_INFLUENCE 0.00001 +#define MESHDEFORM_MIN_INFLUENCE 0.00001f void modifier_mdef_compact_influences(ModifierData *md) { @@ -450,18 +450,18 @@ ModifierTypeInfo modifierType_MeshDeform = { /* copyData */ copyData, /* deformVerts */ deformVerts, - /* deformMatrices */ 0, + /* deformMatrices */ NULL, /* deformVertsEM */ deformVertsEM, - /* deformMatricesEM */ 0, - /* applyModifier */ 0, - /* applyModifierEM */ 0, + /* deformMatricesEM */ NULL, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, /* freeData */ freeData, /* isDisabled */ isDisabled, /* updateDepgraph */ updateDepgraph, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, - /* foreachIDLink */ 0, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index 79cc541f35b..22fba3ceb35 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -309,19 +309,19 @@ ModifierTypeInfo modifierType_Mirror = { | eModifierTypeFlag_AcceptsCVs, /* copyData */ copyData, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, /* applyModifierEM */ applyModifierEM, /* initData */ initData, - /* requiredDataMask */ 0, - /* freeData */ 0, - /* isDisabled */ 0, + /* requiredDataMask */ NULL, + /* freeData */ NULL, + /* isDisabled */ NULL, /* updateDepgraph */ updateDepgraph, - /* dependsOnTime */ 0, - /* dependsOnNormal */ 0, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, - /* foreachIDLink */ 0, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 8159865b977..7296271eeb0 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -115,19 +115,19 @@ ModifierTypeInfo modifierType_Multires = { | eModifierTypeFlag_RequiresOriginalData, /* copyData */ copyData, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, - /* applyModifierEM */ 0, + /* applyModifierEM */ NULL, /* initData */ initData, - /* requiredDataMask */ 0, - /* freeData */ 0, - /* isDisabled */ 0, - /* updateDepgraph */ 0, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, + /* requiredDataMask */ NULL, + /* freeData */ NULL, + /* isDisabled */ NULL, + /* updateDepgraph */ NULL, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_none.c b/source/blender/modifiers/intern/MOD_none.c index bebb9b58774..489733c8480 100644 --- a/source/blender/modifiers/intern/MOD_none.c +++ b/source/blender/modifiers/intern/MOD_none.c @@ -38,8 +38,7 @@ * \ingroup modifiers */ - - +#include <stdio.h> #include "BLI_utildefines.h" @@ -62,20 +61,20 @@ ModifierTypeInfo modifierType_None = { /* flags */ eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_AcceptsCVs, - /* copyData */ 0, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, - /* applyModifier */ 0, - /* applyModifierEM */ 0, - /* initData */ 0, - /* requiredDataMask */ 0, - /* freeData */ 0, + /* copyData */ NULL, + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, + /* initData */ NULL, + /* requiredDataMask */ NULL, + /* freeData */ NULL, /* isDisabled */ isDisabled, - /* updateDepgraph */ 0, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, + /* updateDepgraph */ NULL, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index 92c8b089360..a2aa0e47e54 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -115,8 +115,8 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm = derivedData, *result; ParticleInstanceModifierData *pimd= (ParticleInstanceModifierData*) md; ParticleSimulationData sim; - ParticleSystem * psys=0; - ParticleData *pa=0, *pars=0; + ParticleSystem *psys= NULL; + ParticleData *pa= NULL, *pars= NULL; MFace *mface, *orig_mface; MVert *mvert, *orig_mvert; int i,totvert, totpart=0, totface, maxvert, maxface, first_particle=0; @@ -127,13 +127,13 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob, trackneg=((ob->trackflag>2)?1:0); if(pimd->ob==ob){ - pimd->ob=0; + pimd->ob= NULL; return derivedData; } if(pimd->ob){ psys = BLI_findlink(&pimd->ob->particlesystem,pimd->psys-1); - if(psys==0 || psys->totpart==0) + if(psys==NULL || psys->totpart==0) return derivedData; } else return derivedData; @@ -236,7 +236,7 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob, normalize_v3(state.vel); /* TODO: incremental rotations somehow */ - if(state.vel[axis] < -0.9999 || state.vel[axis] > 0.9999) { + if(state.vel[axis] < -0.9999f || state.vel[axis] > 0.9999f) { state.rot[0] = 1; state.rot[1] = state.rot[2] = state.rot[3] = 0.0f; } @@ -274,7 +274,7 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob, if(psys->part->childtype==PART_CHILD_PARTICLES) pa=psys->particles+(psys->child+i/totface-psys->totpart)->parent; else - pa=0; + pa= NULL; } else pa=pars+i/totface; @@ -283,7 +283,7 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob, if(psys->part->childtype==PART_CHILD_PARTICLES) pa=psys->particles+(psys->child+i/totface)->parent; else - pa=0; + pa= NULL; } if(pa){ @@ -339,19 +339,19 @@ ModifierTypeInfo modifierType_ParticleInstance = { | eModifierTypeFlag_EnableInEditmode, /* copyData */ copyData, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, /* applyModifierEM */ applyModifierEM, /* initData */ initData, - /* requiredDataMask */ 0, - /* freeData */ 0, - /* isDisabled */ 0, + /* requiredDataMask */ NULL, + /* freeData */ NULL, + /* isDisabled */ NULL, /* updateDepgraph */ updateDepgraph, /* dependsOnTime */ dependsOnTime, - /* dependsOnNormals */ 0, + /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, - /* foreachIDLink */ 0, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 80c96fd8553..7ab23cfd27b 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -35,7 +35,7 @@ */ -#include "stddef.h" +#include <stddef.h> #include "DNA_material_types.h" @@ -53,8 +53,8 @@ static void initData(ModifierData *md) { ParticleSystemModifierData *psmd= (ParticleSystemModifierData*) md; - psmd->psys= 0; - psmd->dm=0; + psmd->psys= NULL; + psmd->dm= NULL; psmd->totdmvert= psmd->totdmedge= psmd->totdmface= 0; } static void freeData(ModifierData *md) @@ -64,7 +64,7 @@ static void freeData(ModifierData *md) if(psmd->dm){ psmd->dm->needsFree = 1; psmd->dm->release(psmd->dm); - psmd->dm=0; + psmd->dm = NULL; } /* ED_object_modifier_remove may have freed this first before calling @@ -77,7 +77,7 @@ static void copyData(ModifierData *md, ModifierData *target) ParticleSystemModifierData *psmd= (ParticleSystemModifierData*) md; ParticleSystemModifierData *tpsmd= (ParticleSystemModifierData*) target; - tpsmd->dm = 0; + tpsmd->dm = NULL; tpsmd->totdmvert = tpsmd->totdmedge = tpsmd->totdmface = 0; //tpsmd->facepa = 0; tpsmd->flag = psmd->flag; @@ -101,7 +101,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) dataMask |= CD_MASK_MTFACE; } - if(psmd->psys->part->tanfac!=0.0) + if(psmd->psys->part->tanfac != 0.0f) dataMask |= CD_MASK_MTFACE; /* ask for vertexgroups if we need them */ @@ -131,7 +131,7 @@ static void deformVerts(ModifierData *md, Object *ob, { DerivedMesh *dm = derivedData; ParticleSystemModifierData *psmd= (ParticleSystemModifierData*) md; - ParticleSystem * psys=0; + ParticleSystem * psys= NULL; int needsFree=0; if(ob->particlesystem.first) @@ -142,7 +142,7 @@ static void deformVerts(ModifierData *md, Object *ob, if(!psys_check_enabled(ob, psys)) return; - if(dm==0) { + if(dm==NULL) { dm= get_dm(ob, NULL, NULL, vertexCos, 1); if(!dm) @@ -228,18 +228,18 @@ ModifierTypeInfo modifierType_ParticleSystem = { /* copyData */ copyData, /* deformVerts */ deformVerts, - /* deformVertsEM */ 0 /* deformVertsEM */ , - /* deformMatrices */ 0, - /* deformMatricesEM */ 0, - /* applyModifier */ 0, - /* applyModifierEM */ 0, + /* deformVertsEM */ NULL /* deformVertsEM */ , + /* deformMatrices */ NULL, + /* deformMatricesEM */ NULL, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, /* freeData */ freeData, - /* isDisabled */ 0, - /* updateDepgraph */ 0, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, + /* isDisabled */ NULL, + /* updateDepgraph */ NULL, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 68ad5437585..db7482b79ee 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -272,7 +272,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* will the screw be closed? * Note! smaller then FLT_EPSILON*100 gives problems with float precision so its never closed. */ - if (fabs(screw_ofs) <= (FLT_EPSILON*100) && fabs(fabs(angle) - (M_PI * 2)) <= (FLT_EPSILON*100)) { + if (fabsf(screw_ofs) <= (FLT_EPSILON*100.0f) && fabsf(fabsf(angle) - ((float)M_PI * 2.0f)) <= (FLT_EPSILON*100.0f)) { close= 1; step_tot--; if(step_tot < 2) step_tot= 2; @@ -892,19 +892,19 @@ ModifierTypeInfo modifierType_Screw = { | eModifierTypeFlag_EnableInEditmode, /* copyData */ copyData, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, /* applyModifierEM */ applyModifierEM, /* initData */ initData, - /* requiredDataMask */ 0, - /* freeData */ 0, - /* isDisabled */ 0, + /* requiredDataMask */ NULL, + /* freeData */ NULL, + /* isDisabled */ NULL, /* updateDepgraph */ updateDepgraph, /* dependsOnTime */ dependsOnTime, - /* dependsOnNormals */ 0, + /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, - /* foreachIDLink */ 0, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index cfd12833a38..e1fc4bc969f 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -172,18 +172,18 @@ ModifierTypeInfo modifierType_Shrinkwrap = { /* copyData */ copyData, /* deformVerts */ deformVerts, - /* deformMatrices */ 0, + /* deformMatrices */ NULL, /* deformVertsEM */ deformVertsEM, - /* deformMatricesEM */ 0, - /* applyModifier */ 0, - /* applyModifierEM */ 0, + /* deformMatricesEM */ NULL, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, - /* freeData */ 0, + /* freeData */ NULL, /* isDisabled */ isDisabled, /* updateDepgraph */ updateDepgraph, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, - /* foreachIDLink */ 0, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 0150322ae8c..2e6d9350148 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -89,11 +89,11 @@ static void simpleDeform_stretch(const float factor, const float dcut[3], float float x = co[0], y = co[1], z = co[2]; float scale; - scale = (z*z*factor-factor + 1.0); + scale = (z*z*factor-factor + 1.0f); co[0] = x*scale; co[1] = y*scale; - co[2] = z*(1.0+factor); + co[2] = z*(1.0f+factor); if(dcut) @@ -134,7 +134,7 @@ static void simpleDeform_bend(const float factor, const float dcut[3], float *co sint = sin(theta); cost = cos(theta); - if(fabs(factor) > 1e-7f) + if(fabsf(factor) > 1e-7f) { co[0] = -(y-1.0f/factor)*sint; co[1] = (y-1.0f/factor)*cost + 1.0f/factor; @@ -168,8 +168,8 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object //Safe-check if(smd->origin == ob) smd->origin = NULL; //No self references - if(smd->limit[0] < 0.0) smd->limit[0] = 0.0f; - if(smd->limit[0] > 1.0) smd->limit[0] = 1.0f; + if(smd->limit[0] < 0.0f) smd->limit[0] = 0.0f; + if(smd->limit[0] > 1.0f) smd->limit[0] = 1.0f; smd->limit[0] = MIN2(smd->limit[0], smd->limit[1]); //Upper limit >= than lower limit @@ -381,18 +381,18 @@ ModifierTypeInfo modifierType_SimpleDeform = { /* copyData */ copyData, /* deformVerts */ deformVerts, - /* deformMatrices */ 0, + /* deformMatrices */ NULL, /* deformVertsEM */ deformVertsEM, - /* deformMatricesEM */ 0, - /* applyModifier */ 0, - /* applyModifierEM */ 0, + /* deformMatricesEM */ NULL, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, - /* freeData */ 0, - /* isDisabled */ 0, + /* freeData */ NULL, + /* isDisabled */ NULL, /* updateDepgraph */ updateDepgraph, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, - /* foreachIDLink */ 0, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c index 46f0483dbff..d8e94e92bfa 100644 --- a/source/blender/modifiers/intern/MOD_smoke.c +++ b/source/blender/modifiers/intern/MOD_smoke.c @@ -35,7 +35,7 @@ */ -#include "stddef.h" +#include <stddef.h> #include "MEM_guardedalloc.h" @@ -147,6 +147,17 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, } } +static void foreachIDLink(ModifierData *md, Object *ob, + IDWalkFunc walk, void *userData) +{ + SmokeModifierData *smd = (SmokeModifierData*) md; + + if(smd->type==MOD_SMOKE_TYPE_DOMAIN && smd->domain) { + walk(userData, ob, (ID **)&smd->domain->coll_group); + walk(userData, ob, (ID **)&smd->domain->fluid_group); + walk(userData, ob, (ID **)&smd->domain->eff_group); + } +} ModifierTypeInfo modifierType_Smoke = { /* name */ "Smoke", @@ -159,18 +170,18 @@ ModifierTypeInfo modifierType_Smoke = { /* copyData */ copyData, /* deformVerts */ deformVerts, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, - /* applyModifier */ 0, - /* applyModifierEM */ 0, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, /* initData */ initData, - /* requiredDataMask */ 0, + /* requiredDataMask */ NULL, /* freeData */ freeData, - /* isDisabled */ 0, + /* isDisabled */ NULL, /* updateDepgraph */ updateDepgraph, /* dependsOnTime */ dependsOnTime, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ foreachIDLink, }; diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index 526b54d1cf8..5f76fad14b1 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -142,9 +142,7 @@ static void smoothModifier_do( v1 = vertexCos[idx1]; v2 = vertexCos[idx2]; - fvec[0] = (v1[0] + v2[0]) / 2.0; - fvec[1] = (v1[1] + v2[1]) / 2.0; - fvec[2] = (v1[2] + v2[2]) / 2.0; + mid_v3_v3v3(fvec, v1, v2); v1 = &ftmp[idx1*3]; v2 = &ftmp[idx2*3]; @@ -261,18 +259,18 @@ ModifierTypeInfo modifierType_Smooth = { /* copyData */ copyData, /* deformVerts */ deformVerts, - /* deformMatrices */ 0, + /* deformMatrices */ NULL, /* deformVertsEM */ deformVertsEM, - /* deformMatricesEM */ 0, - /* applyModifier */ 0, - /* applyModifierEM */ 0, + /* deformMatricesEM */ NULL, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, - /* freeData */ 0, + /* freeData */ NULL, /* isDisabled */ isDisabled, - /* updateDepgraph */ 0, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, + /* updateDepgraph */ NULL, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_softbody.c b/source/blender/modifiers/intern/MOD_softbody.c index 0abf2fa6281..25996286735 100644 --- a/source/blender/modifiers/intern/MOD_softbody.c +++ b/source/blender/modifiers/intern/MOD_softbody.c @@ -34,12 +34,12 @@ * \ingroup modifiers */ +#include <stdio.h> #include "DNA_scene_types.h" #include "BLI_utildefines.h" - #include "BKE_cdderivedmesh.h" #include "BKE_particle.h" #include "BKE_softbody.h" @@ -71,20 +71,20 @@ ModifierTypeInfo modifierType_Softbody = { | eModifierTypeFlag_RequiresOriginalData | eModifierTypeFlag_Single, - /* copyData */ 0, + /* copyData */ NULL, /* deformVerts */ deformVerts, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, - /* applyModifier */ 0, - /* applyModifierEM */ 0, - /* initData */ 0, - /* requiredDataMask */ 0, - /* freeData */ 0, - /* isDisabled */ 0, - /* updateDepgraph */ 0, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, + /* initData */ NULL, + /* requiredDataMask */ NULL, + /* freeData */ NULL, + /* isDisabled */ NULL, + /* updateDepgraph */ NULL, /* dependsOnTime */ dependsOnTime, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index f3c99bf9e3e..c591272c9c4 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -211,6 +211,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, int numLoops=0, newLoops=0, newFaces=0, newEdges=0; int j; + /* only use material offsets if we have 2 or more materials */ + const short mat_nr_max= ob->totcol > 1 ? ob->totcol - 1 : 0; + const short mat_ofs= mat_nr_max ? smd->mat_ofs : 0; + const short mat_ofs_rim= mat_nr_max ? smd->mat_ofs_rim : 0; + /* use for edges */ int *new_vert_arr= NULL; BLI_array_declare(new_vert_arr); @@ -355,6 +360,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, for (j=0; j<mp->totloop; j++) { CustomData_copy_data(&dm->loopData, &result->loopData, mp->loopstart+j, mp->loopstart+(mp->totloop-j-1)+dm->numLoopData, 1); + + if(mat_ofs) { + mp->mat_nr += mat_ofs; + CLAMP(mp->mat_nr, 0, mat_nr_max); + } } e = ml2[0].e; @@ -526,9 +536,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, float (*edge_vert_nos)[3]= MEM_callocN(sizeof(float) * numVerts * 3, "solidify_edge_nos"); float nor[3]; #endif - /* maximum value -1, so we have room to increase */ - const short mat_nr_shift= (smd->flag & MOD_SOLIDIFY_RIM_MATERIAL) ? ob->totcol-1 : -1; - const unsigned char crease_rim= smd->crease_rim * 255.0f; const unsigned char crease_outer= smd->crease_outer * 255.0f; const unsigned char crease_inner= smd->crease_inner * 255.0f; @@ -629,15 +636,17 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, ml[j++].e = numEdges*2 + old_vert_arr[ed->v1]; } - /* use the next material index if option enabled */ - if(mp->mat_nr < mat_nr_shift) - mp->mat_nr++; - - if(crease_outer) - ed->crease= crease_outer; - + if(crease_outer) { + /* crease += crease_outer; without wrapping */ + unsigned char *cr= (unsigned char *)&(medge[numEdges + eidx].crease); + int tcr= *cr + crease_outer; + *cr= tcr > 255 ? 255 : tcr; + } if(crease_inner) { - medge[numEdges + eidx].crease= crease_inner; + /* crease += crease_inner; without wrapping */ + unsigned char *cr= (unsigned char *)&(medge[numEdges + eidx].crease); + int tcr= *cr + crease_inner; + *cr= tcr > 255 ? 255 : tcr; } #ifdef SOLIDIFY_SIDE_NORMALS @@ -678,8 +687,14 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, if (old_vert_arr) MEM_freeN(old_vert_arr); + CDDM_recalc_tesselation(result, 1); + /* must recalculate normals with vgroups since they can displace unevenly [#26888] */ + if(dvert) { + CDDM_calc_normals(result); + } + return result; } @@ -687,7 +702,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob, - struct EditMesh *UNUSED(editData), + struct BMEditMesh *UNUSED(editData), DerivedMesh *derivedData) { return applyModifier(md, ob, derivedData, 0, 1); diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index 6d5477e5ec8..fa3d8ae9a33 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -35,7 +35,7 @@ */ -#include "stddef.h" +#include <stddef.h> #include "DNA_scene_types.h" #include "DNA_object_types.h" @@ -137,19 +137,19 @@ ModifierTypeInfo modifierType_Subsurf = { | eModifierTypeFlag_AcceptsCVs, /* copyData */ copyData, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, /* applyModifierEM */ applyModifierEM, /* initData */ initData, - /* requiredDataMask */ 0, + /* requiredDataMask */ NULL, /* freeData */ freeData, /* isDisabled */ isDisabled, - /* updateDepgraph */ 0, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, + /* updateDepgraph */ NULL, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c index d229f75189f..05ecee6ab29 100644 --- a/source/blender/modifiers/intern/MOD_surface.c +++ b/source/blender/modifiers/intern/MOD_surface.c @@ -176,20 +176,20 @@ ModifierTypeInfo modifierType_Surface = { /* flags */ eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_NoUserAdd, - /* copyData */ 0, + /* copyData */ NULL, /* deformVerts */ deformVerts, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, - /* applyModifier */ 0, - /* applyModifierEM */ 0, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, /* initData */ initData, - /* requiredDataMask */ 0, + /* requiredDataMask */ NULL, /* freeData */ freeData, - /* isDisabled */ 0, - /* updateDepgraph */ 0, + /* isDisabled */ NULL, + /* updateDepgraph */ NULL, /* dependsOnTime */ dependsOnTime, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 29bdde4d2f6..a6ff728af37 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -194,7 +194,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, free_uci= 1; } else { - float scale= (cam->type == CAM_PERSP) ? cam->clipsta * 32.0 / cam->lens : cam->ortho_scale; + float scale= (cam->type == CAM_PERSP) ? cam->clipsta * 32.0f / cam->lens : cam->ortho_scale; float xmax, xmin, ymax, ymin; if(aspect > 1.0f) { @@ -417,19 +417,19 @@ ModifierTypeInfo modifierType_UVProject = { | eModifierTypeFlag_EnableInEditmode, /* copyData */ copyData, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, + /* deformVerts */ NULL, + /* deformMatrices */ NULL, + /* deformVertsEM */ NULL, + /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, /* applyModifierEM */ applyModifierEM, /* initData */ initData, /* requiredDataMask */ requiredDataMask, - /* freeData */ 0, - /* isDisabled */ 0, + /* freeData */ NULL, + /* isDisabled */ NULL, /* updateDepgraph */ updateDepgraph, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ foreachIDLink, }; diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 42b1369e8ca..e3ee612374a 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -286,7 +286,7 @@ static void waveModifier_do(WaveModifierData *md, if(wmd->damp == 0) wmd->damp = 10.0f; - if(wmd->lifetime != 0.0) { + if(wmd->lifetime != 0.0f) { float x = ctime - wmd->timeoffs; if(x > wmd->lifetime) { @@ -294,7 +294,7 @@ static void waveModifier_do(WaveModifierData *md, if(lifefac > wmd->damp) lifefac = 0.0; else lifefac = - (float)(wmd->height * (1.0 - sqrt(lifefac / wmd->damp))); + (float)(wmd->height * (1.0f - sqrtf(lifefac / wmd->damp))); } } @@ -304,9 +304,9 @@ static void waveModifier_do(WaveModifierData *md, wavemod_get_texture_coords(wmd, ob, dm, vertexCos, tex_co, numVerts); } - if(lifefac != 0.0) { + if(lifefac != 0.0f) { /* avoid divide by zero checks within the loop */ - float falloff_inv= wmd->falloff ? 1.0f / wmd->falloff : 1.0; + float falloff_inv= wmd->falloff ? 1.0f / wmd->falloff : 1.0f; int i; for(i = 0; i < numVerts; i++) { @@ -364,14 +364,14 @@ static void waveModifier_do(WaveModifierData *md, amplit -= (ctime - wmd->timeoffs) * wmd->speed; if(wmd->flag & MOD_WAVE_CYCL) { - amplit = (float)fmod(amplit - wmd->width, 2.0 * wmd->width) + amplit = (float)fmodf(amplit - wmd->width, 2.0f * wmd->width) + wmd->width; } /* GAUSSIAN */ if(amplit > -wmd->width && amplit < wmd->width) { amplit = amplit * wmd->narrow; - amplit = (float)(1.0 / exp(amplit * amplit) - minfac); + amplit = (float)(1.0f / expf(amplit * amplit) - minfac); /*apply texture*/ if(wmd->texture) @@ -457,18 +457,18 @@ ModifierTypeInfo modifierType_Wave = { | eModifierTypeFlag_SupportsEditmode, /* copyData */ copyData, /* deformVerts */ deformVerts, - /* deformMatrices */ 0, + /* deformMatrices */ NULL, /* deformVertsEM */ deformVertsEM, - /* deformMatricesEM */ 0, - /* applyModifier */ 0, - /* applyModifierEM */ 0, + /* deformMatricesEM */ NULL, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, - /* freeData */ 0, - /* isDisabled */ 0, + /* freeData */ NULL, + /* isDisabled */ NULL, /* updateDepgraph */ updateDepgraph, /* dependsOnTime */ dependsOnTime, - /* dependsOnNormals */ 0, + /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ foreachIDLink, }; |