From 4501069c2759493d8462ad0554185bbef172d5c6 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Tue, 25 Nov 2003 16:48:55 +0000 Subject: [PATCH] - the weird OB and ME buttons in 2nd Panel in MaterialButtons didnt work properly. Also the "1 Mat 1" buttons didnt display in all situations. --- source/blender/src/buttons_shading.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index 603cc15209c..e37f4126852 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -2319,9 +2319,12 @@ static void material_panel_material(Object *ob, Material *ma) if(ob->actcol==0) ob->actcol= 1; /* because of TOG|BIT button */ - uiBlockBeginAlign(block); + /* id is the block from which the material is used */ + if( BTST(ob->colbits, ob->actcol-1) ) id= (ID *)ob; + else id= ob->data; + /* indicate which one is linking a material */ if(id) { strncpy(str, id->name, 2); @@ -2338,19 +2341,13 @@ static void material_panel_material(Object *ob, Material *ma) uiDefButS(block, TOGN|BIT|(ob->actcol-1), B_MATFROM, str, 158,174,32,20, &ob->colbits, 0, 0, 0, 0, "Show the block the material is linked to"); uiBlockSetCol(block, TH_AUTO); - if( id == NULL ) return; - uiSetButLock(id->lib!=0, "Can't edit library data"); - - /* id is the block from which the material is used */ - if( BTST(ob->colbits, ob->actcol-1) ) id= (ID *)ob; - else id= ob->data; - sprintf(str, "%d Mat", ob->totcol); if(ob->totcol) min= 1.0; else min= 0.0; uiDefButC(block, NUM, B_ACTCOL, str, 191,174,114,20, &(ob->actcol), min, (float)ob->totcol, 0, 0, "Number of materials on object / Active material"); uiBlockEndAlign(block); if(ob->totcol==0) return; + uiSetButLock(id->lib!=0, "Can't edit library data"); ma= give_current_material(ob, ob->actcol); if(ma==0) return;