- fixed bug caused by changing order of drawing buttons in material panel 2

the 'OB' and 'ME' buttons were not visible in all situations anymore...
This commit is contained in:
Ton Roosendaal
2003-11-19 12:43:21 +00:00
parent 76766ed969
commit ab9e6f69a0
3 changed files with 16 additions and 10 deletions

View File

@@ -2287,18 +2287,16 @@ static void material_panel_material(Object *ob, Material *ma)
if(ob->actcol==0) ob->actcol= 1; /* because of TOG|BIT button */
/* indicate which one is linking a material */
if( id == NULL ) return;
uiBlockBeginAlign(block);
uiSetButLock(id->lib!=0, "Can't edit library data");
strncpy(str, id->name, 2);
str[2]= ':'; str[3]= 0;
but= uiDefBut(block, TEX, B_IDNAME, str, 8,174,115,20, id->name+2, 0.0, 18.0, 0, 0, "Show the block the material is linked to");
uiButSetFunc(but, test_idbutton_cb, id->name, NULL);
/* indicate which one is linking a material */
if(id) {
strncpy(str, id->name, 2);
str[2]= ':'; str[3]= 0;
but= uiDefBut(block, TEX, B_IDNAME, str, 8,174,115,20, id->name+2, 0.0, 18.0, 0, 0, "Show the block the material is linked to");
uiButSetFunc(but, test_idbutton_cb, id->name, NULL);
}
uiBlockSetCol(block, TH_BUT_ACTION);
uiDefButS(block, TOG|BIT|(ob->actcol-1), B_MATFROM, "OB", 125,174,32,20, &ob->colbits, 0, 0, 0, 0, "Link material to object");
idn= ob->data;
@@ -2308,6 +2306,9 @@ 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;

View File

@@ -634,9 +634,11 @@ void uiDrawBlock(uiBlock *block)
{
uiBut *but;
/* handle pending stuff */
if(block->autofill) ui_autofill(block);
if(block->minx==0.0 && block->maxx==0.0) uiBoundsBlock(block, 0);
if(block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
uiPanelPush(block); // panel matrix
if(block->flag & UI_BLOCK_LOOP) {

View File

@@ -461,6 +461,9 @@ void myortho(float x1, float x2, float y1, float y2, float n, float f)
void myortho2(float x1, float x2, float y1, float y2)
{
/* prevent opengl from generating errors */
if(x1==x2) x2+=1.0;
if(y1==y2) y2+=1.0;
bwin_ortho(curswin, x1, x2, y1, y2, -1, 1);
}