From 55f68c36574779ae2fac3652466584628b22c633 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 12 Feb 2011 16:54:24 +0000 Subject: fix for more warnings. - modifier code was using sizeof() without knowing the sizeof the array when clearing the modifier type array. - use BLI_snprintf rather then sprintf where the size of the string is known. - particle drawing code kept a reference to stack float values (not a problem at the moment but would crash if accessed later). --- source/blender/modifiers/intern/MOD_util.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 036ae276a7b..8ea717469a3 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -148,7 +148,6 @@ DerivedMesh *get_dm(Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*ve /* only called by BKE_modifier.h/modifier.c */ void modifier_type_init(ModifierTypeInfo *types[]) { - memset(types, 0, sizeof(types)); #define INIT_TYPE(typeName) (types[eModifierType_##typeName] = &modifierType_##typeName) INIT_TYPE(None); INIT_TYPE(Curve); -- cgit v1.2.3 From 867fc4b463ef39ea16103f18f332c3d259624d29 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Feb 2011 03:21:27 +0000 Subject: enforce string limits (reported by pedantic checking tools & some developers). mostly replace strcpy with BLI_strncpy and multiple strcat's with a BLI_snprintf(). also fix possible crash if CWD isnt available. --- source/blender/modifiers/intern/MOD_collision.c | 9 ++++++--- source/blender/modifiers/intern/MOD_explode.c | 5 ++--- source/blender/modifiers/intern/MOD_fluidsim_util.c | 5 ++--- source/blender/modifiers/intern/MOD_mask.c | 2 +- source/blender/modifiers/intern/MOD_screw.c | 10 +++++----- source/blender/modifiers/intern/MOD_shapekey.c | 5 +++-- source/blender/modifiers/intern/MOD_shrinkwrap.c | 4 ++-- source/blender/modifiers/intern/MOD_simpledeform.c | 3 ++- source/blender/modifiers/intern/MOD_surface.c | 2 +- 9 files changed, 24 insertions(+), 21 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 8decb460d6a..bdc0f0ea2e9 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -110,8 +110,6 @@ static void deformVerts(ModifierData *md, Object *ob, { CollisionModifierData *collmd = (CollisionModifierData*) md; DerivedMesh *dm = NULL; - float current_time = 0; - unsigned int numverts = 0, i = 0; MVert *tempVert = NULL; /* if possible use/create DerivedMesh */ @@ -126,6 +124,9 @@ static void deformVerts(ModifierData *md, Object *ob, if(dm) { + float current_time = 0; + unsigned int numverts = 0; + CDDM_apply_vert_coords(dm, vertexCos); CDDM_calc_normals(dm); @@ -137,7 +138,9 @@ static void deformVerts(ModifierData *md, Object *ob, numverts = dm->getNumVerts ( dm ); if((current_time > collmd->time)|| (BKE_ptcache_get_continue_physics())) - { + { + unsigned int i; + // check if mesh has changed if(collmd->x && (numverts != collmd->numverts)) freeData((ModifierData *)collmd); diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index a0765b56808..8c3b4f7db47 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -128,11 +128,10 @@ static void createFacepa(ExplodeModifierData *emd, /* set protected verts */ if(emd->vgroup){ MDeformVert *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT); - float val; if(dvert){ - int defgrp_index= emd->vgroup-1; + const int defgrp_index= emd->vgroup-1; for(i=0; iprotect)*val + emd->protect*0.5f; if(val < defvert_find_weight(dvert, defgrp_index)) vertpa[i] = -1; diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index eb556e31aba..7d5c9a0ec13 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -459,7 +459,7 @@ DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluid displaymode = fss->renderDisplayMode; } - strncpy(targetDir, fss->surfdataPath, FILE_MAXDIR); + BLI_strncpy(targetDir, fss->surfdataPath, sizeof(targetDir)); // use preview or final mesh? if(displaymode==1) @@ -479,8 +479,7 @@ DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluid BLI_path_abs(targetDir, G.main->name); BLI_path_frame(targetDir, curFrame, 0); // fixed #frame-no - strcpy(targetFile,targetDir); - strcat(targetFile, ".bobj.gz"); + BLI_snprintf(targetFile, sizeof(targetFile), "%s.bobj.gz", targetDir); dm = fluidsim_read_obj(targetFile); diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index b2f2c86c46d..a8a48eb720f 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -53,7 +53,7 @@ static void copyData(ModifierData *md, ModifierData *target) MaskModifierData *mmd = (MaskModifierData*) md; MaskModifierData *tmmd = (MaskModifierData*) target; - strcpy(tmmd->vgroup, mmd->vgroup); + BLI_strncpy(tmmd->vgroup, mmd->vgroup, sizeof(tmmd->vgroup)); tmmd->flag = mmd->flag; } diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 7e8fad2801e..7bbb07eb658 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -433,15 +433,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* find the first vert */ vc= vert_connect; for (i=0; i < totvert; i++, vc++) { - int v_best=-1, ed_loop_closed=0; /* vert and vert new */ - int ed_loop_flip= 0; /* compiler complains if not initialized, but it should be initialized below */ - float fl= -1.0f; - ScrewVertIter lt_iter; - /* Now do search for connected verts, order all edges and flip them * so resulting faces are flipped the right way */ vc_tot_linked= 0; /* count the number of linked verts for this loop */ if (vc->flag == 0) { + int v_best=-1, ed_loop_closed=0; /* vert and vert new */ + ScrewVertIter lt_iter; + int ed_loop_flip= 0; /* compiler complains if not initialized, but it should be initialized below */ + float fl= -1.0f; + /*printf("Loop on connected vert: %i\n", i);*/ for(j=0; j<2; j++) { diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c index e03783e8eeb..874efd77c9e 100644 --- a/source/blender/modifiers/intern/MOD_shapekey.c +++ b/source/blender/modifiers/intern/MOD_shapekey.c @@ -70,11 +70,12 @@ static void deformMatrices(ModifierData *md, Object *ob, DerivedMesh *derivedDat Key *key= ob_get_key(ob); KeyBlock *kb= ob_get_keyblock(ob); float scale[3][3]; - int a; (void)vertexCos; /* unused */ if(kb && kb->totelem==numVerts && kb!=key->refkey) { + int a; + if(ob->shapeflag & OB_SHAPE_LOCK) scale_m3_fl(scale, 1); else scale_m3_fl(scale, kb->curval); @@ -107,11 +108,11 @@ static void deformMatricesEM(ModifierData *UNUSED(md), Object *ob, Key *key= ob_get_key(ob); KeyBlock *kb= ob_get_keyblock(ob); float scale[3][3]; - int a; (void)vertexCos; /* unused */ if(kb && kb->totelem==numVerts && kb!=key->refkey) { + int a; scale_m3_fl(scale, kb->curval); for(a=0; a +#include "BLI_string.h" #include "BLI_utildefines.h" - #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" #include "BKE_shrinkwrap.h" @@ -65,7 +65,7 @@ static void copyData(ModifierData *md, ModifierData *target) tsmd->target = smd->target; tsmd->auxTarget = smd->auxTarget; - strcpy(tsmd->vgroup_name, smd->vgroup_name); + BLI_strncpy(tsmd->vgroup_name, smd->vgroup_name, sizeof(tsmd->vgroup_name)); tsmd->keepDist = smd->keepDist; tsmd->shrinkType= smd->shrinkType; diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 1c3e40a4193..7c95b460838 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -34,6 +34,7 @@ #include "DNA_object_types.h" #include "BLI_math.h" +#include "BLI_string.h" #include "BLI_utildefines.h" #include "BKE_cdderivedmesh.h" @@ -288,7 +289,7 @@ static void copyData(ModifierData *md, ModifierData *target) tsmd->originOpts= smd->originOpts; tsmd->factor= smd->factor; memcpy(tsmd->limit, smd->limit, sizeof(tsmd->limit)); - strcpy(tsmd->vgroup_name, smd->vgroup_name); + BLI_strncpy(tsmd->vgroup_name, smd->vgroup_name, sizeof(tsmd->vgroup_name)); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c index 8d6f6954e18..b5d25d8e146 100644 --- a/source/blender/modifiers/intern/MOD_surface.c +++ b/source/blender/modifiers/intern/MOD_surface.c @@ -91,7 +91,6 @@ static void deformVerts(ModifierData *md, Object *ob, int UNUSED(isFinalCalc)) { SurfaceModifierData *surmd = (SurfaceModifierData*) md; - unsigned int numverts = 0, i = 0; if(surmd->dm) surmd->dm->release(surmd->dm); @@ -108,6 +107,7 @@ static void deformVerts(ModifierData *md, Object *ob, if(surmd->dm) { + unsigned int numverts = 0, i = 0; int init = 0; float *vec; MVert *x, *v; -- cgit v1.2.3 From 0955c664aa7c5fc5f0bd345c58219c40f04ab9c1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Feb 2011 10:52:18 +0000 Subject: fix for warnings from Sparse static source code checker, mostly BKE/BLI and python functions. - use NULL rather then 0 where possible (makes code & function calls more readable IMHO). - set static variables and functions (exposed some unused vars/funcs). - use func(void) rather then func() for definitions. --- source/blender/modifiers/intern/MOD_shapekey.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c index 874efd77c9e..a2fd83b8bcb 100644 --- a/source/blender/modifiers/intern/MOD_shapekey.c +++ b/source/blender/modifiers/intern/MOD_shapekey.c @@ -128,20 +128,20 @@ ModifierTypeInfo modifierType_ShapeKey = { /* flags */ eModifierTypeFlag_AcceptsCVs | eModifierTypeFlag_SupportsEditmode, - /* copyData */ 0, + /* copyData */ NULL, /* deformVerts */ deformVerts, /* deformMatrices */ deformMatrices, /* deformVertsEM */ deformVertsEM, /* deformMatricesEM */ deformMatricesEM, - /* applyModifier */ 0, - /* applyModifierEM */ 0, - /* initData */ 0, - /* requiredDataMask */ 0, - /* freeData */ 0, - /* isDisabled */ 0, - /* updateDepgraph */ 0, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, + /* initData */ NULL, + /* requiredDataMask */ NULL, + /* freeData */ NULL, + /* isDisabled */ NULL, + /* updateDepgraph */ NULL, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL }; -- cgit v1.2.3 From 4124804b4e67c7a1d15abaac220d08497e37d34a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Feb 2011 14:16:36 +0000 Subject: many functions in blender are not marked static but should be. most local modifier,GPU,ImBuf and Interface functions are now static. also fixed an error were the fluid modifier definition and the header didnt have the same number of args. --- source/blender/modifiers/intern/MOD_array.c | 2 ++ source/blender/modifiers/intern/MOD_bevel.c | 2 ++ source/blender/modifiers/intern/MOD_boolean.c | 1 + source/blender/modifiers/intern/MOD_boolean_util.c | 4 +++- source/blender/modifiers/intern/MOD_build.c | 1 + source/blender/modifiers/intern/MOD_cloth.c | 1 + source/blender/modifiers/intern/MOD_collision.c | 1 + source/blender/modifiers/intern/MOD_curve.c | 1 + source/blender/modifiers/intern/MOD_decimate.c | 2 ++ source/blender/modifiers/intern/MOD_edgesplit.c | 1 + source/blender/modifiers/intern/MOD_explode.c | 1 + source/blender/modifiers/intern/MOD_fluidsim.c | 1 + source/blender/modifiers/intern/MOD_fluidsim_util.c | 10 ++++++---- source/blender/modifiers/intern/MOD_fluidsim_util.h | 2 +- source/blender/modifiers/intern/MOD_hook.c | 1 + source/blender/modifiers/intern/MOD_mask.c | 1 + source/blender/modifiers/intern/MOD_mirror.c | 2 ++ source/blender/modifiers/intern/MOD_multires.c | 2 ++ source/blender/modifiers/intern/MOD_particleinstance.c | 1 + source/blender/modifiers/intern/MOD_simpledeform.c | 2 +- source/blender/modifiers/intern/MOD_util.h | 3 +++ 21 files changed, 35 insertions(+), 7 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 9b49066d623..6c729c8519f 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -51,6 +51,8 @@ #include "depsgraph_private.h" +#include "MOD_util.h" + static void initData(ModifierData *md) { ArrayModifierData *amd = (ArrayModifierData*) md; diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index effc376943e..09e5016cb2b 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -38,6 +38,8 @@ #include "BKE_modifier.h" #include "BKE_particle.h" +#include "MOD_util.h" + static void initData(ModifierData *md) { diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index c40d6cfb79e..3aa5bff5f61 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -41,6 +41,7 @@ #include "depsgraph_private.h" #include "MOD_boolean_util.h" +#include "MOD_util.h" static void copyData(ModifierData *md, ModifierData *target) diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index 900a94487e5..8cd032a48c4 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -48,6 +48,8 @@ #include "CSG_BooleanOps.h" +#include "MOD_boolean_util.h" + /** * Here's the vertex iterator structure used to walk through * the blender vertex structure. @@ -451,7 +453,7 @@ static void FreeMeshDescriptors( FaceIt_Destruct(face_it); } -DerivedMesh *NewBooleanDerivedMesh_intern( +static DerivedMesh *NewBooleanDerivedMesh_intern( DerivedMesh *dm, struct Object *ob, DerivedMesh *dm_select, struct Object *ob_select, int int_op_type, Material **mat, int *totmat) { diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index 704caf0aff8..3bf1fa401f9 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -46,6 +46,7 @@ #include "BKE_particle.h" #include "BKE_scene.h" +#include "MOD_util.h" static void initData(ModifierData *md) { diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 1cb46c0992f..bb1fc67ef8b 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -47,6 +47,7 @@ #include "depsgraph_private.h" +#include "MOD_util.h" static void initData(ModifierData *md) { diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index bdc0f0ea2e9..106e8b3957a 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -48,6 +48,7 @@ #include "BKE_pointcache.h" #include "BKE_scene.h" +#include "MOD_util.h" static void initData(ModifierData *md) { diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index c4e41941acc..d458d026c61 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -44,6 +44,7 @@ #include "depsgraph_private.h" +#include "MOD_util.h" static void initData(ModifierData *md) { diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index 2f1723cf9bb..e90a6ea2ac4 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -47,6 +47,8 @@ #include "LOD_decimation.h" #endif +#include "MOD_util.h" + static void initData(ModifierData *md) { DecimateModifierData *dmd = (DecimateModifierData*) md; diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index 56138552000..22b7e72adfc 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -48,6 +48,7 @@ #include "MEM_guardedalloc.h" +#include "MOD_util.h" #if 0 #define EDGESPLIT_DEBUG_3 diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 8c3b4f7db47..67476a33a00 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -51,6 +51,7 @@ #include "MEM_guardedalloc.h" +#include "MOD_util.h" static void initData(ModifierData *md) { diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c index 19111b0cafc..9a1635e3dad 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim.c +++ b/source/blender/modifiers/intern/MOD_fluidsim.c @@ -42,6 +42,7 @@ #include "depsgraph_private.h" +#include "MOD_util.h" #include "MOD_fluidsim_util.h" #include "MEM_guardedalloc.h" diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 7d5c9a0ec13..fdf3209b500 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -45,11 +45,13 @@ #include "BLI_utildefines.h" #include "BKE_main.h" +#include "BKE_fluidsim.h" /* ensure definitions here match */ #include "BKE_cdderivedmesh.h" #include "BKE_mesh.h" #include "BKE_utildefines.h" #include "BKE_global.h" /* G.main->name only */ +#include "MOD_fluidsim_util.h" #include "MOD_modifiertypes.h" #include "MEM_guardedalloc.h" @@ -167,7 +169,7 @@ void fluidsim_free(FluidsimModifierData *fluidmd) #ifndef DISABLE_ELBEEM /* read .bobj.gz file into a fluidsimDerivedMesh struct */ -DerivedMesh *fluidsim_read_obj(char *filename) +static DerivedMesh *fluidsim_read_obj(const char *filename) { int wri = 0,i; int gotBytes; @@ -379,7 +381,7 @@ void fluid_estimate_memory(Object *ob, FluidsimSettings *fss, char *value) /* read zipped fluidsim velocities into the co's of the fluidsimsettings normals struct */ -void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *dm, char *filename) +static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *dm, char *filename) { int wri, i, j; float wrf; @@ -442,7 +444,7 @@ void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *dm, cha gzclose(gzf); } -DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams) +static DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams) { int displaymode = 0; int curFrame = framenr - 1 /*scene->r.sfra*/; /* start with 0 at start frame */ @@ -537,7 +539,7 @@ DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluid DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Object *UNUSED(ob), DerivedMesh *dm, - int useRenderParams) + int useRenderParams, int UNUSED(isFinalCalc)) { #ifndef DISABLE_ELBEEM DerivedMesh *result = NULL; diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.h b/source/blender/modifiers/intern/MOD_fluidsim_util.h index a06c74cb8dd..522cf379435 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.h +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.h @@ -42,6 +42,6 @@ void fluidsim_free(struct FluidsimModifierData *fluidmd); struct DerivedMesh *fluidsimModifier_do(struct FluidsimModifierData *fluidmd, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm, int useRenderParams, int isFinalCalc); - + #endif diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 79493d2c549..cbd88f32409 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -46,6 +46,7 @@ #include "depsgraph_private.h" #include "MEM_guardedalloc.h" +#include "MOD_util.h" static void initData(ModifierData *md) { diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index a8a48eb720f..19d9c7c9dd8 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -47,6 +47,7 @@ #include "depsgraph_private.h" +#include "MOD_util.h" static void copyData(ModifierData *md, ModifierData *target) { diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index 5c73b2f0866..007d8eb5197 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -45,6 +45,8 @@ #include "MEM_guardedalloc.h" #include "depsgraph_private.h" +#include "MOD_util.h" + static void initData(ModifierData *md) { MirrorModifierData *mmd = (MirrorModifierData*) md; diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 10b135aaa77..3b2c552bb9f 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -40,6 +40,8 @@ #include "DNA_mesh_types.h" +#include "MOD_util.h" + static void initData(ModifierData *md) { MultiresModifierData *mmd = (MultiresModifierData*)md; diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index c36581d9317..739d7aa0e6d 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -45,6 +45,7 @@ #include "BKE_particle.h" #include "BKE_pointcache.h" +#include "MOD_util.h" #include "depsgraph_private.h" diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 7c95b460838..9add0e9a67d 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -148,7 +148,7 @@ static void simpleDeform_bend(const float factor, const float dcut[3], float *co /* simple deform modifier */ -void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object *ob, struct DerivedMesh *dm, float (*vertexCos)[3], int numVerts) +static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object *ob, struct DerivedMesh *dm, float (*vertexCos)[3], int numVerts) { static const float lock_axis[2] = {0.0f, 0.0f}; diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h index 0ba35ad23e6..a4d63c6d168 100644 --- a/source/blender/modifiers/intern/MOD_util.h +++ b/source/blender/modifiers/intern/MOD_util.h @@ -28,6 +28,9 @@ #ifndef MOD_UTIL_H #define MOD_UTIL_H +/* so modifier types match their defines */ +#include "MOD_modifiertypes.h" + struct Tex; struct TexResult; struct CustomData; -- cgit v1.2.3 From d4ebace1496303cda26a52875ebbbe6a5bee6b18 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 14 Feb 2011 21:00:49 +0000 Subject: Tweak priority so link error on Linux is solved. Reported by Hypercrush on IRC. --- source/blender/modifiers/SConscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/SConscript b/source/blender/modifiers/SConscript index 874aefbaa22..8ea4f893bb9 100644 --- a/source/blender/modifiers/SConscript +++ b/source/blender/modifiers/SConscript @@ -21,4 +21,4 @@ if env['BF_NO_ELBEEM']: env.BlenderLib ( libname = 'bf_modifiers', sources = sources, includes = Split(incs), defines=defs, - libtype=['core','player'], priority = [180, 40] ) + libtype=['core','player'], priority = [80, 40] ) -- cgit v1.2.3 From f6911cfe3839d0eda5bffbb65043732c504667f2 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Wed, 16 Feb 2011 11:38:28 +0000 Subject: Fix for [#26102] Particle Texture mismapped on Multires (in some modes) * Particle modifier didn't check for particle textures using uv-coordinates properly. --- source/blender/modifiers/intern/MOD_particlesystem.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index c7638afbbcc..246a1b5391e 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -91,14 +91,10 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) if(!psmd->psys->part) return 0; - ma= give_current_material(ob, psmd->psys->part->omat); - if(ma) { - for(i=0; imtex[i]; - if(mtex && (ma->septex & (1<pmapto && (mtex->texco & TEXCO_UV)) - dataMask |= CD_MASK_MTFACE; - } + for(i=0; ipsys->part->mtex[i]; + if(mtex && mtex->mapto && (mtex->texco & TEXCO_UV)) + dataMask |= CD_MASK_MTFACE; } if(psmd->psys->part->tanfac!=0.0) -- cgit v1.2.3 From aed7eaf0d9171c4bfa7814e141afad773cb31441 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 16 Feb 2011 17:31:04 +0000 Subject: sphinx doc gen: multiple examples possible and include the scripts docstring inline in sphinx. also tag unused vars --- source/blender/modifiers/intern/MOD_particlesystem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 246a1b5391e..2f3bc0c53f4 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -80,11 +80,10 @@ static void copyData(ModifierData *md, ModifierData *target) tpsmd->psys = psmd->psys; } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { ParticleSystemModifierData *psmd= (ParticleSystemModifierData*) md; CustomDataMask dataMask = 0; - Material *ma; MTex *mtex; int i; -- cgit v1.2.3 From 06aee2ef0e1c810c24b2559838e46045d708b22f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 20 Feb 2011 15:48:01 +0000 Subject: misc warnings/fixes - WITH_OPENJPEG wasn't defined for creator.c with CMake. - remove shadowed/redefined vars. - remove some unused RNA report args. - re-arrange IMB_FILE_TYPES so IRIS is not the first format tested, since its not very common test JPEG and PNG first. --- source/blender/modifiers/intern/MOD_build.c | 173 ++++++++++++------------- source/blender/modifiers/intern/MOD_hook.c | 1 - source/blender/modifiers/intern/MOD_solidify.c | 26 ++-- 3 files changed, 96 insertions(+), 104 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index 3bf1fa401f9..bc59c2cba0b 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -82,7 +82,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, BuildModifierData *bmd = (BuildModifierData*) md; int i; int numFaces, numEdges; - int maxVerts, maxEdges, maxFaces; int *vertMap, *edgeMap, *faceMap; float frac; GHashIterator *hashIter; @@ -93,19 +92,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, GHash *edgeHash = BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "build ed apply gh"); - maxVerts = dm->getNumVerts(dm); - vertMap = MEM_callocN(sizeof(*vertMap) * maxVerts, - "build modifier vertMap"); - for(i = 0; i < maxVerts; ++i) vertMap[i] = i; + const int maxVerts= dm->getNumVerts(dm); + const int maxEdges= dm->getNumEdges(dm); + const int maxFaces= dm->getNumFaces(dm); - maxEdges = dm->getNumEdges(dm); - edgeMap = MEM_callocN(sizeof(*edgeMap) * maxEdges, - "build modifier edgeMap"); + vertMap = MEM_callocN(sizeof(*vertMap) * maxVerts, "build modifier vertMap"); + for(i = 0; i < maxVerts; ++i) vertMap[i] = i; + edgeMap = MEM_callocN(sizeof(*edgeMap) * maxEdges, "build modifier edgeMap"); for(i = 0; i < maxEdges; ++i) edgeMap[i] = i; - - maxFaces = dm->getNumFaces(dm); - faceMap = MEM_callocN(sizeof(*faceMap) * maxFaces, - "build modifier faceMap"); + faceMap = MEM_callocN(sizeof(*faceMap) * maxFaces, "build modifier faceMap"); for(i = 0; i < maxFaces; ++i) faceMap[i] = i; if (ob) { @@ -121,8 +116,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* if there's at least one face, build based on faces */ if(numFaces) { - int maxEdges; - if(bmd->randomize) BLI_array_randomize(faceMap, sizeof(*faceMap), maxFaces, bmd->seed); @@ -151,7 +144,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* get the set of edges that will be in the new mesh (i.e. all edges * that have both verts in the new mesh) */ - maxEdges = dm->getNumEdges(dm); for(i = 0; i < maxEdges; ++i) { MEdge me; dm->getEdge(dm, i, &me); @@ -211,71 +203,72 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, BLI_ghash_size(edgeHash), numFaces); /* copy the vertices across */ - for(hashIter = BLI_ghashIterator_new(vertHash); - !BLI_ghashIterator_isDone(hashIter); - BLI_ghashIterator_step(hashIter)) { - MVert source; - MVert *dest; - int oldIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(hashIter)); - int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(hashIter)); - - dm->getVert(dm, oldIndex, &source); - dest = CDDM_get_vert(result, newIndex); - - DM_copy_vert_data(dm, result, oldIndex, newIndex, 1); - *dest = source; - } - BLI_ghashIterator_free(hashIter); - - /* copy the edges across, remapping indices */ - for(i = 0; i < BLI_ghash_size(edgeHash); ++i) { - MEdge source; - MEdge *dest; - int oldIndex = GET_INT_FROM_POINTER(BLI_ghash_lookup(edgeHash, SET_INT_IN_POINTER(i))); - - dm->getEdge(dm, oldIndex, &source); - dest = CDDM_get_edge(result, i); - - source.v1 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v1))); - source.v2 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v2))); - - DM_copy_edge_data(dm, result, oldIndex, i, 1); - *dest = source; - } - - /* copy the faces across, remapping indices */ - for(i = 0; i < numFaces; ++i) { - MFace source; - MFace *dest; - int orig_v4; - - dm->getFace(dm, faceMap[i], &source); - dest = CDDM_get_face(result, i); - - orig_v4 = source.v4; - - source.v1 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v1))); - source.v2 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v2))); - source.v3 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v3))); - if(source.v4) - source.v4 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v4))); - - DM_copy_face_data(dm, result, faceMap[i], i, 1); - *dest = source; - - test_index_face(dest, &result->faceData, i, (orig_v4 ? 4 : 3)); - } - - CDDM_calc_normals(result); - - BLI_ghash_free(vertHash, NULL, NULL); - BLI_ghash_free(edgeHash, NULL, NULL); + for( hashIter = BLI_ghashIterator_new(vertHash); + !BLI_ghashIterator_isDone(hashIter); + BLI_ghashIterator_step(hashIter) + ) { + MVert source; + MVert *dest; + int oldIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(hashIter)); + int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(hashIter)); + + dm->getVert(dm, oldIndex, &source); + dest = CDDM_get_vert(result, newIndex); + + DM_copy_vert_data(dm, result, oldIndex, newIndex, 1); + *dest = source; + } + BLI_ghashIterator_free(hashIter); + + /* copy the edges across, remapping indices */ + for(i = 0; i < BLI_ghash_size(edgeHash); ++i) { + MEdge source; + MEdge *dest; + int oldIndex = GET_INT_FROM_POINTER(BLI_ghash_lookup(edgeHash, SET_INT_IN_POINTER(i))); + + dm->getEdge(dm, oldIndex, &source); + dest = CDDM_get_edge(result, i); + + source.v1 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v1))); + source.v2 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v2))); + + DM_copy_edge_data(dm, result, oldIndex, i, 1); + *dest = source; + } - MEM_freeN(vertMap); - MEM_freeN(edgeMap); - MEM_freeN(faceMap); + /* copy the faces across, remapping indices */ + for(i = 0; i < numFaces; ++i) { + MFace source; + MFace *dest; + int orig_v4; + + dm->getFace(dm, faceMap[i], &source); + dest = CDDM_get_face(result, i); + + orig_v4 = source.v4; + + source.v1 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v1))); + source.v2 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v2))); + source.v3 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v3))); + if(source.v4) + source.v4 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v4))); + + DM_copy_face_data(dm, result, faceMap[i], i, 1); + *dest = source; + + test_index_face(dest, &result->faceData, i, (orig_v4 ? 4 : 3)); + } - return result; + CDDM_calc_normals(result); + + BLI_ghash_free(vertHash, NULL, NULL); + BLI_ghash_free(edgeHash, NULL, NULL); + + MEM_freeN(vertMap); + MEM_freeN(edgeMap); + MEM_freeN(faceMap); + + return result; } @@ -287,19 +280,19 @@ ModifierTypeInfo modifierType_Build = { /* flags */ eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_AcceptsCVs, /* 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, + /* 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_hook.c b/source/blender/modifiers/intern/MOD_hook.c index cbd88f32409..59c45eb2eec 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -244,7 +244,6 @@ static void deformVerts(ModifierData *md, Object *ob, } } else if(dvert) { /* vertex group hook */ - int i; const float fac_orig= hmd->force; for(i = 0; i < max_dvert; i++, dvert++) { diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 4faf955b953..edf149c1580 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -291,7 +291,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, ehi= BLI_edgehashIterator_new(edgehash); for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) { - int eidx= GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi)); + eidx= GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi)); if(edge_users[eidx] >= 0) { BLI_edgehashIterator_getKey(ehi, &v1, &v2); orig_mvert[v1].flag |= ME_VERT_TMP_TAG; @@ -408,7 +408,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, float *vert_angles= MEM_callocN(sizeof(float) * numVerts * 2, "mod_solid_pair"); /* 2 in 1 */ float *vert_accum= vert_angles + numVerts; float face_angles[4]; - int i, j, vidx; + int j, vidx; face_nors = CustomData_get_layer(&dm->faceData, CD_NORMAL); if(!face_nors) { @@ -650,19 +650,19 @@ ModifierTypeInfo modifierType_Solidify = { | 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 }; -- cgit v1.2.3 From 8c8ae3dedf0da0c3ea8e15b37a1f57a856d89206 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 21 Feb 2011 06:58:46 +0000 Subject: doxygen: entry for gpu, modifiers, nodes, python and render --- source/blender/modifiers/MOD_modifiertypes.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/MOD_modifiertypes.h b/source/blender/modifiers/MOD_modifiertypes.h index 6063acf47f4..8486e2b5d29 100644 --- a/source/blender/modifiers/MOD_modifiertypes.h +++ b/source/blender/modifiers/MOD_modifiertypes.h @@ -1,4 +1,4 @@ -/** +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -25,6 +25,10 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file MOD_modifiertypes.h + * \ingroup modifiers + */ + #ifndef MOD_MODIFIERTYPES_H #define MOD_MODIFIERTYPES_H -- cgit v1.2.3 From 322ff7dfe42a77da4caf63fcaa98a82ef6e6ecad Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 21 Feb 2011 12:35:04 +0000 Subject: I swear, it was just an innocence change in guardedalloc! The butterfly wing flap, causing a nice storm in the rest of blender. Now all dependencies should point ok again. CMakers, do double-test. --- source/blender/modifiers/CMakeLists.txt | 1 + source/blender/modifiers/SConscript | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 787c93f5b8a..c610a2fbdda 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -27,6 +27,7 @@ set(INC . ./intern ../blenlib + ../blenloader ../makesdna ../blenkernel ../blenkernel/intern diff --git a/source/blender/modifiers/SConscript b/source/blender/modifiers/SConscript index 8ea4f893bb9..d1bb95761ff 100644 --- a/source/blender/modifiers/SConscript +++ b/source/blender/modifiers/SConscript @@ -5,7 +5,7 @@ sources = env.Glob('intern/*.c') incs = '. ./intern' incs += ' #/intern/guardedalloc #/intern/decimation/extern #/intern/bsp/extern #/intern/elbeem/extern' -incs += ' ../render/extern/include' +incs += ' ../render/extern/include ../blenloader' incs += ' ../include ../blenlib ../makesdna ../blenkernel ../blenkernel/intern' incs += ' ' + env['BF_ZLIB_INC'] -- cgit v1.2.3 From 5b607701a7541c328cc058e10bd7a8c6d0c998ab Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Wed, 23 Feb 2011 10:52:22 +0000 Subject: doxygen: prevent GPL license block from being parsed as doxygen comment. --- source/blender/modifiers/intern/MOD_boolean_util.c | 2 +- source/blender/modifiers/intern/MOD_boolean_util.h | 2 +- source/blender/modifiers/intern/MOD_fluidsim_util.h | 2 +- source/blender/modifiers/intern/MOD_none.c | 2 +- source/blender/modifiers/intern/MOD_util.c | 2 +- source/blender/modifiers/intern/MOD_util.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index 8cd032a48c4..e4526a359e4 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -1,4 +1,4 @@ -/** +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** diff --git a/source/blender/modifiers/intern/MOD_boolean_util.h b/source/blender/modifiers/intern/MOD_boolean_util.h index e415b368a85..5aef8fe6bc8 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.h +++ b/source/blender/modifiers/intern/MOD_boolean_util.h @@ -1,4 +1,4 @@ -/** +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.h b/source/blender/modifiers/intern/MOD_fluidsim_util.h index 522cf379435..29f3a1b77ae 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.h +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.h @@ -1,4 +1,4 @@ -/** +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** diff --git a/source/blender/modifiers/intern/MOD_none.c b/source/blender/modifiers/intern/MOD_none.c index c08335d638a..d9e25394686 100644 --- a/source/blender/modifiers/intern/MOD_none.c +++ b/source/blender/modifiers/intern/MOD_none.c @@ -1,4 +1,4 @@ -/** +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 8ea717469a3..2cc9c6601c7 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -1,4 +1,4 @@ -/** +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h index a4d63c6d168..b48a3a56092 100644 --- a/source/blender/modifiers/intern/MOD_util.h +++ b/source/blender/modifiers/intern/MOD_util.h @@ -1,4 +1,4 @@ -/** +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** -- cgit v1.2.3 From 3bee6abb74f03cb2170c15c14ea76187dbaead48 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Wed, 23 Feb 2011 19:29:59 +0000 Subject: Fix for [#26133] Explode modifier doesn't care about UVs (Option "split edges") * This is basically a total rewrite of the edge split algorithm. The old one didn't handle tris at all and quads were cut wrong in some cases too with the addition of not handling uv coordinates at all. * This new algorithm uses a flag system to categorize different splits and the identical but rotated cases in a similar way to how marching cubes indexes different cases. * It cuts quads and tris and creates proper uv's for the new faces too. * I also renamed the option to "edge cut" to differentiate if from the edge split modifier and added an option to override a uv-channel in the exploded mesh with particle age as x-coordinate so that the shrapnel can be faded out nicely etc. --- source/blender/modifiers/intern/MOD_explode.c | 883 +++++++++++++++----------- 1 file changed, 504 insertions(+), 379 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 67476a33a00..a0a658031f0 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -180,15 +180,370 @@ static void createFacepa(ExplodeModifierData *emd, BLI_kdtree_free(tree); } -static int edgesplit_get(EdgeHash *edgehash, int v1, int v2) +static int edgecut_get(EdgeHash *edgehash, int v1, int v2) { return GET_INT_FROM_POINTER(BLI_edgehash_lookup(edgehash, v1, v2)); } -static DerivedMesh * splitEdges(ExplodeModifierData *emd, DerivedMesh *dm){ + +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) +{ + MFace *df = CDDM_get_face(split, cur); + DM_copy_face_data(dm, split, i, cur, 1); + *df = *mf; + return df; +} + +#define SET_VERTS(a, b, c, d) \ + v[0]=mf->v##a; uv[0]=a-1; \ + v[1]=mf->v##b; uv[1]=b-1; \ + v[2]=mf->v##c; uv[2]=c-1; \ + v[3]=mf->v##d; uv[3]=d-1; + +#define GET_ES(v1, v2) edgecut_get(eh, v1, v2); +#define INT_UV(uvf, c0, c1) interp_v2_v2v2(uvf, mf->uv[c0], mf->uv[c1], 0.5f); + +static void remap_faces_3_6_9_12(DerivedMesh *dm, DerivedMesh *split, MFace *mf, int *facepa, int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3, int v4) +{ + MFace *df1 = get_dface(dm, split, cur, i, mf); + MFace *df2 = get_dface(dm, split, cur+1, i, mf); + MFace *df3 = get_dface(dm, split, cur+2, i, mf); + + facepa[cur] = vertpa[v1]; + df1->v1 = v1; + df1->v2 = GET_ES(v1, v2) + df1->v3 = GET_ES(v2, v3) + df1->v4 = v3; + df1->flag |= ME_FACE_SEL; + + facepa[cur+1] = vertpa[v2]; + df2->v1 = GET_ES(v1, v2) + df2->v2 = v2; + df2->v3 = GET_ES(v2, v3) + df2->v4 = 0; + df2->flag &= ~ME_FACE_SEL; + + facepa[cur+2] = vertpa[v1]; + df3->v1 = v1; + df3->v2 = v3; + df3->v3 = v4; + df3->v4 = 0; + df3->flag &= ~ME_FACE_SEL; +} + +static void remap_uvs_3_6_9_12(DerivedMesh *dm, DerivedMesh *split, int numlayer, int i, int cur, int c0, int c1, int c2, int c3) +{ + MTFace *mf, *df1, *df2, *df3; + int l; + + for(l=0; lfaceData, CD_MTFACE, l); + df1 = mf+cur; + df2 = df1 + 1; + df3 = df1 + 2; + mf = CustomData_get_layer_n(&dm->faceData, CD_MTFACE, l); + mf += i; + + copy_v2_v2(df1->uv[0], mf->uv[c0]); + INT_UV(df1->uv[1], c0, c1) + INT_UV(df1->uv[2], c1, c2) + copy_v2_v2(df1->uv[3], mf->uv[c2]); + + INT_UV(df2->uv[0], c0, c1) + copy_v2_v2(df2->uv[1], mf->uv[c1]); + INT_UV(df2->uv[2], c1, c2) + + copy_v2_v2(df3->uv[0], mf->uv[c0]); + copy_v2_v2(df3->uv[1], mf->uv[c2]); + copy_v2_v2(df3->uv[2], mf->uv[c3]); + } +} + +static void remap_faces_5_10(DerivedMesh *dm, DerivedMesh *split, MFace *mf, int *facepa, int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3, int v4) +{ + MFace *df1 = get_dface(dm, split, cur, i, mf); + MFace *df2 = get_dface(dm, split, cur+1, i, mf); + + facepa[cur] = vertpa[v1]; + df1->v1 = v1; + df1->v2 = v2; + df1->v3 = GET_ES(v2, v3) + df1->v4 = GET_ES(v1, v4) + df1->flag |= ME_FACE_SEL; + + facepa[cur+1] = vertpa[v3]; + df2->v1 = GET_ES(v1, v4) + df2->v2 = GET_ES(v2, v3) + df2->v3 = v3; + df2->v4 = v4; + df2->flag |= ME_FACE_SEL; +} + +static void remap_uvs_5_10(DerivedMesh *dm, DerivedMesh *split, int numlayer, int i, int cur, int c0, int c1, int c2, int c3) +{ + MTFace *mf, *df1, *df2; + int l; + + for(l=0; lfaceData, CD_MTFACE, l); + df1 = mf+cur; + df2 = df1 + 1; + mf = CustomData_get_layer_n(&dm->faceData, CD_MTFACE, l); + mf += i; + + copy_v2_v2(df1->uv[0], mf->uv[c0]); + copy_v2_v2(df1->uv[1], mf->uv[c1]); + INT_UV(df1->uv[2], c1, c2) + INT_UV(df1->uv[3], c0, c3) + + INT_UV(df2->uv[0], c0, c3) + INT_UV(df2->uv[1], c1, c2) + copy_v2_v2(df2->uv[2], mf->uv[c2]); + copy_v2_v2(df2->uv[3], mf->uv[c3]); + + } +} + +static void remap_faces_15(DerivedMesh *dm, DerivedMesh *split, MFace *mf, int *facepa, int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3, int v4) +{ + MFace *df1 = get_dface(dm, split, cur, i, mf); + MFace *df2 = get_dface(dm, split, cur+1, i, mf); + MFace *df3 = get_dface(dm, split, cur+2, i, mf); + MFace *df4 = get_dface(dm, split, cur+3, i, mf); + + facepa[cur] = vertpa[v1]; + df1->v1 = v1; + df1->v2 = GET_ES(v1, v2) + df1->v3 = GET_ES(v1, v3) + df1->v4 = GET_ES(v1, v4) + df1->flag |= ME_FACE_SEL; + + facepa[cur+1] = vertpa[v2]; + df2->v1 = GET_ES(v1, v2) + df2->v2 = v2; + df2->v3 = GET_ES(v2, v3) + df2->v4 = GET_ES(v1, v3) + df2->flag |= ME_FACE_SEL; + + facepa[cur+2] = vertpa[v3]; + df3->v1 = GET_ES(v1, v3) + df3->v2 = GET_ES(v2, v3) + df3->v3 = v3; + df3->v4 = GET_ES(v3, v4) + df3->flag |= ME_FACE_SEL; + + facepa[cur+3] = vertpa[v4]; + df4->v1 = GET_ES(v1, v4) + df4->v2 = GET_ES(v1, v3) + df4->v3 = GET_ES(v3, v4) + df4->v4 = v4; + df4->flag |= ME_FACE_SEL; +} + +static void remap_uvs_15(DerivedMesh *dm, DerivedMesh *split, int numlayer, int i, int cur, int c0, int c1, int c2, int c3) +{ + MTFace *mf, *df1, *df2, *df3, *df4; + int l; + + for(l=0; lfaceData, CD_MTFACE, l); + df1 = mf+cur; + df2 = df1 + 1; + df3 = df1 + 2; + df4 = df1 + 3; + mf = CustomData_get_layer_n(&dm->faceData, CD_MTFACE, l); + mf += i; + + copy_v2_v2(df1->uv[0], mf->uv[c0]); + INT_UV(df1->uv[1], c0, c1) + INT_UV(df1->uv[2], c0, c2) + INT_UV(df1->uv[3], c0, c3) + + INT_UV(df2->uv[0], c0, c1) + copy_v2_v2(df2->uv[1], mf->uv[c1]); + INT_UV(df2->uv[2], c1, c2) + INT_UV(df2->uv[3], c0, c2) + + INT_UV(df3->uv[0], c0, c2) + INT_UV(df3->uv[1], c1, c2) + copy_v2_v2(df3->uv[2], mf->uv[c2]); + INT_UV(df3->uv[3], c2, c3) + + INT_UV(df4->uv[0], c0, c3) + INT_UV(df4->uv[1], c0, c2) + INT_UV(df4->uv[2], c2, c3) + copy_v2_v2(df4->uv[3], mf->uv[c3]); + } +} + +static void remap_faces_7_11_13_14(DerivedMesh *dm, DerivedMesh *split, MFace *mf, int *facepa, int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3, int v4) +{ + MFace *df1 = get_dface(dm, split, cur, i, mf); + MFace *df2 = get_dface(dm, split, cur+1, i, mf); + MFace *df3 = get_dface(dm, split, cur+2, i, mf); + + facepa[cur] = vertpa[v1]; + df1->v1 = v1; + df1->v2 = GET_ES(v1, v2) + df1->v3 = GET_ES(v2, v3) + df1->v4 = GET_ES(v1, v4) + df1->flag |= ME_FACE_SEL; + + facepa[cur+1] = vertpa[v2]; + df2->v1 = GET_ES(v1, v2) + df2->v2 = v2; + df2->v3 = GET_ES(v2, v3) + df2->v4 = 0; + df2->flag &= ~ME_FACE_SEL; + + facepa[cur+2] = vertpa[v4]; + df3->v1 = GET_ES(v1, v4) + df3->v2 = GET_ES(v2, v3) + df3->v3 = v3; + df3->v4 = v4; + df3->flag |= ME_FACE_SEL; +} + +static void remap_uvs_7_11_13_14(DerivedMesh *dm, DerivedMesh *split, int numlayer, int i, int cur, int c0, int c1, int c2, int c3) +{ + MTFace *mf, *df1, *df2, *df3; + int l; + + for(l=0; lfaceData, CD_MTFACE, l); + df1 = mf+cur; + df2 = df1 + 1; + df3 = df1 + 2; + mf = CustomData_get_layer_n(&dm->faceData, CD_MTFACE, l); + mf += i; + + copy_v2_v2(df1->uv[0], mf->uv[c0]); + INT_UV(df1->uv[1], c0, c1) + INT_UV(df1->uv[2], c1, c2) + INT_UV(df1->uv[3], c0, c3) + + INT_UV(df2->uv[0], c0, c1) + copy_v2_v2(df2->uv[1], mf->uv[c1]); + INT_UV(df2->uv[2], c1, c2) + + INT_UV(df3->uv[0], c0, c3) + INT_UV(df3->uv[1], c1, c2) + copy_v2_v2(df3->uv[2], mf->uv[c2]); + copy_v2_v2(df3->uv[3], mf->uv[c3]); + } +} + +static void remap_faces_19_21_22(DerivedMesh *dm, DerivedMesh *split, MFace *mf, int *facepa, int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3) +{ + MFace *df1 = get_dface(dm, split, cur, i, mf); + MFace *df2 = get_dface(dm, split, cur+1, i, mf); + + facepa[cur] = vertpa[v1]; + df1->v1 = v1; + df1->v2 = GET_ES(v1, v2) + df1->v3 = GET_ES(v1, v3) + df1->v4 = 0; + df1->flag &= ~ME_FACE_SEL; + + facepa[cur+1] = vertpa[v2]; + df2->v1 = GET_ES(v1, v2) + df2->v2 = v2; + df2->v3 = v3; + df2->v4 = GET_ES(v1, v3) + df2->flag |= ME_FACE_SEL; +} + +static void remap_uvs_19_21_22(DerivedMesh *dm, DerivedMesh *split, int numlayer, int i, int cur, int c0, int c1, int c2) +{ + MTFace *mf, *df1, *df2; + int l; + + for(l=0; lfaceData, CD_MTFACE, l); + df1 = mf+cur; + df2 = df1 + 1; + mf = CustomData_get_layer_n(&dm->faceData, CD_MTFACE, l); + mf += i; + + copy_v2_v2(df1->uv[0], mf->uv[c0]); + INT_UV(df1->uv[1], c0, c1) + INT_UV(df1->uv[2], c0, c2) + + INT_UV(df2->uv[0], c0, c1) + copy_v2_v2(df2->uv[1], mf->uv[c1]); + copy_v2_v2(df2->uv[2], mf->uv[c2]); + INT_UV(df2->uv[3], c0, c2) + } +} + +static void remap_faces_23(DerivedMesh *dm, DerivedMesh *split, MFace *mf, int *facepa, int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3) +{ + MFace *df1 = get_dface(dm, split, cur, i, mf); + MFace *df2 = get_dface(dm, split, cur+1, i, mf); + MFace *df3 = get_dface(dm, split, cur+2, i, mf); + + facepa[cur] = vertpa[v1]; + df1->v1 = v1; + df1->v2 = GET_ES(v1, v2) + df1->v3 = GET_ES(v2, v3) + df1->v4 = GET_ES(v1, v3) + df1->flag |= ME_FACE_SEL; + + facepa[cur+1] = vertpa[v2]; + df2->v1 = GET_ES(v1, v2) + df2->v2 = v2; + df2->v3 = GET_ES(v2, v3) + df2->v4 = 0; + df2->flag &= ~ME_FACE_SEL; + + facepa[cur+2] = vertpa[v3]; + df3->v1 = GET_ES(v1, v3) + df3->v2 = GET_ES(v2, v3) + df3->v3 = v3; + df3->v4 = 0; + df3->flag &= ~ME_FACE_SEL; +} + +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; + int l; + + for(l=0; lfaceData, CD_MTFACE, l); + df1 = mf+cur; + df2 = df1 + 1; + df3 = df1 + 2; + mf = CustomData_get_layer_n(&dm->faceData, CD_MTFACE, l); + mf += i; + + copy_v2_v2(df1->uv[0], mf->uv[c0]); + INT_UV(df1->uv[1], c0, c1) + INT_UV(df1->uv[2], c1, c2) + INT_UV(df1->uv[3], c0, c2) + + INT_UV(df2->uv[0], c0, c1) + copy_v2_v2(df2->uv[1], mf->uv[c1]); + INT_UV(df2->uv[2], c1, c2) + + INT_UV(df2->uv[0], c0, c2) + INT_UV(df2->uv[1], c1, c2) + copy_v2_v2(df2->uv[2], mf->uv[c2]); + } +} + +static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm){ DerivedMesh *splitdm; - MFace *mf=0,*df1=0,*df2=0,*df3=0; + MFace *mf=NULL,*df1=NULL,*df2=NULL,*df3=NULL,*df4=NULL; MFace *mface=dm->getFaceArray(dm); + MTFace *mtf = NULL, *dtf1=NULL, *dtf2=NULL, *dtf3=NULL, *dtf4=NULL; MVert *dupve, *mv; EdgeHash *edgehash; EdgeHashIterator *ehi; @@ -199,7 +554,8 @@ static DerivedMesh * splitEdges(ExplodeModifierData *emd, DerivedMesh *dm){ int *vertpa = MEM_callocN(sizeof(int)*totvert,"explode_vertpa2"); int *facepa = emd->facepa; int *fs, totesplit=0,totfsplit=0,totin=0,curdupface=0,curdupin=0; - int i,j,v1,v2,v3,v4,esplit; + int i,j,v1,v2,v3,v4,esplit, v[4], uv[4]; + int numlayer; edgehash= BLI_edgehash_new(); @@ -214,52 +570,48 @@ static DerivedMesh * splitEdges(ExplodeModifierData *emd, DerivedMesh *dm){ /* mark edges for splitting and how to split faces */ for (i=0,mf=mface,fs=facesplit; iv4){ - v1=vertpa[mf->v1]; - v2=vertpa[mf->v2]; - v3=vertpa[mf->v3]; - v4=vertpa[mf->v4]; + v1=vertpa[mf->v1]; + v2=vertpa[mf->v2]; + v3=vertpa[mf->v3]; - if(v1!=v2){ - BLI_edgehash_insert(edgehash, mf->v1, mf->v2, NULL); - (*fs)++; - } + if(v1!=v2){ + BLI_edgehash_insert(edgehash, mf->v1, mf->v2, NULL); + (*fs) |= 1; + } - if(v2!=v3){ - BLI_edgehash_insert(edgehash, mf->v2, mf->v3, NULL); - (*fs)++; - } + if(v2!=v3){ + BLI_edgehash_insert(edgehash, mf->v2, mf->v3, NULL); + (*fs) |= 2; + } + + if(mf->v4){ + v4=vertpa[mf->v4]; if(v3!=v4){ BLI_edgehash_insert(edgehash, mf->v3, mf->v4, NULL); - (*fs)++; + (*fs) |= 4; } if(v1!=v4){ BLI_edgehash_insert(edgehash, mf->v1, mf->v4, NULL); - (*fs)++; + (*fs) |= 8; } - if(*fs==2){ - if((v1==v2 && v3==v4) || (v1==v4 && v2==v3)) - *fs=1; - else if(v1!=v2){ - if(v1!=v4) - BLI_edgehash_insert(edgehash, mf->v2, mf->v3, NULL); - else - BLI_edgehash_insert(edgehash, mf->v3, mf->v4, NULL); - } - else{ - if(v1!=v4) - BLI_edgehash_insert(edgehash, mf->v1, mf->v2, NULL); - else - BLI_edgehash_insert(edgehash, mf->v1, mf->v4, NULL); - } + /* mark center vertex as a fake edge split */ + if(*fs == 15) + BLI_edgehash_insert(edgehash, mf->v1, mf->v3, NULL); + } + else { + (*fs) |= 16; /* mark face as tri */ + + if(v1!=v3){ + BLI_edgehash_insert(edgehash, mf->v1, mf->v3, NULL); + (*fs) |= 4; } } } - /* count splits & reindex */ + /* count splits & create indexes for new verts */ ehi= BLI_edgehashIterator_new(edgehash); totesplit=totvert; for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) { @@ -269,24 +621,11 @@ static DerivedMesh * splitEdges(ExplodeModifierData *emd, DerivedMesh *dm){ BLI_edgehashIterator_free(ehi); /* count new faces due to splitting */ - for(i=0,fs=facesplit; igetFaceData(dm,i,CD_MFACE);//CDDM_get_face(dm,i); - - if(vertpa[mf->v1]!=vertpa[mf->v2] && vertpa[mf->v2]!=vertpa[mf->v3]) - totin++; - } - } + for(i=0,fs=facesplit; igetNumEdges(dm),totface+totfsplit); + splitdm= CDDM_from_template(dm, totesplit, 0, totface+totfsplit); + numlayer = CustomData_number_of_layers(&splitdm->faceData, CD_MTFACE); /* copy new faces & verts (is it really this painful with custom data??) */ for(i=0; igetFace(dm, i, &source); - dest = CDDM_get_face(splitdm, i); - - DM_copy_face_data(dm, splitdm, i, i, 1); - *dest = source; - } /* override original facepa (original pointer is saved in caller function) */ facepa= MEM_callocN(sizeof(int)*(totface+totfsplit),"explode_facepa"); - memcpy(facepa,emd->facepa,totface*sizeof(int)); + //memcpy(facepa,emd->facepa,totface*sizeof(int)); emd->facepa=facepa; /* create new verts */ @@ -333,320 +663,101 @@ static DerivedMesh * splitEdges(ExplodeModifierData *emd, DerivedMesh *dm){ BLI_edgehashIterator_free(ehi); /* create new faces */ - curdupface=totface; - curdupin=totesplit; + curdupface=0;//=totface; + //curdupin=totesplit; for(i=0,fs=facesplit; iv1]; - v2=vertpa[mf->v2]; - v3=vertpa[mf->v3]; - v4=vertpa[mf->v4]; - /* ouch! creating new faces & remapping them to new verts is no fun */ - if(*fs==1){ - df1=CDDM_get_face(splitdm,curdupface); - DM_copy_face_data(splitdm,splitdm,i,curdupface,1); - *df1=*mf; - curdupface++; - - if(v1==v2){ - df1->v1=edgesplit_get(edgehash, mf->v1, mf->v4); - df1->v2=edgesplit_get(edgehash, mf->v2, mf->v3); - mf->v3=df1->v2; - mf->v4=df1->v1; - } - else{ - df1->v1=edgesplit_get(edgehash, mf->v1, mf->v2); - df1->v4=edgesplit_get(edgehash, mf->v3, mf->v4); - mf->v2=df1->v1; - mf->v3=df1->v4; - } - - facepa[i]=v1; - facepa[curdupface-1]=v3; - - test_index_face(df1, &splitdm->faceData, curdupface, (df1->v4 ? 4 : 3)); - } - if(*fs==2){ - df1=CDDM_get_face(splitdm,curdupface); - DM_copy_face_data(splitdm,splitdm,i,curdupface,1); - *df1=*mf; - curdupface++; - - df2=CDDM_get_face(splitdm,curdupface); - DM_copy_face_data(splitdm,splitdm,i,curdupface,1); - *df2=*mf; - curdupface++; - - if(v1!=v2){ - if(v1!=v4){ - df1->v1=edgesplit_get(edgehash, mf->v1, mf->v4); - df1->v2=edgesplit_get(edgehash, mf->v1, mf->v2); - df2->v1=df1->v3=mf->v2; - df2->v3=df1->v4=mf->v4; - df2->v2=mf->v3; - - mf->v2=df1->v2; - mf->v3=df1->v1; - - df2->v4=mf->v4=0; - - facepa[i]=v1; - } - else{ - df1->v2=edgesplit_get(edgehash, mf->v1, mf->v2); - df1->v3=edgesplit_get(edgehash, mf->v2, mf->v3); - df1->v4=mf->v3; - df2->v2=mf->v3; - df2->v3=mf->v4; - - mf->v1=df1->v2; - mf->v3=df1->v3; - - df2->v4=mf->v4=0; - - facepa[i]=v2; - } - facepa[curdupface-1]=facepa[curdupface-2]=v3; - } - else{ - if(v1!=v4){ - df1->v3=edgesplit_get(edgehash, mf->v3, mf->v4); - df1->v4=edgesplit_get(edgehash, mf->v1, mf->v4); - df1->v2=mf->v3; - - mf->v1=df1->v4; - mf->v2=df1->v3; - mf->v3=mf->v4; - - df2->v4=mf->v4=0; - - facepa[i]=v4; - } - else{ - df1->v3=edgesplit_get(edgehash, mf->v2, mf->v3); - df1->v4=edgesplit_get(edgehash, mf->v3, mf->v4); - df1->v1=mf->v4; - df1->v2=mf->v2; - df2->v3=mf->v4; - - mf->v1=df1->v4; - mf->v2=df1->v3; - - df2->v4=mf->v4=0; - - facepa[i]=v3; - } - - facepa[curdupface-1]=facepa[curdupface-2]=v1; - } - - test_index_face(df1, &splitdm->faceData, curdupface-2, (df1->v4 ? 4 : 3)); - test_index_face(df1, &splitdm->faceData, curdupface-1, (df1->v4 ? 4 : 3)); - } - else if(*fs==3){ - df1=CDDM_get_face(splitdm,curdupface); - DM_copy_face_data(splitdm,splitdm,i,curdupface,1); - *df1=*mf; - curdupface++; - - df2=CDDM_get_face(splitdm,curdupface); - DM_copy_face_data(splitdm,splitdm,i,curdupface,1); - *df2=*mf; - curdupface++; - - df3=CDDM_get_face(splitdm,curdupface); - DM_copy_face_data(splitdm,splitdm,i,curdupface,1); - *df3=*mf; - curdupface++; - - if(v1==v2){ - df2->v1=df1->v1=edgesplit_get(edgehash, mf->v1, mf->v4); - df3->v1=df1->v2=edgesplit_get(edgehash, mf->v2, mf->v3); - df3->v3=df2->v2=df1->v3=edgesplit_get(edgehash, mf->v3, mf->v4); - df3->v2=mf->v3; - df2->v3=mf->v4; - df1->v4=df2->v4=df3->v4=0; - - mf->v3=df1->v2; - mf->v4=df1->v1; - - facepa[i]=facepa[curdupface-3]=v1; - facepa[curdupface-1]=v3; - facepa[curdupface-2]=v4; - } - else if(v2==v3){ - df3->v1=df2->v3=df1->v1=edgesplit_get(edgehash, mf->v1, mf->v4); - df2->v2=df1->v2=edgesplit_get(edgehash, mf->v1, mf->v2); - df3->v2=df1->v3=edgesplit_get(edgehash, mf->v3, mf->v4); - - df3->v3=mf->v4; - df2->v1=mf->v1; - df1->v4=df2->v4=df3->v4=0; - - mf->v1=df1->v2; - mf->v4=df1->v3; - - facepa[i]=facepa[curdupface-3]=v2; - facepa[curdupface-1]=v4; - facepa[curdupface-2]=v1; - } - else if(v3==v4){ - df3->v2=df2->v1=df1->v1=edgesplit_get(edgehash, mf->v1, mf->v2); - df2->v3=df1->v2=edgesplit_get(edgehash, mf->v2, mf->v3); - df3->v3=df1->v3=edgesplit_get(edgehash, mf->v1, mf->v4); - - df3->v1=mf->v1; - df2->v2=mf->v2; - df1->v4=df2->v4=df3->v4=0; - - mf->v1=df1->v3; - mf->v2=df1->v2; - - facepa[i]=facepa[curdupface-3]=v3; - facepa[curdupface-1]=v1; - facepa[curdupface-2]=v2; - } - else{ - df3->v1=df1->v1=edgesplit_get(edgehash, mf->v1, mf->v2); - df3->v3=df2->v1=df1->v2=edgesplit_get(edgehash, mf->v2, mf->v3); - df2->v3=df1->v3=edgesplit_get(edgehash, mf->v3, mf->v4); - - df3->v2=mf->v2; - df2->v2=mf->v3; - df1->v4=df2->v4=df3->v4=0; - - mf->v2=df1->v1; - mf->v3=df1->v3; - - facepa[i]=facepa[curdupface-3]=v1; - facepa[curdupface-1]=v2; - facepa[curdupface-2]=v3; - } - - test_index_face(df1, &splitdm->faceData, curdupface-3, (df1->v4 ? 4 : 3)); - test_index_face(df1, &splitdm->faceData, curdupface-2, (df1->v4 ? 4 : 3)); - test_index_face(df1, &splitdm->faceData, curdupface-1, (df1->v4 ? 4 : 3)); - } - else if(*fs==4){ - if(v1!=v2 && v2!=v3){ - - /* set new vert to face center */ - mv=CDDM_get_vert(splitdm,mf->v1); - dupve=CDDM_get_vert(splitdm,curdupin); - DM_copy_vert_data(splitdm,splitdm,mf->v1,curdupin,1); - *dupve=*mv; - - mv=CDDM_get_vert(splitdm,mf->v2); - VECADD(dupve->co,dupve->co,mv->co); - mv=CDDM_get_vert(splitdm,mf->v3); - VECADD(dupve->co,dupve->co,mv->co); - mv=CDDM_get_vert(splitdm,mf->v4); - VECADD(dupve->co,dupve->co,mv->co); - mul_v3_fl(dupve->co,0.25); - - - df1=CDDM_get_face(splitdm,curdupface); - DM_copy_face_data(splitdm,splitdm,i,curdupface,1); - *df1=*mf; - curdupface++; - - df2=CDDM_get_face(splitdm,curdupface); - DM_copy_face_data(splitdm,splitdm,i,curdupface,1); - *df2=*mf; - curdupface++; - - df3=CDDM_get_face(splitdm,curdupface); - DM_copy_face_data(splitdm,splitdm,i,curdupface,1); - *df3=*mf; - curdupface++; - - df1->v1=edgesplit_get(edgehash, mf->v1, mf->v2); - df3->v2=df1->v3=edgesplit_get(edgehash, mf->v2, mf->v3); - - df2->v1=edgesplit_get(edgehash, mf->v1, mf->v4); - df3->v4=df2->v3=edgesplit_get(edgehash, mf->v3, mf->v4); - - df3->v1=df2->v2=df1->v4=curdupin; - - mf->v2=df1->v1; - mf->v3=curdupin; - mf->v4=df2->v1; - - curdupin++; - - facepa[i]=v1; - facepa[curdupface-3]=v2; - facepa[curdupface-2]=v3; - facepa[curdupface-1]=v4; - - test_index_face(df1, &splitdm->faceData, curdupface-3, (df1->v4 ? 4 : 3)); - - test_index_face(df1, &splitdm->faceData, curdupface-2, (df1->v4 ? 4 : 3)); - test_index_face(df1, &splitdm->faceData, curdupface-1, (df1->v4 ? 4 : 3)); - } - else{ - df1=CDDM_get_face(splitdm,curdupface); - DM_copy_face_data(splitdm,splitdm,i,curdupface,1); - *df1=*mf; - curdupface++; - - df2=CDDM_get_face(splitdm,curdupface); - DM_copy_face_data(splitdm,splitdm,i,curdupface,1); - *df2=*mf; - curdupface++; - - df3=CDDM_get_face(splitdm,curdupface); - DM_copy_face_data(splitdm,splitdm,i,curdupface,1); - *df3=*mf; - curdupface++; - - if(v2==v3){ - df1->v1=edgesplit_get(edgehash, mf->v1, mf->v2); - df3->v1=df1->v2=df1->v3=edgesplit_get(edgehash, mf->v2, mf->v3); - df2->v1=df1->v4=edgesplit_get(edgehash, mf->v1, mf->v4); - - df3->v3=df2->v3=edgesplit_get(edgehash, mf->v3, mf->v4); - - df3->v2=mf->v3; - df3->v4=0; - - mf->v2=df1->v1; - mf->v3=df1->v4; - mf->v4=0; - - facepa[i]=v1; - facepa[curdupface-3]=facepa[curdupface-2]=v2; - facepa[curdupface-1]=v3; - } - else{ - df3->v1=df2->v1=df1->v2=edgesplit_get(edgehash, mf->v1, mf->v2); - df2->v4=df1->v3=edgesplit_get(edgehash, mf->v3, mf->v4); - df1->v4=edgesplit_get(edgehash, mf->v1, mf->v4); - - df3->v3=df2->v2=edgesplit_get(edgehash, mf->v2, mf->v3); - - df3->v4=0; - - mf->v1=df1->v4; - mf->v2=df1->v3; - mf->v3=mf->v4; - mf->v4=0; - - facepa[i]=v4; - facepa[curdupface-3]=facepa[curdupface-2]=v1; - facepa[curdupface-1]=v2; - } - - test_index_face(df1, &splitdm->faceData, curdupface-3, (df1->v4 ? 4 : 3)); - test_index_face(df1, &splitdm->faceData, curdupface-2, (df1->v4 ? 4 : 3)); - test_index_face(df1, &splitdm->faceData, curdupface-1, (df1->v4 ? 4 : 3)); - } - } + mf = dm->getFaceData(dm, i, CD_MFACE); + + switch(*fs) { + case 3: + case 10: + case 11: + case 15: + SET_VERTS(1, 2, 3, 4) + break; + case 5: + case 6: + case 7: + SET_VERTS(2, 3, 4, 1) + break; + case 9: + case 13: + SET_VERTS(4, 1, 2, 3) + break; + case 12: + case 14: + SET_VERTS(3, 4, 1, 2) + break; + case 21: + case 23: + SET_VERTS(1, 2, 3, 4) + break; + case 19: + SET_VERTS(2, 3, 1, 4) + break; + case 22: + SET_VERTS(3, 1, 2, 4) + break; + } - test_index_face(df1, &splitdm->faceData, i, (df1->v4 ? 4 : 3)); + switch(*fs) { + case 3: + case 6: + case 9: + case 12: + remap_faces_3_6_9_12(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]); + if(numlayer) + remap_uvs_3_6_9_12(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]); + break; + case 5: + case 10: + remap_faces_5_10(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]); + if(numlayer) + remap_uvs_5_10(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]); + break; + case 15: + remap_faces_15(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]); + if(numlayer) + remap_uvs_15(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]); + break; + case 7: + case 11: + case 13: + case 14: + remap_faces_7_11_13_14(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]); + if(numlayer) + remap_uvs_7_11_13_14(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]); + break; + case 19: + case 21: + case 22: + remap_faces_19_21_22(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2]); + if(numlayer) + remap_uvs_19_21_22(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2]); + break; + case 23: + remap_faces_23(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2]); + if(numlayer) + remap_uvs_23(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2]); + break; + case 0: + case 16: + df1 = get_dface(dm, splitdm, curdupface, i, mf); + facepa[curdupface] = vertpa[mf->v1]; + + if(df1->v4) + df1->flag |= ME_FACE_SEL; + else + df1->flag &= ~ME_FACE_SEL; + break; } + + curdupface += add_faces[*fs]+1; + } + + for(i=0; ifaceData, i, (mf->flag & ME_FACE_SEL ? 4 : 3)); } BLI_edgehash_free(edgehash, NULL); @@ -675,6 +786,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, int *facepa=emd->facepa; int totdup=0,totvert=0,totface=0,totpart=0; int i, j, v, mindex=0; + MTFace *mtface = NULL, *mtf; totface= dm->getNumFaces(dm); totvert= dm->getNumVerts(dm); @@ -724,6 +836,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, /* the final duplicated vertices */ explode= CDDM_from_template(dm, totdup, 0,totface); + mtface = CustomData_get_layer_named(&explode->faceData, CD_MTFACE, emd->uvname); /*dupvert= CDDM_get_verts(explode);*/ /* getting back to object space */ @@ -800,16 +913,28 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, else mindex = totvert+facepa[i]; - source.v1 = edgesplit_get(vertpahash, source.v1, mindex); - source.v2 = edgesplit_get(vertpahash, source.v2, mindex); - source.v3 = edgesplit_get(vertpahash, source.v3, mindex); + source.v1 = edgecut_get(vertpahash, source.v1, mindex); + source.v2 = edgecut_get(vertpahash, source.v2, mindex); + source.v3 = edgecut_get(vertpahash, source.v3, mindex); if(source.v4) - source.v4 = edgesplit_get(vertpahash, source.v4, mindex); + source.v4 = edgecut_get(vertpahash, source.v4, mindex); DM_copy_face_data(dm,explode,i,i,1); *mf = source; + /* override uv channel for particle age */ + if(mtface) { + float age = (cfra - pa->time)/pa->lifetime; + /* Clamp to this range to avoid flipping to the other side of the coordinates. */ + CLAMP(age, 0.001f, 0.999f); + + mtf = mtface + i; + + mtf->uv[0][0] = mtf->uv[1][0] = mtf->uv[2][0] = mtf->uv[3][0] = age; + mtf->uv[0][1] = mtf->uv[1][1] = mtf->uv[2][1] = mtf->uv[3][1] = 0.5f; + } + test_index_face(mf, &explode->faceData, i, (orig_v4 ? 4 : 3)); } @@ -870,9 +995,9 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob, createFacepa(emd,psmd,derivedData); } /* 2. create new mesh */ - if(emd->flag & eExplodeFlag_EdgeSplit){ + if(emd->flag & eExplodeFlag_EdgeCut){ int *facepa = emd->facepa; - DerivedMesh *splitdm=splitEdges(emd,dm); + DerivedMesh *splitdm=cutEdges(emd,dm); DerivedMesh *explode=explodeMesh(emd, psmd, md->scene, ob, splitdm); MEM_freeN(emd->facepa); -- cgit v1.2.3 From b357033f5e7b0c39586f53512f47a3df23ba914e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 24 Feb 2011 05:41:03 +0000 Subject: remove unused vars. --- source/blender/modifiers/intern/MOD_explode.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index a0a658031f0..b29f0ecc39f 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -541,9 +541,8 @@ static void remap_uvs_23(DerivedMesh *dm, DerivedMesh *split, int numlayer, int static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm){ DerivedMesh *splitdm; - MFace *mf=NULL,*df1=NULL,*df2=NULL,*df3=NULL,*df4=NULL; + MFace *mf=NULL,*df1=NULL; MFace *mface=dm->getFaceArray(dm); - MTFace *mtf = NULL, *dtf1=NULL, *dtf2=NULL, *dtf3=NULL, *dtf4=NULL; MVert *dupve, *mv; EdgeHash *edgehash; EdgeHashIterator *ehi; @@ -553,7 +552,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm){ int *facesplit = MEM_callocN(sizeof(int)*totface,"explode_facesplit"); int *vertpa = MEM_callocN(sizeof(int)*totvert,"explode_vertpa2"); int *facepa = emd->facepa; - int *fs, totesplit=0,totfsplit=0,totin=0,curdupface=0,curdupin=0; + int *fs, totesplit=0,totfsplit=0,curdupface=0; int i,j,v1,v2,v3,v4,esplit, v[4], uv[4]; int numlayer; -- cgit v1.2.3 From caa7bea1c591277556b5cf3a076e90f1804a84f6 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Fri, 25 Feb 2011 13:57:17 +0000 Subject: doxygendoxygen: blender/modifiers tagged. --- source/blender/modifiers/intern/MOD_armature.c | 5 +++++ source/blender/modifiers/intern/MOD_array.c | 5 +++++ source/blender/modifiers/intern/MOD_bevel.c | 5 +++++ source/blender/modifiers/intern/MOD_boolean.c | 5 +++++ source/blender/modifiers/intern/MOD_boolean_util.c | 5 +++++ source/blender/modifiers/intern/MOD_boolean_util.h | 5 +++++ source/blender/modifiers/intern/MOD_build.c | 5 +++++ source/blender/modifiers/intern/MOD_cast.c | 5 +++++ source/blender/modifiers/intern/MOD_cloth.c | 5 +++++ source/blender/modifiers/intern/MOD_collision.c | 5 +++++ source/blender/modifiers/intern/MOD_curve.c | 5 +++++ source/blender/modifiers/intern/MOD_decimate.c | 5 +++++ source/blender/modifiers/intern/MOD_displace.c | 5 +++++ source/blender/modifiers/intern/MOD_edgesplit.c | 5 +++++ source/blender/modifiers/intern/MOD_explode.c | 5 +++++ source/blender/modifiers/intern/MOD_fluidsim.c | 5 +++++ source/blender/modifiers/intern/MOD_fluidsim_util.c | 5 +++++ source/blender/modifiers/intern/MOD_fluidsim_util.h | 5 +++++ source/blender/modifiers/intern/MOD_hook.c | 5 +++++ source/blender/modifiers/intern/MOD_lattice.c | 5 +++++ source/blender/modifiers/intern/MOD_mask.c | 5 +++++ source/blender/modifiers/intern/MOD_meshdeform.c | 5 +++++ source/blender/modifiers/intern/MOD_mirror.c | 5 +++++ source/blender/modifiers/intern/MOD_multires.c | 5 +++++ source/blender/modifiers/intern/MOD_none.c | 5 +++++ source/blender/modifiers/intern/MOD_particleinstance.c | 5 +++++ source/blender/modifiers/intern/MOD_particlesystem.c | 5 +++++ source/blender/modifiers/intern/MOD_screw.c | 5 +++++ source/blender/modifiers/intern/MOD_shapekey.c | 5 +++++ source/blender/modifiers/intern/MOD_shrinkwrap.c | 5 +++++ source/blender/modifiers/intern/MOD_simpledeform.c | 5 +++++ source/blender/modifiers/intern/MOD_smoke.c | 5 +++++ source/blender/modifiers/intern/MOD_smooth.c | 5 +++++ source/blender/modifiers/intern/MOD_softbody.c | 5 +++++ source/blender/modifiers/intern/MOD_solidify.c | 5 +++++ source/blender/modifiers/intern/MOD_subsurf.c | 5 +++++ source/blender/modifiers/intern/MOD_surface.c | 5 +++++ source/blender/modifiers/intern/MOD_util.c | 5 +++++ source/blender/modifiers/intern/MOD_util.h | 5 +++++ source/blender/modifiers/intern/MOD_uvproject.c | 5 +++++ source/blender/modifiers/intern/MOD_wave.c | 5 +++++ 41 files changed, 205 insertions(+) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index ac25987871d..fa39c197c7b 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_armature.c + * \ingroup modifiers + */ + + #include #include "DNA_armature_types.h" diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 6c729c8519f..0a8caee5241 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_array.c + * \ingroup modifiers + */ + + /* Array modifier: duplicates the object multiple times along an axis */ #include "MEM_guardedalloc.h" diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 09e5016cb2b..a1bd3abc176 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -29,6 +29,11 @@ * ***** END GPL LICENSE BLOCK ***** * */ + +/** \file blender/modifiers/intern/MOD_bevel.c + * \ingroup modifiers + */ + #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 3aa5bff5f61..d4be9d3d03a 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_boolean.c + * \ingroup modifiers + */ + + #include "DNA_object_types.h" #include "BLI_utildefines.h" diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index e4526a359e4..9d83e351b2b 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -28,6 +28,11 @@ * CSG operations. */ +/** \file blender/modifiers/intern/MOD_boolean_util.c + * \ingroup modifiers + */ + + #include "DNA_material_types.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" diff --git a/source/blender/modifiers/intern/MOD_boolean_util.h b/source/blender/modifiers/intern/MOD_boolean_util.h index 5aef8fe6bc8..2a4191de407 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.h +++ b/source/blender/modifiers/intern/MOD_boolean_util.h @@ -27,6 +27,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/modifiers/intern/MOD_boolean_util.h + * \ingroup modifiers + */ + + #ifndef MOD_BOOLEAN_UTILS_H #define MOD_BOOLEAN_UTILS_H diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index bc59c2cba0b..0d04476c618 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_build.c + * \ingroup modifiers + */ + + #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index 17c2ec40b7e..68e9e173ee6 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_cast.c + * \ingroup modifiers + */ + + #include "DNA_meshdata_types.h" #include "DNA_object_types.h" diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index bb1fc67ef8b..999349dca7f 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_cloth.c + * \ingroup modifiers + */ + + #include "DNA_cloth_types.h" #include "DNA_scene_types.h" #include "DNA_object_types.h" diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 106e8b3957a..e1371b3b86c 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_collision.c + * \ingroup modifiers + */ + + #include "DNA_scene_types.h" #include "DNA_object_types.h" #include "DNA_meshdata_types.h" diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index d458d026c61..84fee7b5102 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_curve.c + * \ingroup modifiers + */ + + #include #include "DNA_scene_types.h" diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index e90a6ea2ac4..64d6b72a176 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_decimate.c + * \ingroup modifiers + */ + + #include "DNA_meshdata_types.h" #include "BLI_math.h" diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 919814edf59..2ab6921dc8a 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_displace.c + * \ingroup modifiers + */ + + #include "DNA_meshdata_types.h" #include "DNA_object_types.h" diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index 22b7e72adfc..05e195d9b8f 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_edgesplit.c + * \ingroup modifiers + */ + + /* EdgeSplit modifier: Splits edges in the mesh according to sharpness flag * or edge angle (can be used to achieve autosmoothing) */ diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index b29f0ecc39f..aea6997c5d5 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_explode.c + * \ingroup modifiers + */ + + #include "DNA_meshdata_types.h" #include "DNA_scene_types.h" diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c index 9a1635e3dad..1cce9863ccc 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim.c +++ b/source/blender/modifiers/intern/MOD_fluidsim.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_fluidsim.c + * \ingroup modifiers + */ + + #include "DNA_scene_types.h" #include "DNA_object_fluidsim.h" #include "DNA_object_types.h" diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index fdf3209b500..02912e38204 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_fluidsim_util.c + * \ingroup modifiers + */ + + #include #include diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.h b/source/blender/modifiers/intern/MOD_fluidsim_util.h index 29f3a1b77ae..f8af8e6f583 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.h +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.h @@ -27,6 +27,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/modifiers/intern/MOD_fluidsim_util.h + * \ingroup modifiers + */ + + #ifndef MOD_FLUIDSIM_UTIL_H #define MOD_FLUIDSIM_UTIL_H diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 59c45eb2eec..2a85378f987 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_hook.c + * \ingroup modifiers + */ + + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index c5fb87c8ffc..22427d04338 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_lattice.c + * \ingroup modifiers + */ + + #include #include "DNA_object_types.h" diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index 19d9c7c9dd8..9519e5b9131 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_mask.c + * \ingroup modifiers + */ + + #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index 61e7f950e0f..a6b4a5dabcd 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_meshdeform.c + * \ingroup modifiers + */ + + #include "DNA_meshdata_types.h" #include "DNA_object_types.h" diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index 007d8eb5197..cf31e86a2f5 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_mirror.c + * \ingroup modifiers + */ + + #include "DNA_meshdata_types.h" #include "DNA_object_types.h" diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 3b2c552bb9f..7653511da10 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_multires.c + * \ingroup modifiers + */ + + #include #include "BKE_cdderivedmesh.h" diff --git a/source/blender/modifiers/intern/MOD_none.c b/source/blender/modifiers/intern/MOD_none.c index d9e25394686..bebb9b58774 100644 --- a/source/blender/modifiers/intern/MOD_none.c +++ b/source/blender/modifiers/intern/MOD_none.c @@ -34,6 +34,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/modifiers/intern/MOD_none.c + * \ingroup modifiers + */ + + #include "BLI_utildefines.h" diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index 739d7aa0e6d..1fa0ff7beed 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_particleinstance.c + * \ingroup modifiers + */ + + #include "DNA_meshdata_types.h" #include "MEM_guardedalloc.h" diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 2f3bc0c53f4..a23a53335ef 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_particlesystem.c + * \ingroup modifiers + */ + + #include "stddef.h" #include "DNA_material_types.h" diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 7bbb07eb658..ac48a9682a1 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_screw.c + * \ingroup modifiers + */ + + /* Screw modifier: revolves the edges about an axis */ #include "DNA_meshdata_types.h" diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c index a2fd83b8bcb..94d23de6573 100644 --- a/source/blender/modifiers/intern/MOD_shapekey.c +++ b/source/blender/modifiers/intern/MOD_shapekey.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_shapekey.c + * \ingroup modifiers + */ + + #include "BLI_math.h" #include "DNA_key_types.h" diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index c7f15a94bf2..cfd12833a38 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_shrinkwrap.c + * \ingroup modifiers + */ + + #include #include "BLI_string.h" diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 9add0e9a67d..0150322ae8c 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_simpledeform.c + * \ingroup modifiers + */ + + #include "DNA_meshdata_types.h" #include "DNA_object_types.h" diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c index 0227d2008e5..46f0483dbff 100644 --- a/source/blender/modifiers/intern/MOD_smoke.c +++ b/source/blender/modifiers/intern/MOD_smoke.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_smoke.c + * \ingroup modifiers + */ + + #include "stddef.h" #include "MEM_guardedalloc.h" diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index 7761995a419..526b54d1cf8 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_smooth.c + * \ingroup modifiers + */ + + #include "DNA_meshdata_types.h" #include "BLI_math.h" diff --git a/source/blender/modifiers/intern/MOD_softbody.c b/source/blender/modifiers/intern/MOD_softbody.c index 7322628267c..0abf2fa6281 100644 --- a/source/blender/modifiers/intern/MOD_softbody.c +++ b/source/blender/modifiers/intern/MOD_softbody.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_softbody.c + * \ingroup modifiers + */ + + #include "DNA_scene_types.h" #include "BLI_utildefines.h" diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index edf149c1580..14a07b62a91 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_solidify.c + * \ingroup modifiers + */ + + #include "DNA_meshdata_types.h" #include "BLI_math.h" diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index 4ba139305d8..823cc03cff2 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_subsurf.c + * \ingroup modifiers + */ + + #include "stddef.h" #include "DNA_scene_types.h" diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c index b5d25d8e146..e0bdb063331 100644 --- a/source/blender/modifiers/intern/MOD_surface.c +++ b/source/blender/modifiers/intern/MOD_surface.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_surface.c + * \ingroup modifiers + */ + + #include "DNA_scene_types.h" #include "DNA_object_types.h" #include "DNA_meshdata_types.h" diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 2cc9c6601c7..8c94e6f65bc 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -30,6 +30,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/modifiers/intern/MOD_util.c + * \ingroup modifiers + */ + + #include #include "DNA_modifier_types.h" diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h index b48a3a56092..a42151904e9 100644 --- a/source/blender/modifiers/intern/MOD_util.h +++ b/source/blender/modifiers/intern/MOD_util.h @@ -25,6 +25,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/modifiers/intern/MOD_util.h + * \ingroup modifiers + */ + + #ifndef MOD_UTIL_H #define MOD_UTIL_H diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 8eaf0d5fbcb..1a572984fe3 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_uvproject.c + * \ingroup modifiers + */ + + /* UV Project modifier: Generates UVs projected from an object */ #include "DNA_meshdata_types.h" diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index dae9fc471cd..575c454c980 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -30,6 +30,11 @@ * */ +/** \file blender/modifiers/intern/MOD_wave.c + * \ingroup modifiers + */ + + #include "BLI_math.h" #include "DNA_meshdata_types.h" -- cgit v1.2.3 From a18e1043e87cffb63ef2e6818315431efea17496 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 3 Mar 2011 05:09:07 +0000 Subject: solidify material offsets for 2nd surface and rim faces. run do_versions() on use_rim_material option so Sintel's jacket loads ok. (request from Bassam) --- source/blender/modifiers/intern/MOD_solidify.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 14a07b62a91..8e44cd1ec37 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -214,6 +214,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, const int numEdges = dm->getNumEdges(dm); const int numFaces = dm->getNumFaces(dm); + /* 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; int newFaces = 0; @@ -360,6 +365,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DM_swap_face_data(result, i+numFaces, corner_indices); test_index_face(mf, &result->faceData, numFaces, is_quad ? 4:3); } + + if(mat_ofs) { + mf->mat_nr += mat_ofs; + CLAMP(mf->mat_nr, 0, mat_nr_max); + } } } @@ -520,9 +530,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; @@ -582,9 +589,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } /* use the next material index if option enabled */ - if(mf->mat_nr < mat_nr_shift) - mf->mat_nr++; - + if(mat_ofs_rim) { + mf->mat_nr += mat_ofs_rim; + CLAMP(mf->mat_nr, 0, mat_nr_max); + } if(crease_outer) ed->crease= crease_outer; -- cgit v1.2.3 From 98b608bfdbc3898d857b513f6e2f78df2e77ca40 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 5 Mar 2011 07:17:19 +0000 Subject: workaround for crash (not an actual fix) [#26316] Mirror and EdgeSplit - Grab Vertex do crash --- source/blender/modifiers/intern/MOD_edgesplit.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index 05e195d9b8f..d2dcd0ffeaf 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -848,6 +848,12 @@ static void split_single_vert(SmoothVert *vert, SmoothFace *face, 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); -- cgit v1.2.3 From c7fccc84bf59bed95bdf13207c40f7a1d1711d24 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 5 Mar 2011 10:29:10 +0000 Subject: use NULL rather then 0 for pointer assignments & comparison, modifier, imbuf & editors. --- source/blender/modifiers/intern/MOD_armature.c | 12 +++--- source/blender/modifiers/intern/MOD_array.c | 20 ++++----- source/blender/modifiers/intern/MOD_bevel.c | 22 +++++----- source/blender/modifiers/intern/MOD_boolean.c | 21 ++++----- source/blender/modifiers/intern/MOD_cast.c | 16 +++---- source/blender/modifiers/intern/MOD_cloth.c | 18 ++++---- source/blender/modifiers/intern/MOD_collision.c | 24 +++++------ source/blender/modifiers/intern/MOD_curve.c | 16 +++---- source/blender/modifiers/intern/MOD_decimate.c | 26 +++++------ source/blender/modifiers/intern/MOD_displace.c | 10 ++--- source/blender/modifiers/intern/MOD_edgesplit.c | 24 +++++------ source/blender/modifiers/intern/MOD_explode.c | 50 +++++++++++----------- source/blender/modifiers/intern/MOD_fluidsim.c | 20 ++++----- source/blender/modifiers/intern/MOD_hook.c | 14 +++--- source/blender/modifiers/intern/MOD_lattice.c | 18 ++++---- source/blender/modifiers/intern/MOD_mask.c | 22 +++++----- source/blender/modifiers/intern/MOD_meshdeform.c | 14 +++--- source/blender/modifiers/intern/MOD_mirror.c | 20 ++++----- source/blender/modifiers/intern/MOD_multires.c | 26 +++++------ source/blender/modifiers/intern/MOD_none.c | 33 +++++++------- .../modifiers/intern/MOD_particleinstance.c | 30 ++++++------- .../blender/modifiers/intern/MOD_particlesystem.c | 34 +++++++-------- source/blender/modifiers/intern/MOD_screw.c | 18 ++++---- source/blender/modifiers/intern/MOD_shrinkwrap.c | 16 +++---- source/blender/modifiers/intern/MOD_simpledeform.c | 18 ++++---- source/blender/modifiers/intern/MOD_smoke.c | 20 ++++----- source/blender/modifiers/intern/MOD_smooth.c | 20 ++++----- source/blender/modifiers/intern/MOD_softbody.c | 30 ++++++------- source/blender/modifiers/intern/MOD_subsurf.c | 20 ++++----- source/blender/modifiers/intern/MOD_surface.c | 24 +++++------ source/blender/modifiers/intern/MOD_uvproject.c | 16 +++---- source/blender/modifiers/intern/MOD_wave.c | 14 +++--- 32 files changed, 343 insertions(+), 343 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index fa39c197c7b..95579147dbb 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 0a8caee5241..3a34b048aa3 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -811,19 +811,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, - /* dependsOnNormals */ 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 a1bd3abc176..323ed71dd74 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -135,19 +135,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 #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_cast.c b/source/blender/modifiers/intern/MOD_cast.c index 68e9e173ee6..91d89aaa5d1 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -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 e1371b3b86c..2ed66f2374b 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -250,20 +250,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 84fee7b5102..ecd10250c00 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 64d6b72a176..ba9dbfc31ad 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -203,19 +203,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 2ab6921dc8a..d303f3d2516 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 d2dcd0ffeaf..1de95b67cad 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -1289,19 +1289,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, - /* 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_explode.c b/source/blender/modifiers/intern/MOD_explode.c index aea6997c5d5..292d7f7a65c 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; pdm,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,0,0,0,0,0); + psys_particle_on_dm(psmd->dm,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); @@ -776,14 +776,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; */ @@ -870,7 +870,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; @@ -960,7 +960,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) @@ -980,12 +980,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->getNumFaces(dm)) @@ -1023,19 +1023,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 2a85378f987..4dbe781ca13 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -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 22427d04338..694f8fb3e52 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 9519e5b9131..b36d6848533 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -404,19 +404,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 a6b4a5dabcd..fa9976b1ad6 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -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 cf31e86a2f5..b1c765e5c9b 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -348,19 +348,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, - /* dependsOnNormals */ 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 7653511da10..def2020f35f 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 #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 1fa0ff7beed..4b6e4bd0241 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; @@ -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){ @@ -335,19 +335,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 a23a53335ef..1a6cbc4781f 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -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; @@ -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 ac48a9682a1..076c09cc51a 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -888,19 +888,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..fc13eafa866 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -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..351a86624be 100644 --- a/source/blender/modifiers/intern/MOD_smoke.c +++ b/source/blender/modifiers/intern/MOD_smoke.c @@ -159,18 +159,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 */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index 526b54d1cf8..8aca9ec82c3 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -261,18 +261,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 #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_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index 823cc03cff2..0d0e81925f7 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -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 e0bdb063331..382358b179e 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 1a572984fe3..abe87458038 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -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 575c454c980..b4e94157e9a 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -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, }; -- cgit v1.2.3 From f1e0ef1d1281cc63d092a144ddbe3b1140104cd5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 6 Mar 2011 22:10:33 +0000 Subject: fix [#26368] Solidify breaks EdgeCrease Make edge crease additive rather then overwriting existing values. There are other problems pointed out in this report but they are unrelated to solidify. --- source/blender/modifiers/intern/MOD_solidify.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 8e44cd1ec37..f7a55720a5e 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -593,11 +593,18 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, mf->mat_nr += mat_ofs_rim; CLAMP(mf->mat_nr, 0, mat_nr_max); } - if(crease_outer) - ed->crease= crease_outer; + if(crease_outer) { + /* crease += crease_outer; without wrapping */ + unsigned char *cr= (unsigned char *)&(ed->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 -- cgit v1.2.3 From 53139432dd5dd308c44cb3c536f24913afa7ccb2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 9 Mar 2011 01:25:59 +0000 Subject: image.depth, 96/128 for float color images, was 24/32 for byte images. also use <> for system includes --- source/blender/modifiers/intern/MOD_particlesystem.c | 2 +- source/blender/modifiers/intern/MOD_smoke.c | 2 +- source/blender/modifiers/intern/MOD_subsurf.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 1a6cbc4781f..7e94a76598b 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 #include "DNA_material_types.h" diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c index 351a86624be..b13d86a609e 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 #include "MEM_guardedalloc.h" diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index 0d0e81925f7..fc9958b08d0 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 #include "DNA_scene_types.h" #include "DNA_object_types.h" -- cgit v1.2.3 From 60ce95f5622d3947e30fe960eda22ea305660619 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Fri, 18 Mar 2011 15:31:32 +0000 Subject: New particle collisions code: * The old collisions code detected particle collisions by calculating the collision times analytically from the collision mesh faces. This was pretty accurate, but didn't support rotating/deforming faces at all, as the equations for these quickly become quite nasty. * The new code uses a simple "distance to plane/edge/vert" function and iterates this with the Newton-Rhapson method to find the closest particle distance during a simulation step. * The advantage in this is that the collision object can now move, rotate, scale or even deform freely and collisions are still detected reliably. * For some extreme movements the calculation errors could stack up so much that the detection fails, but this can be easily fixed by increasing the particle size or simulation substeps. * As a side note the algorithm doesn't really do point particles anymore, but uses a very small radius as the particle size when "size deflect" isn't selected. * I've also updated the collision response code a bit, so now the particles shouldn't leak even from tight corners. All in all the collisions code is now much cleaner and more robust than before! --- source/blender/modifiers/intern/MOD_collision.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 2ed66f2374b..83ba8a12163 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); } -- cgit v1.2.3 From e9005b985ef283d952aaaa7486d42ad6a48fb117 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 19 Mar 2011 05:06:06 +0000 Subject: remove some redundant vars, assignments & checks. --- source/blender/modifiers/intern/MOD_explode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 292d7f7a65c..237a0f9b216 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -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; lfaceData, CD_MTFACE, l); df1 = mf+cur; df2 = df1 + 1; - df3 = df1 + 2; mf = CustomData_get_layer_n(&dm->faceData, CD_MTFACE, l); mf += i; -- cgit v1.2.3 From 9997c3c8951fb253fa5e37b624b81005202ceb6d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 27 Mar 2011 13:49:53 +0000 Subject: modifiers: floats were being implicitly promoted to doubles, adjust to use floats. --- source/blender/modifiers/intern/MOD_build.c | 2 +- source/blender/modifiers/intern/MOD_cast.c | 16 ++++++++-------- source/blender/modifiers/intern/MOD_edgesplit.c | 4 ++-- source/blender/modifiers/intern/MOD_hook.c | 4 ++-- source/blender/modifiers/intern/MOD_meshdeform.c | 2 +- source/blender/modifiers/intern/MOD_particleinstance.c | 2 +- source/blender/modifiers/intern/MOD_particlesystem.c | 2 +- source/blender/modifiers/intern/MOD_screw.c | 2 +- source/blender/modifiers/intern/MOD_simpledeform.c | 10 +++++----- source/blender/modifiers/intern/MOD_smooth.c | 4 +--- source/blender/modifiers/intern/MOD_uvproject.c | 2 +- source/blender/modifiers/intern/MOD_wave.c | 12 ++++++------ 12 files changed, 30 insertions(+), 32 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index 0d04476c618..1cf67ac8cae 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->getNumFaces(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 91d89aaa5d1..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]; diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index 1de95b67cad..09e29d9ed8e 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -1052,7 +1052,7 @@ static void tag_and_count_extra_edges(SmoothMesh *mesh, float split_angle, /* if normal1 dot normal2 < threshold, angle is greater, so split */ /* FIXME not sure if this always works */ /* 0.00001 added for floating-point rounding */ - float threshold = cos((split_angle + 0.00001) * M_PI / 180.0); + float threshold = cos((split_angle + 0.00001f) * (float)M_PI / 180.0f); int i; *extra_edges = 0; @@ -1113,7 +1113,7 @@ static void split_sharp_edges(SmoothMesh *mesh, float split_angle, int flags) /* if normal1 dot normal2 < threshold, angle is greater, so split */ /* FIXME not sure if this always works */ /* 0.00001 added for floating-point rounding */ - mesh->threshold = cos((split_angle + 0.00001) * M_PI / 180.0); + mesh->threshold = cosf((split_angle + 0.00001f) * (float)M_PI / 180.0f); mesh->flags = flags; /* loop through edges, splitting sharp ones */ diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 4dbe781ca13..082c199b16f 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)); } } diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index fa9976b1ad6..ba73f3fa0d1 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) { diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index 4b6e4bd0241..46d53e0db15 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -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; } diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 7e94a76598b..533bfd203b5 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -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 */ diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 076c09cc51a..17e350482f0 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; diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index fc13eafa866..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 diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index 8aca9ec82c3..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]; diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index abe87458038..b054a5b0a6e 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) { diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index b4e94157e9a..6d547867ed8 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) -- cgit v1.2.3 From c7183d2622a0cba5e07653daa4a5aca9ad9ed9cc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 31 Mar 2011 11:21:21 +0000 Subject: library linked modifiers were not having their ID linked expanded properly. was missing array cap ends, wave map object and shrinkwrap objects. use modifiers_foreachIDLink() rather then having to list all modifiers ID's in this function. also add foreachIDLink() for smoke domain. This fixes a bug where a linked object has as a modifier using an indirectly linked object for the missing cases mentioned above. --- source/blender/modifiers/intern/MOD_smoke.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c index b13d86a609e..d8e94e92bfa 100644 --- a/source/blender/modifiers/intern/MOD_smoke.c +++ b/source/blender/modifiers/intern/MOD_smoke.c @@ -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", @@ -172,5 +183,5 @@ ModifierTypeInfo modifierType_Smoke = { /* dependsOnTime */ dependsOnTime, /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, - /* foreachIDLink */ NULL, + /* foreachIDLink */ foreachIDLink, }; -- cgit v1.2.3 From 0298d223cc1156df3a32fbb3a97dccf5ddb5ad02 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 3 Apr 2011 10:04:16 +0000 Subject: quiet various warnings, also disable -Wdouble-promotion with cmake since it gives warnings with variable length args. --- source/blender/modifiers/intern/MOD_explode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 237a0f9b216..36e804607cf 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -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_face(split, cur); DM_copy_face_data(dm, split, i, cur, 1); -- cgit v1.2.3 From f8124d6db776d146854f95cf9589ceeca2dcc6fb Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Sun, 10 Apr 2011 11:24:29 +0000 Subject: [#26848] Keyed Particles seems to be broken * Explode modifier wasn't updated properly when keyed particles were used. * Explode modifier didn't get correct locations for grid distributed particles. --- source/blender/modifiers/intern/MOD_explode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 36e804607cf..924035538da 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -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; pdm,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,NULL,NULL,NULL,NULL,NULL); + 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); -- cgit v1.2.3 From 62c0dfbb46b4e4eefc82e58219b2ce8541b4307c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 12 Apr 2011 12:59:37 +0000 Subject: fix [#26888] 3D viewport shading broken after solidify modifier --- source/blender/modifiers/intern/MOD_solidify.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index f7a55720a5e..1b7b724835c 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -643,6 +643,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, MEM_freeN(edge_order); } + /* must recalculate normals with vgroups since they can displace unevenly [#26888] */ + if(dvert) { + CDDM_calc_normals(result); + } + return result; } -- cgit v1.2.3 From 66b605ec933a2d53f5a7596328fac8baed86a3e4 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Wed, 20 Apr 2011 17:15:33 +0000 Subject: Fix for [#27075] Explode Modifier - Apply as Shape impossible * Explode modifier was flagged as "nonconstructive", so the "apply as shape" option was shown. And yes I know exploding things probably isn't usually considered as very constructive, but.. :P --- source/blender/modifiers/intern/MOD_explode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 924035538da..00ab5d027fb 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -1019,7 +1019,7 @@ ModifierTypeInfo modifierType_Explode = { /* name */ "Explode", /* structName */ "ExplodeModifierData", /* structSize */ sizeof(ExplodeModifierData), - /* type */ eModifierTypeType_Nonconstructive, + /* type */ eModifierTypeType_Constructive, /* flags */ eModifierTypeFlag_AcceptsMesh, /* copyData */ copyData, /* deformVerts */ NULL, -- cgit v1.2.3 From f9f771cd01b626be30a85a533ea622bcedd981f5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 21 Apr 2011 15:53:30 +0000 Subject: converted more mixed tab/space indentations to tabs. only whitespace changes. --- source/blender/modifiers/intern/MOD_array.c | 866 ++++++++++++------------ source/blender/modifiers/intern/MOD_build.c | 18 +- source/blender/modifiers/intern/MOD_edgesplit.c | 132 ++-- source/blender/modifiers/intern/MOD_explode.c | 26 +- 4 files changed, 521 insertions(+), 521 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 3a34b048aa3..90954fef1c7 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -313,60 +313,60 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, else /* if the offset has no translation, just make one copy */ count = 1; - } + } - if(count < 1) - count = 1; + if(count < 1) + count = 1; /* allocate memory for count duplicates (including original) plus * start and end caps */ - finalVerts = dm->getNumVerts(dm) * count; - finalEdges = dm->getNumEdges(dm) * count; - finalFaces = dm->getNumFaces(dm) * count; - if(start_cap) { - finalVerts += start_cap->getNumVerts(start_cap); - finalEdges += start_cap->getNumEdges(start_cap); - finalFaces += start_cap->getNumFaces(start_cap); - } - if(end_cap) { - finalVerts += end_cap->getNumVerts(end_cap); - finalEdges += end_cap->getNumEdges(end_cap); - finalFaces += end_cap->getNumFaces(end_cap); - } - result = CDDM_from_template(dm, finalVerts, finalEdges, finalFaces); - - /* calculate the offset matrix of the final copy (for merging) */ - unit_m4(final_offset); - - for(j=0; j < count - 1; j++) { - mul_m4_m4m4(tmp_mat, final_offset, offset); - copy_m4_m4(final_offset, tmp_mat); - } - - numVerts = numEdges = numFaces = 0; - mvert = CDDM_get_verts(result); - - for (i = 0; i < maxVerts; i++) { - indexMap[i].merge = -1; /* default to no merge */ - indexMap[i].merge_final = 0; /* default to no merge */ - } - - for (i = 0; i < maxVerts; i++) { - MVert *inMV; - MVert *mv = &mvert[numVerts]; - MVert *mv2; - float co[3]; - - inMV = &src_mvert[i]; - - DM_copy_vert_data(dm, result, i, numVerts, 1); - *mv = *inMV; - numVerts++; - - indexMap[i].new = numVerts - 1; - - copy_v3_v3(co, mv->co); + finalVerts = dm->getNumVerts(dm) * count; + finalEdges = dm->getNumEdges(dm) * count; + finalFaces = dm->getNumFaces(dm) * count; + if(start_cap) { + finalVerts += start_cap->getNumVerts(start_cap); + finalEdges += start_cap->getNumEdges(start_cap); + finalFaces += start_cap->getNumFaces(start_cap); + } + if(end_cap) { + finalVerts += end_cap->getNumVerts(end_cap); + finalEdges += end_cap->getNumEdges(end_cap); + finalFaces += end_cap->getNumFaces(end_cap); + } + result = CDDM_from_template(dm, finalVerts, finalEdges, finalFaces); + + /* calculate the offset matrix of the final copy (for merging) */ + unit_m4(final_offset); + + for(j=0; j < count - 1; j++) { + mul_m4_m4m4(tmp_mat, final_offset, offset); + copy_m4_m4(final_offset, tmp_mat); + } + + numVerts = numEdges = numFaces = 0; + mvert = CDDM_get_verts(result); + + for (i = 0; i < maxVerts; i++) { + indexMap[i].merge = -1; /* default to no merge */ + indexMap[i].merge_final = 0; /* default to no merge */ + } + + for (i = 0; i < maxVerts; i++) { + MVert *inMV; + MVert *mv = &mvert[numVerts]; + MVert *mv2; + float co[3]; + + inMV = &src_mvert[i]; + + DM_copy_vert_data(dm, result, i, numVerts, 1); + *mv = *inMV; + numVerts++; + + indexMap[i].new = numVerts - 1; + + copy_v3_v3(co, mv->co); /* Attempts to merge verts from one duplicate with verts from the * next duplicate which are closer than amd->merge_dist. @@ -374,405 +374,405 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, * If verts are merged in the first duplicate pair, they are merged * in all pairs. */ - if((count > 1) && (amd->flags & MOD_ARR_MERGE)) { - float tmp_co[3]; - mul_v3_m4v3(tmp_co, offset, mv->co); - - for(j = 0; j < maxVerts; j++) { - /* if vertex already merged, don't use it */ - if( indexMap[j].merge != -1 ) continue; - - inMV = &src_mvert[j]; - /* if this vert is within merge limit, merge */ - if(compare_len_v3v3(tmp_co, inMV->co, amd->merge_dist)) { - indexMap[i].merge = j; - - /* test for merging with final copy of merge target */ - if(amd->flags & MOD_ARR_MERGEFINAL) { - copy_v3_v3(tmp_co, inMV->co); - inMV = &src_mvert[i]; - mul_m4_v3(final_offset, tmp_co); - if(compare_len_v3v3(tmp_co, inMV->co, amd->merge_dist)) - indexMap[i].merge_final = 1; - } - break; - } - } - } - - /* if no merging, generate copies of this vert */ - if(indexMap[i].merge < 0) { - for(j=0; j < count - 1; j++) { - mv2 = &mvert[numVerts]; - - DM_copy_vert_data(result, result, numVerts - 1, numVerts, 1); - *mv2 = *mv; - numVerts++; - - mul_m4_v3(offset, co); - copy_v3_v3(mv2->co, co); - } - } else if(indexMap[i].merge != i && indexMap[i].merge_final) { + if((count > 1) && (amd->flags & MOD_ARR_MERGE)) { + float tmp_co[3]; + mul_v3_m4v3(tmp_co, offset, mv->co); + + for(j = 0; j < maxVerts; j++) { + /* if vertex already merged, don't use it */ + if( indexMap[j].merge != -1 ) continue; + + inMV = &src_mvert[j]; + /* if this vert is within merge limit, merge */ + if(compare_len_v3v3(tmp_co, inMV->co, amd->merge_dist)) { + indexMap[i].merge = j; + + /* test for merging with final copy of merge target */ + if(amd->flags & MOD_ARR_MERGEFINAL) { + copy_v3_v3(tmp_co, inMV->co); + inMV = &src_mvert[i]; + mul_m4_v3(final_offset, tmp_co); + if(compare_len_v3v3(tmp_co, inMV->co, amd->merge_dist)) + indexMap[i].merge_final = 1; + } + break; + } + } + } + + /* if no merging, generate copies of this vert */ + if(indexMap[i].merge < 0) { + for(j=0; j < count - 1; j++) { + mv2 = &mvert[numVerts]; + + DM_copy_vert_data(result, result, numVerts - 1, numVerts, 1); + *mv2 = *mv; + numVerts++; + + mul_m4_v3(offset, co); + copy_v3_v3(mv2->co, co); + } + } else if(indexMap[i].merge != i && indexMap[i].merge_final) { /* if this vert is not merging with itself, and it is merging * with the final copy of its merge target, remove the first copy */ - numVerts--; - DM_free_vert_data(result, numVerts, 1); - } - } + numVerts--; + DM_free_vert_data(result, numVerts, 1); + } + } - /* make a hashtable so we can avoid duplicate edges from merging */ - edges = BLI_edgehash_new(); + /* make a hashtable so we can avoid duplicate edges from merging */ + edges = BLI_edgehash_new(); - maxEdges = dm->getNumEdges(dm); - medge = CDDM_get_edges(result); - for(i = 0; i < maxEdges; i++) { - MEdge inMED; - MEdge med; - MEdge *med2; - int vert1, vert2; + maxEdges = dm->getNumEdges(dm); + medge = CDDM_get_edges(result); + for(i = 0; i < maxEdges; i++) { + MEdge inMED; + MEdge med; + MEdge *med2; + int vert1, vert2; - dm->getEdge(dm, i, &inMED); + dm->getEdge(dm, i, &inMED); - med = inMED; - med.v1 = indexMap[inMED.v1].new; - med.v2 = indexMap[inMED.v2].new; + med = inMED; + med.v1 = indexMap[inMED.v1].new; + med.v2 = indexMap[inMED.v2].new; /* if vertices are to be merged with the final copies of their * merge targets, calculate that final copy */ - if(indexMap[inMED.v1].merge_final) { - med.v1 = calc_mapping(indexMap, indexMap[inMED.v1].merge, - count - 1); - } - if(indexMap[inMED.v2].merge_final) { - med.v2 = calc_mapping(indexMap, indexMap[inMED.v2].merge, - count - 1); - } - - if(med.v1 == med.v2) continue; - - /* XXX Unfortunately the calc_mapping returns sometimes numVerts... leads to bad crashes */ - if(med.v1 >= numVerts) - med.v1= numVerts-1; - if(med.v2 >= numVerts) - med.v2= numVerts-1; - - if (initFlags) { - med.flag |= ME_EDGEDRAW | ME_EDGERENDER; - } - - if(!BLI_edgehash_haskey(edges, med.v1, med.v2)) { - DM_copy_edge_data(dm, result, i, numEdges, 1); - medge[numEdges] = med; - numEdges++; - - BLI_edgehash_insert(edges, med.v1, med.v2, NULL); - } - - for(j = 1; j < count; j++) - { - vert1 = calc_mapping(indexMap, inMED.v1, j); - vert2 = calc_mapping(indexMap, inMED.v2, j); - - /* edge could collapse to single point after mapping */ - if(vert1 == vert2) continue; - - /* XXX Unfortunately the calc_mapping returns sometimes numVerts... leads to bad crashes */ - if(vert1 >= numVerts) - vert1= numVerts-1; - if(vert2 >= numVerts) - vert2= numVerts-1; - - /* avoid duplicate edges */ - if(!BLI_edgehash_haskey(edges, vert1, vert2)) { - med2 = &medge[numEdges]; - - DM_copy_edge_data(dm, result, i, numEdges, 1); - *med2 = med; - numEdges++; - - med2->v1 = vert1; - med2->v2 = vert2; - - BLI_edgehash_insert(edges, med2->v1, med2->v2, NULL); - } - } - } - - maxFaces = dm->getNumFaces(dm); - mface = CDDM_get_faces(result); - for (i=0; i < maxFaces; i++) { - MFace inMF; - MFace *mf = &mface[numFaces]; - - dm->getFace(dm, i, &inMF); - - DM_copy_face_data(dm, result, i, numFaces, 1); - *mf = inMF; - - mf->v1 = indexMap[inMF.v1].new; - mf->v2 = indexMap[inMF.v2].new; - mf->v3 = indexMap[inMF.v3].new; - if(inMF.v4) - mf->v4 = indexMap[inMF.v4].new; + if(indexMap[inMED.v1].merge_final) { + med.v1 = calc_mapping(indexMap, indexMap[inMED.v1].merge, + count - 1); + } + if(indexMap[inMED.v2].merge_final) { + med.v2 = calc_mapping(indexMap, indexMap[inMED.v2].merge, + count - 1); + } + + if(med.v1 == med.v2) continue; + + /* XXX Unfortunately the calc_mapping returns sometimes numVerts... leads to bad crashes */ + if(med.v1 >= numVerts) + med.v1= numVerts-1; + if(med.v2 >= numVerts) + med.v2= numVerts-1; + + if (initFlags) { + med.flag |= ME_EDGEDRAW | ME_EDGERENDER; + } + + if(!BLI_edgehash_haskey(edges, med.v1, med.v2)) { + DM_copy_edge_data(dm, result, i, numEdges, 1); + medge[numEdges] = med; + numEdges++; + + BLI_edgehash_insert(edges, med.v1, med.v2, NULL); + } + + for(j = 1; j < count; j++) + { + vert1 = calc_mapping(indexMap, inMED.v1, j); + vert2 = calc_mapping(indexMap, inMED.v2, j); + + /* edge could collapse to single point after mapping */ + if(vert1 == vert2) continue; + + /* XXX Unfortunately the calc_mapping returns sometimes numVerts... leads to bad crashes */ + if(vert1 >= numVerts) + vert1= numVerts-1; + if(vert2 >= numVerts) + vert2= numVerts-1; + + /* avoid duplicate edges */ + if(!BLI_edgehash_haskey(edges, vert1, vert2)) { + med2 = &medge[numEdges]; + + DM_copy_edge_data(dm, result, i, numEdges, 1); + *med2 = med; + numEdges++; + + med2->v1 = vert1; + med2->v2 = vert2; + + BLI_edgehash_insert(edges, med2->v1, med2->v2, NULL); + } + } + } + + maxFaces = dm->getNumFaces(dm); + mface = CDDM_get_faces(result); + for (i=0; i < maxFaces; i++) { + MFace inMF; + MFace *mf = &mface[numFaces]; + + dm->getFace(dm, i, &inMF); + + DM_copy_face_data(dm, result, i, numFaces, 1); + *mf = inMF; + + mf->v1 = indexMap[inMF.v1].new; + mf->v2 = indexMap[inMF.v2].new; + mf->v3 = indexMap[inMF.v3].new; + if(inMF.v4) + mf->v4 = indexMap[inMF.v4].new; /* if vertices are to be merged with the final copies of their * merge targets, calculate that final copy */ - if(indexMap[inMF.v1].merge_final) - mf->v1 = calc_mapping(indexMap, indexMap[inMF.v1].merge, count-1); - if(indexMap[inMF.v2].merge_final) - mf->v2 = calc_mapping(indexMap, indexMap[inMF.v2].merge, count-1); - if(indexMap[inMF.v3].merge_final) - mf->v3 = calc_mapping(indexMap, indexMap[inMF.v3].merge, count-1); - if(inMF.v4 && indexMap[inMF.v4].merge_final) - mf->v4 = calc_mapping(indexMap, indexMap[inMF.v4].merge, count-1); - - if(test_index_face_maxvert(mf, &result->faceData, numFaces, inMF.v4?4:3, numVerts) < 3) - continue; - - numFaces++; - - /* if the face has fewer than 3 vertices, don't create it */ - if(mf->v3 == 0 || (mf->v1 && (mf->v1 == mf->v3 || mf->v1 == mf->v4))) { - numFaces--; - DM_free_face_data(result, numFaces, 1); - } - - for(j = 1; j < count; j++) - { - MFace *mf2 = &mface[numFaces]; - - DM_copy_face_data(dm, result, i, numFaces, 1); - *mf2 = *mf; - - mf2->v1 = calc_mapping(indexMap, inMF.v1, j); - mf2->v2 = calc_mapping(indexMap, inMF.v2, j); - mf2->v3 = calc_mapping(indexMap, inMF.v3, j); - if (inMF.v4) - mf2->v4 = calc_mapping(indexMap, inMF.v4, j); - - numFaces++; - - /* if the face has fewer than 3 vertices, don't create it */ - if(test_index_face_maxvert(mf2, &result->faceData, numFaces-1, inMF.v4?4:3, numVerts) < 3) { - numFaces--; - DM_free_face_data(result, numFaces, 1); - } - } - } - - /* add start and end caps */ - if(start_cap) { - float startoffset[4][4]; - MVert *cap_mvert; - MEdge *cap_medge; - MFace *cap_mface; - int *origindex; - int *vert_map; - int capVerts, capEdges, capFaces; - - capVerts = start_cap->getNumVerts(start_cap); - capEdges = start_cap->getNumEdges(start_cap); - capFaces = start_cap->getNumFaces(start_cap); - cap_mvert = start_cap->getVertArray(start_cap); - cap_medge = start_cap->getEdgeArray(start_cap); - cap_mface = start_cap->getFaceArray(start_cap); - - invert_m4_m4(startoffset, offset); - - vert_map = MEM_callocN(sizeof(*vert_map) * capVerts, - "arrayModifier_doArray vert_map"); - - origindex = result->getVertDataArray(result, CD_ORIGINDEX); - for(i = 0; i < capVerts; i++) { - MVert *mv = &cap_mvert[i]; - short merged = 0; - - if(amd->flags & MOD_ARR_MERGE) { - float tmp_co[3]; - MVert *in_mv; - int j; - - copy_v3_v3(tmp_co, mv->co); - mul_m4_v3(startoffset, tmp_co); - - for(j = 0; j < maxVerts; j++) { - in_mv = &src_mvert[j]; - /* if this vert is within merge limit, merge */ - if(compare_len_v3v3(tmp_co, in_mv->co, amd->merge_dist)) { - vert_map[i] = calc_mapping(indexMap, j, 0); - merged = 1; - break; - } - } - } - - if(!merged) { - DM_copy_vert_data(start_cap, result, i, numVerts, 1); - mvert[numVerts] = *mv; - mul_m4_v3(startoffset, mvert[numVerts].co); - origindex[numVerts] = ORIGINDEX_NONE; - - vert_map[i] = numVerts; - - numVerts++; - } - } - origindex = result->getEdgeDataArray(result, CD_ORIGINDEX); - for(i = 0; i < capEdges; i++) { - int v1, v2; - - v1 = vert_map[cap_medge[i].v1]; - v2 = vert_map[cap_medge[i].v2]; - - if(!BLI_edgehash_haskey(edges, v1, v2)) { - DM_copy_edge_data(start_cap, result, i, numEdges, 1); - medge[numEdges] = cap_medge[i]; - medge[numEdges].v1 = v1; - medge[numEdges].v2 = v2; - origindex[numEdges] = ORIGINDEX_NONE; - - numEdges++; - } - } - origindex = result->getFaceDataArray(result, CD_ORIGINDEX); - for(i = 0; i < capFaces; i++) { - DM_copy_face_data(start_cap, result, i, numFaces, 1); - mface[numFaces] = cap_mface[i]; - mface[numFaces].v1 = vert_map[mface[numFaces].v1]; - mface[numFaces].v2 = vert_map[mface[numFaces].v2]; - mface[numFaces].v3 = vert_map[mface[numFaces].v3]; - if(mface[numFaces].v4) { - mface[numFaces].v4 = vert_map[mface[numFaces].v4]; - - test_index_face_maxvert(&mface[numFaces], &result->faceData, - numFaces, 4, numVerts); - } - else - { - test_index_face(&mface[numFaces], &result->faceData, - numFaces, 3); - } - - origindex[numFaces] = ORIGINDEX_NONE; - - numFaces++; - } - - MEM_freeN(vert_map); - start_cap->release(start_cap); - } - - if(end_cap) { - float endoffset[4][4]; - MVert *cap_mvert; - MEdge *cap_medge; - MFace *cap_mface; - int *origindex; - int *vert_map; - int capVerts, capEdges, capFaces; - - capVerts = end_cap->getNumVerts(end_cap); - capEdges = end_cap->getNumEdges(end_cap); - capFaces = end_cap->getNumFaces(end_cap); - cap_mvert = end_cap->getVertArray(end_cap); - cap_medge = end_cap->getEdgeArray(end_cap); - cap_mface = end_cap->getFaceArray(end_cap); - - mul_m4_m4m4(endoffset, final_offset, offset); - - vert_map = MEM_callocN(sizeof(*vert_map) * capVerts, - "arrayModifier_doArray vert_map"); - - origindex = result->getVertDataArray(result, CD_ORIGINDEX); - for(i = 0; i < capVerts; i++) { - MVert *mv = &cap_mvert[i]; - short merged = 0; - - if(amd->flags & MOD_ARR_MERGE) { - float tmp_co[3]; - MVert *in_mv; - int j; - - copy_v3_v3(tmp_co, mv->co); - mul_m4_v3(offset, tmp_co); - - for(j = 0; j < maxVerts; j++) { - in_mv = &src_mvert[j]; - /* if this vert is within merge limit, merge */ - if(compare_len_v3v3(tmp_co, in_mv->co, amd->merge_dist)) { - vert_map[i] = calc_mapping(indexMap, j, count - 1); - merged = 1; - break; - } - } - } - - if(!merged) { - DM_copy_vert_data(end_cap, result, i, numVerts, 1); - mvert[numVerts] = *mv; - mul_m4_v3(endoffset, mvert[numVerts].co); - origindex[numVerts] = ORIGINDEX_NONE; - - vert_map[i] = numVerts; - - numVerts++; - } - } - origindex = result->getEdgeDataArray(result, CD_ORIGINDEX); - for(i = 0; i < capEdges; i++) { - int v1, v2; - - v1 = vert_map[cap_medge[i].v1]; - v2 = vert_map[cap_medge[i].v2]; - - if(!BLI_edgehash_haskey(edges, v1, v2)) { - DM_copy_edge_data(end_cap, result, i, numEdges, 1); - medge[numEdges] = cap_medge[i]; - medge[numEdges].v1 = v1; - medge[numEdges].v2 = v2; - origindex[numEdges] = ORIGINDEX_NONE; - - numEdges++; - } - } - origindex = result->getFaceDataArray(result, CD_ORIGINDEX); - for(i = 0; i < capFaces; i++) { - DM_copy_face_data(end_cap, result, i, numFaces, 1); - mface[numFaces] = cap_mface[i]; - mface[numFaces].v1 = vert_map[mface[numFaces].v1]; - mface[numFaces].v2 = vert_map[mface[numFaces].v2]; - mface[numFaces].v3 = vert_map[mface[numFaces].v3]; - if(mface[numFaces].v4) { - mface[numFaces].v4 = vert_map[mface[numFaces].v4]; - - test_index_face(&mface[numFaces], &result->faceData, - numFaces, 4); - } - else - { - test_index_face(&mface[numFaces], &result->faceData, - numFaces, 3); - } - origindex[numFaces] = ORIGINDEX_NONE; - - numFaces++; - } - - MEM_freeN(vert_map); - end_cap->release(end_cap); - } - - BLI_edgehash_free(edges, NULL); - MEM_freeN(indexMap); - - CDDM_lower_num_verts(result, numVerts); - CDDM_lower_num_edges(result, numEdges); - CDDM_lower_num_faces(result, numFaces); - - return result; + if(indexMap[inMF.v1].merge_final) + mf->v1 = calc_mapping(indexMap, indexMap[inMF.v1].merge, count-1); + if(indexMap[inMF.v2].merge_final) + mf->v2 = calc_mapping(indexMap, indexMap[inMF.v2].merge, count-1); + if(indexMap[inMF.v3].merge_final) + mf->v3 = calc_mapping(indexMap, indexMap[inMF.v3].merge, count-1); + if(inMF.v4 && indexMap[inMF.v4].merge_final) + mf->v4 = calc_mapping(indexMap, indexMap[inMF.v4].merge, count-1); + + if(test_index_face_maxvert(mf, &result->faceData, numFaces, inMF.v4?4:3, numVerts) < 3) + continue; + + numFaces++; + + /* if the face has fewer than 3 vertices, don't create it */ + if(mf->v3 == 0 || (mf->v1 && (mf->v1 == mf->v3 || mf->v1 == mf->v4))) { + numFaces--; + DM_free_face_data(result, numFaces, 1); + } + + for(j = 1; j < count; j++) + { + MFace *mf2 = &mface[numFaces]; + + DM_copy_face_data(dm, result, i, numFaces, 1); + *mf2 = *mf; + + mf2->v1 = calc_mapping(indexMap, inMF.v1, j); + mf2->v2 = calc_mapping(indexMap, inMF.v2, j); + mf2->v3 = calc_mapping(indexMap, inMF.v3, j); + if (inMF.v4) + mf2->v4 = calc_mapping(indexMap, inMF.v4, j); + + numFaces++; + + /* if the face has fewer than 3 vertices, don't create it */ + if(test_index_face_maxvert(mf2, &result->faceData, numFaces-1, inMF.v4?4:3, numVerts) < 3) { + numFaces--; + DM_free_face_data(result, numFaces, 1); + } + } + } + + /* add start and end caps */ + if(start_cap) { + float startoffset[4][4]; + MVert *cap_mvert; + MEdge *cap_medge; + MFace *cap_mface; + int *origindex; + int *vert_map; + int capVerts, capEdges, capFaces; + + capVerts = start_cap->getNumVerts(start_cap); + capEdges = start_cap->getNumEdges(start_cap); + capFaces = start_cap->getNumFaces(start_cap); + cap_mvert = start_cap->getVertArray(start_cap); + cap_medge = start_cap->getEdgeArray(start_cap); + cap_mface = start_cap->getFaceArray(start_cap); + + invert_m4_m4(startoffset, offset); + + vert_map = MEM_callocN(sizeof(*vert_map) * capVerts, + "arrayModifier_doArray vert_map"); + + origindex = result->getVertDataArray(result, CD_ORIGINDEX); + for(i = 0; i < capVerts; i++) { + MVert *mv = &cap_mvert[i]; + short merged = 0; + + if(amd->flags & MOD_ARR_MERGE) { + float tmp_co[3]; + MVert *in_mv; + int j; + + copy_v3_v3(tmp_co, mv->co); + mul_m4_v3(startoffset, tmp_co); + + for(j = 0; j < maxVerts; j++) { + in_mv = &src_mvert[j]; + /* if this vert is within merge limit, merge */ + if(compare_len_v3v3(tmp_co, in_mv->co, amd->merge_dist)) { + vert_map[i] = calc_mapping(indexMap, j, 0); + merged = 1; + break; + } + } + } + + if(!merged) { + DM_copy_vert_data(start_cap, result, i, numVerts, 1); + mvert[numVerts] = *mv; + mul_m4_v3(startoffset, mvert[numVerts].co); + origindex[numVerts] = ORIGINDEX_NONE; + + vert_map[i] = numVerts; + + numVerts++; + } + } + origindex = result->getEdgeDataArray(result, CD_ORIGINDEX); + for(i = 0; i < capEdges; i++) { + int v1, v2; + + v1 = vert_map[cap_medge[i].v1]; + v2 = vert_map[cap_medge[i].v2]; + + if(!BLI_edgehash_haskey(edges, v1, v2)) { + DM_copy_edge_data(start_cap, result, i, numEdges, 1); + medge[numEdges] = cap_medge[i]; + medge[numEdges].v1 = v1; + medge[numEdges].v2 = v2; + origindex[numEdges] = ORIGINDEX_NONE; + + numEdges++; + } + } + origindex = result->getFaceDataArray(result, CD_ORIGINDEX); + for(i = 0; i < capFaces; i++) { + DM_copy_face_data(start_cap, result, i, numFaces, 1); + mface[numFaces] = cap_mface[i]; + mface[numFaces].v1 = vert_map[mface[numFaces].v1]; + mface[numFaces].v2 = vert_map[mface[numFaces].v2]; + mface[numFaces].v3 = vert_map[mface[numFaces].v3]; + if(mface[numFaces].v4) { + mface[numFaces].v4 = vert_map[mface[numFaces].v4]; + + test_index_face_maxvert(&mface[numFaces], &result->faceData, + numFaces, 4, numVerts); + } + else + { + test_index_face(&mface[numFaces], &result->faceData, + numFaces, 3); + } + + origindex[numFaces] = ORIGINDEX_NONE; + + numFaces++; + } + + MEM_freeN(vert_map); + start_cap->release(start_cap); + } + + if(end_cap) { + float endoffset[4][4]; + MVert *cap_mvert; + MEdge *cap_medge; + MFace *cap_mface; + int *origindex; + int *vert_map; + int capVerts, capEdges, capFaces; + + capVerts = end_cap->getNumVerts(end_cap); + capEdges = end_cap->getNumEdges(end_cap); + capFaces = end_cap->getNumFaces(end_cap); + cap_mvert = end_cap->getVertArray(end_cap); + cap_medge = end_cap->getEdgeArray(end_cap); + cap_mface = end_cap->getFaceArray(end_cap); + + mul_m4_m4m4(endoffset, final_offset, offset); + + vert_map = MEM_callocN(sizeof(*vert_map) * capVerts, + "arrayModifier_doArray vert_map"); + + origindex = result->getVertDataArray(result, CD_ORIGINDEX); + for(i = 0; i < capVerts; i++) { + MVert *mv = &cap_mvert[i]; + short merged = 0; + + if(amd->flags & MOD_ARR_MERGE) { + float tmp_co[3]; + MVert *in_mv; + int j; + + copy_v3_v3(tmp_co, mv->co); + mul_m4_v3(offset, tmp_co); + + for(j = 0; j < maxVerts; j++) { + in_mv = &src_mvert[j]; + /* if this vert is within merge limit, merge */ + if(compare_len_v3v3(tmp_co, in_mv->co, amd->merge_dist)) { + vert_map[i] = calc_mapping(indexMap, j, count - 1); + merged = 1; + break; + } + } + } + + if(!merged) { + DM_copy_vert_data(end_cap, result, i, numVerts, 1); + mvert[numVerts] = *mv; + mul_m4_v3(endoffset, mvert[numVerts].co); + origindex[numVerts] = ORIGINDEX_NONE; + + vert_map[i] = numVerts; + + numVerts++; + } + } + origindex = result->getEdgeDataArray(result, CD_ORIGINDEX); + for(i = 0; i < capEdges; i++) { + int v1, v2; + + v1 = vert_map[cap_medge[i].v1]; + v2 = vert_map[cap_medge[i].v2]; + + if(!BLI_edgehash_haskey(edges, v1, v2)) { + DM_copy_edge_data(end_cap, result, i, numEdges, 1); + medge[numEdges] = cap_medge[i]; + medge[numEdges].v1 = v1; + medge[numEdges].v2 = v2; + origindex[numEdges] = ORIGINDEX_NONE; + + numEdges++; + } + } + origindex = result->getFaceDataArray(result, CD_ORIGINDEX); + for(i = 0; i < capFaces; i++) { + DM_copy_face_data(end_cap, result, i, numFaces, 1); + mface[numFaces] = cap_mface[i]; + mface[numFaces].v1 = vert_map[mface[numFaces].v1]; + mface[numFaces].v2 = vert_map[mface[numFaces].v2]; + mface[numFaces].v3 = vert_map[mface[numFaces].v3]; + if(mface[numFaces].v4) { + mface[numFaces].v4 = vert_map[mface[numFaces].v4]; + + test_index_face(&mface[numFaces], &result->faceData, + numFaces, 4); + } + else + { + test_index_face(&mface[numFaces], &result->faceData, + numFaces, 3); + } + origindex[numFaces] = ORIGINDEX_NONE; + + numFaces++; + } + + MEM_freeN(vert_map); + end_cap->release(end_cap); + } + + BLI_edgehash_free(edges, NULL); + MEM_freeN(indexMap); + + CDDM_lower_num_verts(result, numVerts); + CDDM_lower_num_edges(result, numEdges); + CDDM_lower_num_faces(result, numFaces); + + return result; } static DerivedMesh *applyModifier(ModifierData *md, Object *ob, diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index 1cf67ac8cae..e293be5886d 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -212,17 +212,17 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, !BLI_ghashIterator_isDone(hashIter); BLI_ghashIterator_step(hashIter) ) { - MVert source; - MVert *dest; - int oldIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(hashIter)); - int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(hashIter)); + MVert source; + MVert *dest; + int oldIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(hashIter)); + int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(hashIter)); - dm->getVert(dm, oldIndex, &source); - dest = CDDM_get_vert(result, newIndex); + dm->getVert(dm, oldIndex, &source); + dest = CDDM_get_vert(result, newIndex); - DM_copy_vert_data(dm, result, oldIndex, newIndex, 1); - *dest = source; - } + DM_copy_vert_data(dm, result, oldIndex, newIndex, 1); + *dest = source; + } BLI_ghashIterator_free(hashIter); /* copy the edges across, remapping indices */ diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index 09e29d9ed8e..22ba1447d20 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -175,11 +175,11 @@ static SmoothMesh *smoothmesh_new(int num_verts, int num_edges, int num_faces, { SmoothMesh *mesh = MEM_callocN(sizeof(*mesh), "smoothmesh"); mesh->verts = MEM_callocN(sizeof(*mesh->verts) * max_verts, - "SmoothMesh.verts"); + "SmoothMesh.verts"); mesh->edges = MEM_callocN(sizeof(*mesh->edges) * max_edges, - "SmoothMesh.edges"); + "SmoothMesh.edges"); mesh->faces = MEM_callocN(sizeof(*mesh->faces) * max_faces, - "SmoothMesh.faces"); + "SmoothMesh.faces"); mesh->num_verts = num_verts; mesh->num_edges = num_edges; @@ -280,8 +280,8 @@ static void smoothmesh_print(SmoothMesh *mesh) dm->getVert(dm, vert->oldIndex, &mv); printf("%3d: ind={%3d, %3d}, pos={% 5.1f, % 5.1f, % 5.1f}", - i, vert->oldIndex, vert->newIndex, - mv.co[0], mv.co[1], mv.co[2]); + i, vert->oldIndex, vert->newIndex, + mv.co[0], mv.co[1], mv.co[2]); printf(", faces={"); for(node = vert->faces; node != NULL; node = node->next) { printf(" %d", ((SmoothFace *)node->link)->newIndex); @@ -296,8 +296,8 @@ static void smoothmesh_print(SmoothMesh *mesh) printf("%4d: indices={%4d, %4d}, verts={%4d, %4d}", i, - edge->oldIndex, edge->newIndex, - edge->verts[0]->newIndex, edge->verts[1]->newIndex); + edge->oldIndex, edge->newIndex, + edge->verts[0]->newIndex, edge->verts[1]->newIndex); if(edge->verts[0] == edge->verts[1]) printf(" <- DUPLICATE VERTEX"); printf(", faces={"); for(node = edge->faces; node != NULL; node = node->next) { @@ -311,7 +311,7 @@ static void smoothmesh_print(SmoothMesh *mesh) SmoothFace *face = &mesh->faces[i]; printf("%4d: indices={%4d, %4d}, edges={", i, - face->oldIndex, face->newIndex); + face->oldIndex, face->newIndex); for(j = 0; j < SMOOTHFACE_MAX_EDGES && face->edges[j]; j++) { if(face->flip[j]) printf(" -%-2d", face->edges[j]->newIndex); @@ -339,7 +339,7 @@ static SmoothMesh *smoothmesh_from_derivedmesh(DerivedMesh *dm) totface = dm->getNumFaces(dm); mesh = smoothmesh_new(totvert, totedge, totface, - totvert, totedge, totface); + totvert, totedge, totface); mesh->dm = dm; @@ -410,8 +410,8 @@ static DerivedMesh *CDDM_from_smoothmesh(SmoothMesh *mesh) { DerivedMesh *result = CDDM_from_template(mesh->dm, mesh->num_verts, - mesh->num_edges, - mesh->num_faces); + mesh->num_edges, + mesh->num_faces); MVert *new_verts = CDDM_get_verts(result); MEdge *new_edges = CDDM_get_edges(result); MFace *new_faces = CDDM_get_faces(result); @@ -422,7 +422,7 @@ static DerivedMesh *CDDM_from_smoothmesh(SmoothMesh *mesh) MVert *newMV = &new_verts[vert->newIndex]; DM_copy_vert_data(mesh->dm, result, - vert->oldIndex, vert->newIndex, 1); + vert->oldIndex, vert->newIndex, 1); mesh->dm->getVert(mesh->dm, vert->oldIndex, newMV); } @@ -431,7 +431,7 @@ static DerivedMesh *CDDM_from_smoothmesh(SmoothMesh *mesh) MEdge *newME = &new_edges[edge->newIndex]; DM_copy_edge_data(mesh->dm, result, - edge->oldIndex, edge->newIndex, 1); + edge->oldIndex, edge->newIndex, 1); mesh->dm->getEdge(mesh->dm, edge->oldIndex, newME); newME->v1 = edge->verts[0]->newIndex; newME->v2 = edge->verts[1]->newIndex; @@ -442,7 +442,7 @@ static DerivedMesh *CDDM_from_smoothmesh(SmoothMesh *mesh) MFace *newMF = &new_faces[face->newIndex]; DM_copy_face_data(mesh->dm, result, - face->oldIndex, face->newIndex, 1); + face->oldIndex, face->newIndex, 1); mesh->dm->getFace(mesh->dm, face->oldIndex, newMF); newMF->v1 = face->edges[0]->verts[face->flip[0]]->newIndex; @@ -666,7 +666,7 @@ static void edge_replace_vert(void *ptr, void *userdata) #ifdef EDGESPLIT_DEBUG_3 printf("replacing vert %4d with %4d in edge %4d", - find->newIndex, replace->newIndex, edge->newIndex); + find->newIndex, replace->newIndex, edge->newIndex); printf(": {%4d, %4d}", edge->verts[0]->newIndex, edge->verts[1]->newIndex); #endif @@ -702,15 +702,15 @@ static void face_replace_edge(void *ptr, void *userdata) #ifdef EDGESPLIT_DEBUG_3 printf("replacing edge %4d with %4d in face %4d", - find->newIndex, replace->newIndex, face->newIndex); + find->newIndex, replace->newIndex, face->newIndex); if(face->edges[3]) printf(": {%2d %2d %2d %2d}", - face->edges[0]->newIndex, face->edges[1]->newIndex, - face->edges[2]->newIndex, face->edges[3]->newIndex); + face->edges[0]->newIndex, face->edges[1]->newIndex, + face->edges[2]->newIndex, face->edges[3]->newIndex); else printf(": {%2d %2d %2d}", - face->edges[0]->newIndex, face->edges[1]->newIndex, - face->edges[2]->newIndex); + face->edges[0]->newIndex, face->edges[1]->newIndex, + face->edges[2]->newIndex); #endif for(i = 0; i < SMOOTHFACE_MAX_EDGES && face->edges[i]; i++) { @@ -724,12 +724,12 @@ static void face_replace_edge(void *ptr, void *userdata) #ifdef EDGESPLIT_DEBUG_3 if(face->edges[3]) printf(" -> {%2d %2d %2d %2d}\n", - face->edges[0]->newIndex, face->edges[1]->newIndex, - face->edges[2]->newIndex, face->edges[3]->newIndex); + face->edges[0]->newIndex, face->edges[1]->newIndex, + face->edges[2]->newIndex, face->edges[3]->newIndex); else printf(" -> {%2d %2d %2d}\n", - face->edges[0]->newIndex, face->edges[1]->newIndex, - face->edges[2]->newIndex); + face->edges[0]->newIndex, face->edges[1]->newIndex, + face->edges[2]->newIndex); #endif } @@ -776,7 +776,7 @@ static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge, Lin LinkNode *visited_edges = NULL; #ifdef EDGESPLIT_DEBUG_1 printf("=== START === find_other_sharp_edge(edge = %4d, vert = %4d)\n", - edge->newIndex, vert->newIndex); + edge->newIndex, vert->newIndex); #endif /* get a face on which to start */ @@ -800,7 +800,7 @@ static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge, Lin && !linklist_contains(visited_edges, edge2)) { #ifdef EDGESPLIT_DEBUG_3 printf("current face %4d; current edge %4d\n", face->newIndex, - edge2->newIndex); + edge2->newIndex); #endif /* get the next face */ face = other_face(edge2, face); @@ -818,26 +818,26 @@ static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge, Lin edge2 = other_edge(face, vert, edge2); #ifdef EDGESPLIT_DEBUG_3 printf("next face %4d; next edge %4d\n", - face->newIndex, edge2->newIndex); + 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; + /* 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); + 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); + 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; + return edge2; } static void split_single_vert(SmoothVert *vert, SmoothFace *face, @@ -911,7 +911,7 @@ static void propagate_split(SmoothEdge *edge, SmoothVert *vert, LinkNode *visited_faces = NULL; #ifdef EDGESPLIT_DEBUG_1 printf("=== START === propagate_split(edge = %4d, vert = %4d)\n", - edge->newIndex, vert->newIndex); + edge->newIndex, vert->newIndex); #endif edge2 = find_other_sharp_edge(vert, edge, &visited_faces); @@ -956,7 +956,7 @@ static void propagate_split(SmoothEdge *edge, SmoothVert *vert, BLI_linklist_free(visited_faces, NULL); #ifdef EDGESPLIT_DEBUG_1 printf("=== END === propagate_split(edge = %4d, vert = %4d)\n", - edge->newIndex, vert->newIndex); + edge->newIndex, vert->newIndex); #endif } @@ -969,7 +969,7 @@ static void split_edge(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh) LinkNode *visited_faces = NULL; #ifdef EDGESPLIT_DEBUG_1 printf("=== START === split_edge(edge = %4d, vert = %4d)\n", - edge->newIndex, vert->newIndex); + edge->newIndex, vert->newIndex); #endif edge2 = find_other_sharp_edge(vert, edge, &visited_faces); @@ -1042,7 +1042,7 @@ static void split_edge(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh) BLI_linklist_free(visited_faces, NULL); #ifdef EDGESPLIT_DEBUG_1 printf("=== END === split_edge(edge = %4d, vert = %4d)\n", - edge->newIndex, vert->newIndex); + edge->newIndex, vert->newIndex); #endif } @@ -1078,31 +1078,31 @@ static void tag_and_count_extra_edges(SmoothMesh *mesh, float split_angle, /* (the edge can only be sharp if we're checking angle or flag, * and it has at least 2 faces) */ - /* if we're checking the sharp flag and it's set, good */ - if((flags & MOD_EDGESPLIT_FROMFLAG) && (edge->flag & ME_SHARP)) { - /* this edge is sharp */ - sharp = 1; - - (*extra_edges)++; - } else if(flags & MOD_EDGESPLIT_FROMANGLE) { - /* we know the edge has 2 faces, so check the angle */ - SmoothFace *face1 = edge->faces->link; - SmoothFace *face2 = edge->faces->next->link; - float edge_angle_cos = dot_v3v3(face1->normal, - face2->normal); - - if(edge_angle_cos < threshold) { - /* this edge is sharp */ - sharp = 1; - - (*extra_edges)++; - } - } - } + /* if we're checking the sharp flag and it's set, good */ + if((flags & MOD_EDGESPLIT_FROMFLAG) && (edge->flag & ME_SHARP)) { + /* this edge is sharp */ + sharp = 1; + + (*extra_edges)++; + } else if(flags & MOD_EDGESPLIT_FROMANGLE) { + /* we know the edge has 2 faces, so check the angle */ + SmoothFace *face1 = edge->faces->link; + SmoothFace *face2 = edge->faces->next->link; + float edge_angle_cos = dot_v3v3(face1->normal, + face2->normal); + + if(edge_angle_cos < threshold) { + /* this edge is sharp */ + sharp = 1; + + (*extra_edges)++; + } + } + } - /* set/clear sharp flag appropriately */ - if(sharp) edge->flag |= ME_SHARP; - else edge->flag &= ~ME_SHARP; + /* set/clear sharp flag appropriately */ + if(sharp) edge->flag |= ME_SHARP; + else edge->flag &= ~ME_SHARP; } } @@ -1244,7 +1244,7 @@ static DerivedMesh *edgesplitModifier_do(EdgeSplitModifierData *emd, DerivedMesh #ifdef EDGESPLIT_DEBUG_0 printf("Edgesplit: Estimated %d verts & %d edges, " "found %d verts & %d edges\n", max_verts, max_edges, - mesh->num_verts, mesh->num_edges); + mesh->num_verts, mesh->num_edges); #endif result = CDDM_from_smoothmesh(mesh); diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 00ab5d027fb..f1bc0d33fd8 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -997,19 +997,19 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob, createFacepa(emd,psmd,derivedData); } - /* 2. create new mesh */ - if(emd->flag & eExplodeFlag_EdgeCut){ - int *facepa = emd->facepa; - DerivedMesh *splitdm=cutEdges(emd,dm); - DerivedMesh *explode=explodeMesh(emd, psmd, md->scene, ob, splitdm); - - MEM_freeN(emd->facepa); - emd->facepa=facepa; - splitdm->release(splitdm); - return explode; - } - else - return explodeMesh(emd, psmd, md->scene, ob, derivedData); + /* 2. create new mesh */ + if(emd->flag & eExplodeFlag_EdgeCut){ + int *facepa = emd->facepa; + DerivedMesh *splitdm=cutEdges(emd,dm); + DerivedMesh *explode=explodeMesh(emd, psmd, md->scene, ob, splitdm); + + MEM_freeN(emd->facepa); + emd->facepa=facepa; + splitdm->release(splitdm); + return explode; + } + else + return explodeMesh(emd, psmd, md->scene, ob, derivedData); } return derivedData; } -- cgit v1.2.3 From 8fec90e220e3120d944ef2e385de0b0da615102f Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 25 Apr 2011 06:27:32 +0000 Subject: Displace Modifier - Optimisation Tweaks for jpbouza and ZanQdo - When strength is 0, there's no need to perform any of the calculations at all - When the vertexgroup weight for a vert is set to 0, skip evaluating the modifier for that vertex as it should result in no-change to the final result --- source/blender/modifiers/intern/MOD_displace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index d303f3d2516..7f887eb162a 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -260,6 +260,7 @@ static void displaceModifier_do( float (*tex_co)[3]; if(!dmd->texture) return; + if(dmd->strength == 0.0f) return; defgrp_index = defgroup_name_index(ob, dmd->defgrp_name); @@ -284,7 +285,7 @@ static void displaceModifier_do( break; } } - if(!def_weight) continue; + if(!def_weight || def_weight->weight==0.0f) continue; } texres.nor = NULL; -- cgit v1.2.3 From 7bedbde536e14aa8a4931ba1d560f38dc3326b8f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 25 Apr 2011 16:02:53 +0000 Subject: indentation changes only. --- source/blender/modifiers/intern/MOD_edgesplit.c | 74 ++++++++++++------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index 22ba1447d20..c7c2f3edc8a 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -280,8 +280,8 @@ static void smoothmesh_print(SmoothMesh *mesh) dm->getVert(dm, vert->oldIndex, &mv); printf("%3d: ind={%3d, %3d}, pos={% 5.1f, % 5.1f, % 5.1f}", - i, vert->oldIndex, vert->newIndex, - mv.co[0], mv.co[1], mv.co[2]); + i, vert->oldIndex, vert->newIndex, + mv.co[0], mv.co[1], mv.co[2]); printf(", faces={"); for(node = vert->faces; node != NULL; node = node->next) { printf(" %d", ((SmoothFace *)node->link)->newIndex); @@ -295,9 +295,9 @@ static void smoothmesh_print(SmoothMesh *mesh) LinkNode *node; printf("%4d: indices={%4d, %4d}, verts={%4d, %4d}", - i, - edge->oldIndex, edge->newIndex, - edge->verts[0]->newIndex, edge->verts[1]->newIndex); + i, + edge->oldIndex, edge->newIndex, + edge->verts[0]->newIndex, edge->verts[1]->newIndex); if(edge->verts[0] == edge->verts[1]) printf(" <- DUPLICATE VERTEX"); printf(", faces={"); for(node = edge->faces; node != NULL; node = node->next) { @@ -311,7 +311,7 @@ static void smoothmesh_print(SmoothMesh *mesh) SmoothFace *face = &mesh->faces[i]; printf("%4d: indices={%4d, %4d}, edges={", i, - face->oldIndex, face->newIndex); + face->oldIndex, face->newIndex); for(j = 0; j < SMOOTHFACE_MAX_EDGES && face->edges[j]; j++) { if(face->flip[j]) printf(" -%-2d", face->edges[j]->newIndex); @@ -514,18 +514,18 @@ static void linklist_copy(LinkNode **target, LinkNode *source) for(; source; source = source->next) { if(node) { node->next = MEM_mallocN(sizeof(*node->next), "nlink_copy"); - node = node->next; -} else { - node = *target = MEM_mallocN(sizeof(**target), "nlink_copy"); -} - node->link = source->link; - node->next = NULL; -} + node = node->next; + } else { + node = *target = MEM_mallocN(sizeof(**target), "nlink_copy"); + } + node->link = source->link; + node->next = NULL; + } } #endif - /* appends source to target if it's not already in target */ - static void linklist_append_unique(LinkNode **target, void *source) +/* appends source to target if it's not already in target */ +static void linklist_append_unique(LinkNode **target, void *source) { LinkNode *node; LinkNode *prev = NULL; @@ -559,7 +559,7 @@ static void linklist_prepend_linklist(LinkNode **list, LinkNode *prepend) node->next = *list; *list = prepend; -} + } } #endif @@ -666,7 +666,7 @@ static void edge_replace_vert(void *ptr, void *userdata) #ifdef EDGESPLIT_DEBUG_3 printf("replacing vert %4d with %4d in edge %4d", - find->newIndex, replace->newIndex, edge->newIndex); + find->newIndex, replace->newIndex, edge->newIndex); printf(": {%4d, %4d}", edge->verts[0]->newIndex, edge->verts[1]->newIndex); #endif @@ -702,15 +702,15 @@ static void face_replace_edge(void *ptr, void *userdata) #ifdef EDGESPLIT_DEBUG_3 printf("replacing edge %4d with %4d in face %4d", - find->newIndex, replace->newIndex, face->newIndex); + find->newIndex, replace->newIndex, face->newIndex); if(face->edges[3]) printf(": {%2d %2d %2d %2d}", - face->edges[0]->newIndex, face->edges[1]->newIndex, - face->edges[2]->newIndex, face->edges[3]->newIndex); + face->edges[0]->newIndex, face->edges[1]->newIndex, + face->edges[2]->newIndex, face->edges[3]->newIndex); else printf(": {%2d %2d %2d}", - face->edges[0]->newIndex, face->edges[1]->newIndex, - face->edges[2]->newIndex); + face->edges[0]->newIndex, face->edges[1]->newIndex, + face->edges[2]->newIndex); #endif for(i = 0; i < SMOOTHFACE_MAX_EDGES && face->edges[i]; i++) { @@ -724,12 +724,12 @@ static void face_replace_edge(void *ptr, void *userdata) #ifdef EDGESPLIT_DEBUG_3 if(face->edges[3]) printf(" -> {%2d %2d %2d %2d}\n", - face->edges[0]->newIndex, face->edges[1]->newIndex, - face->edges[2]->newIndex, face->edges[3]->newIndex); + face->edges[0]->newIndex, face->edges[1]->newIndex, + face->edges[2]->newIndex, face->edges[3]->newIndex); else printf(" -> {%2d %2d %2d}\n", - face->edges[0]->newIndex, face->edges[1]->newIndex, - face->edges[2]->newIndex); + face->edges[0]->newIndex, face->edges[1]->newIndex, + face->edges[2]->newIndex); #endif } @@ -776,7 +776,7 @@ static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge, Lin LinkNode *visited_edges = NULL; #ifdef EDGESPLIT_DEBUG_1 printf("=== START === find_other_sharp_edge(edge = %4d, vert = %4d)\n", - edge->newIndex, vert->newIndex); + edge->newIndex, vert->newIndex); #endif /* get a face on which to start */ @@ -800,7 +800,7 @@ static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge, Lin && !linklist_contains(visited_edges, edge2)) { #ifdef EDGESPLIT_DEBUG_3 printf("current face %4d; current edge %4d\n", face->newIndex, - edge2->newIndex); + edge2->newIndex); #endif /* get the next face */ face = other_face(edge2, face); @@ -818,7 +818,7 @@ static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge, Lin edge2 = other_edge(face, vert, edge2); #ifdef EDGESPLIT_DEBUG_3 printf("next face %4d; next edge %4d\n", - face->newIndex, edge2->newIndex); + face->newIndex, edge2->newIndex); } else { printf("loose edge: %4d\n", edge2->newIndex); #endif @@ -834,8 +834,8 @@ static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge, Lin #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); + "returning edge %d\n", + edge->newIndex, vert->newIndex, edge2 ? edge2->newIndex : -1); #endif return edge2; } @@ -911,7 +911,7 @@ static void propagate_split(SmoothEdge *edge, SmoothVert *vert, LinkNode *visited_faces = NULL; #ifdef EDGESPLIT_DEBUG_1 printf("=== START === propagate_split(edge = %4d, vert = %4d)\n", - edge->newIndex, vert->newIndex); + edge->newIndex, vert->newIndex); #endif edge2 = find_other_sharp_edge(vert, edge, &visited_faces); @@ -956,7 +956,7 @@ static void propagate_split(SmoothEdge *edge, SmoothVert *vert, BLI_linklist_free(visited_faces, NULL); #ifdef EDGESPLIT_DEBUG_1 printf("=== END === propagate_split(edge = %4d, vert = %4d)\n", - edge->newIndex, vert->newIndex); + edge->newIndex, vert->newIndex); #endif } @@ -969,7 +969,7 @@ static void split_edge(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh) LinkNode *visited_faces = NULL; #ifdef EDGESPLIT_DEBUG_1 printf("=== START === split_edge(edge = %4d, vert = %4d)\n", - edge->newIndex, vert->newIndex); + edge->newIndex, vert->newIndex); #endif edge2 = find_other_sharp_edge(vert, edge, &visited_faces); @@ -1042,7 +1042,7 @@ static void split_edge(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh) BLI_linklist_free(visited_faces, NULL); #ifdef EDGESPLIT_DEBUG_1 printf("=== END === split_edge(edge = %4d, vert = %4d)\n", - edge->newIndex, vert->newIndex); + edge->newIndex, vert->newIndex); #endif } @@ -1243,8 +1243,8 @@ static DerivedMesh *edgesplitModifier_do(EdgeSplitModifierData *emd, DerivedMesh #ifdef EDGESPLIT_DEBUG_0 printf("Edgesplit: Estimated %d verts & %d edges, " - "found %d verts & %d edges\n", max_verts, max_edges, - mesh->num_verts, mesh->num_edges); + "found %d verts & %d edges\n", max_verts, max_edges, + mesh->num_verts, mesh->num_edges); #endif result = CDDM_from_smoothmesh(mesh); -- cgit v1.2.3 From 461a7c5c8185d0504c63ddc8de0b2c765e72be4b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 25 Apr 2011 16:24:38 +0000 Subject: fix [#26993] Edge Split Crash --- source/blender/modifiers/intern/MOD_edgesplit.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index c7c2f3edc8a..25a8625b342 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -942,10 +942,13 @@ static void propagate_split(SmoothEdge *edge, SmoothVert *vert, /* vert has more than one fan of faces attached; split it */ vert2 = smoothvert_copy(vert, mesh); - /* replace vert with its copy in visited_faces */ - repdata.find = vert; - repdata.replace = vert2; - BLI_linklist_apply(visited_faces, face_replace_vert, &repdata); + /* fails in rare cases, see [#26993] */ + if(vert2) { + /* replace vert with its copy in visited_faces */ + repdata.find = vert; + repdata.replace = vert2; + BLI_linklist_apply(visited_faces, face_replace_vert, &repdata); + } } } else { /* edge is not loose, so it must be sharp; split it */ -- cgit v1.2.3 From b12d46f73e448ef2bdefe854a32bcb1f8cb0e74e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 26 Apr 2011 10:38:18 +0000 Subject: - fix for player linking - added notes to release todo's. - renamed view3d view transform matching functions. - added assert in edge split modifier to make a certain bug easier to spot. --- source/blender/modifiers/intern/MOD_edgesplit.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index 25a8625b342..8d0aea41b5c 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -38,6 +38,8 @@ /* EdgeSplit modifier: Splits edges in the mesh according to sharpness flag * or edge angle (can be used to achieve autosmoothing) */ +#include + #include "DNA_meshdata_types.h" #include "BLI_listbase.h" @@ -125,6 +127,8 @@ static SmoothVert *smoothvert_copy(SmoothVert *vert, SmoothMesh *mesh) { SmoothVert *copy = &mesh->verts[mesh->num_verts]; + assert(vert != NULL); + if(mesh->num_verts >= mesh->max_verts) { printf("Attempted to add a SmoothMesh vert beyond end of array\n"); return NULL; -- cgit v1.2.3 From f280f8384f839bdf0de7916e8c7f4737e16b3c21 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 28 Apr 2011 05:19:17 +0000 Subject: fix [#27186] Wave modifier falloff regression from 2.4x (own fault) --- source/blender/modifiers/intern/MOD_wave.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 6d547867ed8..df3a7f80490 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -352,6 +352,7 @@ static void waveModifier_do(WaveModifierData *md, } falloff_fac = (1.0f - (dist * falloff_inv)); + CLAMP(falloff_fac, 0.0f, 1.0f); if(wmd->flag & MOD_WAVE_X) { if(wmd->flag & MOD_WAVE_Y) amplit = (float)sqrt(x*x + y*y); -- cgit v1.2.3 From 7a2d6482e3971d669427697a8cd9fe0b1563bb83 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 28 Apr 2011 05:34:11 +0000 Subject: skip some calculations with the wave modifier - when the vert has no vgroup weight or 0.0 falloff. --- source/blender/modifiers/intern/MOD_wave.c | 94 +++++++++++++++--------------- 1 file changed, 46 insertions(+), 48 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index df3a7f80490..6dfe5314131 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -263,6 +263,9 @@ static void waveModifier_do(WaveModifierData *md, (float)(1.0 / exp(wmd->width * wmd->narrow * wmd->width * wmd->narrow)); float lifefac = wmd->height; float (*tex_co)[3] = NULL; + const int wmd_axis= wmd->flag & (MOD_WAVE_X|MOD_WAVE_Y); + const float falloff= wmd->falloff; + float falloff_fac= 1.0f; /* when falloff == 0.0f this stays at 1.0f */ if(wmd->flag & MOD_WAVE_NORM && ob->type == OB_MESH) mvert = dm->getVertArray(dm); @@ -306,7 +309,7 @@ static void waveModifier_do(WaveModifierData *md, if(lifefac != 0.0f) { /* avoid divide by zero checks within the loop */ - float falloff_inv= wmd->falloff ? 1.0f / wmd->falloff : 1.0f; + float falloff_inv= falloff ? 1.0f / falloff : 1.0f; int i; for(i = 0; i < numVerts; i++) { @@ -314,52 +317,29 @@ static void waveModifier_do(WaveModifierData *md, float x = co[0] - wmd->startx; float y = co[1] - wmd->starty; float amplit= 0.0f; - float dist = 0.0f; - float falloff_fac = 0.0f; - TexResult texres; - MDeformWeight *def_weight = NULL; + float def_weight= 1.0f; /* get weights */ if(dvert) { - int j; - for(j = 0; j < dvert[i].totweight; ++j) { - if(dvert[i].dw[j].def_nr == defgrp_index) { - def_weight = &dvert[i].dw[j]; - break; - } - } + def_weight= defvert_find_weight(&dvert[i], defgrp_index); /* if this vert isn't in the vgroup, don't deform it */ - if(!def_weight) continue; - } - - if(wmd->texture) { - texres.nor = NULL; - get_texture_value(wmd->texture, tex_co[i], &texres); - } - - /*get dist*/ - if(wmd->flag & MOD_WAVE_X) { - if(wmd->flag & MOD_WAVE_Y){ - dist = (float)sqrt(x*x + y*y); - } - else{ - dist = fabs(x); + if(def_weight == 0.0f) { + continue; } } - else if(wmd->flag & MOD_WAVE_Y) { - dist = fabs(y); - } - - falloff_fac = (1.0f - (dist * falloff_inv)); - CLAMP(falloff_fac, 0.0f, 1.0f); - if(wmd->flag & MOD_WAVE_X) { - if(wmd->flag & MOD_WAVE_Y) amplit = (float)sqrt(x*x + y*y); - else amplit = x; + switch(wmd_axis) { + case MOD_WAVE_X|MOD_WAVE_Y: + amplit = sqrtf(x*x + y*y); + break; + case MOD_WAVE_X: + amplit = x; + break; + case MOD_WAVE_Y: + amplit = y; + break; } - else if(wmd->flag & MOD_WAVE_Y) - amplit= y; /* this way it makes nice circles */ amplit -= (ctime - wmd->timeoffs) * wmd->speed; @@ -369,22 +349,40 @@ static void waveModifier_do(WaveModifierData *md, + wmd->width; } + if(falloff != 0.0f) { + float dist = 0.0f; + + switch(wmd_axis) { + case MOD_WAVE_X|MOD_WAVE_Y: + dist = sqrtf(x*x + y*y); + break; + case MOD_WAVE_X: + dist = fabsf(x); + break; + case MOD_WAVE_Y: + dist = fabsf(y); + break; + } + + falloff_fac = (1.0f - (dist * falloff_inv)); + CLAMP(falloff_fac, 0.0f, 1.0f); + } + /* GAUSSIAN */ - if(amplit > -wmd->width && amplit < wmd->width) { + if((falloff_fac != 0.0f) && (amplit > -wmd->width) && (amplit < wmd->width)) { amplit = amplit * wmd->narrow; amplit = (float)(1.0f / expf(amplit * amplit) - minfac); /*apply texture*/ - if(wmd->texture) - amplit = amplit * texres.tin; - - /*apply weight*/ - if(def_weight) - amplit = amplit * def_weight->weight; + if(wmd->texture) { + TexResult texres; + texres.nor = NULL; + get_texture_value(wmd->texture, tex_co[i], &texres); + amplit *= texres.tin; + } - /*apply falloff*/ - if (wmd->falloff > 0) - amplit = amplit * falloff_fac; + /*apply weight & falloff */ + amplit *= def_weight * falloff_fac; if(mvert) { /* move along normals */ -- cgit v1.2.3 From f3a9b7580eb5c4514580f50795954981348c69b9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 29 Apr 2011 04:43:36 +0000 Subject: spelling corrections. --- source/blender/modifiers/intern/MOD_simpledeform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 2e6d9350148..ea4771b679a 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -56,7 +56,7 @@ /* Clamps/Limits the given coordinate to: limits[0] <= co[axis] <= limits[1] - * The ammount of clamp is saved on dcut */ + * The amount of clamp is saved on dcut */ static void axis_limit(int axis, const float limits[2], float co[3], float dcut[3]) { float val = co[axis]; -- cgit v1.2.3 From 6b0d932c0d27dbce5e62e2a422e388e02f341a52 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 1 May 2011 15:16:59 +0000 Subject: warp modifier, added in the render branch for durian. simple modifier, almost like a hook, except it can deform with 2 object source -> target, has option to preserve rotation and use different falloff types. --- source/blender/modifiers/CMakeLists.txt | 1 + source/blender/modifiers/MOD_modifiertypes.h | 1 + source/blender/modifiers/intern/MOD_displace.c | 88 +----- source/blender/modifiers/intern/MOD_util.c | 90 +++++++ source/blender/modifiers/intern/MOD_util.h | 1 + source/blender/modifiers/intern/MOD_warp.c | 359 +++++++++++++++++++++++++ 6 files changed, 453 insertions(+), 87 deletions(-) create mode 100644 source/blender/modifiers/intern/MOD_warp.c (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index c610a2fbdda..7abcb331f08 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -74,6 +74,7 @@ set(SRC intern/MOD_surface.c intern/MOD_util.c intern/MOD_uvproject.c + intern/MOD_warp.c intern/MOD_wave.c MOD_modifiertypes.h diff --git a/source/blender/modifiers/MOD_modifiertypes.h b/source/blender/modifiers/MOD_modifiertypes.h index 8486e2b5d29..4e44a226c64 100644 --- a/source/blender/modifiers/MOD_modifiertypes.h +++ b/source/blender/modifiers/MOD_modifiertypes.h @@ -71,6 +71,7 @@ extern ModifierTypeInfo modifierType_Smoke; extern ModifierTypeInfo modifierType_ShapeKey; extern ModifierTypeInfo modifierType_Solidify; extern ModifierTypeInfo modifierType_Screw; +extern ModifierTypeInfo modifierType_Warp; /* MOD_util.c */ void modifier_type_init(ModifierTypeInfo *types[]); diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 7f887eb162a..3288c1b5da1 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -162,92 +162,6 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, } -static void get_texture_coords(DisplaceModifierData *dmd, Object *ob, - DerivedMesh *dm, - float (*co)[3], float (*texco)[3], - int numVerts) -{ - int i; - int texmapping = dmd->texmapping; - float mapob_imat[4][4]; - - if(texmapping == MOD_DISP_MAP_OBJECT) { - if(dmd->map_object) - invert_m4_m4(mapob_imat, dmd->map_object->obmat); - else /* if there is no map object, default to local */ - texmapping = MOD_DISP_MAP_LOCAL; - } - - /* UVs need special handling, since they come from faces */ - if(texmapping == MOD_DISP_MAP_UV) { - if(CustomData_has_layer(&dm->faceData, CD_MTFACE)) { - MFace *mface = dm->getFaceArray(dm); - MFace *mf; - char *done = MEM_callocN(sizeof(*done) * numVerts, - "get_texture_coords done"); - int numFaces = dm->getNumFaces(dm); - char uvname[32]; - MTFace *tf; - - validate_layer_name(&dm->faceData, CD_MTFACE, dmd->uvlayer_name, uvname); - tf = CustomData_get_layer_named(&dm->faceData, CD_MTFACE, uvname); - - /* verts are given the UV from the first face that uses them */ - for(i = 0, mf = mface; i < numFaces; ++i, ++mf, ++tf) { - if(!done[mf->v1]) { - texco[mf->v1][0] = tf->uv[0][0]; - texco[mf->v1][1] = tf->uv[0][1]; - texco[mf->v1][2] = 0; - done[mf->v1] = 1; - } - if(!done[mf->v2]) { - texco[mf->v2][0] = tf->uv[1][0]; - texco[mf->v2][1] = tf->uv[1][1]; - texco[mf->v2][2] = 0; - done[mf->v2] = 1; - } - if(!done[mf->v3]) { - texco[mf->v3][0] = tf->uv[2][0]; - texco[mf->v3][1] = tf->uv[2][1]; - texco[mf->v3][2] = 0; - done[mf->v3] = 1; - } - if(!done[mf->v4]) { - texco[mf->v4][0] = tf->uv[3][0]; - texco[mf->v4][1] = tf->uv[3][1]; - texco[mf->v4][2] = 0; - done[mf->v4] = 1; - } - } - - /* remap UVs from [0, 1] to [-1, 1] */ - for(i = 0; i < numVerts; ++i) { - texco[i][0] = texco[i][0] * 2 - 1; - texco[i][1] = texco[i][1] * 2 - 1; - } - - MEM_freeN(done); - return; - } else /* if there are no UVs, default to local */ - texmapping = MOD_DISP_MAP_LOCAL; - } - - for(i = 0; i < numVerts; ++i, ++co, ++texco) { - switch(texmapping) { - case MOD_DISP_MAP_LOCAL: - copy_v3_v3(*texco, *co); - break; - case MOD_DISP_MAP_GLOBAL: - mul_v3_m4v3(*texco, ob->obmat, *co); - break; - case MOD_DISP_MAP_OBJECT: - mul_v3_m4v3(*texco, ob->obmat, *co); - mul_m4_v3(mapob_imat, *texco); - break; - } - } -} - /* dm must be a CDDerivedMesh */ static void displaceModifier_do( DisplaceModifierData *dmd, Object *ob, @@ -270,7 +184,7 @@ static void displaceModifier_do( tex_co = MEM_callocN(sizeof(*tex_co) * numVerts, "displaceModifier_do tex_co"); - get_texture_coords(dmd, ob, dm, vertexCos, tex_co, numVerts); + get_texture_coords((MappingInfoModifierData *)dmd, ob, dm, vertexCos, tex_co, numVerts); for(i = 0; i < numVerts; ++i) { TexResult texres; diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 8c94e6f65bc..9fe37e2d174 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -40,8 +40,11 @@ #include "DNA_modifier_types.h" #include "DNA_object_types.h" #include "DNA_curve_types.h" +#include "DNA_meshdata_types.h" #include "BLI_utildefines.h" +#include "BLI_math_vector.h" +#include "BLI_math_matrix.h" #include "BKE_cdderivedmesh.h" #include "BKE_mesh.h" @@ -74,6 +77,92 @@ void get_texture_value(Tex *texture, float *tex_co, TexResult *texres) texres->tr = texres->tg = texres->tb = texres->tin; } +void get_texture_coords(MappingInfoModifierData *dmd, Object *ob, + DerivedMesh *dm, + float (*co)[3], float (*texco)[3], + int numVerts) +{ + int i; + int texmapping = dmd->texmapping; + float mapob_imat[4][4]; + + if(texmapping == MOD_DISP_MAP_OBJECT) { + if(dmd->map_object) + invert_m4_m4(mapob_imat, dmd->map_object->obmat); + else /* if there is no map object, default to local */ + texmapping = MOD_DISP_MAP_LOCAL; + } + + /* UVs need special handling, since they come from faces */ + if(texmapping == MOD_DISP_MAP_UV) { + if(CustomData_has_layer(&dm->faceData, CD_MTFACE)) { + MFace *mface = dm->getFaceArray(dm); + MFace *mf; + char *done = MEM_callocN(sizeof(*done) * numVerts, + "get_texture_coords done"); + int numFaces = dm->getNumFaces(dm); + char uvname[32]; + MTFace *tf; + + validate_layer_name(&dm->faceData, CD_MTFACE, dmd->uvlayer_name, uvname); + tf = CustomData_get_layer_named(&dm->faceData, CD_MTFACE, uvname); + + /* verts are given the UV from the first face that uses them */ + for(i = 0, mf = mface; i < numFaces; ++i, ++mf, ++tf) { + if(!done[mf->v1]) { + texco[mf->v1][0] = tf->uv[0][0]; + texco[mf->v1][1] = tf->uv[0][1]; + texco[mf->v1][2] = 0; + done[mf->v1] = 1; + } + if(!done[mf->v2]) { + texco[mf->v2][0] = tf->uv[1][0]; + texco[mf->v2][1] = tf->uv[1][1]; + texco[mf->v2][2] = 0; + done[mf->v2] = 1; + } + if(!done[mf->v3]) { + texco[mf->v3][0] = tf->uv[2][0]; + texco[mf->v3][1] = tf->uv[2][1]; + texco[mf->v3][2] = 0; + done[mf->v3] = 1; + } + if(!done[mf->v4]) { + texco[mf->v4][0] = tf->uv[3][0]; + texco[mf->v4][1] = tf->uv[3][1]; + texco[mf->v4][2] = 0; + done[mf->v4] = 1; + } + } + + /* remap UVs from [0, 1] to [-1, 1] */ + for(i = 0; i < numVerts; ++i) { + texco[i][0] = texco[i][0] * 2 - 1; + texco[i][1] = texco[i][1] * 2 - 1; + } + + MEM_freeN(done); + return; + } else /* if there are no UVs, default to local */ + texmapping = MOD_DISP_MAP_LOCAL; + } + + for(i = 0; i < numVerts; ++i, ++co, ++texco) { + switch(texmapping) { + case MOD_DISP_MAP_LOCAL: + copy_v3_v3(*texco, *co); + break; + case MOD_DISP_MAP_GLOBAL: + mul_v3_m4v3(*texco, ob->obmat, *co); + break; + case MOD_DISP_MAP_OBJECT: + mul_v3_m4v3(*texco, ob->obmat, *co); + mul_m4_v3(mapob_imat, *texco); + break; + } + } +} + void modifier_vgroup_cache(ModifierData *md, float (*vertexCos)[3]) { while((md=md->next) && md->type==eModifierType_Armature) { @@ -189,5 +278,6 @@ void modifier_type_init(ModifierTypeInfo *types[]) INIT_TYPE(ShapeKey); INIT_TYPE(Solidify); INIT_TYPE(Screw); + INIT_TYPE(Warp); #undef INIT_TYPE } diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h index a42151904e9..b7862403459 100644 --- a/source/blender/modifiers/intern/MOD_util.h +++ b/source/blender/modifiers/intern/MOD_util.h @@ -46,6 +46,7 @@ struct EditMesh; struct ModifierData; void get_texture_value(struct Tex *texture, float *tex_co, struct TexResult *texres); +void get_texture_coords(struct MappingInfoModifierData *dmd, struct Object *ob, struct DerivedMesh *dm, float (*co)[3], float (*texco)[3], int numVerts); void modifier_vgroup_cache(struct ModifierData *md, float (*vertexCos)[3]); void validate_layer_name(const struct CustomData *data, int type, char *name, char *outname); struct DerivedMesh *get_cddm(struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3]); diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c new file mode 100644 index 00000000000..44eea3f9332 --- /dev/null +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -0,0 +1,359 @@ +/* +* $Id: +* +* ***** BEGIN GPL LICENSE BLOCK ***** +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +* +* Contributor(s): Campbell Barton +* +* ***** END GPL LICENSE BLOCK ***** +* +*/ + +#include + +#include "MEM_guardedalloc.h" + +#include "BLI_math.h" +#include "BLI_utildefines.h" + +#include "BKE_cdderivedmesh.h" +#include "BKE_modifier.h" +#include "BKE_deform.h" +#include "BKE_texture.h" +#include "BKE_colortools.h" + +#include "DNA_object_types.h" +#include "DNA_meshdata_types.h" + +#include "depsgraph_private.h" + +#include "RE_shader_ext.h" + +#include "MOD_util.h" + + +static void initData(ModifierData *md) +{ + WarpModifierData *wmd = (WarpModifierData*) md; + + wmd->curfalloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); + wmd->texture = NULL; + wmd->strength = 1.0f; + wmd->falloff_radius = 1.0f; + wmd->falloff_type = eWarp_Falloff_Smooth; + wmd->flag = 0; +} + +static void copyData(ModifierData *md, ModifierData *target) +{ + WarpModifierData *wmd = (WarpModifierData*) md; + WarpModifierData *twmd = (WarpModifierData*) target; + + twmd->object_from = wmd->object_from; + twmd->object_to = wmd->object_to; + + twmd->strength = wmd->strength; + twmd->falloff_radius = wmd->falloff_radius; + twmd->falloff_type = wmd->falloff_type; + strncpy(twmd->defgrp_name, wmd->defgrp_name, sizeof(twmd->defgrp_name)); + twmd->curfalloff = curvemapping_copy(wmd->curfalloff); + + /* map info */ + twmd->texture = wmd->texture; + twmd->map_object = wmd->map_object; + strncpy(twmd->uvlayer_name, wmd->uvlayer_name, sizeof(twmd->uvlayer_name)); + twmd->texmapping= wmd->texmapping; +} + +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) +{ + WarpModifierData *wmd = (WarpModifierData *)md; + CustomDataMask dataMask = 0; + + /* ask for vertexgroups if we need them */ + if(wmd->defgrp_name[0]) dataMask |= (1 << CD_MDEFORMVERT); + dataMask |= (1 << CD_MDEFORMVERT); + + /* ask for UV coordinates if we need them */ + if(wmd->texmapping == MOD_DISP_MAP_UV) dataMask |= (1 << CD_MTFACE); + + return dataMask; +} + +static int dependsOnTime(ModifierData *md) +{ + WarpModifierData *wmd = (WarpModifierData *)md; + + if(wmd->texture) { + return BKE_texture_dependsOnTime(wmd->texture); + } + else { + return 0; + } +} + +static void freeData(ModifierData *md) +{ + WarpModifierData *wmd = (WarpModifierData *) md; + curvemapping_free(wmd->curfalloff); +} + + +static int isDisabled(ModifierData *md, int UNUSED(userRenderParams)) +{ + WarpModifierData *wmd = (WarpModifierData*) md; + + return !(wmd->object_from && wmd->object_to); +} + +static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, void *userData) +{ + WarpModifierData *wmd = (WarpModifierData*) md; + + walk(userData, ob, &wmd->object_from); + walk(userData, ob, &wmd->object_to); + walk(userData, ob, &wmd->map_object); +} + +static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData) +{ + WarpModifierData *wmd = (WarpModifierData*) md; + + walk(userData, ob, (ID **)&wmd->texture); + + walk(userData, ob, (ID **)&wmd->object_from); + walk(userData, ob, (ID **)&wmd->object_to); + walk(userData, ob, (ID **)&wmd->map_object); +} + +static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UNUSED(scene), + Object *UNUSED(ob), DagNode *obNode) +{ + WarpModifierData *wmd = (WarpModifierData*) md; + + if(wmd->object_from && wmd->object_to) { + DagNode *fromNode = dag_get_node(forest, wmd->object_from); + DagNode *toNode = dag_get_node(forest, wmd->object_to); + + dag_add_relation(forest, fromNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Warp Modifier1"); + dag_add_relation(forest, toNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Warp Modifier2"); + } + + if((wmd->texmapping == MOD_DISP_MAP_OBJECT) && wmd->map_object) { + DagNode *curNode = dag_get_node(forest, wmd->map_object); + dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Warp Modifier3"); + } +} + +static void warpModifier_do(WarpModifierData *wmd, Object *ob, + DerivedMesh *dm, float (*vertexCos)[3], int numVerts) +{ + float obinv[4][4]; + float mat_from[4][4]; + float mat_from_inv[4][4]; + float mat_to[4][4]; + float mat_unit[4][4]; + float mat_final[4][4]; + + float tmat[4][4]; + + float strength = wmd->strength; + float fac = 1.0f, weight; + int i; + int defgrp_index = defgroup_name_index(ob, wmd->defgrp_name); + MDeformVert *dv= NULL; + + float (*tex_co)[3]= NULL; + + if(!(wmd->object_from && wmd->object_to)) + return; + + if(wmd->curfalloff==NULL) /* should never happen, but bad lib linking could cause it */ + wmd->curfalloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); + + invert_m4_m4(obinv, ob->obmat); + + mul_m4_m4m4(mat_from, wmd->object_from->obmat, obinv); + mul_m4_m4m4(mat_to, wmd->object_to->obmat, obinv); + + invert_m4_m4(tmat, mat_from); // swap? + mul_m4_m4m4(mat_final, mat_to, tmat); + + invert_m4_m4(mat_from_inv, mat_from); + + unit_m4(mat_unit); + + if(strength < 0.0f) { + strength = -strength; + invert_m4(mat_final); + } + weight= strength; + + if(wmd->texture) { + tex_co = MEM_mallocN(sizeof(*tex_co) * numVerts, "warpModifier_do tex_co"); + get_texture_coords((MappingInfoModifierData *)wmd, ob, dm, vertexCos, tex_co, numVerts); + } + + for(i = 0; i < numVerts; i++) { + float *co = vertexCos[i]; + + if(wmd->falloff_type==eWarp_Falloff_None || + ((fac=len_v3v3(co, mat_from[3])) < wmd->falloff_radius && (fac=(wmd->falloff_radius-fac)/wmd->falloff_radius)) ) { + + /* skip if no vert group found */ + if(defgrp_index >= 0) { + dv = dm->getVertData(dm, i, CD_MDEFORMVERT); + + if(dv) { + weight = defvert_find_weight(dv, defgrp_index) * wmd->strength; + if(weight <= 0.0f) + continue; + } + } + + + /* closely match PROP_SMOOTH and similar */ + switch(wmd->falloff_type) { + case eWarp_Falloff_None: + fac = 1.0f; + break; + case eWarp_Falloff_Curve: + fac = curvemapping_evaluateF(wmd->curfalloff, 0, fac); + break; + case eWarp_Falloff_Sharp: + fac = fac*fac; + break; + case eWarp_Falloff_Smooth: + fac = 3.0f*fac*fac - 2.0f*fac*fac*fac; + break; + case eWarp_Falloff_Root: + fac = (float)sqrt(fac); + break; + case eWarp_Falloff_Linear: + /* pass */ + break; + case eWarp_Falloff_Const: + fac = 1.0f; + break; + case eWarp_Falloff_Sphere: + fac = (float)sqrt(2*fac - fac * fac); + break; + } + + fac *= weight; + + if(tex_co) { + TexResult texres; + texres.nor = NULL; + get_texture_value(wmd->texture, tex_co[i], &texres); + fac *= texres.tin; + } + + /* into the 'from' objects space */ + mul_m4_v3(mat_from_inv, co); + + if(fac >= 1.0f) { + mul_m4_v3(mat_final, co); + } + else if(fac > 0.0f) { + if(wmd->flag & MOD_WARP_VOLUME_PRESERVE) { + /* interpolate the matrix for nicer locations */ + blend_m4_m4m4(tmat, mat_unit, mat_final, fac); + mul_m4_v3(tmat, co); + } + else { + float tvec[3]; + mul_v3_m4v3(tvec, mat_final, co); + interp_v3_v3v3(co, co, tvec, fac); + } + } + + /* out of the 'from' objects space */ + mul_m4_v3(mat_from, co); + } + } + + if(tex_co) + MEM_freeN(tex_co); + +} + +static int warp_needs_dm(WarpModifierData *wmd) +{ + return wmd->texture || wmd->defgrp_name[0]; +} + +static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, + float (*vertexCos)[3], int numVerts, int UNUSED(useRenderParams), int UNUSED(isFinalCalc)) +{ + DerivedMesh *dm= NULL; + int use_dm= warp_needs_dm((WarpModifierData *)md); + + if(use_dm) { + dm= get_cddm(ob, NULL, derivedData, vertexCos); + } + + warpModifier_do((WarpModifierData *)md, ob, dm, vertexCos, numVerts); + + if(use_dm) { + if(dm != derivedData) dm->release(dm); + } +} + +static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editData, + DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) +{ + DerivedMesh *dm = derivedData; + int use_dm= warp_needs_dm((WarpModifierData *)md); + + if(use_dm) { + if(!derivedData) + dm = CDDM_from_editmesh(editData, ob->data); + } + + deformVerts(md, ob, dm, vertexCos, numVerts, 0, 0); + + if(use_dm) { + if(!derivedData) dm->release(dm); + } +} + + +ModifierTypeInfo modifierType_Warp = { + /* name */ "Warp", + /* structName */ "WarpModifierData", + /* structSize */ sizeof(WarpModifierData), + /* type */ eModifierTypeType_OnlyDeform, + /* flags */ eModifierTypeFlag_AcceptsCVs + | eModifierTypeFlag_SupportsEditmode, + /* copyData */ copyData, + /* deformVerts */ deformVerts, + /* deformMatrices */ NULL, + /* deformVertsEM */ deformVertsEM, + /* deformMatricesEM */ NULL, + /* applyModifier */ 0, + /* applyModifierEM */ 0, + /* initData */ initData, + /* requiredDataMask */ requiredDataMask, + /* freeData */ freeData, + /* isDisabled */ isDisabled, + /* updateDepgraph */ updateDepgraph, + /* dependsOnTime */ dependsOnTime, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ foreachObjectLink, + /* foreachIDLink */ foreachIDLink, +}; -- cgit v1.2.3 From 7cc98cbb0b6f2ef113a568532eb0921e77cc973d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 1 May 2011 16:07:18 +0000 Subject: warp modifier, using negative strength inverts the transformation matrix but the location it gave wasnt useful when rotation was used too, just negate the translation. --- source/blender/modifiers/intern/MOD_warp.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 44eea3f9332..8825f640c03 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -198,8 +198,14 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob, unit_m4(mat_unit); if(strength < 0.0f) { + float loc[3]; strength = -strength; + + /* inverted location is not useful, just use the negative */ + copy_v3_v3(loc, mat_final[3]); invert_m4(mat_final); + negate_v3_v3(mat_final[3], loc); + } weight= strength; -- cgit v1.2.3 From 4548063f971179f56847a4a2588ee18dfc56acc4 Mon Sep 17 00:00:00 2001 From: "Guillermo S. Romero" Date: Sun, 1 May 2011 23:16:16 +0000 Subject: SVN maintenance. --- source/blender/modifiers/intern/MOD_warp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 8825f640c03..8e629bf7365 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -1,5 +1,5 @@ /* -* $Id: +* $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * -- cgit v1.2.3 From 1357443e48881617462463bf8e9037e4fa487d79 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 2 May 2011 10:21:07 +0000 Subject: Fix #27230: texture paint face selection mask did not work on multires. It seems the support mapping flag was removed for disabling in edit mode, but this wasn't necessary. --- source/blender/modifiers/intern/MOD_multires.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index def2020f35f..134574ae6c4 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -112,6 +112,7 @@ ModifierTypeInfo modifierType_Multires = { /* structSize */ sizeof(MultiresModifierData), /* type */ eModifierTypeType_Constructive, /* flags */ eModifierTypeFlag_AcceptsMesh + | eModifierTypeFlag_SupportsMapping | eModifierTypeFlag_RequiresOriginalData, /* copyData */ copyData, -- cgit v1.2.3 From b43252079953e6eefad092927e578c80f695d788 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 8 May 2011 12:51:05 +0000 Subject: fix [#27324] WindowManager.invoke_search_popup() crashes blender and does not work also minor formatting fixes. --- source/blender/modifiers/intern/MOD_warp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 8e629bf7365..27add27deb1 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -350,7 +350,7 @@ ModifierTypeInfo modifierType_Warp = { /* deformVerts */ deformVerts, /* deformMatrices */ NULL, /* deformVertsEM */ deformVertsEM, - /* deformMatricesEM */ NULL, + /* deformMatricesEM */ NULL, /* applyModifier */ 0, /* applyModifierEM */ 0, /* initData */ initData, @@ -359,7 +359,7 @@ ModifierTypeInfo modifierType_Warp = { /* isDisabled */ isDisabled, /* updateDepgraph */ updateDepgraph, /* dependsOnTime */ dependsOnTime, - /* dependsOnNormals */ NULL, + /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ foreachIDLink, }; -- cgit v1.2.3