From f88ad3f04894d37028bb35ffdbd39636d57a37cb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 23 Sep 2010 12:03:34 +0000 Subject: bugfix [#23595] Texture paint with a node based brush produces artifacts also changed displace modifier not to link object depgraph when not using object texturespace. --- source/blender/modifiers/intern/MOD_displace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/modifiers/intern/MOD_displace.c') diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 29ace805543..efe57410441 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -134,7 +134,7 @@ static void updateDepgraph( { DisplaceModifierData *dmd = (DisplaceModifierData*) md; - if(dmd->map_object) { + if(dmd->map_object && dmd->texmapping == MOD_DISP_MAP_OBJECT) { DagNode *curNode = dag_get_node(forest, dmd->map_object); dag_add_relation(forest, curNode, obNode, -- cgit v1.2.3 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_displace.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/blender/modifiers/intern/MOD_displace.c') diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index efe57410441..2e811eb742d 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -103,6 +103,12 @@ static int dependsOnTime(ModifierData *md) } } +static int dependsOnNormals(ModifierData *md) +{ + DisplaceModifierData *dmd = (DisplaceModifierData *)md; + return (dmd->direction == MOD_DISP_DIR_NOR); +} + static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, void *userData) { @@ -349,6 +355,7 @@ ModifierTypeInfo modifierType_Displace = { /* isDisabled */ isDisabled, /* updateDepgraph */ updateDepgraph, /* dependsOnTime */ dependsOnTime, + /* dependsOnNormals */ dependsOnNormals, /* foreachObjectLink */ foreachObjectLink, /* foreachIDLink */ foreachIDLink, }; -- 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_displace.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'source/blender/modifiers/intern/MOD_displace.c') diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 2e811eb742d..95e8a9ce4cc 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -35,6 +35,7 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" #include "BKE_texture.h" @@ -75,7 +76,7 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(tdmd->uvlayer_name, dmd->uvlayer_name, 32); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { DisplaceModifierData *dmd = (DisplaceModifierData *)md; CustomDataMask dataMask = 0; @@ -127,16 +128,17 @@ static void foreachIDLink(ModifierData *md, Object *ob, foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData); } -static int isDisabled(ModifierData *md, int useRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { DisplaceModifierData *dmd = (DisplaceModifierData*) md; return (!dmd->texture || dmd->strength == 0.0f); } -static void updateDepgraph( - ModifierData *md, DagForest *forest, struct Scene *scene, - Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { DisplaceModifierData *dmd = (DisplaceModifierData*) md; @@ -308,11 +310,14 @@ static void displaceModifier_do( MEM_freeN(tex_co); } -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 numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { - DerivedMesh *dm= get_cddm(md->scene, ob, NULL, derivedData, vertexCos); + DerivedMesh *dm= get_cddm(ob, NULL, derivedData, vertexCos); displaceModifier_do((DisplaceModifierData *)md, ob, dm, vertexCos, numVerts); @@ -325,7 +330,7 @@ static void deformVertsEM( ModifierData *md, Object *ob, struct EditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { - DerivedMesh *dm= get_cddm(md->scene, ob, editData, derivedData, vertexCos); + DerivedMesh *dm= get_cddm(ob, editData, derivedData, vertexCos); displaceModifier_do((DisplaceModifierData *)md, ob, dm, vertexCos, numVerts); -- cgit v1.2.3 From e2f1740761936b49c7ff0e71c6194e0d954ec415 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 21 Oct 2010 01:55:39 +0000 Subject: use custom data mask defines, no functional changes. --- source/blender/modifiers/intern/MOD_displace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/modifiers/intern/MOD_displace.c') diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 95e8a9ce4cc..ce41f6dfc1d 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -82,10 +82,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(dmd->defgrp_name[0]) dataMask |= (1 << CD_MDEFORMVERT); + if(dmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; /* ask for UV coordinates if we need them */ - if(dmd->texmapping == MOD_DISP_MAP_UV) dataMask |= (1 << CD_MTFACE); + if(dmd->texmapping == MOD_DISP_MAP_UV) dataMask |= CD_MASK_MTFACE; return dataMask; } -- cgit v1.2.3 From 0efdb860f195edc5899d4698f62d21dc0599ab83 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Wed, 15 Dec 2010 13:08:34 +0000 Subject: Bugfix #22982 Displace modifier: mapping "Global" didn't set a dependency entry. Fix provided by the reporter himself, thanks Jacob F! --- source/blender/modifiers/intern/MOD_displace.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender/modifiers/intern/MOD_displace.c') diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index ce41f6dfc1d..f6e5b9c119a 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -148,6 +148,12 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Displace Modifier"); } + + + if(dmd->texmapping == MOD_DISP_MAP_GLOBAL) + dag_add_relation(forest, obNode, obNode, + DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Displace Modifier"); + } static void get_texture_coords(DisplaceModifierData *dmd, Object *ob, -- 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_displace.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/modifiers/intern/MOD_displace.c') diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index f6e5b9c119a..b61467fbd59 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -34,6 +34,7 @@ #include "DNA_object_types.h" #include "BLI_math.h" +#include "BLI_utildefines.h" #include "BKE_utildefines.h" #include "BKE_cdderivedmesh.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_displace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/modifiers/intern/MOD_displace.c') diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index b61467fbd59..931865409cb 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -36,7 +36,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" -#include "BKE_utildefines.h" + #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" #include "BKE_texture.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_displace.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/modifiers/intern/MOD_displace.c') diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 931865409cb..919814edf59 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -357,6 +357,7 @@ ModifierTypeInfo modifierType_Displace = { /* copyData */ copyData, /* deformVerts */ deformVerts, + /* deformMatrices */ 0, /* deformVertsEM */ deformVertsEM, /* deformMatricesEM */ 0, /* applyModifier */ 0, -- 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_displace.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/modifiers/intern/MOD_displace.c') 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" -- cgit v1.2.3