Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-06-10 18:04:03 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-06-10 18:04:03 +0400
commitbfbac9b4489e9dedd5a0988e7eda0e2a5cbc53a9 (patch)
treeec736e8da0348a517a57fa6e2830154f894778c6 /source/blender/modifiers/intern
parent1f7096bb581643e3a61b1da7ec1bea474990be24 (diff)
Fix #35678: Duplicating an object with Displace modifier does not increase the reference count of the texture
Diffstat (limited to 'source/blender/modifiers/intern')
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index d8e2647426c..ffd202736a9 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -42,6 +42,7 @@
#include "BKE_cdderivedmesh.h"
+#include "BKE_library.h"
#include "BKE_modifier.h"
#include "BKE_texture.h"
#include "BKE_deform.h"
@@ -79,6 +80,18 @@ static void copyData(ModifierData *md, ModifierData *target)
tdmd->texmapping = dmd->texmapping;
tdmd->map_object = dmd->map_object;
BLI_strncpy(tdmd->uvlayer_name, dmd->uvlayer_name, sizeof(tdmd->uvlayer_name));
+
+ if (tdmd->texture) {
+ id_us_plus(&tdmd->texture->id);
+ }
+}
+
+static void freeData(ModifierData *md)
+{
+ DisplaceModifierData *dmd = (DisplaceModifierData *) md;
+ if (dmd->texture) {
+ id_us_min(&dmd->texture->id);
+ }
}
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
@@ -292,7 +305,7 @@ ModifierTypeInfo modifierType_Displace = {
/* applyModifierEM */ NULL,
/* initData */ initData,
/* requiredDataMask */ requiredDataMask,
- /* freeData */ NULL,
+ /* freeData */ freeData,
/* isDisabled */ isDisabled,
/* updateDepgraph */ updateDepgraph,
/* dependsOnTime */ dependsOnTime,