diff options
author | Miika Hamalainen <blender@miikah.org> | 2011-10-22 20:16:14 +0400 |
---|---|---|
committer | Miika Hamalainen <blender@miikah.org> | 2011-10-22 20:16:14 +0400 |
commit | 30cba27987362054d16b10e73ddf2601af93be68 (patch) | |
tree | d971f10db56b5d024cf5f7d6f3d48d1e3c20d698 /source/blender/modifiers | |
parent | 8be3249537e7930e0fa5adb59bc343455da309e9 (diff) |
Dynamic Paint:
* Some changes and cleanup pointed on the codereview.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_dynamicpaint.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c index 0c40aea3bd9..707de14cab5 100644 --- a/source/blender/modifiers/intern/MOD_dynamicpaint.c +++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c @@ -12,7 +12,7 @@ * */ -#include "stddef.h" +#include <stddef.h> #include "DNA_meshdata_types.h" #include "DNA_object_types.h" @@ -21,8 +21,8 @@ #include "MEM_guardedalloc.h" #include "BKE_cdderivedmesh.h" -#include "BKE_modifier.h" #include "BKE_dynamicpaint.h" +#include "BKE_modifier.h" #include "depsgraph_private.h" @@ -54,12 +54,34 @@ static void freeData(ModifierData *md) static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) { + DynamicPaintModifierData *pmd = (DynamicPaintModifierData*)md; CustomDataMask dataMask = 0; - dataMask |= (1 << CD_MTFACE); - dataMask |= (1 << CD_MCOL); - dataMask |= (1 << CD_MDEFORMVERT); + if (pmd->canvas) { + DynamicPaintSurface *surface = pmd->canvas->surfaces.first; + for(; surface; surface=surface->next) { + /* tface */ + if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ || + surface->init_color_type == MOD_DPAINT_INITIAL_TEXTURE) { + dataMask |= (1 << CD_MTFACE); + } + /* mcol */ + if (surface->type == MOD_DPAINT_SURFACE_T_PAINT || + surface->init_color_type == MOD_DPAINT_INITIAL_VERTEXCOLOR) { + dataMask |= (1 << CD_MCOL); + } + /* CD_MDEFORMVERT */ + if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) { + dataMask |= (1 << CD_MDEFORMVERT); + } + } + } + if (pmd->brush) { + if (pmd->brush->mat) { + dataMask |= (1 << CD_MTFACE); + } + } return dataMask; } |