diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2018-04-20 18:14:03 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2018-04-20 18:14:52 +0300 |
commit | 5f6c45498c92b91a710a1317f6d41f73fbe83477 (patch) | |
tree | 93b136fb49c656c2c2a5463c91e8a6a38d518354 /source/blender/makesdna | |
parent | 4bfb6d21df96688187f6f1a5d95dd62bcbf85116 (diff) |
UI: New Global Top-Bar (WIP)
== Main Features/Changes for Users
* Add horizontal bar at top of all non-temp windows, consisting out of two horizontal sub-bars.
* Upper sub-bar contains global menus (File, Render, etc.), tabs for workspaces and scene selector.
* Lower sub-bar contains object mode selector, screen-layout and render-layer selector. Later operator and/or tool settings will be placed here.
* Individual sections of the topbar are individually scrollable.
* Workspace tabs can be double- or ctrl-clicked for renaming and contain 'x' icon for deleting.
* Top-bar should scale nicely with DPI.
* The lower half of the top-bar can be hided by dragging the lower top-bar edge up. Better hiding options are planned (e.g. hide in fullscreen modes).
* Info editors at the top of the window and using the full window width with be replaced by the top-bar.
* In fullscreen modes, no more info editor is added on top, the top-bar replaces it.
== Technical Features/Changes
* Adds initial support for global areas
A global area is part of the window, not part of the regular screen-layout.
I've added a macro iterator to iterate over both, global and screen-layout level areas. When iterating over areas, from now on developers should always consider if they have to include global areas.
* Adds a TOPBAR editor type
The editor type is hidden in the UI editor type menu.
* Adds a variation of the ID template to display IDs as tab buttons (template_ID_tabs in BPY)
* Does various changes to RNA button creation code to improve their appearance in the horizontal top-bar.
* Adds support for dynamically sized regions. That is, regions that scale automatically to the layout bounds.
The code for this is currently a big hack (it's based on drawing the UI multiple times). This should definitely be improved.
* Adds a template for displaying operator properties optimized for the top-bar. This will probably change a lot still and is in fact disabled in code.
Since the final top-bar design depends a lot on other 2.8 designs (mainly tool-system and workspaces), we decided to not show the operator or tool settings in the top-bar for now. That means most of the lower sub-bar is empty for the time being.
NOTE: Top-bar or global area data is not written to files or SDNA. They are simply added to the window when opening Blender or reading a file. This allows us doing changes to the top-bar without having to care for compatibility.
== ToDo's
It's a bit hard to predict all the ToDo's here are the known main ones:
* Add options for the new active-tool system and for operator redo to the topbar.
* Automatically hide the top-bar in fullscreen modes.
* General visual polish.
* Top-bar drag & drop support (WIP in temp-tab_drag_drop).
* Improve dynamic regions (should also fix some layout glitches).
* Make internal terminology consistent.
* Enable topbar file writing once design is more advanced.
* Address TODO's and XXX's in code :)
Thanks @brecht for the review! And @sergey for the complaining ;)
Differential Revision: D2758
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_screen_types.h | 60 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 30 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_windowmanager_types.h | 9 |
5 files changed, 95 insertions, 9 deletions
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 46eb0cbade3..6d4494ca2d2 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -48,12 +48,19 @@ struct wmTimer; struct wmTooltipState; +/* TODO Doing this is quite ugly :) + * Once the top-bar is merged bScreen should be refactored to use ScrAreaMap. */ +#define AREAMAP_FROM_SCREEN(screen) ((ScrAreaMap *)&(screen)->vertbase) + typedef struct bScreen { ID id; - + + /* TODO Should become ScrAreaMap now. + * ** NOTE: KEEP ORDER IN SYNC WITH ScrAreaMap! (see AREAMAP_FROM_SCREEN macro above) ** */ ListBase vertbase; /* screens have vertices/edges to define areas */ ListBase edgebase; ListBase areabase; + ListBase regionbase; /* screen level regions (menus), runtime only */ struct Scene *scene DNA_DEPRECATED; @@ -98,6 +105,14 @@ typedef struct ScrEdge { int pad; } ScrEdge; +typedef struct ScrAreaMap { + /* ** NOTE: KEEP ORDER IN SYNC WITH LISTBASES IN bScreen! ** */ + + ListBase vertbase; /* ScrVert - screens have vertices/edges to define areas */ + ListBase edgebase; /* ScrEdge */ + ListBase areabase; /* ScrArea */ +} ScrAreaMap; + typedef struct Panel { /* the part from uiBlock that needs saved in file */ struct Panel *next, *prev; @@ -211,6 +226,23 @@ typedef struct uiPreview { /* some preview UI data need to be saved in short pad1[3]; } uiPreview; +/* These two lines with # tell makesdna this struct can be excluded. + * Should be: #ifndef WITH_TOPBAR_WRITING */ +# +# +typedef struct ScrGlobalAreaData { + /* Global areas have a non-dynamic size. That means, changing the window + * size doesn't affect their size at all. However, they can still be + * 'collapsed', by changing this value. Ignores DPI (ED_area_global_size_y + * and winx/winy don't) */ + short cur_fixed_height; + /* For global areas, this is the min and max size they can use depending on + * if they are 'collapsed' or not. Value is set on area creation and not + * touched afterwards. */ + short size_min, size_max; + short pad; +} ScrGlobalAreaData; + typedef struct ScrArea { struct ScrArea *next, *prev; @@ -221,7 +253,7 @@ typedef struct ScrArea { char spacetype, butspacetype; /* SPACE_..., butspacetype is button arg */ short winx, winy; /* size */ - + short headertype; /* OLD! 0=no header, 1= down, 2= up */ short do_refresh; /* private, for spacetype refresh callback */ short flag; @@ -231,6 +263,9 @@ typedef struct ScrArea { struct SpaceType *type; /* callbacks for this space type */ + /* Non-NULL if this area is global. */ + ScrGlobalAreaData *global; + /* A list of space links (editors) that were open in this area before. When * changing the editor type, we try to reuse old editor data from this list. * The first item is the active/visible one. @@ -295,7 +330,11 @@ enum { HEADER_NO_PULLDOWN = (1 << 0), // AREA_FLAG_DEPRECATED_1 = (1 << 1), // AREA_FLAG_DEPRECATED_2 = (1 << 2), - AREA_TEMP_INFO = (1 << 3), +#ifdef DNA_DEPRECATED_ALLOW + AREA_TEMP_INFO = (1 << 3), /* versioned to make slot reusable */ +#endif + /* update size of regions within the area */ + AREA_FLAG_REGION_SIZE_UPDATE = (1 << 3), // AREA_FLAG_DEPRECATED_4 = (1 << 4), // AREA_FLAG_DEPRECATED_5 = (1 << 5), /* used to check if we should switch back to prevspace (of a different type) */ @@ -413,8 +452,19 @@ enum { #define RGN_SPLIT_PREV 32 /* region flag */ -#define RGN_FLAG_HIDDEN 1 -#define RGN_FLAG_TOO_SMALL 2 +enum { + RGN_FLAG_HIDDEN = (1 << 0), + RGN_FLAG_TOO_SMALL = (1 << 1), + /* Force delayed reinit of region size data, so that region size is calculated + * just big enough to show all its content (if enough space is available). + * Note that only ED_region_header supports this right now. */ + RGN_FLAG_DYNAMIC_SIZE = (1 << 2), + /* The region width stored in ARegion.sizex already has the DPI + * factor applied, skip applying it again (in region_rect_recursive). + * XXX Not nice at all. Leaving for now as temporary solution, but + * it might cause issues if we change how ARegion.sizex is used... */ + RGN_SIZEX_DPI_APPLIED = (1 << 3), +}; /* region do_draw */ #define RGN_DRAW 1 diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 904ffc959d8..a532dff190c 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -67,6 +67,14 @@ struct MovieClipScopes; struct Mask; struct BLI_mempool; +/* TODO 2.8: Remove the operator redo panel/region from the 3D View and Clip + * Editor toolshelf. Leaving this ifdef'ed out for until new tool system and + * topbar design is more clear. */ +//#define WITH_REDO_REGION_REMOVAL +/* TODO 2.8: We don't write the topbar to files currently. Uncomment this + * define to enable writing (should become the default in a bit). */ +//#define WITH_TOPBAR_WRITING + /* SpaceLink (Base) ==================================== */ @@ -1330,6 +1338,7 @@ typedef struct SpaceClip { MaskSpaceInfo mask_info; } SpaceClip; + /* SpaceClip->flag */ typedef enum eSpaceClip_Flag { SC_SHOW_MARKER_PATTERN = (1 << 0), @@ -1378,6 +1387,22 @@ typedef enum eSpaceClip_GPencil_Source { SC_GPENCIL_SRC_TRACK = 1, } eSpaceClip_GPencil_Source; + +/* Top Bar ======================================= */ + +/* These two lines with # tell makesdna this struct can be excluded. + * Should be: #ifndef WITH_TOPBAR_WRITING */ +# +# +typedef struct SpaceTopBar { + SpaceLink *next, *prev; + ListBase regionbase; /* storage of regions for inactive spaces */ + int spacetype; + + int pad; +} SpaceTopBar; + + /* **************** SPACE DEFINES ********************* */ /* space types, moved from DNA_screen_types.h */ @@ -1407,8 +1432,9 @@ typedef enum eSpace_Type { SPACE_CONSOLE = 18, SPACE_USERPREF = 19, SPACE_CLIP = 20, - - SPACEICONMAX = SPACE_CLIP + SPACE_TOPBAR = 21, + + SPACEICONMAX = SPACE_TOPBAR } eSpace_Type; /* use for function args */ diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 1eb17b49cfd..fc10de67d48 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -400,7 +400,8 @@ typedef struct bTheme { ThemeSpace tuserpref; ThemeSpace tconsole; ThemeSpace tclip; - + ThemeSpace ttopbar; + /* 20 sets of bone colors for this theme */ ThemeWireColor tarm[20]; /*ThemeWireColor tobj[20];*/ diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index f6bd0139fdb..d7f9e33d6be 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -213,7 +213,7 @@ typedef struct View3D { char twtype, _pad5, twflag; short flag3; - + /* afterdraw, for xray & transparent */ struct ListBase afterdraw_transp; struct ListBase afterdraw_xray; diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index f03ff4ba8b7..8797f4b1fd6 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -32,6 +32,7 @@ #define __DNA_WINDOWMANAGER_TYPES_H__ #include "DNA_listBase.h" +#include "DNA_screen_types.h" #include "DNA_vec_types.h" #include "DNA_userdef_types.h" @@ -190,6 +191,10 @@ typedef struct wmWindow { struct WorkSpaceInstanceHook *workspace_hook; + /** Global areas aren't part of the screen, but part of the window directly. + * \note Code assumes global areas with fixed height, fixed width not supported yet */ + ScrAreaMap global_areas; + struct bScreen *screen DNA_DEPRECATED; short posx, posy, sizex, sizey; /* window coords */ @@ -376,6 +381,10 @@ typedef struct wmOperator { struct uiLayout *layout; /* runtime for drawing */ short flag, pad[3]; + /* Screen context the operator was finished in. It gets temporarily + * restored during operator repeat. Only set for registered operators. */ + struct ScrArea *execution_area; + struct ARegion *execution_region; } wmOperator; /* operator type return flags: exec(), invoke() modal(), return values */ |