diff options
Diffstat (limited to 'source/blender/blenkernel/intern/texture.c')
-rw-r--r-- | source/blender/blenkernel/intern/texture.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index ab9e6f9af41..52b88de06e0 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -421,6 +421,11 @@ void free_texture(Tex *tex) BKE_previewimg_free(&tex->preview); BKE_icon_delete((struct ID*)tex); tex->id.icon_id = 0; + + if(tex->nodetree) { + ntreeFreeTree(tex->nodetree); + MEM_freeN(tex->nodetree); + } } /* ------------------------------------------------------------------------- */ @@ -578,6 +583,11 @@ Tex *copy_texture(Tex *tex) if(tex->preview) texn->preview = BKE_previewimg_copy(tex->preview); + if(tex->nodetree) { + ntreeEndExecTree(tex->nodetree); + texn->nodetree= ntreeCopyTree(tex->nodetree, 0); /* 0 == full new tree */ + } + return texn; } @@ -728,6 +738,10 @@ void autotexname(Tex *tex) char di[FILE_MAXDIR], fi[FILE_MAXFILE]; if(tex) { + if(tex->use_nodes) { + new_id(&G.main->tex, (ID *)tex, "Noddy"); + } + else if(tex->type==TEX_IMAGE) { ima= tex->ima; if(ima) { |