diff options
author | Ton Roosendaal <ton@blender.org> | 2004-07-01 22:06:27 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2004-07-01 22:06:27 +0400 |
commit | ea7e5c9f410949792cd8f64bfdf2e7cb10682947 (patch) | |
tree | 26d897b119296f4e2e9b332c6d432e14227c0902 /source/blender/src/header_buttonswin.c | |
parent | 30251dbc1339603a20309553c8d02804f582029c (diff) |
Forgot to add code for copying/paste functionality Materials. With new
ColorBand data added in Material that needs to be tackled corectly.
Diffstat (limited to 'source/blender/src/header_buttonswin.c')
-rw-r--r-- | source/blender/src/header_buttonswin.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/src/header_buttonswin.c b/source/blender/src/header_buttonswin.c index f31ee2cc874..5bddc5f25f2 100644 --- a/source/blender/src/header_buttonswin.c +++ b/source/blender/src/header_buttonswin.c @@ -102,10 +102,15 @@ void free_matcopybuf(void) for(a=0; a<8; a++) { if(matcopybuf.mtex[a]) { MEM_freeN(matcopybuf.mtex[a]); - matcopybuf.mtex[a]= 0; + matcopybuf.mtex[a]= NULL; } } + if(matcopybuf.ramp_col) MEM_freeN(matcopybuf.ramp_col); + if(matcopybuf.ramp_spec) MEM_freeN(matcopybuf.ramp_spec); + matcopybuf.ramp_col= NULL; + matcopybuf.ramp_spec= NULL; + default_mtex(&mtexcopybuf); } @@ -142,10 +147,12 @@ void do_buts_buttons(short event) break; case B_MATCOPY: if(G.buts->lockpoin) { - if(matcopied) free_matcopybuf(); memcpy(&matcopybuf, G.buts->lockpoin, sizeof(Material)); + if(matcopybuf.ramp_col) matcopybuf.ramp_col= MEM_dupallocN(matcopybuf.ramp_col); + if(matcopybuf.ramp_spec) matcopybuf.ramp_spec= MEM_dupallocN(matcopybuf.ramp_spec); + for(a=0; a<8; a++) { mtex= matcopybuf.mtex[a]; if(mtex) { @@ -159,6 +166,8 @@ void do_buts_buttons(short event) if(matcopied && G.buts->lockpoin) { ma= G.buts->lockpoin; /* free current mat */ + if(ma->ramp_col) MEM_freeN(ma->ramp_col); + if(ma->ramp_spec) MEM_freeN(ma->ramp_spec); for(a=0; a<8; a++) { mtex= ma->mtex[a]; if(mtex && mtex->tex) mtex->tex->id.us--; @@ -169,6 +178,9 @@ void do_buts_buttons(short event) memcpy(G.buts->lockpoin, &matcopybuf, sizeof(Material)); (ma->id)= id; + if(matcopybuf.ramp_col) ma->ramp_col= MEM_dupallocN(matcopybuf.ramp_col); + if(matcopybuf.ramp_spec) ma->ramp_spec= MEM_dupallocN(matcopybuf.ramp_spec); + for(a=0; a<8; a++) { mtex= ma->mtex[a]; if(mtex) { |