Compare commits
37 Commits
xr-control
...
UI-graphic
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0775680e4d | ||
![]() |
4ade467fc6 | ||
![]() |
7759782ee7 | ||
![]() |
ab9eee4bfb | ||
![]() |
e0b92ca72b | ||
![]() |
131caabfdb | ||
![]() |
a638db50ca | ||
![]() |
60ec6a5419 | ||
![]() |
a05cbcfa7c | ||
![]() |
c5d4607792 | ||
![]() |
97c12109ec | ||
![]() |
fa7188c7da | ||
![]() |
980820124a | ||
![]() |
f3f65f38b7 | ||
![]() |
868b1e3032 | ||
![]() |
700c8c691c | ||
![]() |
c6801d7cdd | ||
![]() |
2524b2b5b9 | ||
![]() |
271b53fa57 | ||
![]() |
029bc907dd | ||
![]() |
96e7a92a23 | ||
![]() |
fa85fd2b6a | ||
![]() |
cddab657e8 | ||
![]() |
9de6520251 | ||
![]() |
f4b3975d65 | ||
![]() |
bd11884d16 | ||
![]() |
a05c604880 | ||
![]() |
2e917e67d4 | ||
![]() |
667718bc7f | ||
![]() |
04f11fb12e | ||
![]() |
2487ee35a8 | ||
![]() |
6272babfba | ||
![]() |
0dd2ed3c6c | ||
![]() |
b3587b8aa2 | ||
![]() |
d031455395 | ||
![]() |
ebfe499e10 | ||
![]() |
0fdac7ca7b |
@@ -626,6 +626,8 @@ class USERPREF_PT_theme(Panel):
|
|||||||
subsub.active = widget_style.show_shaded
|
subsub.active = widget_style.show_shaded
|
||||||
subsub.prop(widget_style, "shadetop")
|
subsub.prop(widget_style, "shadetop")
|
||||||
subsub.prop(widget_style, "shadedown")
|
subsub.prop(widget_style, "shadedown")
|
||||||
|
subsub = colsub.column(align=True)
|
||||||
|
subsub.prop(widget_style, "roundness")
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
@@ -686,6 +688,14 @@ class USERPREF_PT_theme(Panel):
|
|||||||
col = split.column()
|
col = split.column()
|
||||||
ui = theme.user_interface
|
ui = theme.user_interface
|
||||||
|
|
||||||
|
row = col.row()
|
||||||
|
subsplit = row.split(percentage=0.47)
|
||||||
|
subsplit.prop(ui, "interface_style")
|
||||||
|
|
||||||
|
col.separator()
|
||||||
|
col.separator()
|
||||||
|
col.separator()
|
||||||
|
|
||||||
col.label(text="Regular:")
|
col.label(text="Regular:")
|
||||||
self._theme_widget_style(col, ui.wcol_regular)
|
self._theme_widget_style(col, ui.wcol_regular)
|
||||||
|
|
||||||
@@ -800,6 +810,7 @@ class USERPREF_PT_theme(Panel):
|
|||||||
colsub = padding.column()
|
colsub = padding.column()
|
||||||
colsub = padding.column()
|
colsub = padding.column()
|
||||||
colsub.row().prop(ui, "widget_emboss")
|
colsub.row().prop(ui, "widget_emboss")
|
||||||
|
colsub.row().prop(ui, "area_edges")
|
||||||
|
|
||||||
col.separator()
|
col.separator()
|
||||||
col.separator()
|
col.separator()
|
||||||
|
@@ -1345,7 +1345,8 @@ class VIEW3D_MT_object_specials(Menu):
|
|||||||
props.input_scale = 0.05
|
props.input_scale = 0.05
|
||||||
props.header_text = "Clip End: %.2f"
|
props.header_text = "Clip End: %.2f"
|
||||||
|
|
||||||
layout.separator()
|
if obj.type in {'CAMERA', 'CURVE', 'FONT', 'EMPTY', 'LAMP'}:
|
||||||
|
layout.separator()
|
||||||
|
|
||||||
props = layout.operator("object.isolate_type_render")
|
props = layout.operator("object.isolate_type_render")
|
||||||
props = layout.operator("object.hide_render_clear_all")
|
props = layout.operator("object.hide_render_clear_all")
|
||||||
|
@@ -42,7 +42,7 @@ extern "C" {
|
|||||||
* and keep comment above the defines.
|
* and keep comment above the defines.
|
||||||
* Use STRINGIFY() rather than defining with quotes */
|
* Use STRINGIFY() rather than defining with quotes */
|
||||||
#define BLENDER_VERSION 276
|
#define BLENDER_VERSION 276
|
||||||
#define BLENDER_SUBVERSION 1
|
#define BLENDER_SUBVERSION 2
|
||||||
/* Several breakages with 270, e.g. constraint deg vs rad */
|
/* Several breakages with 270, e.g. constraint deg vs rad */
|
||||||
#define BLENDER_MINVERSION 270
|
#define BLENDER_MINVERSION 270
|
||||||
#define BLENDER_MINSUBVERSION 5
|
#define BLENDER_MINSUBVERSION 5
|
||||||
|
@@ -868,4 +868,47 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
bScreen *screen;
|
||||||
|
for (screen = main->screen.first; screen; screen = screen->id.next) {
|
||||||
|
ScrArea *sa;
|
||||||
|
|
||||||
|
for (sa = screen->areabase.first; sa; sa = sa->next) {
|
||||||
|
const char needed_type = (sa->spacetype == SPACE_CLIP) ? RGN_TYPE_PREVIEW : RGN_TYPE_WINDOW;
|
||||||
|
ARegion *ar = BKE_area_find_region_type(sa, needed_type);
|
||||||
|
SpaceLink *sl;
|
||||||
|
|
||||||
|
if (ar == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||||
|
switch (sl->spacetype) {
|
||||||
|
case SPACE_TIME:
|
||||||
|
case SPACE_ACTION:
|
||||||
|
case SPACE_NLA:
|
||||||
|
ar->v2d.flag |= V2D_USES_UNITS_HORIZONTAL;
|
||||||
|
break;
|
||||||
|
case SPACE_IPO:
|
||||||
|
case SPACE_SEQ:
|
||||||
|
ar->v2d.flag |= (V2D_USES_UNITS_HORIZONTAL | V2D_USES_UNITS_VERTICAL);
|
||||||
|
break;
|
||||||
|
case SPACE_CLIP:
|
||||||
|
{
|
||||||
|
SpaceClip *sc = (SpaceClip *)sl;
|
||||||
|
|
||||||
|
if (sc->view == SC_VIEW_DOPESHEET) {
|
||||||
|
ar->v2d.flag |= V2D_USES_UNITS_HORIZONTAL;
|
||||||
|
}
|
||||||
|
else if (sc->view == SC_VIEW_GRAPH) {
|
||||||
|
ar->v2d.flag |= (V2D_USES_UNITS_HORIZONTAL | V2D_USES_UNITS_VERTICAL);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -52,6 +52,8 @@
|
|||||||
*/
|
*/
|
||||||
void BLO_update_defaults_userpref_blend(void)
|
void BLO_update_defaults_userpref_blend(void)
|
||||||
{
|
{
|
||||||
|
uiStyle *style;
|
||||||
|
|
||||||
/* defaults from T37518 */
|
/* defaults from T37518 */
|
||||||
|
|
||||||
U.uiflag |= USER_ZBUF_CURSOR;
|
U.uiflag |= USER_ZBUF_CURSOR;
|
||||||
@@ -60,6 +62,13 @@ void BLO_update_defaults_userpref_blend(void)
|
|||||||
|
|
||||||
U.versions = 1;
|
U.versions = 1;
|
||||||
U.savetime = 2;
|
U.savetime = 2;
|
||||||
|
|
||||||
|
U.dpi = 78;
|
||||||
|
|
||||||
|
for (style = U.uistyles.first; style; style = style->next) {
|
||||||
|
style->paneltitle.points = style->widgetlabel.points = style->widget.points = 10;
|
||||||
|
style->paneltitle.shadow = style->widgetlabel.shadow = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -164,7 +164,9 @@ static int pose_groups_menu_invoke(bContext *C, wmOperator *op, const wmEvent *U
|
|||||||
*/
|
*/
|
||||||
if (strstr(op->idname, "assign")) {
|
if (strstr(op->idname, "assign")) {
|
||||||
uiItemIntO(layout, "New Group", ICON_NONE, op->idname, "type", 0);
|
uiItemIntO(layout, "New Group", ICON_NONE, op->idname, "type", 0);
|
||||||
uiItemS(layout);
|
if (!BLI_listbase_is_empty(&pose->agroups)) {
|
||||||
|
uiItemS(layout);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add entries for each group */
|
/* add entries for each group */
|
||||||
|
@@ -133,8 +133,9 @@ enum {
|
|||||||
|
|
||||||
/* block->flag bits 14-17 are identical to but->drawflag bits */
|
/* block->flag bits 14-17 are identical to but->drawflag bits */
|
||||||
|
|
||||||
#define UI_BLOCK_LIST_ITEM (1 << 19)
|
#define UI_BLOCK_LIST_ITEM (1 << 19)
|
||||||
#define UI_BLOCK_RADIAL (1 << 20)
|
#define UI_BLOCK_RADIAL (1 << 20)
|
||||||
|
#define UI_BLOCK_HAS_SUBMENU (1 << 21) /* the block has at least one button leading to a submenu */
|
||||||
|
|
||||||
/* uiPopupBlockHandle->menuretval */
|
/* uiPopupBlockHandle->menuretval */
|
||||||
#define UI_RETURN_CANCEL (1 << 0) /* cancel all menus cascading */
|
#define UI_RETURN_CANCEL (1 << 0) /* cancel all menus cascading */
|
||||||
@@ -179,11 +180,13 @@ enum {
|
|||||||
UI_BUT_TIP_FORCE = (1 << 28), /* force show tooltips when holding option/alt if U's USER_TOOLTIPS is off */
|
UI_BUT_TIP_FORCE = (1 << 28), /* force show tooltips when holding option/alt if U's USER_TOOLTIPS is off */
|
||||||
UI_BUT_TEXTEDIT_UPDATE = (1 << 29), /* when widget is in textedit mode, update value on each char stroke */
|
UI_BUT_TEXTEDIT_UPDATE = (1 << 29), /* when widget is in textedit mode, update value on each char stroke */
|
||||||
UI_BUT_SEARCH_UNLINK = (1 << 30), /* show unlink for search button */
|
UI_BUT_SEARCH_UNLINK = (1 << 30), /* show unlink for search button */
|
||||||
|
UI_BUT_MENU_TITLE = (1 << 31), /* title of a menu - XXX maybe new BTYPE? */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define UI_PANEL_WIDTH 340
|
#define UI_PANEL_WIDTH 340
|
||||||
#define UI_COMPACT_PANEL_WIDTH 160
|
#define UI_COMPACT_PANEL_WIDTH 160
|
||||||
|
|
||||||
|
#define UI_PANEL_MARGIN (U.widget_unit * 0.25f)
|
||||||
#define UI_PANEL_CATEGORY_MARGIN_WIDTH (U.widget_unit * 1.0f)
|
#define UI_PANEL_CATEGORY_MARGIN_WIDTH (U.widget_unit * 1.0f)
|
||||||
|
|
||||||
/* but->drawflag - these flags should only affect how the button is drawn. */
|
/* but->drawflag - these flags should only affect how the button is drawn. */
|
||||||
@@ -632,6 +635,7 @@ int UI_icon_from_report_type(int type);
|
|||||||
|
|
||||||
uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip);
|
uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip);
|
||||||
uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip);
|
uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip);
|
||||||
|
uiBut *uiDefMenuTitleBut(uiBlock *block, const char *str);
|
||||||
uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, const char *str, int x, int y, short width, short height, const char *tip);
|
uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, const char *str, int x, int y, short width, short height, const char *tip);
|
||||||
uiBut *uiDefIconMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, int x, int y, short width, short height, const char *tip);
|
uiBut *uiDefIconMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, int x, int y, short width, short height, const char *tip);
|
||||||
|
|
||||||
|
@@ -55,6 +55,9 @@ enum {
|
|||||||
TH_REDALERT,
|
TH_REDALERT,
|
||||||
|
|
||||||
TH_THEMEUI,
|
TH_THEMEUI,
|
||||||
|
|
||||||
|
TH_AREA_EDGES,
|
||||||
|
|
||||||
// common colors among spaces
|
// common colors among spaces
|
||||||
|
|
||||||
TH_BACK,
|
TH_BACK,
|
||||||
|
@@ -103,8 +103,10 @@ enum eView2D_Gridlines {
|
|||||||
/* ------ Defines for Scrollers ----- */
|
/* ------ Defines for Scrollers ----- */
|
||||||
|
|
||||||
/* scroller area */
|
/* scroller area */
|
||||||
#define V2D_SCROLL_HEIGHT (0.85f * U.widget_unit)
|
#define V2D_SCROLL_HEIGHT (0.50f * U.widget_unit)
|
||||||
#define V2D_SCROLL_WIDTH (0.85f * U.widget_unit)
|
#define V2D_SCROLL_WIDTH (0.50f * U.widget_unit)
|
||||||
|
#define V2D_SCROLL_HEIGHT_TEXT (0.85f * U.widget_unit)
|
||||||
|
#define V2D_SCROLL_WIDTH_TEXT (0.85f * U.widget_unit)
|
||||||
|
|
||||||
/* scroller 'handles' hotspot radius for mouse */
|
/* scroller 'handles' hotspot radius for mouse */
|
||||||
#define V2D_SCROLLER_HANDLE_SIZE (0.6f * U.widget_unit)
|
#define V2D_SCROLLER_HANDLE_SIZE (0.6f * U.widget_unit)
|
||||||
|
@@ -161,6 +161,13 @@ void ui_block_to_window_rctf(const ARegion *ar, uiBlock *block, rctf *rct_dst, c
|
|||||||
ui_block_to_window_fl(ar, block, &rct_dst->xmax, &rct_dst->ymax);
|
ui_block_to_window_fl(ar, block, &rct_dst->xmax, &rct_dst->ymax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ui_block_to_window_rcti(const ARegion *ar, uiBlock *block, rcti *rct_dst, const rcti *rct_src)
|
||||||
|
{
|
||||||
|
*rct_dst = *rct_src;
|
||||||
|
ui_block_to_window(ar, block, &rct_dst->xmin, &rct_dst->ymin);
|
||||||
|
ui_block_to_window(ar, block, &rct_dst->xmax, &rct_dst->ymax);
|
||||||
|
}
|
||||||
|
|
||||||
void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y) /* for mouse cursor */
|
void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y) /* for mouse cursor */
|
||||||
{
|
{
|
||||||
float a, b, c, d, e, f, px, py;
|
float a, b, c, d, e, f, px, py;
|
||||||
@@ -1327,6 +1334,43 @@ static void ui_but_to_pixelrect(rcti *rect, const ARegion *ar, uiBlock *block, u
|
|||||||
BLI_rcti_translate(rect, -ar->winrct.xmin, -ar->winrct.ymin);
|
BLI_rcti_translate(rect, -ar->winrct.xmin, -ar->winrct.ymin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* project a rcti to pixels in regionspace */
|
||||||
|
void ui_rcti_to_pixelrect(const ARegion *ar, uiBlock *block, rcti *rct_dst, const rcti *rct_src)
|
||||||
|
{
|
||||||
|
rcti rect;
|
||||||
|
|
||||||
|
ui_block_to_window_rcti(ar, block, &rect, rct_src);
|
||||||
|
|
||||||
|
rect.xmin -= ar->winrct.xmin;
|
||||||
|
rect.ymin -= ar->winrct.ymin;
|
||||||
|
rect.xmax -= ar->winrct.xmin;
|
||||||
|
rect.ymax -= ar->winrct.ymin;
|
||||||
|
|
||||||
|
rct_dst->xmin = iroundf(rect.xmin);
|
||||||
|
rct_dst->ymin = iroundf(rect.ymin);
|
||||||
|
rct_dst->xmax = iroundf(rect.xmax);
|
||||||
|
rct_dst->ymax = iroundf(rect.ymax);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* project a rctf to pixels in regionspace */
|
||||||
|
void ui_rctf_to_pixelrect(const ARegion *ar, uiBlock *block, rctf *rct_dst, const rctf *rct_src)
|
||||||
|
{
|
||||||
|
rctf rect;
|
||||||
|
|
||||||
|
ui_block_to_window_rctf(ar, block, &rect, rct_src);
|
||||||
|
|
||||||
|
rect.xmin -= ar->winrct.xmin;
|
||||||
|
rect.ymin -= ar->winrct.ymin;
|
||||||
|
rect.xmax -= ar->winrct.xmin;
|
||||||
|
rect.ymax -= ar->winrct.ymin;
|
||||||
|
|
||||||
|
rct_dst->xmin = floorf(rect.xmin);
|
||||||
|
rct_dst->ymin = floorf(rect.ymin);
|
||||||
|
rct_dst->xmax = floorf(rect.xmax);
|
||||||
|
rct_dst->ymax = floorf(rect.ymax);
|
||||||
|
}
|
||||||
|
|
||||||
/* uses local copy of style, to scale things down, and allow widgets to change stuff */
|
/* uses local copy of style, to scale things down, and allow widgets to change stuff */
|
||||||
void UI_block_draw(const bContext *C, uiBlock *block)
|
void UI_block_draw(const bContext *C, uiBlock *block)
|
||||||
{
|
{
|
||||||
@@ -2564,6 +2608,10 @@ static void ui_but_free(const bContext *C, uiBut *but)
|
|||||||
MEM_freeN(but->dragpoin);
|
MEM_freeN(but->dragpoin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((BLI_listbase_is_empty(&but->subbuts)) == false) {
|
||||||
|
BLI_freelistN(&but->subbuts);
|
||||||
|
}
|
||||||
|
|
||||||
BLI_assert(UI_butstore_is_registered(but->block, but) == false);
|
BLI_assert(UI_butstore_is_registered(but->block, but) == false);
|
||||||
|
|
||||||
MEM_freeN(but);
|
MEM_freeN(but);
|
||||||
@@ -3154,6 +3202,26 @@ void ui_block_cm_to_display_space_range(uiBlock *block, float *min, float *max)
|
|||||||
*max = max_fff(UNPACK3(pixel));
|
*max = max_fff(UNPACK3(pixel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uiSubBut *ui_def_subbut(
|
||||||
|
uiBut *but, const int type,
|
||||||
|
uiSubButAlign alignment,
|
||||||
|
const int width, const int height)
|
||||||
|
{
|
||||||
|
uiSubBut *sbut = MEM_callocN(sizeof(uiSubBut), "uiSubBut");
|
||||||
|
|
||||||
|
sbut->type = type;
|
||||||
|
sbut->align = alignment;
|
||||||
|
sbut->width = width;
|
||||||
|
sbut->height = height;
|
||||||
|
|
||||||
|
/* sbut->rect is calculated later */
|
||||||
|
|
||||||
|
BLI_addtail(&but->subbuts, sbut);
|
||||||
|
|
||||||
|
return sbut;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief ui_def_but is the function that draws many button types
|
* \brief ui_def_but is the function that draws many button types
|
||||||
*
|
*
|
||||||
@@ -3268,6 +3336,13 @@ static uiBut *ui_def_but(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (but->type == UI_BTYPE_NUM) {
|
||||||
|
const int sbut_width = MIN2(width / 3, height);
|
||||||
|
|
||||||
|
ui_def_subbut(but, UI_SBUT_TYPE_VAL_DECREASE, UI_SBUT_ALIGN_LEFT, sbut_width, height);
|
||||||
|
ui_def_subbut(but, UI_SBUT_TYPE_VAL_INCREASE, UI_SBUT_ALIGN_RIGHT, sbut_width, height);
|
||||||
|
}
|
||||||
|
|
||||||
/* keep track of UI_interface.h */
|
/* keep track of UI_interface.h */
|
||||||
if (ELEM(but->type,
|
if (ELEM(but->type,
|
||||||
UI_BTYPE_BLOCK, UI_BTYPE_BUT, UI_BTYPE_LABEL,
|
UI_BTYPE_BLOCK, UI_BTYPE_BUT, UI_BTYPE_LABEL,
|
||||||
@@ -4310,6 +4385,17 @@ uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, const char
|
|||||||
return but;
|
return but;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uiBut *uiDefMenuTitleBut(uiBlock *block, const char *str)
|
||||||
|
{
|
||||||
|
uiBut *but = ui_def_but(block, UI_BTYPE_LABEL, 0, str, 0, 0, UI_MENU_TITLE_WIDTH, UI_MENU_TITLE_HEIGHT,
|
||||||
|
NULL, 0.0, 0.0, 0.0, 0.0, "");
|
||||||
|
but->flag |= UI_BUT_MENU_TITLE;
|
||||||
|
|
||||||
|
ui_but_update(but);
|
||||||
|
|
||||||
|
return but;
|
||||||
|
}
|
||||||
|
|
||||||
uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, const char *str, int x, int y, short width, short height, const char *tip)
|
uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, const char *str, int x, int y, short width, short height, const char *tip)
|
||||||
{
|
{
|
||||||
uiBut *but = ui_def_but(block, UI_BTYPE_PULLDOWN, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip);
|
uiBut *but = ui_def_but(block, UI_BTYPE_PULLDOWN, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip);
|
||||||
|
@@ -384,6 +384,7 @@ static bool ui_but_contains_pt(uiBut *but, float mx, float my);
|
|||||||
static bool ui_but_contains_point_px(ARegion *ar, uiBut *but, int x, int y);
|
static bool ui_but_contains_point_px(ARegion *ar, uiBut *but, int x, int y);
|
||||||
static uiBut *ui_but_find_mouse_over_ex(ARegion *ar, const int x, const int y, const bool labeledit);
|
static uiBut *ui_but_find_mouse_over_ex(ARegion *ar, const int x, const int y, const bool labeledit);
|
||||||
static uiBut *ui_but_find_mouse_over(ARegion *ar, const wmEvent *event);
|
static uiBut *ui_but_find_mouse_over(ARegion *ar, const wmEvent *event);
|
||||||
|
static uiSubBut *ui_subbut_find_mouse_over(ARegion *ar, uiBut *but, const int mouse_xy[2]);
|
||||||
static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type);
|
static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type);
|
||||||
static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState state);
|
static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState state);
|
||||||
static void button_activate_exit(
|
static void button_activate_exit(
|
||||||
@@ -4266,68 +4267,8 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (click) {
|
if (click) {
|
||||||
/* we can click on the side arrows to increment/decrement,
|
/* start textediting - clicking to increase/decrease numbers is handled via sub-buttons */
|
||||||
* or click inside to edit the value directly */
|
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
|
||||||
float tempf, softmin, softmax;
|
|
||||||
float handlewidth;
|
|
||||||
int temp;
|
|
||||||
|
|
||||||
softmin = but->softmin;
|
|
||||||
softmax = but->softmax;
|
|
||||||
|
|
||||||
handlewidth = min_ff(BLI_rctf_size_x(&but->rect) / 3, BLI_rctf_size_y(&but->rect));
|
|
||||||
|
|
||||||
if (!ui_but_is_float(but)) {
|
|
||||||
if (mx < (but->rect.xmin + handlewidth)) {
|
|
||||||
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
|
|
||||||
|
|
||||||
temp = (int)data->value - 1;
|
|
||||||
if (temp >= softmin && temp <= softmax)
|
|
||||||
data->value = (double)temp;
|
|
||||||
else
|
|
||||||
data->cancel = true;
|
|
||||||
|
|
||||||
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
|
||||||
}
|
|
||||||
else if (mx > (but->rect.xmax - handlewidth)) {
|
|
||||||
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
|
|
||||||
|
|
||||||
temp = (int)data->value + 1;
|
|
||||||
if (temp >= softmin && temp <= softmax)
|
|
||||||
data->value = (double)temp;
|
|
||||||
else
|
|
||||||
data->cancel = true;
|
|
||||||
|
|
||||||
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (mx < (but->rect.xmin + handlewidth)) {
|
|
||||||
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
|
|
||||||
|
|
||||||
tempf = (float)data->value - (UI_PRECISION_FLOAT_SCALE * but->a1);
|
|
||||||
if (tempf < softmin) tempf = softmin;
|
|
||||||
data->value = tempf;
|
|
||||||
|
|
||||||
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
|
||||||
}
|
|
||||||
else if (mx > but->rect.xmax - handlewidth) {
|
|
||||||
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
|
|
||||||
|
|
||||||
tempf = (float)data->value + (UI_PRECISION_FLOAT_SCALE * but->a1);
|
|
||||||
if (tempf > softmax) tempf = softmax;
|
|
||||||
data->value = tempf;
|
|
||||||
|
|
||||||
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
retval = WM_UI_HANDLER_BREAK;
|
retval = WM_UI_HANDLER_BREAK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4337,6 +4278,40 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ui_do_subbut_NUM(bContext *C, uiBut *but, const uiSubBut *sbut, const wmEvent *event)
|
||||||
|
{
|
||||||
|
uiHandleButtonData *data = but->active;
|
||||||
|
const float softmin = but->softmin;
|
||||||
|
const float softmax = but->softmax;
|
||||||
|
const bool is_float = ui_but_is_float(but);
|
||||||
|
const bool increase = (sbut->type == UI_SBUT_TYPE_VAL_INCREASE);
|
||||||
|
float tempf;
|
||||||
|
int temp;
|
||||||
|
|
||||||
|
if (event->type != LEFTMOUSE || event->val != KM_RELEASE || data->dragchange)
|
||||||
|
return WM_UI_HANDLER_CONTINUE;
|
||||||
|
|
||||||
|
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
|
||||||
|
|
||||||
|
if (is_float) {
|
||||||
|
tempf = (float)data->value + (increase ? 0.01f : -0.01f) * but->a1;
|
||||||
|
CLAMP(tempf, softmin, softmax);
|
||||||
|
data->value = tempf;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
temp = (int)data->value + (increase ? 1 : -1);
|
||||||
|
if (IN_RANGE_INCL(temp, softmin, softmax))
|
||||||
|
data->value = (double)temp;
|
||||||
|
else
|
||||||
|
data->cancel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
||||||
|
|
||||||
|
/* always break */
|
||||||
|
return WM_UI_HANDLER_BREAK;
|
||||||
|
}
|
||||||
|
|
||||||
static bool ui_numedit_but_SLI(
|
static bool ui_numedit_but_SLI(
|
||||||
uiBut *but, uiHandleButtonData *data,
|
uiBut *but, uiHandleButtonData *data,
|
||||||
int mx, const bool is_horizontal,
|
int mx, const bool is_horizontal,
|
||||||
@@ -6502,6 +6477,7 @@ static bool ui_but_menu(bContext *C, uiBut *but)
|
|||||||
uiPopupMenu *pup;
|
uiPopupMenu *pup;
|
||||||
uiLayout *layout;
|
uiLayout *layout;
|
||||||
bool is_array, is_array_component;
|
bool is_array, is_array_component;
|
||||||
|
bool is_first_item = true; /* will the next added item be the first menu entry? */
|
||||||
uiStringInfo label = {BUT_GET_LABEL, NULL};
|
uiStringInfo label = {BUT_GET_LABEL, NULL};
|
||||||
|
|
||||||
/* if ((but->rnapoin.data && but->rnaprop) == 0 && but->optype == NULL)*/
|
/* if ((but->rnapoin.data && but->rnaprop) == 0 && but->optype == NULL)*/
|
||||||
@@ -6524,6 +6500,9 @@ static bool ui_but_menu(bContext *C, uiBut *but)
|
|||||||
|
|
||||||
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
|
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
|
||||||
|
|
||||||
|
/* adds a separator if it wouldn't be the first item (after title) */
|
||||||
|
#define ADD_SEPARATOR_CONDITIONAL if (is_first_item == false) uiItemS(layout);
|
||||||
|
|
||||||
if (but->rnapoin.data && but->rnaprop) {
|
if (but->rnapoin.data && but->rnaprop) {
|
||||||
PointerRNA *ptr = &but->rnapoin;
|
PointerRNA *ptr = &but->rnapoin;
|
||||||
PropertyRNA *prop = but->rnaprop;
|
PropertyRNA *prop = but->rnaprop;
|
||||||
@@ -6563,7 +6542,7 @@ static bool ui_but_menu(bContext *C, uiBut *but)
|
|||||||
/* keyframe settings */
|
/* keyframe settings */
|
||||||
uiItemS(layout);
|
uiItemS(layout);
|
||||||
|
|
||||||
|
is_first_item = false;
|
||||||
}
|
}
|
||||||
else if (but->flag & UI_BUT_DRIVEN) {
|
else if (but->flag & UI_BUT_DRIVEN) {
|
||||||
/* pass */
|
/* pass */
|
||||||
@@ -6579,6 +6558,8 @@ static bool ui_but_menu(bContext *C, uiBut *but)
|
|||||||
uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Insert Keyframe"),
|
uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Insert Keyframe"),
|
||||||
ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 1);
|
ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_first_item = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((but->flag & UI_BUT_ANIMATED) && (but->rnapoin.type != &RNA_NlaStrip)) {
|
if ((but->flag & UI_BUT_ANIMATED) && (but->rnapoin.type != &RNA_NlaStrip)) {
|
||||||
@@ -6592,11 +6573,13 @@ static bool ui_but_menu(bContext *C, uiBut *but)
|
|||||||
uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Clear Keyframes"),
|
uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Clear Keyframes"),
|
||||||
ICON_NONE, "ANIM_OT_keyframe_clear_button", "all", 1);
|
ICON_NONE, "ANIM_OT_keyframe_clear_button", "all", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_first_item = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Drivers */
|
/* Drivers */
|
||||||
if (but->flag & UI_BUT_DRIVEN) {
|
if (but->flag & UI_BUT_DRIVEN) {
|
||||||
uiItemS(layout);
|
ADD_SEPARATOR_CONDITIONAL
|
||||||
|
|
||||||
if (is_array_component) {
|
if (is_array_component) {
|
||||||
uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Delete Drivers"),
|
uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Delete Drivers"),
|
||||||
@@ -6615,12 +6598,14 @@ static bool ui_but_menu(bContext *C, uiBut *but)
|
|||||||
uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Paste Driver"),
|
uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Paste Driver"),
|
||||||
ICON_NONE, "ANIM_OT_paste_driver_button");
|
ICON_NONE, "ANIM_OT_paste_driver_button");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_first_item = false;
|
||||||
}
|
}
|
||||||
else if (but->flag & (UI_BUT_ANIMATED_KEY | UI_BUT_ANIMATED)) {
|
else if (but->flag & (UI_BUT_ANIMATED_KEY | UI_BUT_ANIMATED)) {
|
||||||
/* pass */
|
/* pass */
|
||||||
}
|
}
|
||||||
else if (is_anim) {
|
else if (is_anim) {
|
||||||
uiItemS(layout);
|
ADD_SEPARATOR_CONDITIONAL
|
||||||
|
|
||||||
if (is_array_component) {
|
if (is_array_component) {
|
||||||
uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add Drivers"),
|
uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add Drivers"),
|
||||||
@@ -6637,12 +6622,14 @@ static bool ui_but_menu(bContext *C, uiBut *but)
|
|||||||
uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Paste Driver"),
|
uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Paste Driver"),
|
||||||
ICON_NONE, "ANIM_OT_paste_driver_button");
|
ICON_NONE, "ANIM_OT_paste_driver_button");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_first_item = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keying Sets */
|
/* Keying Sets */
|
||||||
/* TODO: check on modifyability of Keying Set when doing this */
|
/* TODO: check on modifyability of Keying Set when doing this */
|
||||||
if (is_anim) {
|
if (is_anim) {
|
||||||
uiItemS(layout);
|
ADD_SEPARATOR_CONDITIONAL
|
||||||
|
|
||||||
if (is_array_component) {
|
if (is_array_component) {
|
||||||
uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add All to Keying Set"),
|
uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add All to Keying Set"),
|
||||||
@@ -6658,10 +6645,12 @@ static bool ui_but_menu(bContext *C, uiBut *but)
|
|||||||
uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Keying Set"),
|
uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Keying Set"),
|
||||||
ICON_NONE, "ANIM_OT_keyingset_button_remove");
|
ICON_NONE, "ANIM_OT_keyingset_button_remove");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_first_item = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uiItemS(layout);
|
ADD_SEPARATOR_CONDITIONAL
|
||||||
|
|
||||||
/* Property Operators */
|
/* Property Operators */
|
||||||
|
|
||||||
/* Copy Property Value
|
/* Copy Property Value
|
||||||
@@ -6729,6 +6718,7 @@ static bool ui_but_menu(bContext *C, uiBut *but)
|
|||||||
"please use User Preferences otherwise"));
|
"please use User Preferences otherwise"));
|
||||||
UI_but_flag_enable(but2, UI_BUT_DISABLED);
|
UI_but_flag_enable(but2, UI_BUT_DISABLED);
|
||||||
}
|
}
|
||||||
|
is_first_item = false;
|
||||||
}
|
}
|
||||||
/* only show 'add' if there's a suitable key map for it to go in */
|
/* only show 'add' if there's a suitable key map for it to go in */
|
||||||
else if (WM_keymap_guess_opname(C, but->optype->idname)) {
|
else if (WM_keymap_guess_opname(C, but->optype->idname)) {
|
||||||
@@ -6736,11 +6726,15 @@ static bool ui_but_menu(bContext *C, uiBut *but)
|
|||||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add Shortcut"),
|
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add Shortcut"),
|
||||||
0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
|
0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
|
||||||
UI_but_func_set(but2, popup_add_shortcut_func, but, NULL);
|
UI_but_func_set(but2, popup_add_shortcut_func, but, NULL);
|
||||||
|
|
||||||
|
is_first_item = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uiItemS(layout);
|
ADD_SEPARATOR_CONDITIONAL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef ADD_SEPARATOR_CONDITIONAL
|
||||||
|
|
||||||
/* Show header tools for header buttons. */
|
/* Show header tools for header buttons. */
|
||||||
if (ui_block_is_menu(but->block) == false) {
|
if (ui_block_is_menu(but->block) == false) {
|
||||||
ARegion *ar = CTX_wm_region(C);
|
ARegion *ar = CTX_wm_region(C);
|
||||||
@@ -6785,8 +6779,33 @@ static bool ui_but_menu(bContext *C, uiBut *but)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ui_do_but_subbut(bContext *C, uiBut *but, uiSubBut *sbut, const wmEvent *event)
|
||||||
|
{
|
||||||
|
int retval = WM_UI_HANDLER_CONTINUE;
|
||||||
|
|
||||||
|
BLI_assert(sbut->is_hovered);
|
||||||
|
|
||||||
|
switch (but->type) {
|
||||||
|
case UI_BTYPE_NUM:
|
||||||
|
retval = ui_do_subbut_NUM(C, but, sbut, event);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (retval == WM_UI_HANDLER_BREAK) {
|
||||||
|
BLI_assert(ui_but_contains_point_px(CTX_wm_region(C), but, event->x, event->y));
|
||||||
|
button_activate_exit(C, but, but->active, true, false);
|
||||||
|
/* reactivate highlight state */
|
||||||
|
button_activate_init(C, CTX_wm_region(C), but, BUTTON_ACTIVATE_OVER);
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *event)
|
static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *event)
|
||||||
{
|
{
|
||||||
|
uiSubBut *sbut;
|
||||||
uiHandleButtonData *data;
|
uiHandleButtonData *data;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
@@ -6930,6 +6949,16 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sbut = ui_subbut_find_mouse_over(CTX_wm_region(C), but, &event->x);
|
||||||
|
|
||||||
|
if (sbut) {
|
||||||
|
retval = ui_do_but_subbut(C, but, sbut, event);
|
||||||
|
|
||||||
|
if (retval == WM_UI_HANDLER_BREAK) {
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (but->type) {
|
switch (but->type) {
|
||||||
case UI_BTYPE_BUT:
|
case UI_BTYPE_BUT:
|
||||||
retval = ui_do_but_BUT(C, but, data, event);
|
retval = ui_do_but_BUT(C, but, data, event);
|
||||||
@@ -7408,6 +7437,25 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, const wmEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static uiSubBut *ui_subbut_find_mouse_over(ARegion *ar, uiBut *but, const int mouse_xy[2])
|
||||||
|
{
|
||||||
|
uiSubBut *sbut;
|
||||||
|
float mx = mouse_xy[0];
|
||||||
|
float my = mouse_xy[1];
|
||||||
|
|
||||||
|
BLI_assert(ui_but_contains_point_px(ar, but, UNPACK2(mouse_xy)));
|
||||||
|
|
||||||
|
ui_window_to_block_fl(ar, but->block, &mx, &my);
|
||||||
|
|
||||||
|
for (sbut = but->subbuts.first; sbut; sbut = sbut->next) {
|
||||||
|
if (BLI_rcti_isect_x(&sbut->rect, mx)) {
|
||||||
|
return sbut;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static uiBut *ui_list_find_mouse_over_ex(ARegion *ar, int x, int y)
|
static uiBut *ui_list_find_mouse_over_ex(ARegion *ar, int x, int y)
|
||||||
{
|
{
|
||||||
uiBlock *block;
|
uiBlock *block;
|
||||||
@@ -8095,6 +8143,31 @@ static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiBu
|
|||||||
|
|
||||||
/************ handle events for an activated button ***********/
|
/************ handle events for an activated button ***********/
|
||||||
|
|
||||||
|
static void ui_handle_but_subbuts(ARegion *ar, uiBut *but, const int mouse_xy[2])
|
||||||
|
{
|
||||||
|
uiSubBut *sbut = ui_subbut_find_mouse_over(ar, but, mouse_xy);
|
||||||
|
bool changed = false;
|
||||||
|
|
||||||
|
if (sbut) {
|
||||||
|
if (sbut->is_hovered == false) {
|
||||||
|
sbut->is_hovered = true;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (sbut = but->subbuts.first; sbut; sbut = sbut->next) {
|
||||||
|
if (sbut->is_hovered) {
|
||||||
|
sbut->is_hovered = false;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed) {
|
||||||
|
ED_region_tag_redraw(ar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
|
static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
|
||||||
{
|
{
|
||||||
uiHandleButtonData *data = but->active;
|
uiHandleButtonData *data = but->active;
|
||||||
@@ -8141,6 +8214,10 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
|
|||||||
button_tooltip_timer_reset(C, but);
|
button_tooltip_timer_reset(C, but);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (BLI_listbase_is_empty(&but->subbuts) == false) {
|
||||||
|
ui_handle_but_subbuts(ar, but, &event->x);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TIMER:
|
case TIMER:
|
||||||
@@ -8807,7 +8884,7 @@ static int ui_handle_menu_event(
|
|||||||
|
|
||||||
/* check if mouse is inside block */
|
/* check if mouse is inside block */
|
||||||
inside = BLI_rctf_isect_pt(&block->rect, mx, my);
|
inside = BLI_rctf_isect_pt(&block->rect, mx, my);
|
||||||
inside_title = inside && ((my + (UI_UNIT_Y * 1.5f)) > block->rect.ymax);
|
inside_title = inside && ((my + UI_MENU_TITLE_HEIGHT) > block->rect.ymax);
|
||||||
|
|
||||||
/* if there's an active modal button, don't check events or outside, except for search menu */
|
/* if there's an active modal button, don't check events or outside, except for search menu */
|
||||||
but = ui_but_find_active_in_region(ar);
|
but = ui_but_find_active_in_region(ar);
|
||||||
|
@@ -101,6 +101,11 @@ typedef enum {
|
|||||||
UI_WTYPE_PROGRESSBAR,
|
UI_WTYPE_PROGRESSBAR,
|
||||||
} uiWidgetTypeEnum;
|
} uiWidgetTypeEnum;
|
||||||
|
|
||||||
|
/* general menu defines */
|
||||||
|
#define UI_MENU_TITLE_WIDTH (short)(UI_UNIT_X * 5.0f)
|
||||||
|
#define UI_MENU_TITLE_HEIGHT (short)(UI_UNIT_Y * 1.1f)
|
||||||
|
#define UI_MENU_SUBMENU_PADDING (10 * UI_DPI_FAC) /* some extra padding added to menus containing submenu icons */
|
||||||
|
|
||||||
/* menu scrolling */
|
/* menu scrolling */
|
||||||
#define UI_MENU_SCROLL_ARROW 12
|
#define UI_MENU_SCROLL_ARROW 12
|
||||||
#define UI_MENU_SCROLL_MOUSE (UI_MENU_SCROLL_ARROW + 2)
|
#define UI_MENU_SCROLL_MOUSE (UI_MENU_SCROLL_ARROW + 2)
|
||||||
@@ -121,6 +126,18 @@ enum {
|
|||||||
/* warn: rest of uiBut->flag in UI_interface.h */
|
/* warn: rest of uiBut->flag in UI_interface.h */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* uiSubBut->type */
|
||||||
|
typedef enum uiSubButType {
|
||||||
|
UI_SBUT_TYPE_VAL_DECREASE,
|
||||||
|
UI_SBUT_TYPE_VAL_INCREASE,
|
||||||
|
} uiSubButType;
|
||||||
|
|
||||||
|
/* uiSubBut->align */
|
||||||
|
typedef enum uiSubButAlign {
|
||||||
|
UI_SBUT_ALIGN_LEFT,
|
||||||
|
UI_SBUT_ALIGN_RIGHT,
|
||||||
|
} uiSubButAlign;
|
||||||
|
|
||||||
/* some buttons display icons only under special conditions
|
/* some buttons display icons only under special conditions
|
||||||
* (e.g. 'x' icon in search menu) - used with ui_but_icon_extra_get */
|
* (e.g. 'x' icon in search menu) - used with ui_but_icon_extra_get */
|
||||||
typedef enum uiButExtraIconType {
|
typedef enum uiButExtraIconType {
|
||||||
@@ -204,8 +221,23 @@ typedef struct {
|
|||||||
ListBase lines;
|
ListBase lines;
|
||||||
} uiLink;
|
} uiLink;
|
||||||
|
|
||||||
|
typedef struct uiSubBut {
|
||||||
|
struct uiSubBut *next, *prev;
|
||||||
|
|
||||||
|
uiSubButType type;
|
||||||
|
uiSubButAlign align; /* alignment within but */
|
||||||
|
|
||||||
|
int width, height;
|
||||||
|
rcti rect; /* block relative coords */
|
||||||
|
|
||||||
|
bool is_hovered; /* could be made into flag */
|
||||||
|
} uiSubBut;
|
||||||
|
|
||||||
struct uiBut {
|
struct uiBut {
|
||||||
struct uiBut *next, *prev;
|
struct uiBut *next, *prev;
|
||||||
|
|
||||||
|
ListBase subbuts;
|
||||||
|
|
||||||
int flag, drawflag;
|
int flag, drawflag;
|
||||||
eButType type;
|
eButType type;
|
||||||
eButPointerType pointype;
|
eButPointerType pointype;
|
||||||
@@ -446,11 +478,14 @@ extern bool ui_block_is_pie_menu(const uiBlock *block) ATTR_WARN_UNUSED_RESULT;
|
|||||||
extern void ui_block_to_window_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y);
|
extern void ui_block_to_window_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y);
|
||||||
extern void ui_block_to_window(const struct ARegion *ar, uiBlock *block, int *x, int *y);
|
extern void ui_block_to_window(const struct ARegion *ar, uiBlock *block, int *x, int *y);
|
||||||
extern void ui_block_to_window_rctf(const struct ARegion *ar, uiBlock *block, rctf *rct_dst, const rctf *rct_src);
|
extern void ui_block_to_window_rctf(const struct ARegion *ar, uiBlock *block, rctf *rct_dst, const rctf *rct_src);
|
||||||
|
extern void ui_block_to_window_rcti(const ARegion *ar, uiBlock *block, rcti *rct_dst, const rcti *rct_src);
|
||||||
extern void ui_window_to_block_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y);
|
extern void ui_window_to_block_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y);
|
||||||
extern void ui_window_to_block(const struct ARegion *ar, uiBlock *block, int *x, int *y);
|
extern void ui_window_to_block(const struct ARegion *ar, uiBlock *block, int *x, int *y);
|
||||||
extern void ui_window_to_region(const ARegion *ar, int *x, int *y);
|
extern void ui_window_to_region(const ARegion *ar, int *x, int *y);
|
||||||
extern void ui_region_to_window(const struct ARegion *ar, int *x, int *y);
|
extern void ui_region_to_window(const struct ARegion *ar, int *x, int *y);
|
||||||
extern void ui_region_winrct_get_no_margin(const struct ARegion *ar, struct rcti *r_rect);
|
extern void ui_region_winrct_get_no_margin(const struct ARegion *ar, struct rcti *r_rect);
|
||||||
|
extern void ui_rcti_to_pixelrect(const ARegion *ar, uiBlock *block, rcti *rct_dst, const rcti *rct_src);
|
||||||
|
extern void ui_rctf_to_pixelrect(const ARegion *ar, uiBlock *block, rctf *rct_dst, const rctf *rct_src);
|
||||||
|
|
||||||
extern double ui_but_value_get(uiBut *but);
|
extern double ui_but_value_get(uiBut *but);
|
||||||
extern void ui_but_value_set(uiBut *but, double value);
|
extern void ui_but_value_set(uiBut *but, double value);
|
||||||
|
@@ -281,12 +281,40 @@ static void ui_item_position(uiItem *item, int x, int y, int w, int h)
|
|||||||
{
|
{
|
||||||
if (item->type == ITEM_BUTTON) {
|
if (item->type == ITEM_BUTTON) {
|
||||||
uiButtonItem *bitem = (uiButtonItem *)item;
|
uiButtonItem *bitem = (uiButtonItem *)item;
|
||||||
|
uiBut *but = bitem->but;
|
||||||
|
|
||||||
|
but->rect.xmin = x;
|
||||||
|
but->rect.ymin = y;
|
||||||
|
but->rect.xmax = x + w;
|
||||||
|
but->rect.ymax = y + h;
|
||||||
|
|
||||||
|
/* set subbut sizes */
|
||||||
|
if (BLI_listbase_is_empty(&but->subbuts) == false) {
|
||||||
|
uiSubBut *sbut;
|
||||||
|
for (sbut = but->subbuts.first; sbut; sbut = sbut->next) {
|
||||||
|
if (sbut->align == UI_SBUT_ALIGN_LEFT) {
|
||||||
|
sbut->rect.xmin = but->rect.xmin - 2; /* - 2 looks a bit better */
|
||||||
|
sbut->rect.xmax = sbut->rect.xmin + sbut->width;
|
||||||
|
}
|
||||||
|
else if (sbut->align == UI_SBUT_ALIGN_RIGHT) {
|
||||||
|
sbut->rect.xmax = but->rect.xmax + 4; /* + 4 looks a bit better */
|
||||||
|
sbut->rect.xmin = but->rect.xmax - sbut->width;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
BLI_assert(0);
|
||||||
|
}
|
||||||
|
sbut->rect.ymin = but->rect.ymin + (U.pixelsize - 1.0f);
|
||||||
|
sbut->rect.ymax = sbut->rect.ymin + sbut->height;
|
||||||
|
|
||||||
|
if (but->block->panel) {
|
||||||
|
uiStyle *style = UI_style_get_dpi();
|
||||||
|
|
||||||
|
sbut->rect.ymin += (but->block->panel->sizey - style->panelspace);
|
||||||
|
sbut->rect.ymax += (but->block->panel->sizey - style->panelspace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bitem->but->rect.xmin = x;
|
|
||||||
bitem->but->rect.ymin = y;
|
|
||||||
bitem->but->rect.xmax = x + w;
|
|
||||||
bitem->but->rect.ymax = y + h;
|
|
||||||
|
|
||||||
ui_but_update(bitem->but); /* for strlen */
|
ui_but_update(bitem->but); /* for strlen */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@@ -427,16 +427,43 @@ void UI_draw_icon_tri(float x, float y, char dir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* triangle 'icon' inside rect */
|
static void ui_draw_tria_rect(const rctf *rect, const bool is_closed)
|
||||||
static void ui_draw_tria_rect(const rctf *rect, char dir)
|
|
||||||
{
|
{
|
||||||
if (dir == 'h') {
|
const float col_tint = 50;
|
||||||
|
const int px = (int)UI_DPI_FAC;
|
||||||
|
float col[3];
|
||||||
|
|
||||||
|
/* XXX ensure contrast */
|
||||||
|
UI_GetThemeColorShade3fv(TH_TITLE, col_tint, col);
|
||||||
|
|
||||||
|
/* color for shadow drawing */
|
||||||
|
glColor4f(0.0f, 0.0f, 0.0f, 0.3f);
|
||||||
|
|
||||||
|
if (is_closed) {
|
||||||
float half = 0.5f * BLI_rctf_size_y(rect);
|
float half = 0.5f * BLI_rctf_size_y(rect);
|
||||||
ui_draw_anti_tria(rect->xmin, rect->ymin, rect->xmin, rect->ymax, rect->xmax, rect->ymin + half);
|
|
||||||
|
/* draw shadow first */
|
||||||
|
ui_draw_anti_tria(rect->xmin + px, rect->ymin - px,
|
||||||
|
rect->xmin + px, rect->ymax - px,
|
||||||
|
rect->xmax + px, rect->ymin + half - px);
|
||||||
|
|
||||||
|
glColor3fv(col);
|
||||||
|
ui_draw_anti_tria(rect->xmin, rect->ymin,
|
||||||
|
rect->xmin, rect->ymax,
|
||||||
|
rect->xmax, rect->ymin + half);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float half = 0.5f * BLI_rctf_size_x(rect);
|
float half = 0.5f * BLI_rctf_size_y(rect);
|
||||||
ui_draw_anti_tria(rect->xmin, rect->ymax, rect->xmax, rect->ymax, rect->xmin + half, rect->ymin);
|
|
||||||
|
/* draw shadow first */
|
||||||
|
ui_draw_anti_tria(rect->xmin + px, rect->ymax - px,
|
||||||
|
rect->xmax + px, rect->ymax - px,
|
||||||
|
rect->xmin + half + px, rect->ymin - px);
|
||||||
|
|
||||||
|
glColor3fv(col);
|
||||||
|
ui_draw_anti_tria(rect->xmin, rect->ymax,
|
||||||
|
rect->xmax, rect->ymax,
|
||||||
|
rect->xmin + half, rect->ymin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,9 +489,7 @@ static void ui_draw_anti_x(float x1, float y1, float x2, float y2)
|
|||||||
/* x 'icon' for panel header */
|
/* x 'icon' for panel header */
|
||||||
static void ui_draw_x_icon(float x, float y)
|
static void ui_draw_x_icon(float x, float y)
|
||||||
{
|
{
|
||||||
|
|
||||||
ui_draw_anti_x(x, y, x + 9.375f, y + 9.375f);
|
ui_draw_anti_x(x, y, x + 9.375f, y + 9.375f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PNL_ICON UI_UNIT_X /* could be UI_UNIT_Y too */
|
#define PNL_ICON UI_UNIT_X /* could be UI_UNIT_Y too */
|
||||||
@@ -492,86 +517,133 @@ static void ui_draw_panel_scalewidget(const rcti *rect)
|
|||||||
fdrawline(xmin + dx, ymin + 1, xmax, ymax - dy + 1);
|
fdrawline(xmin + dx, ymin + 1, xmax, ymax - dy + 1);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ui_draw_panel_dragwidget(const rctf *rect)
|
static void ui_draw_panel_dragwidget(const rctf *rect)
|
||||||
{
|
{
|
||||||
unsigned char col_back[3], col_high[3], col_dark[3];
|
unsigned char col_back[3], col_high[3], col_dark[3];
|
||||||
const int col_tint = 84;
|
const int col_tint = 60;
|
||||||
|
|
||||||
const int px = (int)U.pixelsize;
|
const int px = (int)UI_DPI_FAC;
|
||||||
const int px_zoom = max_ii(iroundf(BLI_rctf_size_y(rect) / 22.0f), 1);
|
const int px_zoom = max_ii(iroundf(BLI_rctf_size_y(rect) / 22.0f), 1);
|
||||||
|
|
||||||
const int box_margin = max_ii(iroundf((float)(px_zoom * 2.0f)), px);
|
const int box_margin = max_ii(iroundf((float)(px_zoom * 2.0f)), px);
|
||||||
const int box_size = max_ii(iroundf((BLI_rctf_size_y(rect) / 8.0f) - px), px);
|
const int box_size = max_ii(iroundf((BLI_rctf_size_y(rect) / 8.0f) - px), px);
|
||||||
|
const int box_rows = 4;
|
||||||
|
|
||||||
const int x_min = rect->xmin;
|
const int x_min = rect->xmin;
|
||||||
const int y_min = rect->ymin;
|
const int y_min = rect->ymin;
|
||||||
const int y_ofs = max_ii(iroundf(BLI_rctf_size_y(rect) / 3.0f), px);
|
const int y_ofs = (BLI_rctf_size_y(rect) / box_rows) - (box_margin * 0.5f);
|
||||||
const int x_ofs = y_ofs;
|
int i;
|
||||||
int i_x, i_y;
|
|
||||||
|
|
||||||
|
|
||||||
UI_GetThemeColor3ubv(UI_GetThemeValue(TH_PANEL_SHOW_HEADER) ? TH_PANEL_HEADER : TH_PANEL_BACK, col_back);
|
UI_GetThemeColor3ubv(UI_GetThemeValue(TH_PANEL_SHOW_HEADER) ? TH_PANEL_HEADER : TH_PANEL_BACK, col_back);
|
||||||
UI_GetColorPtrShade3ubv(col_back, col_high, col_tint);
|
UI_GetColorPtrShade3ubv(col_back, col_high, col_tint);
|
||||||
UI_GetColorPtrShade3ubv(col_back, col_dark, -col_tint);
|
UI_GetColorPtrShade3ubv(col_back, col_dark, -(col_tint * 0.4));
|
||||||
|
|
||||||
|
|
||||||
/* draw multiple boxes */
|
/* draw multiple boxes */
|
||||||
for (i_x = 0; i_x < 4; i_x++) {
|
for (i = 0; i < box_rows; i++) {
|
||||||
for (i_y = 0; i_y < 2; i_y++) {
|
const int y_co = (y_min + y_ofs) + (i * (box_size + box_margin));
|
||||||
const int x_co = (x_min + x_ofs) + (i_x * (box_size + box_margin));
|
|
||||||
const int y_co = (y_min + y_ofs) + (i_y * (box_size + box_margin));
|
|
||||||
|
|
||||||
glColor3ubv(col_dark);
|
glColor3ubv(col_dark);
|
||||||
glRectf(x_co - box_size, y_co - px_zoom, x_co, (y_co + box_size) - px_zoom);
|
glRectf(x_min - box_size + px_zoom, y_co - px_zoom, x_min + px_zoom, (y_co + box_size) - px_zoom);
|
||||||
glColor3ubv(col_high);
|
glColor3ubv(col_high);
|
||||||
glRectf(x_co - box_size, y_co, x_co, y_co + box_size);
|
glRectf(x_min - box_size, y_co, x_min, y_co + box_size);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ui_draw_aligned_panel_header(
|
||||||
static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, const rcti *rect, char dir)
|
const uiStyle *style, const uiBlock *block,
|
||||||
|
const rcti *rect, const char dir)
|
||||||
{
|
{
|
||||||
Panel *panel = block->panel;
|
const Panel *panel = block->panel;
|
||||||
rcti hrect;
|
const int px = (int)UI_DPI_FAC;
|
||||||
int pnl_icons;
|
|
||||||
const char *activename = panel->drawname[0] ? panel->drawname : panel->panelname;
|
const char *activename = panel->drawname[0] ? panel->drawname : panel->panelname;
|
||||||
|
rcti hrect;
|
||||||
|
|
||||||
/* + 0.001f to avoid flirting with float inaccuracy */
|
|
||||||
if (panel->control & UI_PNL_CLOSE)
|
|
||||||
pnl_icons = (panel->labelofs + 2 * PNL_ICON + 5) / block->aspect + 0.001f;
|
|
||||||
else
|
|
||||||
pnl_icons = (panel->labelofs + PNL_ICON + 5) / block->aspect + 0.001f;
|
|
||||||
|
|
||||||
/* active tab */
|
/* active tab */
|
||||||
/* draw text label */
|
/* draw text label */
|
||||||
UI_ThemeColor(TH_TITLE);
|
UI_ThemeColor(TH_TITLE);
|
||||||
|
|
||||||
hrect = *rect;
|
hrect = *rect;
|
||||||
if (dir == 'h') {
|
if (dir == 'h') {
|
||||||
hrect.xmin = rect->xmin + pnl_icons;
|
hrect.xmin = rect->xmin + BLI_rcti_size_y(rect);
|
||||||
hrect.ymin += 2.0f / block->aspect;
|
hrect.ymin += (2.0f / block->aspect) * px;
|
||||||
UI_fontstyle_draw(&style->paneltitle, &hrect, activename);
|
UI_fontstyle_draw(&style->paneltitle, &hrect, activename);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* ignore 'pnl_icons', otherwise the text gets offset horizontally
|
hrect.xmin = rect->xmin + ((PNL_HEADER - 1) / block->aspect);
|
||||||
* + 0.001f to avoid flirting with float inaccuracy
|
|
||||||
*/
|
|
||||||
hrect.xmin = rect->xmin + (PNL_ICON + 5) / block->aspect + 0.001f;
|
|
||||||
UI_fontstyle_draw_rotated(&style->paneltitle, &hrect, activename);
|
UI_fontstyle_draw_rotated(&style->paneltitle, &hrect, activename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ui_draw_panel_shadow(
|
||||||
|
const rctf shadowrect, const float aspect,
|
||||||
|
const float alpha_fac, const bool is_selected)
|
||||||
|
{
|
||||||
|
float alpha_fac_tmp = 0.2f * alpha_fac;
|
||||||
|
const int px = MAX2(iroundf(UI_DPI_FAC * (1 / aspect)), 1);
|
||||||
|
short shadow_ofs = is_selected ? 2.0f * px : 1.0f * px;
|
||||||
|
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
|
if (is_selected) {
|
||||||
|
/* draw a big soft shadow while dragging */
|
||||||
|
UI_draw_box_shadow(alpha_fac * 255, shadowrect.xmin, shadowrect.ymin, shadowrect.xmax, shadowrect.ymax);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
short i;
|
||||||
|
|
||||||
|
/* draw a soft 2px shadow */
|
||||||
|
for (i = 0; i < 2; i++) {
|
||||||
|
glColor4f(0.0f, 0.0f, 0.0f, alpha_fac_tmp);
|
||||||
|
|
||||||
|
glRectf(shadowrect.xmin + shadow_ofs, shadowrect.ymin - shadow_ofs,
|
||||||
|
shadowrect.xmax + shadow_ofs, shadowrect.ymax - shadow_ofs);
|
||||||
|
|
||||||
|
shadow_ofs += px;
|
||||||
|
alpha_fac_tmp *= 0.5f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void panel_boundbox_get(
|
||||||
|
const uiBlock *block, const Panel *pa,
|
||||||
|
const rcti *blockrect, const rcti *headrect,
|
||||||
|
rctf *r_bounds)
|
||||||
|
{
|
||||||
|
const int xmax = (pa->flag & PNL_CLOSEDX) ? (blockrect->xmin + (PNL_HEADER / block->aspect)) : blockrect->xmax;
|
||||||
|
const int ymin = (pa->flag & PNL_CLOSED) ? headrect->ymin : blockrect->ymin;
|
||||||
|
|
||||||
|
BLI_rctf_init(r_bounds, blockrect->xmin, xmax, ymin, headrect->ymax);
|
||||||
|
}
|
||||||
|
|
||||||
/* panel integrated in buttonswindow, tool/property lists etc */
|
/* panel integrated in buttonswindow, tool/property lists etc */
|
||||||
void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, const bool show_pin)
|
void ui_draw_aligned_panel(
|
||||||
|
uiStyle *style, uiBlock *block,
|
||||||
|
const rcti *rect,
|
||||||
|
const bool show_pin)
|
||||||
{
|
{
|
||||||
Panel *panel = block->panel;
|
Panel *panel = block->panel;
|
||||||
|
rctf fullrect, itemrect;
|
||||||
rcti headrect;
|
rcti headrect;
|
||||||
rctf itemrect;
|
|
||||||
int ofsx;
|
int ofsx;
|
||||||
|
|
||||||
|
const bool is_selected = (panel->flag & PNL_SELECT) ? true : false;
|
||||||
|
const float alpha_fac = is_selected ? 0.7f : 1.0f;
|
||||||
|
|
||||||
|
/* panel states */
|
||||||
|
const bool is_inside = ELEM(panel->mouse_state, PANEL_MOUSE_INSIDE_CONTENT, PANEL_MOUSE_INSIDE_HEADER);
|
||||||
|
const bool is_closed_xy = (panel->flag & PNL_CLOSED) ? true : false;
|
||||||
const bool is_closed_x = (panel->flag & PNL_CLOSEDX) ? true : false;
|
const bool is_closed_x = (panel->flag & PNL_CLOSEDX) ? true : false;
|
||||||
const bool is_closed_y = (panel->flag & PNL_CLOSEDY) ? true : false;
|
const bool is_closed_y = (panel->flag & PNL_CLOSEDY) ? true : false;
|
||||||
|
|
||||||
|
/* theme options */
|
||||||
|
const bool draw_header = UI_GetThemeValue(TH_PANEL_SHOW_HEADER);
|
||||||
|
const bool draw_back = UI_GetThemeValue(TH_PANEL_SHOW_BACK);
|
||||||
|
|
||||||
if (panel->paneltab) return;
|
if (panel->paneltab) return;
|
||||||
if (panel->type && (panel->type->flag & PNL_NO_HEADER)) return;
|
if (panel->type && (panel->type->flag & PNL_NO_HEADER)) return;
|
||||||
|
|
||||||
@@ -581,20 +653,45 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
|
|||||||
headrect.ymin = headrect.ymax;
|
headrect.ymin = headrect.ymax;
|
||||||
headrect.ymax = headrect.ymin + floor(PNL_HEADER / block->aspect + 0.001f);
|
headrect.ymax = headrect.ymin + floor(PNL_HEADER / block->aspect + 0.001f);
|
||||||
|
|
||||||
|
/* set fullrect */
|
||||||
|
panel_boundbox_get(block, panel, rect, &headrect, &fullrect);
|
||||||
|
|
||||||
|
if (draw_header == false && is_closed_xy) {
|
||||||
|
/* skip */
|
||||||
|
}
|
||||||
|
/* draw panel shadow */
|
||||||
|
else if (draw_header || draw_back) {
|
||||||
|
rctf shadowrect = fullrect;
|
||||||
|
|
||||||
|
/* adjust shadowrect for special case: draw background but not header */
|
||||||
|
if (draw_back && !draw_header) {
|
||||||
|
shadowrect.ymax = rect->ymax;
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_draw_panel_shadow(shadowrect, block->aspect, alpha_fac, is_selected);
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
float minx = rect->xmin;
|
float minx = rect->xmin;
|
||||||
float maxx = is_closed_x ? (minx + PNL_HEADER / block->aspect) : rect->xmax;
|
float maxx = is_closed_x ? (minx + (PNL_HEADER / block->aspect)) : rect->xmax;
|
||||||
float y = headrect.ymax;
|
float y = headrect.ymax;
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
if (UI_GetThemeValue(TH_PANEL_SHOW_HEADER)) {
|
if (draw_header) {
|
||||||
/* draw with background color */
|
float col[3];
|
||||||
UI_ThemeColor4(TH_PANEL_HEADER);
|
|
||||||
glRectf(minx, headrect.ymin + 1, maxx, y);
|
|
||||||
|
|
||||||
fdrawline(minx, y, maxx, y);
|
if (is_inside) {
|
||||||
fdrawline(minx, y, maxx, y);
|
/* highlight if mouse is inside */
|
||||||
|
UI_GetThemeColorShade3fv(TH_PANEL_HEADER, 7, col);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
UI_GetThemeColor3fv(TH_PANEL_HEADER, col);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* draw with background color */
|
||||||
|
glColor4f(UNPACK3(col), alpha_fac);
|
||||||
|
glRectf(minx, headrect.ymin, maxx, y);
|
||||||
}
|
}
|
||||||
else if (!(panel->runtime_flag & PNL_FIRST)) {
|
else if (!(panel->runtime_flag & PNL_FIRST)) {
|
||||||
/* draw embossed separator */
|
/* draw embossed separator */
|
||||||
@@ -622,24 +719,24 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
UI_icon_draw_aspect(headrect.xmax - ((PNL_ICON * 2.2f) / block->aspect), headrect.ymin + (5.0f / block->aspect),
|
UI_icon_draw_aspect(headrect.xmax - ((PNL_ICON * 1.8f) / block->aspect), headrect.ymin + (5.0f / block->aspect),
|
||||||
(panel->flag & PNL_PIN) ? ICON_PINNED : ICON_UNPINNED,
|
(panel->flag & PNL_PIN) ? ICON_PINNED : ICON_UNPINNED,
|
||||||
(block->aspect / UI_DPI_FAC), 1.0f);
|
(block->aspect / UI_DPI_FAC), 1.0f);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* horizontal title */
|
|
||||||
if (is_closed_x == false) {
|
if (is_closed_x == false) {
|
||||||
|
/* horizontal title */
|
||||||
ui_draw_aligned_panel_header(style, block, &headrect, 'h');
|
ui_draw_aligned_panel_header(style, block, &headrect, 'h');
|
||||||
|
|
||||||
/* itemrect smaller */
|
/* drag widget */
|
||||||
itemrect.xmax = headrect.xmax - 5.0f / block->aspect;
|
if (is_inside) {
|
||||||
itemrect.xmin = itemrect.xmax - BLI_rcti_size_y(&headrect);
|
BLI_rctf_rcti_copy(&itemrect, &headrect);
|
||||||
itemrect.ymin = headrect.ymin;
|
/* itemrect smaller */
|
||||||
itemrect.ymax = headrect.ymax;
|
itemrect.xmin = itemrect.xmax - (5.0f / block->aspect);
|
||||||
|
|
||||||
BLI_rctf_scale(&itemrect, 0.7f);
|
ui_draw_panel_dragwidget(&itemrect);
|
||||||
ui_draw_panel_dragwidget(&itemrect);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if the panel is minimized vertically:
|
/* if the panel is minimized vertically:
|
||||||
@@ -654,21 +751,23 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
|
|||||||
}
|
}
|
||||||
/* an open panel */
|
/* an open panel */
|
||||||
else {
|
else {
|
||||||
/* in some occasions, draw a border */
|
|
||||||
if (panel->flag & PNL_SELECT) {
|
|
||||||
if (panel->control & UI_PNL_SOLID) UI_draw_roundbox_corner_set(UI_CNR_ALL);
|
|
||||||
else UI_draw_roundbox_corner_set(UI_CNR_NONE);
|
|
||||||
|
|
||||||
UI_ThemeColorShade(TH_BACK, -120);
|
|
||||||
UI_draw_roundbox_unfilled(0.5f + rect->xmin, 0.5f + rect->ymin, 0.5f + rect->xmax, 0.5f + headrect.ymax + 1, 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* panel backdrop */
|
/* panel backdrop */
|
||||||
if (UI_GetThemeValue(TH_PANEL_SHOW_BACK)) {
|
if (draw_back) {
|
||||||
/* draw with background color */
|
/* draw with background color */
|
||||||
|
float col[3];
|
||||||
|
|
||||||
|
if (is_inside) {
|
||||||
|
/* highlight if mouse is inside */
|
||||||
|
UI_GetThemeColorShade3fv(TH_PANEL_BACK, 7, col);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
UI_GetThemeColor3fv(TH_PANEL_BACK, col);
|
||||||
|
}
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
UI_ThemeColor4(TH_PANEL_BACK);
|
glColor4f(UNPACK3(col), alpha_fac);
|
||||||
glRecti(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
|
glRecti(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
|
||||||
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (panel->control & UI_PNL_SCALE)
|
if (panel->control & UI_PNL_SCALE)
|
||||||
@@ -684,23 +783,14 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
|
|||||||
ofsx = 22;
|
ofsx = 22;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* draw collapse icon */
|
|
||||||
UI_ThemeColor(TH_TITLE);
|
|
||||||
|
|
||||||
/* itemrect smaller */
|
/* itemrect smaller */
|
||||||
itemrect.xmin = headrect.xmin + 5.0f / block->aspect;
|
itemrect.xmin = headrect.xmin + (is_closed_x ? (1.0f / block->aspect) : (3.0f / block->aspect));
|
||||||
itemrect.xmax = itemrect.xmin + BLI_rcti_size_y(&headrect);
|
itemrect.xmax = itemrect.xmin + BLI_rcti_size_y(&headrect);
|
||||||
itemrect.ymin = headrect.ymin;
|
itemrect.ymin = headrect.ymin;
|
||||||
itemrect.ymax = headrect.ymax;
|
itemrect.ymax = headrect.ymax;
|
||||||
|
|
||||||
BLI_rctf_scale(&itemrect, 0.35f);
|
BLI_rctf_scale(&itemrect, 0.35f);
|
||||||
|
|
||||||
if (is_closed_y)
|
ui_draw_tria_rect(&itemrect, is_closed_xy);
|
||||||
ui_draw_tria_rect(&itemrect, 'h');
|
|
||||||
else if (is_closed_x)
|
|
||||||
ui_draw_tria_rect(&itemrect, 'h');
|
|
||||||
else
|
|
||||||
ui_draw_tria_rect(&itemrect, 'v');
|
|
||||||
|
|
||||||
(void)ofsx;
|
(void)ofsx;
|
||||||
}
|
}
|
||||||
@@ -851,8 +941,9 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
|
|||||||
|
|
||||||
/* no smart other default start loc! this keeps switching f5/f6/etc compatible */
|
/* no smart other default start loc! this keeps switching f5/f6/etc compatible */
|
||||||
ps = panelsort;
|
ps = panelsort;
|
||||||
ps->pa->ofsx = 0;
|
ps->pa->ofsx = UI_PANEL_MARGIN;
|
||||||
ps->pa->ofsy = -get_panel_size_y(ps->pa);
|
/* offset first panel, but not for properties editor, there is already some space making this look odd */
|
||||||
|
ps->pa->ofsy = -(get_panel_size_y(ps->pa) + (sa->spacetype == SPACE_BUTS ? 0 : UI_PANEL_MARGIN));
|
||||||
|
|
||||||
if (has_category_tabs) {
|
if (has_category_tabs) {
|
||||||
if (align == BUT_VERTICAL) {
|
if (align == BUT_VERTICAL) {
|
||||||
@@ -865,10 +956,10 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
|
|||||||
|
|
||||||
if (align == BUT_VERTICAL) {
|
if (align == BUT_VERTICAL) {
|
||||||
psnext->pa->ofsx = ps->pa->ofsx;
|
psnext->pa->ofsx = ps->pa->ofsx;
|
||||||
psnext->pa->ofsy = get_panel_real_ofsy(ps->pa) - get_panel_size_y(psnext->pa);
|
psnext->pa->ofsy = get_panel_real_ofsy(ps->pa) - get_panel_size_y(psnext->pa) - UI_PANEL_MARGIN;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
psnext->pa->ofsx = get_panel_real_ofsx(ps->pa);
|
psnext->pa->ofsx = get_panel_real_ofsx(ps->pa) + UI_PANEL_MARGIN * 2;
|
||||||
psnext->pa->ofsy = ps->pa->ofsy + get_panel_size_y(ps->pa) - get_panel_size_y(psnext->pa);
|
psnext->pa->ofsy = ps->pa->ofsy + get_panel_size_y(ps->pa) - get_panel_size_y(psnext->pa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1312,17 +1403,17 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
|
|||||||
int align = panel_aligned(sa, ar), button = 0;
|
int align = panel_aligned(sa, ar), button = 0;
|
||||||
|
|
||||||
rctf rect_drag, rect_pin;
|
rctf rect_drag, rect_pin;
|
||||||
float rect_leftmost;
|
float collapse_xmax;
|
||||||
|
|
||||||
|
|
||||||
/* drag and pin rect's */
|
/* drag and pin rect's */
|
||||||
rect_drag = block->rect;
|
rect_drag = block->rect;
|
||||||
rect_drag.xmin = block->rect.xmax - (PNL_ICON * 1.5f);
|
rect_drag.xmin = block->rect.xmax - (PNL_ICON * 0.8f);
|
||||||
rect_pin = rect_drag;
|
rect_pin = rect_drag;
|
||||||
if (show_pin) {
|
if (show_pin) {
|
||||||
BLI_rctf_translate(&rect_pin, -PNL_ICON, 0.0f);
|
BLI_rctf_translate(&rect_pin, -PNL_ICON, 0.0f);
|
||||||
}
|
}
|
||||||
rect_leftmost = rect_pin.xmin;
|
collapse_xmax = rect_pin.xmin;
|
||||||
|
|
||||||
/* mouse coordinates in panel space! */
|
/* mouse coordinates in panel space! */
|
||||||
|
|
||||||
@@ -1345,7 +1436,7 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
|
|||||||
if (mx <= block->rect.xmax - 8 - PNL_ICON) button = 2;
|
if (mx <= block->rect.xmax - 8 - PNL_ICON) button = 2;
|
||||||
//else if (mx <= block->rect.xmin + 10 + 2 * PNL_ICON + 2) button = 1;
|
//else if (mx <= block->rect.xmin + 10 + 2 * PNL_ICON + 2) button = 1;
|
||||||
}
|
}
|
||||||
else if (mx < rect_leftmost) {
|
else if (mx < collapse_xmax) {
|
||||||
button = 1;
|
button = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1903,13 +1994,21 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* do a first iteration over all panels to see if we have one that is already being dragged */
|
||||||
|
for (block = ar->uiblocks.last; block; block = block->prev) {
|
||||||
|
if (block->panel && block->panel->flag & PNL_SELECT) {
|
||||||
|
/* don't handle any further interaction while a panel
|
||||||
|
* is dragged (which is handled separately) */
|
||||||
|
retval = WM_UI_HANDLER_BREAK;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (retval == WM_UI_HANDLER_BREAK) {
|
if (retval == WM_UI_HANDLER_BREAK) {
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (block = ar->uiblocks.last; block; block = block->prev) {
|
for (block = ar->uiblocks.last; block; block = block->prev) {
|
||||||
uiPanelMouseState mouse_state;
|
|
||||||
|
|
||||||
mx = event->x;
|
mx = event->x;
|
||||||
my = event->y;
|
my = event->y;
|
||||||
ui_window_to_block(ar, block, &mx, &my);
|
ui_window_to_block(ar, block, &mx, &my);
|
||||||
@@ -1922,10 +2021,22 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar, cons
|
|||||||
if (pa->type && pa->type->flag & PNL_NO_HEADER) /* XXX - accessed freed panels when scripts reload, need to fix. */
|
if (pa->type && pa->type->flag & PNL_NO_HEADER) /* XXX - accessed freed panels when scripts reload, need to fix. */
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mouse_state = ui_panel_mouse_state_get(block, pa, mx, my);
|
pa->mouse_state = ui_panel_mouse_state_get(block, pa, mx, my);
|
||||||
|
|
||||||
|
/* some special redrawing (skipped if area is already tagged for redraw) */
|
||||||
|
if (event->type == MOUSEMOVE && ar->do_draw == 0) {
|
||||||
|
int mx_prev = event->prevx;
|
||||||
|
int my_prev = event->prevy;
|
||||||
|
|
||||||
|
ui_window_to_block(ar, block, &mx_prev, &my_prev);
|
||||||
|
/* redraw if mouse state has changed for mouse hover feedback */
|
||||||
|
if (pa->mouse_state != ui_panel_mouse_state_get(block, pa, mx_prev, my_prev)) {
|
||||||
|
ED_region_tag_redraw(ar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* XXX hardcoded key warning */
|
/* XXX hardcoded key warning */
|
||||||
if (ELEM(mouse_state, PANEL_MOUSE_INSIDE_CONTENT, PANEL_MOUSE_INSIDE_HEADER) && event->val == KM_PRESS) {
|
if (ELEM(pa->mouse_state, PANEL_MOUSE_INSIDE_CONTENT, PANEL_MOUSE_INSIDE_HEADER) && event->val == KM_PRESS) {
|
||||||
if (event->type == AKEY && ((event->ctrl + event->oskey + event->shift + event->alt) == 0)) {
|
if (event->type == AKEY && ((event->ctrl + event->oskey + event->shift + event->alt) == 0)) {
|
||||||
|
|
||||||
if (pa->flag & PNL_CLOSEDY) {
|
if (pa->flag & PNL_CLOSEDY) {
|
||||||
@@ -1944,13 +2055,13 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar, cons
|
|||||||
if (ui_but_is_active(ar))
|
if (ui_but_is_active(ar))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ELEM(mouse_state, PANEL_MOUSE_INSIDE_CONTENT, PANEL_MOUSE_INSIDE_HEADER)) {
|
if (ELEM(pa->mouse_state, PANEL_MOUSE_INSIDE_CONTENT, PANEL_MOUSE_INSIDE_HEADER)) {
|
||||||
|
|
||||||
if (event->val == KM_PRESS) {
|
if (event->val == KM_PRESS) {
|
||||||
|
|
||||||
/* open close on header */
|
/* open close on header */
|
||||||
if (ELEM(event->type, RETKEY, PADENTER)) {
|
if (ELEM(event->type, RETKEY, PADENTER)) {
|
||||||
if (mouse_state == PANEL_MOUSE_INSIDE_HEADER) {
|
if (pa->mouse_state == PANEL_MOUSE_INSIDE_HEADER) {
|
||||||
ui_handle_panel_header(C, block, mx, my, RETKEY, event->ctrl, event->shift);
|
ui_handle_panel_header(C, block, mx, my, RETKEY, event->ctrl, event->shift);
|
||||||
retval = WM_UI_HANDLER_BREAK;
|
retval = WM_UI_HANDLER_BREAK;
|
||||||
break;
|
break;
|
||||||
@@ -1960,12 +2071,12 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar, cons
|
|||||||
/* all inside clicks should return in break - overlapping/float panels */
|
/* all inside clicks should return in break - overlapping/float panels */
|
||||||
retval = WM_UI_HANDLER_BREAK;
|
retval = WM_UI_HANDLER_BREAK;
|
||||||
|
|
||||||
if (mouse_state == PANEL_MOUSE_INSIDE_HEADER) {
|
if (pa->mouse_state == PANEL_MOUSE_INSIDE_HEADER) {
|
||||||
ui_handle_panel_header(C, block, mx, my, event->type, event->ctrl, event->shift);
|
ui_handle_panel_header(C, block, mx, my, event->type, event->ctrl, event->shift);
|
||||||
retval = WM_UI_HANDLER_BREAK;
|
retval = WM_UI_HANDLER_BREAK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if ((mouse_state == PANEL_MOUSE_INSIDE_SCALE) && !(pa->flag & PNL_CLOSED)) {
|
else if ((pa->mouse_state == PANEL_MOUSE_INSIDE_SCALE) && !(pa->flag & PNL_CLOSED)) {
|
||||||
panel_activate_state(C, pa, PANEL_STATE_DRAG_SCALE);
|
panel_activate_state(C, pa, PANEL_STATE_DRAG_SCALE);
|
||||||
retval = WM_UI_HANDLER_BREAK;
|
retval = WM_UI_HANDLER_BREAK;
|
||||||
break;
|
break;
|
||||||
@@ -1973,7 +2084,7 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar, cons
|
|||||||
|
|
||||||
}
|
}
|
||||||
else if (event->type == RIGHTMOUSE) {
|
else if (event->type == RIGHTMOUSE) {
|
||||||
if (mouse_state == PANEL_MOUSE_INSIDE_HEADER) {
|
if (pa->mouse_state == PANEL_MOUSE_INSIDE_HEADER) {
|
||||||
ui_panel_menu(C, ar, block->panel);
|
ui_panel_menu(C, ar, block->panel);
|
||||||
retval = WM_UI_HANDLER_BREAK;
|
retval = WM_UI_HANDLER_BREAK;
|
||||||
break;
|
break;
|
||||||
|
@@ -1402,6 +1402,10 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
|
|||||||
|
|
||||||
for (bt = block->buttons.first; bt; bt = bt->next) {
|
for (bt = block->buttons.first; bt; bt = bt->next) {
|
||||||
BLI_rctf_union(&block->rect, &bt->rect);
|
BLI_rctf_union(&block->rect, &bt->rect);
|
||||||
|
|
||||||
|
if (UNLIKELY(block->flag & UI_BLOCK_HAS_SUBMENU)) {
|
||||||
|
bt->rect.xmax += UI_MENU_SUBMENU_PADDING;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1409,8 +1413,12 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
|
|||||||
block->rect.xmin = block->rect.ymin = 0;
|
block->rect.xmin = block->rect.ymin = 0;
|
||||||
block->rect.xmax = block->rect.ymax = 20;
|
block->rect.xmax = block->rect.ymax = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (block->flag & UI_BLOCK_HAS_SUBMENU) {
|
||||||
|
block->rect.xmax += UI_MENU_SUBMENU_PADDING;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* aspect = (float)(BLI_rcti_size_x(&block->rect) + 4);*/ /*UNUSED*/
|
/* aspect = (float)(BLI_rcti_size_x(&block->rect) + 4);*/ /*UNUSED*/
|
||||||
ui_block_to_window_rctf(butregion, but->block, &block->rect, &block->rect);
|
ui_block_to_window_rctf(butregion, but->block, &block->rect, &block->rect);
|
||||||
|
|
||||||
@@ -1478,35 +1486,41 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
|
|||||||
if (dir2 == UI_DIR_DOWN && down == 0) dir2 = UI_DIR_UP;
|
if (dir2 == UI_DIR_DOWN && down == 0) dir2 = UI_DIR_UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dir1 == UI_DIR_LEFT) {
|
#define RECTS_BUT_BLOCK_DIFF(member) (butrct.member - block->rect.member)
|
||||||
xof = butrct.xmin - block->rect.xmax;
|
|
||||||
if (dir2 == UI_DIR_UP) yof = butrct.ymin - block->rect.ymin - center - MENU_PADDING;
|
switch (dir1) {
|
||||||
else yof = butrct.ymax - block->rect.ymax + center + MENU_PADDING;
|
case UI_DIR_LEFT:
|
||||||
}
|
xof = butrct.xmin - block->rect.xmax;
|
||||||
else if (dir1 == UI_DIR_RIGHT) {
|
if (dir2 == UI_DIR_UP) yof = RECTS_BUT_BLOCK_DIFF(ymin) - center - MENU_PADDING;
|
||||||
xof = butrct.xmax - block->rect.xmin;
|
else yof = RECTS_BUT_BLOCK_DIFF(ymax) + center + MENU_PADDING;
|
||||||
if (dir2 == UI_DIR_UP) yof = butrct.ymin - block->rect.ymin - center - MENU_PADDING;
|
break;
|
||||||
else yof = butrct.ymax - block->rect.ymax + center + MENU_PADDING;
|
case UI_DIR_RIGHT:
|
||||||
}
|
xof = butrct.xmax - block->rect.xmin;
|
||||||
else if (dir1 == UI_DIR_UP) {
|
if (dir2 == UI_DIR_UP) yof = RECTS_BUT_BLOCK_DIFF(ymin) - center - MENU_PADDING;
|
||||||
yof = butrct.ymax - block->rect.ymin;
|
else yof = RECTS_BUT_BLOCK_DIFF(ymax) + center + MENU_PADDING;
|
||||||
if (dir2 == UI_DIR_RIGHT) xof = butrct.xmax - block->rect.xmax;
|
break;
|
||||||
else xof = butrct.xmin - block->rect.xmin;
|
case UI_DIR_UP:
|
||||||
/* changed direction? */
|
yof = iroundf(butrct.ymax - block->rect.ymin - (2.0f * U.pixelsize));
|
||||||
if ((dir1 & block->direction) == 0) {
|
if (dir2 == UI_DIR_RIGHT) xof = RECTS_BUT_BLOCK_DIFF(xmax);
|
||||||
UI_block_order_flip(block);
|
else xof = RECTS_BUT_BLOCK_DIFF(xmin);
|
||||||
}
|
/* changed direction? */
|
||||||
}
|
if ((dir1 & block->direction) == 0) {
|
||||||
else if (dir1 == UI_DIR_DOWN) {
|
UI_block_order_flip(block);
|
||||||
yof = butrct.ymin - block->rect.ymax;
|
}
|
||||||
if (dir2 == UI_DIR_RIGHT) xof = butrct.xmax - block->rect.xmax;
|
break;
|
||||||
else xof = butrct.xmin - block->rect.xmin;
|
case UI_DIR_DOWN:
|
||||||
/* changed direction? */
|
yof = iroundf(butrct.ymin - block->rect.ymax + (2.0f * U.pixelsize));
|
||||||
if ((dir1 & block->direction) == 0) {
|
if (dir2 == UI_DIR_RIGHT) xof = RECTS_BUT_BLOCK_DIFF(xmax);
|
||||||
UI_block_order_flip(block);
|
else xof = RECTS_BUT_BLOCK_DIFF(xmin);
|
||||||
}
|
/* changed direction? */
|
||||||
|
if ((dir1 & block->direction) == 0) {
|
||||||
|
UI_block_order_flip(block);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef RECTS_BUT_BLOCK_DIFF
|
||||||
|
|
||||||
/* and now we handle the exception; no space below or to top */
|
/* and now we handle the exception; no space below or to top */
|
||||||
if (top == 0 && down == 0) {
|
if (top == 0 && down == 0) {
|
||||||
if (dir1 == UI_DIR_LEFT || dir1 == UI_DIR_RIGHT) {
|
if (dir1 == UI_DIR_LEFT || dir1 == UI_DIR_RIGHT) {
|
||||||
@@ -2700,14 +2714,15 @@ uiPopupMenu *UI_popup_menu_begin(bContext *C, const char *title, int icon)
|
|||||||
|
|
||||||
if (icon) {
|
if (icon) {
|
||||||
BLI_snprintf(titlestr, sizeof(titlestr), " %s", title);
|
BLI_snprintf(titlestr, sizeof(titlestr), " %s", title);
|
||||||
uiDefIconTextBut(pup->block, UI_BTYPE_LABEL, 0, icon, titlestr, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
but = uiDefIconTextBut(pup->block, UI_BTYPE_LABEL, 0, icon, titlestr, 0, 0,
|
||||||
|
UI_MENU_TITLE_WIDTH, UI_MENU_TITLE_HEIGHT, NULL,
|
||||||
|
0.0, 0.0, 0, 0, "");
|
||||||
|
but->flag |= UI_BUT_MENU_TITLE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
but = uiDefBut(pup->block, UI_BTYPE_LABEL, 0, title, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
but = uiDefMenuTitleBut(pup->block, title);
|
||||||
but->drawflag = UI_BUT_TEXT_LEFT;
|
but->drawflag = UI_BUT_TEXT_LEFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
uiItemS(pup->layout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pup;
|
return pup;
|
||||||
|
@@ -79,6 +79,8 @@
|
|||||||
|
|
||||||
#include "UI_interface.h"
|
#include "UI_interface.h"
|
||||||
#include "UI_interface_icons.h"
|
#include "UI_interface_icons.h"
|
||||||
|
#include "UI_view2d.h"
|
||||||
|
|
||||||
#include "interface_intern.h"
|
#include "interface_intern.h"
|
||||||
|
|
||||||
void UI_template_fix_linking(void)
|
void UI_template_fix_linking(void)
|
||||||
@@ -3122,7 +3124,7 @@ void uiTemplateList(
|
|||||||
/* add scrollbar */
|
/* add scrollbar */
|
||||||
if (len > layoutdata.visual_items) {
|
if (len > layoutdata.visual_items) {
|
||||||
col = uiLayoutColumn(row, false);
|
col = uiLayoutColumn(row, false);
|
||||||
uiDefButI(block, UI_BTYPE_SCROLL, 0, "", 0, 0, UI_UNIT_X * 0.75, UI_UNIT_Y * dyn_data->visual_height,
|
uiDefButI(block, UI_BTYPE_SCROLL, 0, "", 0, 0, V2D_SCROLL_WIDTH, UI_UNIT_Y * dyn_data->visual_height,
|
||||||
&ui_list->list_scroll, 0, dyn_data->height - dyn_data->visual_height,
|
&ui_list->list_scroll, 0, dyn_data->height - dyn_data->visual_height,
|
||||||
dyn_data->visual_height, 0, "");
|
dyn_data->visual_height, 0, "");
|
||||||
}
|
}
|
||||||
@@ -3211,7 +3213,7 @@ void uiTemplateList(
|
|||||||
/* add scrollbar */
|
/* add scrollbar */
|
||||||
if (len > layoutdata.visual_items) {
|
if (len > layoutdata.visual_items) {
|
||||||
/* col = */ uiLayoutColumn(row, false);
|
/* col = */ uiLayoutColumn(row, false);
|
||||||
uiDefButI(block, UI_BTYPE_SCROLL, 0, "", 0, 0, UI_UNIT_X * 0.75, UI_UNIT_Y * dyn_data->visual_height,
|
uiDefButI(block, UI_BTYPE_SCROLL, 0, "", 0, 0, V2D_SCROLL_WIDTH, UI_UNIT_Y * dyn_data->visual_height,
|
||||||
&ui_list->list_scroll, 0, dyn_data->height - dyn_data->visual_height,
|
&ui_list->list_scroll, 0, dyn_data->height - dyn_data->visual_height,
|
||||||
dyn_data->visual_height, 0, "");
|
dyn_data->visual_height, 0, "");
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -171,6 +171,10 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (colorid) {
|
switch (colorid) {
|
||||||
|
case TH_AREA_EDGES:
|
||||||
|
cp = btheme->tui.area_edges;
|
||||||
|
break;
|
||||||
|
|
||||||
case TH_BACK:
|
case TH_BACK:
|
||||||
if (theme_regionid == RGN_TYPE_WINDOW)
|
if (theme_regionid == RGN_TYPE_WINDOW)
|
||||||
cp = ts->back;
|
cp = ts->back;
|
||||||
@@ -798,6 +802,11 @@ static void ui_theme_init_new_do(ThemeSpace *ts)
|
|||||||
rgba_char_args_set(ts->tab_inactive, 83, 83, 83, 255);
|
rgba_char_args_set(ts->tab_inactive, 83, 83, 83, 255);
|
||||||
rgba_char_args_set(ts->tab_back, 64, 64, 64, 255);
|
rgba_char_args_set(ts->tab_back, 64, 64, 64, 255);
|
||||||
rgba_char_args_set(ts->tab_outline, 60, 60, 60, 255);
|
rgba_char_args_set(ts->tab_outline, 60, 60, 60, 255);
|
||||||
|
|
||||||
|
/* XXX maybe remove show_back/show_header options? */
|
||||||
|
ts->panelcolors.show_back = ts->panelcolors.show_header = true;
|
||||||
|
rgba_char_args_set(ts->panelcolors.back, 128, 128, 128, 255);
|
||||||
|
rgba_char_args_set(ts->panelcolors.header, 97, 97, 97, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ui_theme_init_new(bTheme *btheme)
|
static void ui_theme_init_new(bTheme *btheme)
|
||||||
@@ -846,7 +855,9 @@ void ui_theme_init_default(void)
|
|||||||
|
|
||||||
/* UI buttons */
|
/* UI buttons */
|
||||||
ui_widget_color_init(&btheme->tui);
|
ui_widget_color_init(&btheme->tui);
|
||||||
|
|
||||||
|
rgba_char_args_set_fl(btheme->tui.area_edges, 0.15f, 0.15f, 0.15f, 1.0f);
|
||||||
|
|
||||||
btheme->tui.iconfile[0] = 0;
|
btheme->tui.iconfile[0] = 0;
|
||||||
btheme->tui.panel.show_back = false;
|
btheme->tui.panel.show_back = false;
|
||||||
btheme->tui.panel.show_header = false;
|
btheme->tui.panel.show_header = false;
|
||||||
@@ -870,10 +881,6 @@ void ui_theme_init_default(void)
|
|||||||
ui_theme_init_new(btheme);
|
ui_theme_init_new(btheme);
|
||||||
|
|
||||||
/* space view3d */
|
/* space view3d */
|
||||||
btheme->tv3d.panelcolors.show_back = false;
|
|
||||||
btheme->tv3d.panelcolors.show_header = false;
|
|
||||||
rgba_char_args_set_fl(btheme->tv3d.panelcolors.back, 0.45, 0.45, 0.45, 0.5);
|
|
||||||
rgba_char_args_set_fl(btheme->tv3d.panelcolors.header, 0, 0, 0, 0.01);
|
|
||||||
rgba_char_args_set_fl(btheme->tv3d.back, 0.225, 0.225, 0.225, 1.0);
|
rgba_char_args_set_fl(btheme->tv3d.back, 0.225, 0.225, 0.225, 1.0);
|
||||||
rgba_char_args_set(btheme->tv3d.text, 0, 0, 0, 255);
|
rgba_char_args_set(btheme->tv3d.text, 0, 0, 0, 255);
|
||||||
rgba_char_args_set(btheme->tv3d.text_hi, 255, 255, 255, 255);
|
rgba_char_args_set(btheme->tv3d.text_hi, 255, 255, 255, 255);
|
||||||
@@ -2646,6 +2653,26 @@ void init_userdef_do_versions(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (U.versionfile < 276 || (U.versionfile == 276 && U.subversionfile < 2)) {
|
||||||
|
bTheme *btheme;
|
||||||
|
ThemeSpace *ts;
|
||||||
|
|
||||||
|
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
|
||||||
|
for (ts = UI_THEMESPACE_START(btheme); ts != UI_THEMESPACE_END(btheme); ts++) {
|
||||||
|
/* XXX maybe remove show_back/show_header options? */
|
||||||
|
ts->panelcolors.show_back = ts->panelcolors.show_header = true;
|
||||||
|
rgba_char_args_set(ts->panelcolors.back, 128, 128, 128, 255);
|
||||||
|
rgba_char_args_set(ts->panelcolors.header, 97, 97, 97, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
rgba_char_args_set_fl(btheme->tui.area_edges, 0.10f, 0.10f, 0.10f, 1.0f);
|
||||||
|
|
||||||
|
btheme->tui.interface_style = TH_IFACE_STYLE_FLAT;
|
||||||
|
|
||||||
|
ui_widget_color_init(&btheme->tui);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (U.pixelsize == 0.0f)
|
if (U.pixelsize == 0.0f)
|
||||||
U.pixelsize = 1.0f;
|
U.pixelsize = 1.0f;
|
||||||
|
|
||||||
|
@@ -152,18 +152,21 @@ static void view2d_masks(View2D *v2d, bool check_scrollers)
|
|||||||
* - if they overlap, they must not occupy the corners (which are reserved for other widgets)
|
* - if they overlap, they must not occupy the corners (which are reserved for other widgets)
|
||||||
*/
|
*/
|
||||||
if (scroll) {
|
if (scroll) {
|
||||||
|
const int scroll_width = (v2d->flag & V2D_USES_UNITS_VERTICAL) ? V2D_SCROLL_WIDTH_TEXT : V2D_SCROLL_WIDTH;
|
||||||
|
const int scroll_height = (v2d->flag & V2D_USES_UNITS_HORIZONTAL) ? V2D_SCROLL_HEIGHT_TEXT : V2D_SCROLL_HEIGHT;
|
||||||
|
|
||||||
/* vertical scroller */
|
/* vertical scroller */
|
||||||
if (scroll & V2D_SCROLL_LEFT) {
|
if (scroll & V2D_SCROLL_LEFT) {
|
||||||
/* on left-hand edge of region */
|
/* on left-hand edge of region */
|
||||||
v2d->vert = v2d->mask;
|
v2d->vert = v2d->mask;
|
||||||
v2d->vert.xmax = V2D_SCROLL_WIDTH;
|
v2d->vert.xmax = scroll_width;
|
||||||
v2d->mask.xmin = v2d->vert.xmax + 1;
|
v2d->mask.xmin = v2d->vert.xmax + 1;
|
||||||
}
|
}
|
||||||
else if (scroll & V2D_SCROLL_RIGHT) {
|
else if (scroll & V2D_SCROLL_RIGHT) {
|
||||||
/* on right-hand edge of region */
|
/* on right-hand edge of region */
|
||||||
v2d->vert = v2d->mask;
|
v2d->vert = v2d->mask;
|
||||||
v2d->vert.xmax++; /* one pixel extra... was leaving a minor gap... */
|
v2d->vert.xmax++; /* one pixel extra... was leaving a minor gap... */
|
||||||
v2d->vert.xmin = v2d->vert.xmax - V2D_SCROLL_WIDTH;
|
v2d->vert.xmin = v2d->vert.xmax - scroll_width;
|
||||||
v2d->mask.xmax = v2d->vert.xmin - 1;
|
v2d->mask.xmax = v2d->vert.xmin - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,13 +174,13 @@ static void view2d_masks(View2D *v2d, bool check_scrollers)
|
|||||||
if (scroll & (V2D_SCROLL_BOTTOM)) {
|
if (scroll & (V2D_SCROLL_BOTTOM)) {
|
||||||
/* on bottom edge of region */
|
/* on bottom edge of region */
|
||||||
v2d->hor = v2d->mask;
|
v2d->hor = v2d->mask;
|
||||||
v2d->hor.ymax = V2D_SCROLL_HEIGHT;
|
v2d->hor.ymax = scroll_height;
|
||||||
v2d->mask.ymin = v2d->hor.ymax + 1;
|
v2d->mask.ymin = v2d->hor.ymax + 1;
|
||||||
}
|
}
|
||||||
else if (scroll & V2D_SCROLL_TOP) {
|
else if (scroll & V2D_SCROLL_TOP) {
|
||||||
/* on upper edge of region */
|
/* on upper edge of region */
|
||||||
v2d->hor = v2d->mask;
|
v2d->hor = v2d->mask;
|
||||||
v2d->hor.ymin = v2d->hor.ymax - V2D_SCROLL_HEIGHT;
|
v2d->hor.ymin = v2d->hor.ymax - scroll_height;
|
||||||
v2d->mask.ymax = v2d->hor.ymin - 1;
|
v2d->mask.ymax = v2d->hor.ymin - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -78,33 +78,31 @@ extern void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3,
|
|||||||
static void region_draw_emboss(const ARegion *ar, const rcti *scirct)
|
static void region_draw_emboss(const ARegion *ar, const rcti *scirct)
|
||||||
{
|
{
|
||||||
rcti rect;
|
rcti rect;
|
||||||
|
|
||||||
|
if (!ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_PROPS))
|
||||||
|
return;
|
||||||
|
|
||||||
/* translate scissor rect to region space */
|
/* translate scissor rect to region space */
|
||||||
rect.xmin = scirct->xmin - ar->winrct.xmin;
|
rect.xmin = scirct->xmin - ar->winrct.xmin;
|
||||||
rect.ymin = scirct->ymin - ar->winrct.ymin;
|
rect.ymin = scirct->ymin - ar->winrct.ymin;
|
||||||
rect.xmax = scirct->xmax - ar->winrct.xmin;
|
rect.xmax = scirct->xmax - ar->winrct.xmin;
|
||||||
rect.ymax = scirct->ymax - ar->winrct.ymin;
|
rect.ymax = scirct->ymax - ar->winrct.ymin;
|
||||||
|
|
||||||
/* set transp line */
|
/* set transp line */
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glColor4ub(0, 0, 0, 50);
|
||||||
/* right */
|
|
||||||
glColor4ub(0, 0, 0, 30);
|
/* bottom */
|
||||||
sdrawline(rect.xmax, rect.ymin, rect.xmax, rect.ymax);
|
if (ar->alignment == RGN_ALIGN_TOP) {
|
||||||
|
sdrawline(rect.xmin, rect.ymin, rect.xmax, rect.ymin);
|
||||||
/* bottom */
|
}
|
||||||
glColor4ub(0, 0, 0, 30);
|
/* top */
|
||||||
sdrawline(rect.xmin, rect.ymin, rect.xmax, rect.ymin);
|
else {
|
||||||
|
BLI_assert(ar->alignment == RGN_ALIGN_BOTTOM);
|
||||||
/* top */
|
sdrawline(rect.xmin, rect.ymax, rect.xmax, rect.ymax);
|
||||||
glColor4ub(255, 255, 255, 30);
|
}
|
||||||
sdrawline(rect.xmin, rect.ymax, rect.xmax, rect.ymax);
|
|
||||||
|
|
||||||
/* left */
|
|
||||||
glColor4ub(255, 255, 255, 30);
|
|
||||||
sdrawline(rect.xmin, rect.ymin, rect.xmin, rect.ymax);
|
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1729,7 +1727,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, const char *context, int c
|
|||||||
Panel *panel;
|
Panel *panel;
|
||||||
View2D *v2d = &ar->v2d;
|
View2D *v2d = &ar->v2d;
|
||||||
View2DScrollers *scrollers;
|
View2DScrollers *scrollers;
|
||||||
int x, y, xco, yco, w, em, triangle;
|
int x, y, xco, yco, w, em;
|
||||||
bool is_context_new = 0;
|
bool is_context_new = 0;
|
||||||
int redo;
|
int redo;
|
||||||
int scroll;
|
int scroll;
|
||||||
@@ -1818,7 +1816,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, const char *context, int c
|
|||||||
em = (ar->type->prefsizex) ? 10 : 20;
|
em = (ar->type->prefsizex) ? 10 : 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
w -= margin_x;
|
w -= margin_x + UI_PANEL_MARGIN * 2.0f;
|
||||||
|
|
||||||
/* create panels */
|
/* create panels */
|
||||||
UI_panels_begin(C, ar);
|
UI_panels_begin(C, ar);
|
||||||
@@ -1842,24 +1840,28 @@ void ED_region_panels(const bContext *C, ARegion *ar, const char *context, int c
|
|||||||
block = UI_block_begin(C, ar, pt->idname, UI_EMBOSS);
|
block = UI_block_begin(C, ar, pt->idname, UI_EMBOSS);
|
||||||
panel = UI_panel_begin(sa, ar, block, pt, panel, &open);
|
panel = UI_panel_begin(sa, ar, block, pt, panel, &open);
|
||||||
|
|
||||||
/* bad fixed values */
|
|
||||||
triangle = (int)(UI_UNIT_Y * 1.1f);
|
|
||||||
|
|
||||||
if (pt->draw_header && !(pt->flag & PNL_NO_HEADER) && (open || vertical)) {
|
if (pt->draw_header && !(pt->flag & PNL_NO_HEADER) && (open || vertical)) {
|
||||||
|
const int ar_x = (int)BLI_rctf_size_x(&ar->v2d.cur);
|
||||||
|
const int ofs_x = iroundf(MIN2(UI_UNIT_X * 0.6f, ar_x * 0.1f));
|
||||||
|
/* using panel->sizex causes too much jittering */
|
||||||
|
const int panel_sizex = ar_x - (int)(UI_PANEL_MARGIN * 2.0f);
|
||||||
|
|
||||||
/* for enabled buttons */
|
/* for enabled buttons */
|
||||||
panel->layout = UI_block_layout(
|
uiLayout *row;
|
||||||
block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER,
|
uiLayout *layout = UI_block_layout(
|
||||||
triangle, (UI_UNIT_Y * 1.1f) + style->panelspace, UI_UNIT_Y, 1, 0, style);
|
block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL,
|
||||||
|
-ofs_x, (UI_UNIT_Y * 1.1f) + style->panelspace,
|
||||||
|
panel_sizex, 1, 0, style);
|
||||||
|
|
||||||
|
|
||||||
|
row = uiLayoutRow(layout, 1);
|
||||||
|
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
|
||||||
|
panel->layout = row;
|
||||||
|
|
||||||
pt->draw_header(C, panel);
|
pt->draw_header(C, panel);
|
||||||
|
|
||||||
UI_block_layout_resolve(block, &xco, &yco);
|
|
||||||
panel->labelofs = xco - triangle;
|
|
||||||
panel->layout = NULL;
|
panel->layout = NULL;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
panel->labelofs = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (open) {
|
if (open) {
|
||||||
short panelContext;
|
short panelContext;
|
||||||
|
@@ -64,6 +64,7 @@
|
|||||||
#include "ED_render.h"
|
#include "ED_render.h"
|
||||||
|
|
||||||
#include "UI_interface.h"
|
#include "UI_interface.h"
|
||||||
|
#include "UI_resources.h"
|
||||||
|
|
||||||
/* XXX actually should be not here... solve later */
|
/* XXX actually should be not here... solve later */
|
||||||
#include "wm_subwindow.h"
|
#include "wm_subwindow.h"
|
||||||
@@ -1011,47 +1012,38 @@ static void scrarea_draw_shape_light(ScrArea *sa, char UNUSED(dir))
|
|||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawscredge_area_draw(int sizex, int sizey, int x1, int y1, int x2, int y2, int a)
|
static void drawscredge_area_draw(int sizex, int sizey, int x1, int y1, int x2, int y2)
|
||||||
{
|
{
|
||||||
/* right border area */
|
/* right border area */
|
||||||
if (x2 < sizex - 1)
|
if (x2 < sizex - 1)
|
||||||
sdrawline(x2 + a, y1, x2 + a, y2);
|
sdrawline(x2, y1, x2, y2);
|
||||||
|
|
||||||
/* left border area */
|
/* left border area */
|
||||||
if (x1 > 0) /* otherwise it draws the emboss of window over */
|
if (x1 > 0) /* otherwise it draws the emboss of window over */
|
||||||
sdrawline(x1 + a, y1, x1 + a, y2);
|
sdrawline(x1, y1, x1, y2);
|
||||||
|
|
||||||
/* top border area */
|
/* top border area */
|
||||||
if (y2 < sizey - 1)
|
if (y2 < sizey - 1)
|
||||||
sdrawline(x1, y2 + a, x2, y2 + a);
|
sdrawline(x1, y2, x2, y2);
|
||||||
|
|
||||||
/* bottom border area */
|
/* bottom border area */
|
||||||
if (y1 > 0)
|
if (y1 > 0)
|
||||||
sdrawline(x1, y1 + a, x2, y1 + a);
|
sdrawline(x1, y1, x2, y1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** screen edges drawing **/
|
/** screen edges drawing **/
|
||||||
static void drawscredge_area(ScrArea *sa, int sizex, int sizey, int center)
|
static void drawscredge_area(ScrArea *sa, int sizex, int sizey)
|
||||||
{
|
{
|
||||||
short x1 = sa->v1->vec.x;
|
short x1 = sa->v1->vec.x;
|
||||||
short y1 = sa->v1->vec.y;
|
short y1 = sa->v1->vec.y;
|
||||||
short x2 = sa->v3->vec.x;
|
short x2 = sa->v3->vec.x;
|
||||||
short y2 = sa->v3->vec.y;
|
short y2 = sa->v3->vec.y;
|
||||||
|
|
||||||
if (center == 0) {
|
glLineWidth(UI_DPI_FAC * 2.0f);
|
||||||
if (U.pixelsize > 1.0f) {
|
UI_ThemeColor(TH_AREA_EDGES);
|
||||||
|
drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2);
|
||||||
glColor3ub(0x50, 0x50, 0x50);
|
glLineWidth(1.0f);
|
||||||
glLineWidth((2.0f * U.pixelsize) - 1);
|
|
||||||
drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2, 0);
|
|
||||||
glLineWidth(1.0f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
glColor3ub(0, 0, 0);
|
|
||||||
drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ****************** EXPORTED API TO OTHER MODULES *************************** */
|
/* ****************** EXPORTED API TO OTHER MODULES *************************** */
|
||||||
@@ -1134,10 +1126,8 @@ void ED_screen_draw(wmWindow *win)
|
|||||||
if (sa->flag & AREA_FLAG_DRAWJOINFROM) sa1 = sa;
|
if (sa->flag & AREA_FLAG_DRAWJOINFROM) sa1 = sa;
|
||||||
if (sa->flag & AREA_FLAG_DRAWJOINTO) sa2 = sa;
|
if (sa->flag & AREA_FLAG_DRAWJOINTO) sa2 = sa;
|
||||||
if (sa->flag & (AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V)) sa3 = sa;
|
if (sa->flag & (AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V)) sa3 = sa;
|
||||||
drawscredge_area(sa, winsize_x, winsize_y, 0);
|
drawscredge_area(sa, winsize_x, winsize_y);
|
||||||
}
|
}
|
||||||
for (sa = win->screen->areabase.first; sa; sa = sa->next)
|
|
||||||
drawscredge_area(sa, winsize_x, winsize_y, 1);
|
|
||||||
|
|
||||||
/* blended join arrow */
|
/* blended join arrow */
|
||||||
if (sa1 && sa2) {
|
if (sa1 && sa2) {
|
||||||
|
@@ -118,7 +118,7 @@ static SpaceLink *action_new(const bContext *C)
|
|||||||
ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
|
ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
|
||||||
ar->v2d.keepofs = V2D_KEEPOFS_Y;
|
ar->v2d.keepofs = V2D_KEEPOFS_Y;
|
||||||
ar->v2d.align = V2D_ALIGN_NO_POS_Y;
|
ar->v2d.align = V2D_ALIGN_NO_POS_Y;
|
||||||
ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
|
ar->v2d.flag = (V2D_VIEWSYNC_AREA_VERTICAL | V2D_USES_UNITS_HORIZONTAL);
|
||||||
|
|
||||||
return (SpaceLink *)saction;
|
return (SpaceLink *)saction;
|
||||||
}
|
}
|
||||||
|
@@ -104,7 +104,7 @@ static void init_preview_region(const bContext *C, ARegion *ar)
|
|||||||
ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
|
ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
|
||||||
ar->v2d.keepofs = V2D_KEEPOFS_Y;
|
ar->v2d.keepofs = V2D_KEEPOFS_Y;
|
||||||
ar->v2d.align = V2D_ALIGN_NO_POS_Y;
|
ar->v2d.align = V2D_ALIGN_NO_POS_Y;
|
||||||
ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
|
ar->v2d.flag = (V2D_VIEWSYNC_AREA_VERTICAL | V2D_USES_UNITS_HORIZONTAL);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ar->v2d.tot.xmin = 0.0f;
|
ar->v2d.tot.xmin = 0.0f;
|
||||||
@@ -128,7 +128,7 @@ static void init_preview_region(const bContext *C, ARegion *ar)
|
|||||||
ar->v2d.keepzoom = 0;
|
ar->v2d.keepzoom = 0;
|
||||||
ar->v2d.keepofs = 0;
|
ar->v2d.keepofs = 0;
|
||||||
ar->v2d.align = 0;
|
ar->v2d.align = 0;
|
||||||
ar->v2d.flag = 0;
|
ar->v2d.flag = (V2D_USES_UNITS_HORIZONTAL | V2D_USES_UNITS_VERTICAL);
|
||||||
|
|
||||||
ar->v2d.keeptot = 0;
|
ar->v2d.keeptot = 0;
|
||||||
}
|
}
|
||||||
@@ -143,8 +143,8 @@ static void reinit_preview_region(const bContext *C, ARegion *ar)
|
|||||||
init_preview_region(C, ar);
|
init_preview_region(C, ar);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (ar->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL)
|
/* XXX check with sergey */
|
||||||
init_preview_region(C, ar);
|
init_preview_region(C, ar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -156,6 +156,7 @@ static SpaceLink *graph_new(const bContext *C)
|
|||||||
|
|
||||||
ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL);
|
ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL);
|
||||||
ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_SCALE_VERTICAL);
|
ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_SCALE_VERTICAL);
|
||||||
|
ar->v2d.flag |= (V2D_USES_UNITS_HORIZONTAL | V2D_USES_UNITS_VERTICAL);
|
||||||
|
|
||||||
ar->v2d.keeptot = 0;
|
ar->v2d.keeptot = 0;
|
||||||
|
|
||||||
|
@@ -292,9 +292,7 @@ static void ui_imageuser_slot_menu(bContext *UNUSED(C), uiLayout *layout, void *
|
|||||||
Image *image = image_p;
|
Image *image = image_p;
|
||||||
int slot;
|
int slot;
|
||||||
|
|
||||||
uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("Slot"),
|
uiDefMenuTitleBut(block, IFACE_("Slot"));
|
||||||
0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
|
||||||
uiItemS(layout);
|
|
||||||
|
|
||||||
slot = IMA_MAX_RENDER_SLOT;
|
slot = IMA_MAX_RENDER_SLOT;
|
||||||
while (slot--) {
|
while (slot--) {
|
||||||
@@ -346,9 +344,7 @@ static void ui_imageuser_layer_menu(bContext *UNUSED(C), uiLayout *layout, void
|
|||||||
UI_block_layout_set_current(block, layout);
|
UI_block_layout_set_current(block, layout);
|
||||||
uiLayoutColumn(layout, false);
|
uiLayoutColumn(layout, false);
|
||||||
|
|
||||||
uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("Layer"),
|
uiDefMenuTitleBut(block, IFACE_("Layer"));
|
||||||
0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
|
||||||
uiItemS(layout);
|
|
||||||
|
|
||||||
nr = BLI_listbase_count(&rr->layers) - 1;
|
nr = BLI_listbase_count(&rr->layers) - 1;
|
||||||
fake_name = ui_imageuser_layer_fake_name(rr);
|
fake_name = ui_imageuser_layer_fake_name(rr);
|
||||||
@@ -413,10 +409,7 @@ static void ui_imageuser_pass_menu(bContext *UNUSED(C), uiLayout *layout, void *
|
|||||||
UI_block_layout_set_current(block, layout);
|
UI_block_layout_set_current(block, layout);
|
||||||
uiLayoutColumn(layout, false);
|
uiLayoutColumn(layout, false);
|
||||||
|
|
||||||
uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("Pass"),
|
uiDefMenuTitleBut(block, IFACE_("Pass"));
|
||||||
0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
|
||||||
|
|
||||||
uiItemS(layout);
|
|
||||||
|
|
||||||
nr = 0;
|
nr = 0;
|
||||||
fake_name = ui_imageuser_pass_fake_name(rl);
|
fake_name = ui_imageuser_pass_fake_name(rl);
|
||||||
@@ -472,10 +465,7 @@ static void ui_imageuser_view_menu_rr(bContext *UNUSED(C), uiLayout *layout, voi
|
|||||||
UI_block_layout_set_current(block, layout);
|
UI_block_layout_set_current(block, layout);
|
||||||
uiLayoutColumn(layout, false);
|
uiLayoutColumn(layout, false);
|
||||||
|
|
||||||
uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("View"),
|
uiDefMenuTitleBut(block, IFACE_("View"));
|
||||||
0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
|
||||||
|
|
||||||
uiItemS(layout);
|
|
||||||
|
|
||||||
nr = (rr ? BLI_listbase_count(&rr->views) : 0) - 1;
|
nr = (rr ? BLI_listbase_count(&rr->views) : 0) - 1;
|
||||||
for (rview = rr ? rr->views.last : NULL; rview; rview = rview->prev, nr--) {
|
for (rview = rr ? rr->views.last : NULL; rview; rview = rview->prev, nr--) {
|
||||||
@@ -498,10 +488,7 @@ static void ui_imageuser_view_menu_multiview(bContext *UNUSED(C), uiLayout *layo
|
|||||||
UI_block_layout_set_current(block, layout);
|
UI_block_layout_set_current(block, layout);
|
||||||
uiLayoutColumn(layout, false);
|
uiLayoutColumn(layout, false);
|
||||||
|
|
||||||
uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("View"),
|
uiDefMenuTitleBut(block, IFACE_("View"));
|
||||||
0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
|
||||||
|
|
||||||
uiItemS(layout);
|
|
||||||
|
|
||||||
nr = BLI_listbase_count(&image->views) - 1;
|
nr = BLI_listbase_count(&image->views) - 1;
|
||||||
for (iv = image->views.last; iv; iv = iv->prev, nr--) {
|
for (iv = image->views.last; iv; iv = iv->prev, nr--) {
|
||||||
|
@@ -2236,7 +2236,6 @@ static int nla_fmodifier_add_invoke(bContext *C, wmOperator *UNUSED(op), const w
|
|||||||
/* add entry to add this type of modifier */
|
/* add entry to add this type of modifier */
|
||||||
uiItemEnumO(layout, "NLA_OT_fmodifier_add", fmi->name, 0, "type", i);
|
uiItemEnumO(layout, "NLA_OT_fmodifier_add", fmi->name, 0, "type", i);
|
||||||
}
|
}
|
||||||
uiItemS(layout);
|
|
||||||
|
|
||||||
UI_popup_menu_end(C, pup);
|
UI_popup_menu_end(C, pup);
|
||||||
|
|
||||||
|
@@ -158,7 +158,7 @@ static SpaceLink *nla_new(const bContext *C)
|
|||||||
ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
|
ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
|
||||||
ar->v2d.keepofs = V2D_KEEPOFS_Y;
|
ar->v2d.keepofs = V2D_KEEPOFS_Y;
|
||||||
ar->v2d.align = V2D_ALIGN_NO_POS_Y;
|
ar->v2d.align = V2D_ALIGN_NO_POS_Y;
|
||||||
ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
|
ar->v2d.flag = (V2D_VIEWSYNC_AREA_VERTICAL | V2D_USES_UNITS_HORIZONTAL);
|
||||||
|
|
||||||
return (SpaceLink *)snla;
|
return (SpaceLink *)snla;
|
||||||
}
|
}
|
||||||
|
@@ -190,6 +190,7 @@ static SpaceLink *sequencer_new(const bContext *C)
|
|||||||
ar->v2d.keepzoom = 0;
|
ar->v2d.keepzoom = 0;
|
||||||
ar->v2d.keeptot = 0;
|
ar->v2d.keeptot = 0;
|
||||||
ar->v2d.align = V2D_ALIGN_NO_NEG_Y;
|
ar->v2d.align = V2D_ALIGN_NO_NEG_Y;
|
||||||
|
ar->v2d.flag |= (V2D_USES_UNITS_HORIZONTAL | V2D_USES_UNITS_VERTICAL);
|
||||||
|
|
||||||
return (SpaceLink *)sseq;
|
return (SpaceLink *)sseq;
|
||||||
}
|
}
|
||||||
|
@@ -675,6 +675,7 @@ static SpaceLink *time_new(const bContext *C)
|
|||||||
ar->v2d.align |= V2D_ALIGN_NO_NEG_Y;
|
ar->v2d.align |= V2D_ALIGN_NO_NEG_Y;
|
||||||
ar->v2d.keepofs |= V2D_LOCKOFS_Y;
|
ar->v2d.keepofs |= V2D_LOCKOFS_Y;
|
||||||
ar->v2d.keepzoom |= V2D_LOCKZOOM_Y;
|
ar->v2d.keepzoom |= V2D_LOCKZOOM_Y;
|
||||||
|
ar->v2d.flag |= V2D_USES_UNITS_HORIZONTAL;
|
||||||
|
|
||||||
|
|
||||||
return (SpaceLink *)stime;
|
return (SpaceLink *)stime;
|
||||||
|
@@ -102,9 +102,9 @@ typedef struct Panel { /* the part from uiBlock that needs saved in file */
|
|||||||
char panelname[64], tabname[64]; /* defined as UI_MAX_NAME_STR */
|
char panelname[64], tabname[64]; /* defined as UI_MAX_NAME_STR */
|
||||||
char drawname[64]; /* panelname is identifier for restoring location */
|
char drawname[64]; /* panelname is identifier for restoring location */
|
||||||
int ofsx, ofsy, sizex, sizey;
|
int ofsx, ofsy, sizex, sizey;
|
||||||
short labelofs, pad;
|
|
||||||
short flag, runtime_flag;
|
short flag, runtime_flag;
|
||||||
short control;
|
short mouse_state; /* is mouse inside header/content/...? */
|
||||||
|
short control, pad;
|
||||||
short snap;
|
short snap;
|
||||||
int sortorder; /* panels are aligned according to increasing sortorder */
|
int sortorder; /* panels are aligned according to increasing sortorder */
|
||||||
struct Panel *paneltab; /* this panel is tabbed in *paneltab */
|
struct Panel *paneltab; /* this panel is tabbed in *paneltab */
|
||||||
|
@@ -129,7 +129,9 @@ typedef struct uiWidgetColors {
|
|||||||
char text_sel[4];
|
char text_sel[4];
|
||||||
short shaded;
|
short shaded;
|
||||||
short shadetop, shadedown;
|
short shadetop, shadedown;
|
||||||
short alpha_check;
|
short pad;
|
||||||
|
float roundness;
|
||||||
|
short alpha_check, pad2;
|
||||||
} uiWidgetColors;
|
} uiWidgetColors;
|
||||||
|
|
||||||
typedef struct uiWidgetStateColors {
|
typedef struct uiWidgetStateColors {
|
||||||
@@ -169,6 +171,11 @@ typedef struct ThemeUI {
|
|||||||
|
|
||||||
uiPanelColors panel; /* depricated, but we keep it for do_versions (2.66.1) */
|
uiPanelColors panel; /* depricated, but we keep it for do_versions (2.66.1) */
|
||||||
|
|
||||||
|
short interface_style; /* flat/classic - don't confuse with uiStyle */
|
||||||
|
short pad2;
|
||||||
|
|
||||||
|
char area_edges[4];
|
||||||
|
|
||||||
char widget_emboss[4];
|
char widget_emboss[4];
|
||||||
|
|
||||||
/* fac: 0 - 1 for blend factor, width in pixels */
|
/* fac: 0 - 1 for blend factor, width in pixels */
|
||||||
@@ -902,6 +909,11 @@ typedef enum eOpensubdiv_Computee_Type {
|
|||||||
USER_OPENSUBDIV_COMPUTE_GLSL_COMPUTE = 6,
|
USER_OPENSUBDIV_COMPUTE_GLSL_COMPUTE = 6,
|
||||||
} eOpensubdiv_Computee_Type;
|
} eOpensubdiv_Computee_Type;
|
||||||
|
|
||||||
|
typedef enum eTheme_InterfaceStyle {
|
||||||
|
TH_IFACE_STYLE_CLASSIC = 0,
|
||||||
|
TH_IFACE_STYLE_FLAT = 1,
|
||||||
|
} eTheme_InterfaceStyle;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -114,6 +114,9 @@ typedef struct View2D {
|
|||||||
#define V2D_PIXELOFS_Y (1<<3)
|
#define V2D_PIXELOFS_Y (1<<3)
|
||||||
/* view settings need to be set still... */
|
/* view settings need to be set still... */
|
||||||
#define V2D_IS_INITIALISED (1<<10)
|
#define V2D_IS_INITIALISED (1<<10)
|
||||||
|
/* for screens that need to draw units on top of the scroller */
|
||||||
|
#define V2D_USES_UNITS_VERTICAL (1 << 11)
|
||||||
|
#define V2D_USES_UNITS_HORIZONTAL (1 << 12)
|
||||||
|
|
||||||
/* scroller flags for View2D (v2d->scroll) */
|
/* scroller flags for View2D (v2d->scroll) */
|
||||||
/* left scrollbar */
|
/* left scrollbar */
|
||||||
|
@@ -909,6 +909,11 @@ static void rna_def_userdef_theme_ui_wcol(BlenderRNA *brna)
|
|||||||
RNA_def_property_range(prop, -100, 100);
|
RNA_def_property_range(prop, -100, 100);
|
||||||
RNA_def_property_ui_text(prop, "Shade Down", "");
|
RNA_def_property_ui_text(prop, "Shade Down", "");
|
||||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||||
|
|
||||||
|
prop = RNA_def_property(srna, "roundness", PROP_FLOAT, PROP_FACTOR);
|
||||||
|
RNA_def_property_range(prop, 0.1f, 0.5f);
|
||||||
|
RNA_def_property_ui_text(prop, "Roundness", "");
|
||||||
|
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_def_userdef_theme_ui_wcol_state(BlenderRNA *brna)
|
static void rna_def_userdef_theme_ui_wcol_state(BlenderRNA *brna)
|
||||||
@@ -967,10 +972,12 @@ static void rna_def_userdef_theme_ui_panel(BlenderRNA *brna)
|
|||||||
RNA_def_struct_ui_text(srna, "Theme Panel Color", "Theme settings for panel colors");
|
RNA_def_struct_ui_text(srna, "Theme Panel Color", "Theme settings for panel colors");
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "header", PROP_FLOAT, PROP_COLOR_GAMMA);
|
prop = RNA_def_property(srna, "header", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||||
|
RNA_def_property_array(prop, 3);
|
||||||
RNA_def_property_ui_text(prop, "Header", "");
|
RNA_def_property_ui_text(prop, "Header", "");
|
||||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_COLOR_GAMMA);
|
prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||||
|
RNA_def_property_array(prop, 3);
|
||||||
RNA_def_property_ui_text(prop, "Background", "");
|
RNA_def_property_ui_text(prop, "Background", "");
|
||||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||||
|
|
||||||
@@ -1014,6 +1021,12 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
|
|||||||
StructRNA *srna;
|
StructRNA *srna;
|
||||||
PropertyRNA *prop;
|
PropertyRNA *prop;
|
||||||
|
|
||||||
|
static EnumPropertyItem interface_style_items[] = {
|
||||||
|
{TH_IFACE_STYLE_CLASSIC, "CLASSIC", 0, "Classic", "Use a classic interface drawing style"},
|
||||||
|
{TH_IFACE_STYLE_FLAT, "FLAT", 0, "Flat", "Use a flat interface drawing style"},
|
||||||
|
{0, NULL, 0, NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
rna_def_userdef_theme_ui_wcol(brna);
|
rna_def_userdef_theme_ui_wcol(brna);
|
||||||
rna_def_userdef_theme_ui_wcol_state(brna);
|
rna_def_userdef_theme_ui_wcol_state(brna);
|
||||||
rna_def_userdef_theme_ui_panel(brna);
|
rna_def_userdef_theme_ui_panel(brna);
|
||||||
@@ -1119,6 +1132,18 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
|
|||||||
RNA_def_property_ui_text(prop, "State Colors", "");
|
RNA_def_property_ui_text(prop, "State Colors", "");
|
||||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||||
|
|
||||||
|
prop = RNA_def_property(srna, "interface_style", PROP_ENUM, PROP_NONE);
|
||||||
|
RNA_def_property_enum_sdna(prop, NULL, "interface_style");
|
||||||
|
RNA_def_property_enum_items(prop, interface_style_items);
|
||||||
|
RNA_def_property_ui_text(prop, "Interface Style", "Adjusts the interface drawing for different styles");
|
||||||
|
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||||
|
|
||||||
|
prop = RNA_def_property(srna, "area_edges", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||||
|
RNA_def_property_float_sdna(prop, NULL, "area_edges");
|
||||||
|
RNA_def_property_array(prop, 3);
|
||||||
|
RNA_def_property_ui_text(prop, "Area Edges", "Color of the 1px separator between areas");
|
||||||
|
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "menu_shadow_fac", PROP_FLOAT, PROP_FACTOR);
|
prop = RNA_def_property(srna, "menu_shadow_fac", PROP_FLOAT, PROP_FACTOR);
|
||||||
RNA_def_property_ui_text(prop, "Menu Shadow Strength", "Blending factor for menu shadows");
|
RNA_def_property_ui_text(prop, "Menu Shadow Strength", "Blending factor for menu shadows");
|
||||||
RNA_def_property_range(prop, 0.01f, 1.0f);
|
RNA_def_property_range(prop, 0.01f, 1.0f);
|
||||||
|
Reference in New Issue
Block a user