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
This commit is contained in:
@@ -157,62 +157,72 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
|
||||
* \a check_prop callback filters functions to avoid drawing certain properties,
|
||||
* in cases where PROP_HIDDEN flag can't be used for a property.
|
||||
*/
|
||||
int uiDefAutoButsRNA(
|
||||
eAutoPropButsReturn uiDefAutoButsRNA(
|
||||
uiLayout *layout, PointerRNA *ptr,
|
||||
bool (*check_prop)(PointerRNA *, PropertyRNA *),
|
||||
const char label_align)
|
||||
const eButLabelAlign label_align, const bool compact)
|
||||
{
|
||||
eAutoPropButsReturn return_info = UI_PROP_BUTS_NONE_ADDED;
|
||||
uiLayout *split, *col;
|
||||
int flag;
|
||||
const char *name;
|
||||
int tot = 0;
|
||||
|
||||
assert(ELEM(label_align, '\0', 'H', 'V'));
|
||||
|
||||
RNA_STRUCT_BEGIN (ptr, prop)
|
||||
{
|
||||
flag = RNA_property_flag(prop);
|
||||
if (flag & PROP_HIDDEN || (check_prop && check_prop(ptr, prop) == 0))
|
||||
|
||||
if (flag & PROP_HIDDEN) {
|
||||
continue;
|
||||
|
||||
if (label_align != '\0') {
|
||||
PropertyType type = RNA_property_type(prop);
|
||||
const bool is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(prop));
|
||||
|
||||
name = RNA_property_ui_name(prop);
|
||||
|
||||
if (label_align == 'V') {
|
||||
col = uiLayoutColumn(layout, true);
|
||||
|
||||
if (!is_boolean)
|
||||
uiItemL(col, name, ICON_NONE);
|
||||
}
|
||||
else { /* (label_align == 'H') */
|
||||
BLI_assert(label_align == 'H');
|
||||
split = uiLayoutSplit(layout, 0.5f, false);
|
||||
|
||||
col = uiLayoutColumn(split, false);
|
||||
uiItemL(col, (is_boolean) ? "" : name, ICON_NONE);
|
||||
col = uiLayoutColumn(split, false);
|
||||
}
|
||||
|
||||
/* may meed to add more cases here.
|
||||
* don't override enum flag names */
|
||||
|
||||
/* name is shown above, empty name for button below */
|
||||
name = (flag & PROP_ENUM_FLAG || is_boolean) ? NULL : "";
|
||||
}
|
||||
else {
|
||||
col = layout;
|
||||
name = NULL; /* no smart label alignment, show default name with button */
|
||||
if (check_prop && check_prop(ptr, prop) == 0) {
|
||||
return_info |= UI_PROP_BUTS_ANY_FAILED_CHECK;
|
||||
continue;
|
||||
}
|
||||
|
||||
uiItemFullR(col, ptr, prop, -1, 0, 0, name, ICON_NONE);
|
||||
tot++;
|
||||
switch (label_align) {
|
||||
case UI_BUT_LABEL_ALIGN_COLUMN:
|
||||
case UI_BUT_LABEL_ALIGN_SPLIT_COLUMN:
|
||||
{
|
||||
PropertyType type = RNA_property_type(prop);
|
||||
const bool is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(prop));
|
||||
|
||||
name = RNA_property_ui_name(prop);
|
||||
|
||||
if (label_align == UI_BUT_LABEL_ALIGN_COLUMN) {
|
||||
col = uiLayoutColumn(layout, true);
|
||||
|
||||
if (!is_boolean)
|
||||
uiItemL(col, name, ICON_NONE);
|
||||
}
|
||||
else {
|
||||
BLI_assert(label_align == UI_BUT_LABEL_ALIGN_SPLIT_COLUMN);
|
||||
split = uiLayoutSplit(layout, 0.5f, false);
|
||||
|
||||
col = uiLayoutColumn(split, false);
|
||||
uiItemL(col, (is_boolean) ? "" : name, ICON_NONE);
|
||||
col = uiLayoutColumn(split, false);
|
||||
}
|
||||
|
||||
/* may meed to add more cases here.
|
||||
* don't override enum flag names */
|
||||
|
||||
/* name is shown above, empty name for button below */
|
||||
name = (flag & PROP_ENUM_FLAG || is_boolean) ? NULL : "";
|
||||
|
||||
break;
|
||||
}
|
||||
case UI_BUT_LABEL_ALIGN_NONE:
|
||||
col = layout;
|
||||
name = NULL; /* no smart label alignment, show default name with button */
|
||||
break;
|
||||
}
|
||||
|
||||
uiItemFullR(col, ptr, prop, -1, 0, compact ? UI_ITEM_R_COMPACT : 0, name, ICON_NONE);
|
||||
return_info &= ~UI_PROP_BUTS_NONE_ADDED;
|
||||
}
|
||||
RNA_STRUCT_END;
|
||||
|
||||
return tot;
|
||||
return return_info;
|
||||
}
|
||||
|
||||
/* *** RNA collection search menu *** */
|
||||
|
||||
Reference in New Issue
Block a user