Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_node/node_edit.c
| Show First 20 Lines • Show All 1,122 Lines • ▼ Show 20 Lines | void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set) | ||||
| } | } | ||||
| } | } | ||||
| /* checks snode->mouse position, and returns found node/socket */ | /* checks snode->mouse position, and returns found node/socket */ | ||||
| static bool cursor_isect_multi_input_socket(const float cursor[2], const bNodeSocket *socket) | static bool cursor_isect_multi_input_socket(const float cursor[2], const bNodeSocket *socket) | ||||
| { | { | ||||
| const float node_socket_height = node_socket_calculate_height(socket); | const float node_socket_height = node_socket_calculate_height(socket); | ||||
| const rctf multi_socket_rect = { | const rctf multi_socket_rect = { | ||||
| .xmin = socket->locx - NODE_SOCKSIZE * 4, | .xmin = socket->locx - NODE_SOCKSIZE * 4.0f, | ||||
| .xmax = socket->locx + NODE_SOCKSIZE, | .xmax = socket->locx + NODE_SOCKSIZE * 2.0f, | ||||
| .ymin = socket->locy - node_socket_height * 0.5 - NODE_SOCKSIZE * 2.0f, | /*.xmax = socket->locx + NODE_SOCKSIZE * 5.5f | ||||
| .ymax = socket->locy + node_socket_height * 0.5 + NODE_SOCKSIZE * 2.0f, | * would be the same behavior as for regular sockets. | ||||
| * But keep it smaller because for multi-input socket you | |||||
HooglyBoogly: Comments shouldn't really be written in first person. Best to rephrase this like, "But keep it… | |||||
| * sometimes want to drag the link to the other side, if you may | |||||
Not Done Inline ActionsExtra "if" I think HooglyBoogly: Extra "if" I think | |||||
| * accidentally pick the wrong link otherwise. */ | |||||
| .ymin = socket->locy - node_socket_height * 0.5 - NODE_SOCKSIZE, | |||||
| .ymax = socket->locy + node_socket_height * 0.5 + NODE_SOCKSIZE, | |||||
| }; | }; | ||||
| if (BLI_rctf_isect_pt(&multi_socket_rect, cursor[0], cursor[1])) { | if (BLI_rctf_isect_pt(&multi_socket_rect, cursor[0], cursor[1])) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| /* type is SOCK_IN and/or SOCK_OUT */ | /* type is SOCK_IN and/or SOCK_OUT */ | ||||
| int node_find_indicated_socket( | int node_find_indicated_socket( | ||||
| SpaceNode *snode, bNode **nodep, bNodeSocket **sockp, float cursor[2], int in_out) | SpaceNode *snode, bNode **nodep, bNodeSocket **sockp, const float cursor[2], int in_out) | ||||
| { | { | ||||
| rctf rect; | rctf rect; | ||||
| *nodep = NULL; | *nodep = NULL; | ||||
| *sockp = NULL; | *sockp = NULL; | ||||
| /* check if we click in a socket */ | /* check if we click in a socket */ | ||||
| LISTBASE_FOREACH (bNode *, node, &snode->edittree->nodes) { | LISTBASE_FOREACH (bNode *, node, &snode->edittree->nodes) { | ||||
| ▲ Show 20 Lines • Show All 1,667 Lines • Show Last 20 Lines | |||||
Comments shouldn't really be written in first person. Best to rephrase this like, "But keep it smaller..."