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:
authorMatthew Smith <mjdietel@gmail.com>2012-05-02 01:02:04 +0400
committerMatthew Smith <mjdietel@gmail.com>2012-05-02 01:02:04 +0400
commitf4a82ab917fc398c19ca0ca74134d2a7e6463046 (patch)
tree429265b833f747395ac8dc03d8dfa320d7b630c8 /source/blender/editors/interface
parente54a0039dc93535bd6518766fc29790aa627e250 (diff)
Logic brick connection highlighting on mouseover. Merged from candy branch. I hope it works - my first commit to trunk ^_^
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface.c44
1 files changed, 33 insertions, 11 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 9e12c8f94b7..c8806aa0166 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -498,7 +498,7 @@ static int ui_but_float_precision(uiBut *but, double value)
return prec;
}
-static void ui_draw_linkline(uiLinkLine *line)
+static void ui_draw_linkline(uiLinkLine *line, int hilightActiveLines)
{
rcti rect;
@@ -509,8 +509,10 @@ static void ui_draw_linkline(uiLinkLine *line)
rect.xmax = (line->to->x1 + line->to->x2) / 2.0f;
rect.ymax = (line->to->y1 + line->to->y2) / 2.0f;
- if (line->flag & UI_SELECT)
- glColor3ub(100, 100, 100);
+ if(line->flag & UI_SELECT)
+ glColor3ub(100,100,100);
+ else if(hilightActiveLines && ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE)))
+ UI_ThemeColor(TH_TEXT_HI);
else
glColor3ub(0, 0, 0);
@@ -521,18 +523,38 @@ static void ui_draw_links(uiBlock *block)
{
uiBut *but;
uiLinkLine *line;
-
- but = block->buttons.first;
- while (but) {
- if (but->type == LINK && but->link) {
- line = but->link->lines.first;
- while (line) {
- ui_draw_linkline(line);
- line = line->next;
+
+ // Draw the inactive lines (lines with neither button being hovered over).
+ // As we go, remember if we see any active or selected lines.
+ int foundselectline = 0;
+ int foundactiveline = 0;
+ for (but=block->buttons.first; but; but=but->next) {
+ if(but->type==LINK && but->link) {
+ for (line=but->link->lines.first; line; line=line->next) {
+ if (!(line->from->flag & UI_ACTIVE) && !(line->to->flag & UI_ACTIVE))
+ ui_draw_linkline(line, 0);
+ else
+ foundactiveline = 1;
+
+ if ((line->from->flag & UI_SELECT) || (line->to->flag & UI_SELECT))
+ foundselectline = 1;
}
}
but = but->next;
}
+
+ // Draw any active lines (lines with either button being hovered over).
+ // Do this last so they appear on top of inactive lines.
+ if (foundactiveline) {
+ for (but=block->buttons.first; but; but=but->next) {
+ if(but->type==LINK && but->link) {
+ for (line=but->link->lines.first; line; line=line->next) {
+ if ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE))
+ ui_draw_linkline(line, !foundselectline);
+ }
+ }
+ }
+ }
}
/* ************** BLOCK ENDING FUNCTION ************* */