[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57354] trunk/blender/source/blender/ modifiers/intern/MOD_displace.c: Fix #35678: Duplicating an object with Displace modifier does not increase the reference count of the texture
Sergey Sharybin
sergey.vfx at gmail.com
Mon Jun 10 16:04:04 CEST 2013
Revision: 57354
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57354
Author: nazgul
Date: 2013-06-10 14:04:03 +0000 (Mon, 10 Jun 2013)
Log Message:
-----------
Fix #35678: Duplicating an object with Displace modifier does not increase the reference count of the texture
Modified Paths:
--------------
trunk/blender/source/blender/modifiers/intern/MOD_displace.c
Modified: trunk/blender/source/blender/modifiers/intern/MOD_displace.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_displace.c 2013-06-10 13:54:09 UTC (rev 57353)
+++ trunk/blender/source/blender/modifiers/intern/MOD_displace.c 2013-06-10 14:04:03 UTC (rev 57354)
@@ -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,8 +80,20 @@
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)
{
DisplaceModifierData *dmd = (DisplaceModifierData *)md;
@@ -292,7 +305,7 @@
/* applyModifierEM */ NULL,
/* initData */ initData,
/* requiredDataMask */ requiredDataMask,
- /* freeData */ NULL,
+ /* freeData */ freeData,
/* isDisabled */ isDisabled,
/* updateDepgraph */ updateDepgraph,
/* dependsOnTime */ dependsOnTime,
More information about the Bf-blender-cvs
mailing list