diff options
Diffstat (limited to 'source/blender/editors/space_node/node_edit.c')
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index f679bcc4e15..677a7cac745 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -446,8 +446,17 @@ void ED_node_shader_default(const bContext *C, ID *id) if (GS(id->name) == ID_MA) { /* Materials */ + Object *ob = CTX_data_active_object(C); Material *ma = (Material *)id; - Material *ma_default = BKE_material_default_surface(); + Material *ma_default; + + if (ob && ob->type == OB_VOLUME) { + ma_default = BKE_material_default_volume(); + } + else { + ma_default = BKE_material_default_surface(); + } + ma->nodetree = ntreeCopyTree(bmain, ma_default->nodetree); ntreeUpdateTree(bmain, ma->nodetree); } |