Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Schempp <fabianschempp@googlemail.com>2021-06-25 08:57:24 +0300
committerFabian Schempp <fabianschempp@googlemail.com>2021-06-25 08:57:24 +0300
commitae085e301c2aac0d6956609bfe93a90a19f0e235 (patch)
tree38b86749807915a6b6d46504a2acb90e41a4a77a /source/blender/editors/interface/interface_widgets.c
parent841df831e89dfc4011c323203c2efb8265dc1878 (diff)
Spreadsheet: Dataset region for spreadsheet editor
This patch adds a left aligned sidebar to the spreadsheet editor. This Sidebar can be used to navigate the geometry component types and attribute domains. It also provides a quick overview of domain sizes. It replaces the two dropdowns in the regions header. Next step will be to add the domain cycling shortcut using the CTRL + mouse wheel. Reviewer: Dalai Felinto (dfelinto), Julian Eisel (Severin), Hans Goudey (HooglyBoogly). Differential Revision: https://developer.blender.org/D11046
Diffstat (limited to 'source/blender/editors/interface/interface_widgets.c')
-rw-r--r--source/blender/editors/interface/interface_widgets.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 9212a0a7d9d..8badc05065d 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -113,6 +113,7 @@ typedef enum {
UI_WTYPE_LISTITEM,
UI_WTYPE_PROGRESSBAR,
UI_WTYPE_NODESOCKET,
+ UI_WTYPE_DATASETROW,
} uiWidgetTypeEnum;
/* Button state argument shares bits with 'uiBut.flag'.
@@ -3697,6 +3698,28 @@ static void widget_progressbar(
rect->xmax += (BLI_rcti_size_x(&rect_prog) / 2);
}
+static void widget_datasetrow(
+ uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
+{
+ uiButDatasetRow *but_componentrow = (uiButDatasetRow *)but;
+ uiWidgetBase wtb;
+ widget_init(&wtb);
+
+ /* no outline */
+ wtb.draw_outline = false;
+ const float rad = wcol->roundness * U.widget_unit;
+ round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
+
+ if ((state & UI_ACTIVE) || (state & UI_SELECT)) {
+ widgetbase_draw(&wtb, wcol);
+ }
+
+ BLI_rcti_resize(rect,
+ BLI_rcti_size_x(rect) - UI_UNIT_X * but_componentrow->indentation,
+ BLI_rcti_size_y(rect));
+ BLI_rcti_translate(rect, 0.5f * UI_UNIT_X * but_componentrow->indentation, 0);
+}
+
static void widget_nodesocket(
uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
{
@@ -4469,6 +4492,10 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
wt.custom = widget_progressbar;
break;
+ case UI_WTYPE_DATASETROW:
+ wt.custom = widget_datasetrow;
+ break;
+
case UI_WTYPE_NODESOCKET:
wt.custom = widget_nodesocket;
break;
@@ -4792,6 +4819,11 @@ void ui_draw_but(const bContext *C, struct ARegion *region, uiStyle *style, uiBu
fstyle = &style->widgetlabel;
break;
+ case UI_BTYPE_DATASETROW:
+ wt = widget_type(UI_WTYPE_DATASETROW);
+ fstyle = &style->widgetlabel;
+ break;
+
case UI_BTYPE_SCROLL:
wt = widget_type(UI_WTYPE_SCROLL);
break;