From 81b6d308a771405ef326b1e4cebbc3359e830a6c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 30 Sep 2010 10:51:36 +0000 Subject: [#23673] Modifier construction gives correct result in viewport but incorrect in render. When there are 2+ consecutive deform modifiers, the second modifier was getting incorrect normals, this only showed up for the displace modifier since its the only deform modifier that uses vertex normals. It would have been easy to fix this by always calculating normals on deform modifiers, but slow. To fix this I added a function to check if a deform modifier needs normals, so the normal calculation function only runs if there are 2 modifiers in a row and the second uses normals. --- source/blender/modifiers/intern/MOD_collision.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/modifiers/intern/MOD_collision.c') diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 32fbd58839a..2651122231c 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -248,6 +248,7 @@ ModifierTypeInfo modifierType_Collision = { /* isDisabled */ 0, /* updateDepgraph */ 0, /* dependsOnTime */ dependsOnTime, + /* dependsOnNormals */ 0, /* foreachObjectLink */ 0, /* foreachIDLink */ 0, }; -- cgit v1.2.3 From fbf208d63fe0ba9770cb225726eb94888aa0994d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 14 Oct 2010 06:29:17 +0000 Subject: add UNUSED() to modifiers, also removed some unused args. --- source/blender/modifiers/intern/MOD_collision.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'source/blender/modifiers/intern/MOD_collision.c') diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 2651122231c..20319b8c65f 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -38,6 +38,7 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_collision.h" #include "BKE_cdderivedmesh.h" #include "BKE_global.h" @@ -94,14 +95,17 @@ static void freeData(ModifierData *md) } } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int UNUSED(numVerts), + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { CollisionModifierData *collmd = (CollisionModifierData*) md; DerivedMesh *dm = NULL; -- cgit v1.2.3 From 8f21a43535cb200c0569566a1b012aec883aa53c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 7 Jan 2011 18:36:47 +0000 Subject: split BKE_utildefines.h, now it only has blender specific defines like GS() MAKE_ID, FILE_MAXDIR, moved the generic defines to BLI_utildefines.h. no functional changes. --- source/blender/modifiers/intern/MOD_collision.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/modifiers/intern/MOD_collision.c') diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 20319b8c65f..46dbb0d9a6e 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -37,6 +37,7 @@ #include "MEM_guardedalloc.h" #include "BLI_math.h" +#include "BLI_utildefines.h" #include "BKE_utildefines.h" #include "BKE_collision.h" -- cgit v1.2.3 From 89c9aaaa25cc7ce60c305d8e30e1c008cb117cf1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 7 Jan 2011 19:18:31 +0000 Subject: remove references to BKE_utildefines where its not needed. - move GS() define into DNA_ID.h - add BLI_utildefines as an automatic include with makesrna generated files. --- source/blender/modifiers/intern/MOD_collision.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/modifiers/intern/MOD_collision.c') diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 46dbb0d9a6e..bf324030424 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -39,7 +39,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" -#include "BKE_utildefines.h" + #include "BKE_collision.h" #include "BKE_cdderivedmesh.h" #include "BKE_global.h" -- cgit v1.2.3 From 329e2d8037050e06d16984924a412e8b32ad4351 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 31 Jan 2011 20:02:51 +0000 Subject: Todo issue: sculpting on deformed mesh Used a crazyspace approach (like in edit mode), but only modifiers with deformMatricies are allowed atm (currently shapekeys and armature modifiers only). All the rest modifiers had an warning message that they aren't applied because of sculpt mode. Deformation of multires is also unsupported. With all this restictions users will always see the actual "layer" (or maybe mesh state would be more correct word) they are sculpting on. Internal changes: - All modifiers could have deformMatricies callback (the same as deformMatriciesEM but for non-edit mode usage) - Added function to build crazyspace for sculpting (sculpt_get_deform_matrices), but it could be generalized for usage in other painting modes (particle edit mode, i.e) Todo: - Implement crazyspace correction to support all kinds of deformation modifiers - Maybe deformation of multires isn't so difficult? - And maybe we could avoid extra bad-level-stub for ED_sculpt_modifiers_changed without code duplicating? --- source/blender/modifiers/intern/MOD_collision.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/modifiers/intern/MOD_collision.c') diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index bf324030424..8decb460d6a 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -243,6 +243,7 @@ ModifierTypeInfo modifierType_Collision = { /* copyData */ 0, /* deformVerts */ deformVerts, + /* deformMatrices */ 0, /* deformVertsEM */ 0, /* deformMatricesEM */ 0, /* applyModifier */ 0, -- 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 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source/blender/modifiers/intern/MOD_collision.c') 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); -- 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_collision.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/modifiers/intern/MOD_collision.c') 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) { -- 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_collision.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/modifiers/intern/MOD_collision.c') 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" -- cgit v1.2.3