diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-06-10 22:12:07 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-06-10 22:12:07 +0400 |
commit | 67a5d1b660a37a43f4d70fc7d588b67bef434574 (patch) | |
tree | 509b19645a58de73e8ee9ae6c16342dfaa6155ba /source/blender/modifiers/intern/MOD_weightvgmix.c | |
parent | 5183ba74a84d1d41561f233bc1679d5a4fd422cb (diff) |
Follow up to r57354: WeightVG and Wave modifiers too need to handle tex id refcount ;)
Diffstat (limited to 'source/blender/modifiers/intern/MOD_weightvgmix.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgmix.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index a5843d04c24..1ec287b3b3a 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -39,6 +39,7 @@ #include "BKE_cdderivedmesh.h" #include "BKE_deform.h" +#include "BKE_library.h" #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_texture.h" /* Texture masking. */ @@ -123,6 +124,14 @@ static void initData(ModifierData *md) wmd->mask_tex_mapping = MOD_DISP_MAP_LOCAL; } +static void freeData(ModifierData *md) +{ + WeightVGMixModifierData *wmd = (WeightVGMixModifierData *) md; + if (wmd->mask_texture) { + id_us_min(&wmd->mask_texture->id); + } +} + static void copyData(ModifierData *md, ModifierData *target) { WeightVGMixModifierData *wmd = (WeightVGMixModifierData *) md; @@ -142,6 +151,10 @@ static void copyData(ModifierData *md, ModifierData *target) twmd->mask_tex_mapping = wmd->mask_tex_mapping; twmd->mask_tex_map_obj = wmd->mask_tex_map_obj; BLI_strncpy(twmd->mask_tex_uvlayer_name, wmd->mask_tex_uvlayer_name, sizeof(twmd->mask_tex_uvlayer_name)); + + if (twmd->mask_texture) { + id_us_plus(&twmd->mask_texture->id); + } } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) @@ -418,7 +431,7 @@ ModifierTypeInfo modifierType_WeightVGMix = { /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, - /* freeData */ NULL, + /* freeData */ freeData, /* isDisabled */ isDisabled, /* updateDepgraph */ updateDepgraph, /* dependsOnTime */ dependsOnTime, |