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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-11-08 02:28:49 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-11-08 02:28:49 +0400
commitcd191b7d17c42e90dcdda56ba3fbddf08666b3ab (patch)
treef5e5f411be648797561ca205642c3074e8397748 /source/blender/editors/interface
parentbe23090aae643f3c5a01ec47c601aa50a7174eb4 (diff)
UI/Nodes: templates to edit nodes from the properties editor using a tree view,
to be used by cycles. For testing there's a panel in the node editor if you set debug to 777, didn't enable it because I'm not sure it's very useful there.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface_intern.h6
-rw-r--r--source/blender/editors/interface/interface_regions.c9
-rw-r--r--source/blender/editors/interface/interface_widgets.c42
3 files changed, 42 insertions, 15 deletions
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 29447d492c5..aa4158ad4b7 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -79,6 +79,7 @@ typedef enum {
UI_WTYPE_MENU_RADIO,
UI_WTYPE_MENU_ICON_RADIO,
UI_WTYPE_MENU_POINTER_LINK,
+ UI_WTYPE_MENU_NODE_LINK,
UI_WTYPE_PULLDOWN,
UI_WTYPE_MENU_ITEM,
@@ -96,11 +97,6 @@ typedef enum {
} uiWidgetTypeEnum;
-
-
-#define UI_MAX_DRAW_STR 400
-#define UI_MAX_NAME_STR 128
-
/* panel limits */
#define UI_PANEL_MINX 100
#define UI_PANEL_MINY 70
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index edbd5c5684e..34b62155314 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1533,15 +1533,6 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
if(ELEM(but->type, BLOCK, PULLDOWN))
block->xofs = -2; /* for proper alignment */
- /* only used for automatic toolbox, so can set the shift flag */
- if(but->flag & UI_MAKE_TOP) {
- block->direction= UI_TOP|UI_SHIFT_FLIPPED;
- uiBlockFlipOrder(block);
- }
- if(but->flag & UI_MAKE_DOWN) block->direction= UI_DOWN|UI_SHIFT_FLIPPED;
- if(but->flag & UI_MAKE_LEFT) block->direction |= UI_LEFT;
- if(but->flag & UI_MAKE_RIGHT) block->direction |= UI_RIGHT;
-
ui_block_position(window, butregion, but, block);
}
else {
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 8ab48ac8ffa..aa407bbf6d4 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1181,6 +1181,12 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
widget_draw_icon(but, ICON_DOT, dualset?1.0f:0.25f, rect);
}
+ else if(but->type==MENU && (but->flag & UI_BUT_NODE_LINK)) {
+ int tmp = rect->xmin;
+ rect->xmin = rect->xmax - (rect->ymax - rect->ymin) - 1;
+ widget_draw_icon(but, ICON_LAYER_USED, 1.0f, rect);
+ rect->xmin = tmp;
+ }
/* If there's an icon too (made with uiDefIconTextBut) then draw the icon
and offset the text label to accommodate it */
@@ -1543,6 +1549,10 @@ static void widget_state(uiWidgetType *wt, int state)
char red[4]= {255, 0, 0};
widget_state_blend(wt->wcol.inner, red, 0.4f);
}
+ if(state & UI_BUT_NODE_ACTIVE) {
+ char blue[4]= {86, 128, 194};
+ widget_state_blend(wt->wcol.inner, blue, 0.3f);
+ }
}
/* sliders use special hack which sets 'item' as inner when drawing filling */
@@ -2530,6 +2540,29 @@ static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(stat
widgetbase_draw(&wtb, wcol);
}
+static void widget_menunodebut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
+{
+ /* silly node link button hacks */
+ uiWidgetBase wtb;
+ uiWidgetColors wcol_backup= *wcol;
+
+ widget_init(&wtb);
+
+ /* half rounded */
+ round_box_edges(&wtb, roundboxalign, rect, 4.0f);
+
+ wcol->inner[0] += 15;
+ wcol->inner[1] += 15;
+ wcol->inner[2] += 15;
+ wcol->outline[0] += 15;
+ wcol->outline[1] += 15;
+ wcol->outline[2] += 15;
+
+ /* decoration */
+ widgetbase_draw(&wtb, wcol);
+ *wcol= wcol_backup;
+}
+
static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
{
if(state & UI_ACTIVE) {
@@ -2804,6 +2837,11 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
wt.wcol_theme= &btheme->tui.wcol_menu;
wt.draw= widget_menubut;
break;
+
+ case UI_WTYPE_MENU_NODE_LINK:
+ wt.wcol_theme= &btheme->tui.wcol_menu;
+ wt.draw= widget_menunodebut;
+ break;
case UI_WTYPE_PULLDOWN:
wt.wcol_theme= &btheme->tui.wcol_pulldown;
@@ -2996,7 +3034,9 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
case MENU:
case BLOCK:
case ICONTEXTROW:
- if(!but->str[0] && but->icon)
+ if(but->flag & UI_BUT_NODE_LINK)
+ wt= widget_type(UI_WTYPE_MENU_NODE_LINK);
+ else if(!but->str[0] && but->icon)
wt= widget_type(UI_WTYPE_MENU_ICON_RADIO);
else
wt= widget_type(UI_WTYPE_MENU_RADIO);