diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index 5c82cb33b8a..b131d6faa27 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -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; diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index 8ebdb868aaf..1ce9f582063 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -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) { diff --git a/source/blender/src/mywindow.c b/source/blender/src/mywindow.c index 060cef8abc5..988d8c6dd72 100644 --- a/source/blender/src/mywindow.c +++ b/source/blender/src/mywindow.c @@ -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); }