diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-05-21 19:34:09 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-05-21 19:34:09 +0400 |
commit | 94902dac977cfc089e9740782a19c6ab370cdc03 (patch) | |
tree | bf715f3e99859913a741dd37e3338a6f5cfe7eb6 /source/blender/editors/interface/interface_layout.c | |
parent | 65143c50e0cbbd111c5fa01f54d0177d1a50704f (diff) |
2.5 UI: Modifier Template
* template_modifier creates the modifier box, and returns a layout
to put the buttons in.
* Only the armature modifier is now done with python code, all other
modifiers use C code. To convert a modifier to python, remove the
corresponding C code and create a function in DATA_PT_modifiers.
* Some modifiers still require some RNA work to get it working well,
especially to make pointers editable. Mostly that is a matter of
defining an own _set callback and put some of the modifier C code
into it.
* Still various buttons that don't work, like for hooks or mesh
deform binding.
* Fix for crashing decimate modifier (still disabled).
* Removed UI_BUT_NO_HILITE, HMENU.
* Make uiLayoutBox work with align.
Diffstat (limited to 'source/blender/editors/interface/interface_layout.c')
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 56183bfb314..3fa0a8849fe 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -147,6 +147,7 @@ typedef struct uiLayoutItemSplt { typedef struct uiLayoutItemBx { uiLayout litem; + uiBut *roundbox; } uiLayoutItemBx; typedef struct uiLayoutItemRoot { @@ -839,6 +840,8 @@ static void ui_item_menu(uiLayout *layout, char *name, int icon, uiMenuCreateFun if(layout->root->type == UI_LAYOUT_HEADER) uiBlockSetEmboss(block, UI_EMBOSS); + else if(layout->root->type == UI_LAYOUT_PANEL) + but->type= MENU; } void uiItemM(uiLayout *layout, bContext *C, char *name, int icon, char *menuname) @@ -1146,12 +1149,14 @@ static void ui_litem_estimate_box(uiLayout *litem) ui_litem_estimate_column(litem); litem->w += 2*style->boxspace; - litem->h += 2*style->boxspace; + litem->h += style->boxspace; } static void ui_litem_layout_box(uiLayout *litem) { + uiLayoutItemBx *box= (uiLayoutItemBx*)litem; uiStyle *style= litem->root->style; + uiBut *but; int w, h; w= litem->w; @@ -1169,10 +1174,14 @@ static void ui_litem_layout_box(uiLayout *litem) litem->y -= style->boxspace; if(w != 0) litem->w += 2*style->boxspace; - if(h != 0) litem->h += 2*style->boxspace; + if(h != 0) litem->h += style->boxspace; /* roundbox around the sublayout */ - uiDefBut(litem->root->block, ROUNDBOX, 0, "", litem->x, litem->y, litem->w, litem->h, NULL, 7.0, 0.0, 3, 20, ""); + but= box->roundbox; + but->x1= litem->x; + but->y1= litem->y; + but->x2= litem->x+litem->w; + but->y2= litem->y+litem->h; } /* multi-column layout, automatically flowing to the next */ @@ -1475,6 +1484,8 @@ uiLayout *uiLayoutBox(uiLayout *layout) uiBlockSetCurLayout(layout->root->block, &box->litem); + box->roundbox= uiDefBut(layout->root->block, ROUNDBOX, 0, "", 0, 0, 0, 0, NULL, 0.0, 0.0, 0, 0, ""); + return &box->litem; } @@ -1564,13 +1575,21 @@ static void ui_item_align(uiLayout *litem, int nr) { uiItem *item; uiButtonItem *bitem; + uiLayoutItemBx *box; - for(item=litem->items.first; item; item=item->next) { + for(item=litem->items.last; item; item=item->prev) { if(item->type == ITEM_BUTTON) { bitem= (uiButtonItem*)item; if(ui_but_can_align(bitem->but)) bitem->but->alignnr= nr; } + else if(item->type == ITEM_LAYOUT_FREE); + else if(item->type == ITEM_LAYOUT_BOX) { + box= (uiLayoutItemBx*)item; + box->roundbox->alignnr= nr; + BLI_remlink(&litem->root->block->buttons, box->roundbox); + BLI_addhead(&litem->root->block->buttons, box->roundbox); + } else ui_item_align((uiLayout*)item, nr); } |