[Bf-blender-cvs] [7291996f3bf] blender2.8: Fix T57825: Crash when assign material
Sergey Sharybin
noreply at git.blender.org
Thu Nov 15 16:53:25 CET 2018
Commit: 7291996f3bfd5d7148c1b28fe99627b5ddbc3012
Author: Sergey Sharybin
Date: Thu Nov 15 16:50:30 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB7291996f3bfd5d7148c1b28fe99627b5ddbc3012
Fix T57825: Crash when assign material
We need to make sure that all the nested node trees are localized.
Because of this reason, we need to roll back to a bit older way
of dealing with materials.
Should be all safe now with the fixes from few moments ago.
===================================================================
M source/blender/blenkernel/intern/material.c
===================================================================
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index fc0423dc5e5..0e64b9dd6d0 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -235,19 +235,15 @@ Material *BKE_material_localize(Material *ma)
*
* NOTE: Only possible once nested node trees are fully converted to that too. */
- Material *man;
-
- BKE_id_copy_ex(
- NULL, &ma->id, (ID **)&man,
- (LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_COPY_NO_PREVIEW |
- LIB_ID_COPY_NO_ANIMDATA),
- false);
+ Material *man = BKE_libblock_copy_nolib(&ma->id, false);
man->texpaintslot = NULL;
man->preview = NULL;
+ if (ma->nodetree != NULL) {
+ man->nodetree = ntreeLocalize(ma->nodetree);
+ }
+
/* man->gp_style = NULL; */ /* XXX: We probably don't want to clear here, or else we may get problems with COW later? */
BLI_listbase_clear(&man->gpumaterial);
More information about the Bf-blender-cvs
mailing list