diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-04-17 01:39:45 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-04-17 01:39:45 +0400 |
commit | 38b6f8f167662db35e8b51e8d9b2ecb13800982a (patch) | |
tree | 6500a4395e401d9a2fd82f5bdfd37ceeaa7072e4 /source/blender/editors/space_buttons/space_buttons.c | |
parent | a565154a8749df90c18df251049b0f8e613c3825 (diff) |
UI:
* For new buttons spaces, automatically set horizontal/vertical
align depending on size, instead of free.
* Cleaned up the UI panel API. There's now a new uiBeginPanel
function which takes a panel type, and a uiEndPanel which takes
the final size. uiNewPanel* functions will be phased out.
* Animate the re-alignment when a panel size changes, e.g. when
enabling dupliframes.
* Load ui scripts from the release/ folder first if it is
available. This makes it easier to edit ui scripts, since it
will directly use the original files which avoids having to
run the build system.
* Improve editing of panel types while blender is open. That
means fixing some issues with lacking updates, overlaps, strange
ordering. It even does an animation now when the panel resizes.
Diffstat (limited to 'source/blender/editors/space_buttons/space_buttons.c')
-rw-r--r-- | source/blender/editors/space_buttons/space_buttons.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 5588343d223..018b328836a 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -70,6 +70,7 @@ static SpaceLink *buttons_new(const bContext *C) sbuts= MEM_callocN(sizeof(SpaceButs), "initbuts"); sbuts->spacetype= SPACE_BUTS; sbuts->scaflag= BUTS_SENS_LINK|BUTS_SENS_ACT|BUTS_CONT_ACT|BUTS_ACT_ACT|BUTS_ACT_LINK; + sbuts->align= BUT_AUTO; /* header */ ar= MEM_callocN(sizeof(ARegion), "header for buts"); @@ -128,7 +129,15 @@ static void buttons_free(SpaceLink *sl) /* spacetype; init callback */ static void buttons_init(struct wmWindowManager *wm, ScrArea *sa) { - + SpaceButs *sbuts= sa->spacedata.first; + + /* auto-align based on size */ + if(sbuts->align == BUT_AUTO) { + if(sa->winx > sa->winy) + sbuts->align= BUT_HORIZONTAL; + else + sbuts->align= BUT_VERTICAL; + } } static SpaceLink *buttons_duplicate(SpaceLink *sl) @@ -158,18 +167,14 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C); + int vertical= (sbuts->align == BUT_VERTICAL); + int tab= sbuts->tab[sbuts->mainb]; if(sbuts->mainb == CONTEXT_OBJECT) { - int tab= sbuts->tab[CONTEXT_OBJECT]; - int vertical= (sbuts->align == 2); - if(tab == TAB_OBJECT_OBJECT) uiRegionPanelLayout(C, ar, vertical, "object"); } else if (sbuts->mainb == CONTEXT_SCENE){ - int tab= sbuts->tab[CONTEXT_SCENE]; - int vertical= (sbuts->align == 2); - if(tab == TAB_SCENE_RENDER) uiRegionPanelLayout(C, ar, vertical, "render"); } |