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:
-rw-r--r--source/blender/blenkernel/intern/material.c9
-rw-r--r--source/blender/editors/render/render_shading.c1
2 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 913bc9c47e6..fc03116de20 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -1399,7 +1399,10 @@ void copy_matcopybuf(Main *bmain, Material *ma)
memcpy(&matcopybuf, ma, sizeof(Material));
- matcopybuf.nodetree = ntreeCopyTree_ex(ma->nodetree, bmain, false);
+ if (ma->nodetree != NULL) {
+ matcopybuf.nodetree = ntreeCopyTree_ex(ma->nodetree, bmain, false);
+ }
+
matcopybuf.preview = NULL;
BLI_listbase_clear(&matcopybuf.gpumaterial);
/* TODO Duplicate Engine Settings and set runtime to NULL */
@@ -1425,7 +1428,9 @@ void paste_matcopybuf(Main *bmain, Material *ma)
memcpy(ma, &matcopybuf, sizeof(Material));
(ma->id) = id;
- ma->nodetree = ntreeCopyTree_ex(matcopybuf.nodetree, bmain, false);
+ if (matcopybuf.nodetree != NULL) {
+ ma->nodetree = ntreeCopyTree_ex(matcopybuf.nodetree, bmain, false);
+ }
}
void BKE_material_eval(struct Depsgraph *depsgraph, Material *material)
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 587d2d91029..bc92a45391c 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -1782,6 +1782,7 @@ static int paste_material_exec(bContext *C, wmOperator *UNUSED(op))
paste_matcopybuf(CTX_data_main(C), ma);
+ DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma);
return OPERATOR_FINISHED;