diff options
author | Jacques Lucke <jacques@blender.org> | 2021-08-24 14:41:16 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-08-24 14:41:16 +0300 |
commit | 3aee13b3495413c4809b6993397ec28a9024bd89 (patch) | |
tree | e3e12e3223f5bc67725ab0f79239725107081ba6 | |
parent | ec5160ee946ae625991556a056f0379a1faefb6d (diff) |
cleanup
-rw-r--r-- | source/blender/editors/space_node/drawnode.cc | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc index 6f8c0a513da..732db4a78eb 100644 --- a/source/blender/editors/space_node/drawnode.cc +++ b/source/blender/editors/space_node/drawnode.cc @@ -4176,7 +4176,32 @@ void node_draw_link_bezier(const View2D *v2d, int th_col2, int th_col3) { - const float dim_factor = node_link_dim_factor(v2d, link); + float dim_factor = node_link_dim_factor(v2d, link); + + if (link->fromsock) { + const SocketSingleState from_single_state = get_socket_single_state( + snode->edittree, link->fromnode, link->fromsock); + if (ELEM(from_single_state, + SocketSingleState::RequiredSingle, + SocketSingleState::CurrentlySingle)) { + th_col1 = th_col2 = TH_ACTIVE; + } + else { + dim_factor *= 0.7f; + } + } + + if (link->fromsock && link->tosock) { + const SocketSingleState to_single_state = get_socket_single_state( + snode->edittree, link->tonode, link->tosock); + const SocketSingleState from_single_state = get_socket_single_state( + snode->edittree, link->fromnode, link->fromsock); + + if (to_single_state == SocketSingleState::RequiredSingle && + from_single_state == SocketSingleState::MaybeField) { + th_col1 = th_col2 = TH_REDALERT; + } + } float vec[4][2]; const bool highlighted = link->flag & NODE_LINK_TEMP_HIGHLIGHT; @@ -4278,28 +4303,6 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link) } } - if (link->fromsock) { - const SocketSingleState from_single_state = get_socket_single_state( - snode->edittree, link->fromnode, link->fromsock); - if (ELEM(from_single_state, - SocketSingleState::RequiredSingle, - SocketSingleState::CurrentlySingle)) { - th_col1 = th_col2 = TH_ACTIVE; - } - } - - if (link->fromsock && link->tosock) { - const SocketSingleState to_single_state = get_socket_single_state( - snode->edittree, link->tonode, link->tosock); - const SocketSingleState from_single_state = get_socket_single_state( - snode->edittree, link->fromnode, link->fromsock); - - if (to_single_state == SocketSingleState::RequiredSingle && - from_single_state == SocketSingleState::MaybeField) { - th_col1 = th_col2 = TH_REDALERT; - } - } - node_draw_link_bezier(v2d, snode, link, th_col1, th_col2, th_col3); } |