diff options
author | Ton Roosendaal <ton@blender.org> | 2006-07-22 21:11:36 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-07-22 21:11:36 +0400 |
commit | 9254c07f6ec2f9de0815c65f459eaa9e6ad1b147 (patch) | |
tree | 4017f31f6c14b0329c1b1b65b38e793f846b7d75 | |
parent | 56322ca051d893d15890a566b023257d5fd54471 (diff) |
IRC bugfix (thanks samo!):
The Material buttons copy/paste options (icons) didn't work for node trees.
Code was forgetting to free memory properly.
-rw-r--r-- | source/blender/src/header_buttonswin.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/src/header_buttonswin.c b/source/blender/src/header_buttonswin.c index 0d9f05672f0..dcedee12a6b 100644 --- a/source/blender/src/header_buttonswin.c +++ b/source/blender/src/header_buttonswin.c @@ -108,8 +108,11 @@ void free_matcopybuf(void) matcopybuf.ramp_col= NULL; matcopybuf.ramp_spec= NULL; - ntreeFreeTree(matcopybuf.nodetree); - + if(matcopybuf.nodetree) { + ntreeFreeTree(matcopybuf.nodetree); + MEM_freeN(matcopybuf.nodetree); + matcopybuf.nodetree= NULL; + } default_mtex(&mtexcopybuf); } @@ -166,7 +169,6 @@ void do_buts_buttons(short event) } } matcopybuf.nodetree= ntreeCopyTree(ma->nodetree, 0); - matcopied= 1; } break; @@ -182,9 +184,14 @@ void do_buts_buttons(short event) if(mtex && mtex->tex) mtex->tex->id.us--; if(mtex) MEM_freeN(mtex); } - + + if(ma->nodetree) { + ntreeFreeTree(ma->nodetree); + MEM_freeN(ma->nodetree); + } + id= (ma->id); - memcpy(G.buts->lockpoin, &matcopybuf, sizeof(Material)); + memcpy(ma, &matcopybuf, sizeof(Material)); (ma->id)= id; if(matcopybuf.ramp_col) ma->ramp_col= MEM_dupallocN(matcopybuf.ramp_col); @@ -197,7 +204,7 @@ void do_buts_buttons(short event) if(mtex->tex) id_us_plus((ID *)mtex->tex); } } - ntreeFreeTree(ma->nodetree); + ma->nodetree= ntreeCopyTree(matcopybuf.nodetree, 0); BIF_preview_changed(ID_MA); |