diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-11-15 18:50:30 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-11-15 18:50:30 +0300 |
commit | 7291996f3bfd5d7148c1b28fe99627b5ddbc3012 (patch) | |
tree | c641522e876cde73fa89fa0455d05e00ec32293a /source/blender/blenkernel/intern/material.c | |
parent | 637d5ab6359edefe8ac23c92f338799127e39d18 (diff) |
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.
Diffstat (limited to 'source/blender/blenkernel/intern/material.c')
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 14 |
1 files changed, 5 insertions, 9 deletions
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); |