diff options
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 28 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_add.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_draw.c | 16 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_group.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_relationships.c | 24 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_select.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_templates.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_view.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_node/space_node.c | 16 |
9 files changed, 43 insertions, 71 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 234ca5d5ce6..f3207f2dc1e 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -284,23 +284,21 @@ static int node_resize_area_default(bNode *node, int x, int y) if (BLI_rctf_isect_pt(&totr, x, y)) { return NODE_RESIZE_RIGHT; } - else { - return 0; - } + + return 0; } - else { - const float size = NODE_RESIZE_MARGIN; - rctf totr = node->totr; - int dir = 0; - if (x >= totr.xmax - size && x < totr.xmax && y >= totr.ymin && y < totr.ymax) { - dir |= NODE_RESIZE_RIGHT; - } - if (x >= totr.xmin && x < totr.xmin + size && y >= totr.ymin && y < totr.ymax) { - dir |= NODE_RESIZE_LEFT; - } - return dir; + const float size = NODE_RESIZE_MARGIN; + rctf totr = node->totr; + int dir = 0; + + if (x >= totr.xmax - size && x < totr.xmax && y >= totr.ymin && y < totr.ymax) { + dir |= NODE_RESIZE_RIGHT; } + if (x >= totr.xmin && x < totr.xmin + size && y >= totr.ymin && y < totr.ymax) { + dir |= NODE_RESIZE_LEFT; + } + return dir; } /* ****************** BUTTON CALLBACKS FOR COMMON NODES ***************** */ @@ -3833,7 +3831,7 @@ static bool node_link_bezier_handles(View2D *v2d, if (v2d && min_ffff(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) > v2d->cur.xmax) { return 0; /* clipped */ } - else if (v2d && max_ffff(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) < v2d->cur.xmin) { + if (v2d && max_ffff(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) < v2d->cur.xmin) { return 0; /* clipped */ } diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c index 95a37f85828..037fe575973 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.c @@ -382,9 +382,7 @@ static int node_add_file_invoke(bContext *C, wmOperator *op, const wmEvent *even RNA_struct_property_is_set(op->ptr, "name")) { return node_add_file_exec(C, op); } - else { - return WM_operator_filesel(C, op, event); - } + return WM_operator_filesel(C, op, event); } void NODE_OT_add_file(wmOperatorType *ot) diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index c3823d8eb27..22b549cbd5d 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -97,9 +97,7 @@ static bNodeTree *node_tree_from_ID(ID *id) if (GS(id->name) == ID_NT) { return (bNodeTree *)id; } - else { - return ntreeFromID(id); - } + return ntreeFromID(id); } return NULL; @@ -217,7 +215,7 @@ static bool compare_nodes(const bNode *a, const bNode *b) if ((a->flag & NODE_BACKGROUND) && !(b->flag & NODE_BACKGROUND)) { return 0; } - else if (!(a->flag & NODE_BACKGROUND) && (b->flag & NODE_BACKGROUND)) { + if (!(a->flag & NODE_BACKGROUND) && (b->flag & NODE_BACKGROUND)) { return 1; } @@ -225,7 +223,7 @@ static bool compare_nodes(const bNode *a, const bNode *b) if (!b_active && a_active) { return 1; } - else if (!b_select && (a_active || a_select)) { + if (!b_select && (a_active || a_select)) { return 1; } @@ -1558,15 +1556,13 @@ int node_get_resize_cursor(int directions) if (directions == 0) { return WM_CURSOR_DEFAULT; } - else if ((directions & ~(NODE_RESIZE_TOP | NODE_RESIZE_BOTTOM)) == 0) { + if ((directions & ~(NODE_RESIZE_TOP | NODE_RESIZE_BOTTOM)) == 0) { return WM_CURSOR_Y_MOVE; } - else if ((directions & ~(NODE_RESIZE_RIGHT | NODE_RESIZE_LEFT)) == 0) { + if ((directions & ~(NODE_RESIZE_RIGHT | NODE_RESIZE_LEFT)) == 0) { return WM_CURSOR_X_MOVE; } - else { - return WM_CURSOR_EDIT; - } + return WM_CURSOR_EDIT; } void node_set_cursor(wmWindow *win, SpaceNode *snode, float cursor[2]) diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c index 2617384d046..ef468c63d77 100644 --- a/source/blender/editors/space_node/node_group.c +++ b/source/blender/editors/space_node/node_group.c @@ -107,13 +107,13 @@ static const char *group_node_idname(bContext *C) if (ED_node_is_shader(snode)) { return "ShaderNodeGroup"; } - else if (ED_node_is_compositor(snode)) { + if (ED_node_is_compositor(snode)) { return "CompositorNodeGroup"; } - else if (ED_node_is_texture(snode)) { + if (ED_node_is_texture(snode)) { return "TextureNodeGroup"; } - else if (ED_node_is_simulation(snode)) { + if (ED_node_is_simulation(snode)) { return "SimulationNodeGroup"; } @@ -128,9 +128,7 @@ static bNode *node_group_get_active(bContext *C, const char *node_idname) if (node && STREQ(node->idname, node_idname)) { return node; } - else { - return NULL; - } + return NULL; } /* ***************** Edit Group operator ************* */ diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index 144e3bd3506..e5409271f7c 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -76,10 +76,9 @@ static bool ntree_check_nodes_connected_dfs(bNodeTree *ntree, bNode *from, bNode if (link->tonode == to) { return true; } - else { - if (ntree_check_nodes_connected_dfs(ntree, link->tonode, to)) { - return true; - } + + if (ntree_check_nodes_connected_dfs(ntree, link->tonode, to)) { + return true; } } } @@ -191,9 +190,7 @@ static int sort_nodes_locx(const void *a, const void *b) if (node1->locx > node2->locx) { return 1; } - else { - return 0; - } + return 0; } static bool socket_is_available(bNodeTree *UNUSED(ntree), bNodeSocket *sock, const bool allow_used) @@ -921,9 +918,7 @@ static int node_link_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } - else { - return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH; - } + return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH; } static void node_link_cancel(bContext *C, wmOperator *op) @@ -1078,9 +1073,8 @@ static int cut_links_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } - else { - return OPERATOR_CANCELLED; - } + + return OPERATOR_CANCELLED; } return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH; @@ -1473,9 +1467,7 @@ static bool ed_node_link_conditions(ScrArea *area, if (select) { break; } - else { - select = node; - } + select = node; } } /* only one selected */ diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index 06f568c80f3..316ba3fd2e4 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -1097,9 +1097,7 @@ static int node_select_same_type_step_exec(bContext *C, wmOperator *op) if (node->type == active->type) { break; } - else { - node = NULL; - } + node = NULL; } if (node) { active = node; diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c index 87b1f662b59..4f15cec8c84 100644 --- a/source/blender/editors/space_node/node_templates.c +++ b/source/blender/editors/space_node/node_templates.c @@ -71,9 +71,7 @@ static bool node_link_item_compare(bNode *node, NodeLinkItem *item) if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP)) { return (node->id == (ID *)item->ngroup); } - else { - return true; - } + return true; } static void node_link_item_apply(Main *bmain, bNode *node, NodeLinkItem *item) diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c index e879e01ecc4..b1dbe3bc506 100644 --- a/source/blender/editors/space_node/node_view.c +++ b/source/blender/editors/space_node/node_view.c @@ -133,9 +133,7 @@ static int node_view_all_exec(bContext *C, wmOperator *op) if (space_node_view_flag(C, snode, region, 0, smooth_viewtx)) { return OPERATOR_FINISHED; } - else { - return OPERATOR_CANCELLED; - } + return OPERATOR_CANCELLED; } void NODE_OT_view_all(wmOperatorType *ot) @@ -162,9 +160,7 @@ static int node_view_selected_exec(bContext *C, wmOperator *op) if (space_node_view_flag(C, snode, region, NODE_SELECT, smooth_viewtx)) { return OPERATOR_FINISHED; } - else { - return OPERATOR_CANCELLED; - } + return OPERATOR_CANCELLED; } void NODE_OT_view_selected(wmOperatorType *ot) diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 562aa6b078c..d4adad3fc25 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -641,9 +641,7 @@ static bool node_ima_drop_poll(bContext *UNUSED(C), /* rule might not work? */ return (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE)); } - else { - return WM_drag_ID(drag, ID_IM) != NULL; - } + return WM_drag_ID(drag, ID_IM) != NULL; } static bool node_mask_drop_poll(bContext *UNUSED(C), @@ -787,7 +785,7 @@ static int node_context(const bContext *C, const char *member, bContextDataResul CTX_data_dir_set(result, node_context_dir); return 1; } - else if (CTX_data_equals(member, "selected_nodes")) { + if (CTX_data_equals(member, "selected_nodes")) { bNode *node; if (snode->edittree) { @@ -800,7 +798,7 @@ static int node_context(const bContext *C, const char *member, bContextDataResul CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); return 1; } - else if (CTX_data_equals(member, "active_node")) { + if (CTX_data_equals(member, "active_node")) { if (snode->edittree) { bNode *node = nodeGetActive(snode->edittree); CTX_data_pointer_set(result, &snode->edittree->id, &RNA_Node, node); @@ -809,7 +807,7 @@ static int node_context(const bContext *C, const char *member, bContextDataResul CTX_data_type_set(result, CTX_DATA_TYPE_POINTER); return 1; } - else if (CTX_data_equals(member, "node_previews")) { + if (CTX_data_equals(member, "node_previews")) { if (snode->nodetree) { CTX_data_pointer_set( result, &snode->nodetree->id, &RNA_NodeInstanceHash, snode->nodetree->previews); @@ -818,19 +816,19 @@ static int node_context(const bContext *C, const char *member, bContextDataResul CTX_data_type_set(result, CTX_DATA_TYPE_POINTER); return 1; } - else if (CTX_data_equals(member, "material")) { + if (CTX_data_equals(member, "material")) { if (snode->id && GS(snode->id->name) == ID_MA) { CTX_data_id_pointer_set(result, snode->id); } return 1; } - else if (CTX_data_equals(member, "light")) { + if (CTX_data_equals(member, "light")) { if (snode->id && GS(snode->id->name) == ID_LA) { CTX_data_id_pointer_set(result, snode->id); } return 1; } - else if (CTX_data_equals(member, "world")) { + if (CTX_data_equals(member, "world")) { if (snode->id && GS(snode->id->name) == ID_WO) { CTX_data_id_pointer_set(result, snode->id); } |