- 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.
This commit is contained in:
Ton Roosendaal 2003-11-25 16:48:55 +00:00
parent 5f0704c4f5
commit 4501069c27

@ -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 */ if(ob->actcol==0) ob->actcol= 1; /* because of TOG|BIT button */
uiBlockBeginAlign(block); 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 */ /* indicate which one is linking a material */
if(id) { if(id) {
strncpy(str, id->name, 2); 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"); 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); 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); sprintf(str, "%d Mat", ob->totcol);
if(ob->totcol) min= 1.0; else min= 0.0; 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"); 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); uiBlockEndAlign(block);
if(ob->totcol==0) return; if(ob->totcol==0) return;
uiSetButLock(id->lib!=0, "Can't edit library data");
ma= give_current_material(ob, ob->actcol); ma= give_current_material(ob, ob->actcol);
if(ma==0) return; if(ma==0) return;