diff options
Diffstat (limited to 'source/blender/editors/space_node/node_select.c')
-rw-r--r-- | source/blender/editors/space_node/node_select.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index e22ef389516..a2453cb0837 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -104,9 +104,9 @@ static bool is_position_over_node_or_socket(SpaceNode *snode, float mouse[2]) static bool is_event_over_node_or_socket(bContext *C, const wmEvent *event) { SpaceNode *snode = CTX_wm_space_node(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); float mouse[2]; - UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &mouse[0], &mouse[1]); + UI_view2d_region_to_view(®ion->v2d, event->mval[0], event->mval[1], &mouse[0], &mouse[1]); return is_position_over_node_or_socket(snode, mouse); } @@ -436,7 +436,7 @@ static int node_mouse_select(bContext *C, { Main *bmain = CTX_data_main(C); SpaceNode *snode = CTX_wm_space_node(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); bNode *node, *tnode; bNodeSocket *sock = NULL; bNodeSocket *tsock; @@ -454,7 +454,7 @@ static int node_mouse_select(bContext *C, } /* get mouse coordinates in view2d space */ - UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &cursor[0], &cursor[1]); + UI_view2d_region_to_view(®ion->v2d, mval[0], mval[1], &cursor[0], &cursor[1]); /* first do socket selection, these generally overlap with nodes. */ if (socket_select) { @@ -610,11 +610,11 @@ void NODE_OT_select(wmOperatorType *ot) static int node_box_select_exec(bContext *C, wmOperator *op) { SpaceNode *snode = CTX_wm_space_node(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); rctf rectf; WM_operator_properties_border_to_rctf(op, &rectf); - UI_view2d_region_to_view_rctf(&ar->v2d, &rectf, &rectf); + UI_view2d_region_to_view_rctf(®ion->v2d, &rectf, &rectf); const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode"); const bool select = (sel_op != SEL_OP_SUB); @@ -692,13 +692,14 @@ void NODE_OT_select_box(wmOperatorType *ot) static int node_circleselect_exec(bContext *C, wmOperator *op) { SpaceNode *snode = CTX_wm_space_node(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); bNode *node; int x, y, radius; float offset[2]; - float zoom = (float)(BLI_rcti_size_x(&ar->winrct)) / (float)(BLI_rctf_size_x(&ar->v2d.cur)); + float zoom = (float)(BLI_rcti_size_x(®ion->winrct)) / + (float)(BLI_rctf_size_x(®ion->v2d.cur)); const eSelectOp sel_op = ED_select_op_modal(RNA_enum_get(op->ptr, "mode"), WM_gesture_is_modal_first(op->customdata)); @@ -712,7 +713,7 @@ static int node_circleselect_exec(bContext *C, wmOperator *op) y = RNA_int_get(op->ptr, "y"); radius = RNA_int_get(op->ptr, "radius"); - UI_view2d_region_to_view(&ar->v2d, x, y, &offset[0], &offset[1]); + UI_view2d_region_to_view(®ion->v2d, x, y, &offset[0], &offset[1]); for (node = snode->edittree->nodes.first; node; node = node->next) { if (BLI_rctf_isect_circle(&node->totr, offset, radius / zoom)) { @@ -769,7 +770,7 @@ static bool do_lasso_select_node(bContext *C, const int mcords[][2], short moves SpaceNode *snode = CTX_wm_space_node(C); bNode *node; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); rcti rect; bool changed = false; @@ -794,7 +795,8 @@ static bool do_lasso_select_node(bContext *C, const int mcords[][2], short moves const float cent[2] = {BLI_rctf_cent_x(&node->totr), BLI_rctf_cent_y(&node->totr)}; /* marker in screen coords */ - if (UI_view2d_view_to_region_clip(&ar->v2d, cent[0], cent[1], &screen_co[0], &screen_co[1]) && + if (UI_view2d_view_to_region_clip( + ®ion->v2d, cent[0], cent[1], &screen_co[0], &screen_co[1]) && BLI_rcti_isect_pt(&rect, screen_co[0], screen_co[1]) && BLI_lasso_is_point_inside(mcords, moves, screen_co[0], screen_co[1], INT_MAX)) { nodeSetSelected(node, select); @@ -1004,7 +1006,7 @@ void NODE_OT_select_linked_from(wmOperatorType *ot) static int node_select_same_type_step_exec(bContext *C, wmOperator *op) { SpaceNode *snode = CTX_wm_space_node(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); bNode **node_array; bNode *active = nodeGetActive(snode->edittree); int totnodes; @@ -1072,10 +1074,10 @@ static int node_select_same_type_step_exec(bContext *C, wmOperator *op) node_select_single(C, active); /* is note outside view? */ - if (active->totr.xmax < ar->v2d.cur.xmin || active->totr.xmin > ar->v2d.cur.xmax || - active->totr.ymax < ar->v2d.cur.ymin || active->totr.ymin > ar->v2d.cur.ymax) { + if (active->totr.xmax < region->v2d.cur.xmin || active->totr.xmin > region->v2d.cur.xmax || + active->totr.ymax < region->v2d.cur.ymin || active->totr.ymin > region->v2d.cur.ymax) { const int smooth_viewtx = WM_operator_smooth_viewtx_get(op); - space_node_view_flag(C, snode, ar, NODE_SELECT, smooth_viewtx); + space_node_view_flag(C, snode, region, NODE_SELECT, smooth_viewtx); } } @@ -1142,25 +1144,25 @@ static void node_find_call_cb(struct bContext *C, void *UNUSED(arg1), void *arg2 bNode *active = arg2; if (active) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); node_select_single(C, active); /* is note outside view? */ - if (active->totr.xmax < ar->v2d.cur.xmin || active->totr.xmin > ar->v2d.cur.xmax || - active->totr.ymax < ar->v2d.cur.ymin || active->totr.ymin > ar->v2d.cur.ymax) { - space_node_view_flag(C, snode, ar, NODE_SELECT, U.smooth_viewtx); + if (active->totr.xmax < region->v2d.cur.xmin || active->totr.xmin > region->v2d.cur.xmax || + active->totr.ymax < region->v2d.cur.ymin || active->totr.ymin > region->v2d.cur.ymax) { + space_node_view_flag(C, snode, region, NODE_SELECT, U.smooth_viewtx); } } } -static uiBlock *node_find_menu(bContext *C, ARegion *ar, void *arg_op) +static uiBlock *node_find_menu(bContext *C, ARegion *region, void *arg_op) { static char search[256] = ""; uiBlock *block; uiBut *but; wmOperator *op = (wmOperator *)arg_op; - block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); + block = UI_block_begin(C, region, "_popup", UI_EMBOSS); UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU); UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); |