static void ui_node_link(bContext *C, void *arg_p, void *event_p) { NodeLinkArg *arg = (NodeLinkArg *)arg_p; Main *bmain = arg->bmain; bNode *node_to = arg->node; bNodeSocket *sock_to = arg->sock; bNodeTree *ntree = arg->ntree; int event = GET_INT_FROM_POINTER(event_p); if (event == UI_NODE_LINK_DISCONNECT) node_socket_disconnect(bmain, ntree, node_to, sock_to); else if (event == UI_NODE_LINK_REMOVE) node_socket_remove(bmain, ntree, node_to, sock_to); else node_socket_add_replace(C, ntree, node_to, sock_to, arg->node_type->type, &arg->item); ED_undo_push(C, "Node input modify"); }
static void ui_node_link(bContext *C, void *arg_p, void *event_p) { NodeLinkArg *arg = (NodeLinkArg*)arg_p; Main *bmain = arg->bmain; bNode *node_to = arg->node; bNodeSocket *sock_to = arg->sock; bNodeTree *ntree = arg->ntree; int event = GET_INT_FROM_POINTER(event_p); bNodeTemplate ntemp; ntemp.type = arg->type; ntemp.ngroup = arg->ngroup; ntemp.scene = CTX_data_scene(C); ntemp.main = CTX_data_main(C); if (event == UI_NODE_LINK_DISCONNECT) node_socket_disconnect(bmain, ntree, node_to, sock_to); else if (event == UI_NODE_LINK_REMOVE) node_socket_remove(bmain, ntree, node_to, sock_to); else node_socket_add_replace(bmain, ntree, node_to, sock_to, &ntemp, arg->output); ED_undo_push(C, "Node input modify"); }