Commit: bfd8da753d34881c6f1205938ce9e6e25e3bf4e8
Author: Bastien Montagne
Date: Wed Aug 31 16:42:14 2016 +0200
Branches: master
https://developer.blender.org/rBbfd8da753d34881c6f1205938ce9e6e25e3bf4e8
Fix T49210: Issue with User Count on Images in some shader nodetrees when
rendering previews
Our usercount handling was really... infuriating :|
Here, localization (i.e. 'shalow' copy that should not touch to usercounts) was
incrementing
usercounts of the sole Textures IDs of lamps and worlds (on the weak and
fallacious pretext
that related BKE_free... functions would decrement those counts)... Seriously...
So now, localize funcs do not increment any usercount anymore (since matching
BKE_free... ones do
not decrement any either), and we do not call anymore that stupid unlink when
freeing temp
localized copies of lamps/materials at end of preview generation.
Note that we probably still have a lot to do to cleanup that copy/localize
code, pretty sure
we can dedpulicate a lot more.
===================================================================
M source/blender/blenkernel/intern/lamp.c
M source/blender/blenkernel/intern/world.c
M source/blender/editors/render/render_preview.c
===================================================================
diff --git a/source/blender/blenkernel/intern/lamp.c
b/source/blender/blenkernel/intern/lamp.c
index e9d039a..d098366 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -154,8 +154,6 @@ Lamp *localize_lamp(Lamp *la)
if (lan->mtex[a]) {
lan->mtex[a] = MEM_mallocN(sizeof(MTex),
"localize_lamp");
memcpy(lan->mtex[a], la->mtex[a], sizeof(MTex));
- /* free lamp decrements */
- id_us_plus((ID *)lan->mtex[a]->tex);
}
}
diff --git a/source/blender/blenkernel/intern/world.c
b/source/blender/blenkernel/intern/world.c
index de1e318..caa9a1e 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -158,8 +158,6 @@ World *localize_world(World *wrld)
if (wrld->mtex[a]) {
wrldn->mtex[a] = MEM_mallocN(sizeof(MTex),
"localize_world");
memcpy(wrldn->mtex[a], wrld->mtex[a], sizeof(MTex));
- /* free world decrements */
- id_us_plus((ID *)wrldn->mtex[a]->tex);
}
}
diff --git a/source/blender/editors/render/render_preview.c
b/source/blender/editors/render/render_preview.c
index b4f3426..ddbf59b 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -526,7 +526,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene
*scene, ID *id, int id_ty
BKE_node_preview_init_tree(origwrld->nodetree,
sp->sizex, sp->sizey, true);
}
}
-
+
return sce;
}
@@ -863,8 +863,6 @@ static void shader_preview_free(void *customdata)
/* get rid of copied world */
BLI_remlink(&pr_main->world, sp->worldcopy);
- /* T32865 - we need to unlink the texture copies, unlike for
materials */
- BKE_libblock_relink_ex(pr_main, sp->worldcopy, NULL, NULL,
true);
BKE_world_free(sp->worldcopy);
properties = IDP_GetProperties((ID *)sp->worldcopy, false);
@@ -881,7 +879,6 @@ static void shader_preview_free(void *customdata)
/* get rid of copied lamp */
BLI_remlink(&pr_main->lamp, sp->lampcopy);
- BKE_libblock_relink_ex(pr_main, sp->lampcopy, NULL, NULL, true);
BKE_lamp_free(sp->lampcopy);
properties = IDP_GetProperties((ID *)sp->lampcopy, false);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs