Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-09-09 19:41:07 +0300
committerJacques Lucke <jacques@blender.org>2020-09-09 19:41:07 +0300
commit63916f5941b443dfc8566682bb75374e5abd553f (patch)
treefb0704701f1d4d9acbddf4a6fbc62c819d8d4c36 /source/blender/editors/space_node
parent0cff2c944f9c2cd3ac873fe826c4399fc2f32159 (diff)
Cleanup: reduce variable scope
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r--source/blender/editors/space_node/node_add.c6
-rw-r--r--source/blender/editors/space_node/node_relationships.c13
-rw-r--r--source/blender/editors/space_node/node_templates.c6
3 files changed, 10 insertions, 15 deletions
diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c
index 68f4bd0ff38..f8382a17c59 100644
--- a/source/blender/editors/space_node/node_add.c
+++ b/source/blender/editors/space_node/node_add.c
@@ -100,12 +100,10 @@ static bool add_reroute_intersect_check(bNodeLink *link,
float result[2])
{
float coord_array[NODE_LINK_RESOL + 1][2];
- int i, b;
if (node_link_bezier_points(NULL, NULL, link, coord_array, NODE_LINK_RESOL)) {
-
- for (i = 0; i < tot - 1; i++) {
- for (b = 0; b < NODE_LINK_RESOL; b++) {
+ for (int i = 0; i < tot - 1; i++) {
+ for (int b = 0; b < NODE_LINK_RESOL; b++) {
if (isect_seg_seg_v2(mcoords[i], mcoords[i + 1], coord_array[b], coord_array[b + 1]) > 0) {
result[0] = (mcoords[i][0] + mcoords[i + 1][0]) / 2.0f;
result[1] = (mcoords[i][1] + mcoords[i + 1][1]) / 2.0f;
diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c
index a09c70b794a..57fd84a4521 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -322,7 +322,7 @@ static void snode_autoconnect(Main *bmain,
ListBase *nodelist = MEM_callocN(sizeof(ListBase), "items_list");
bNodeListItem *nli;
bNode *node;
- int i, numlinks = 0;
+ int numlinks = 0;
for (node = ntree->nodes.first; node; node = node->next) {
if (node->flag & NODE_SELECT) {
@@ -376,7 +376,7 @@ static void snode_autoconnect(Main *bmain,
/* no selected inputs, connect by finding suitable match */
int num_inputs = BLI_listbase_count(&node_to->inputs);
- for (i = 0; i < num_inputs; i++) {
+ for (int i = 0; i < num_inputs; i++) {
/* find the best guess input socket */
sock_to = best_socket_input(ntree, node_to, i, replace);
@@ -1007,12 +1007,10 @@ void NODE_OT_link_make(wmOperatorType *ot)
static bool cut_links_intersect(bNodeLink *link, const float mcoords[][2], int tot)
{
float coord_array[NODE_LINK_RESOL + 1][2];
- int i, b;
if (node_link_bezier_points(NULL, NULL, link, coord_array, NODE_LINK_RESOL)) {
-
- for (i = 0; i < tot - 1; i++) {
- for (b = 0; b < NODE_LINK_RESOL; b++) {
+ for (int i = 0; i < tot - 1; i++) {
+ for (int b = 0; b < NODE_LINK_RESOL; b++) {
if (isect_seg_seg_v2(mcoords[i], mcoords[i + 1], coord_array[b], coord_array[b + 1]) > 0) {
return 1;
}
@@ -1536,11 +1534,10 @@ void ED_node_link_intersect_test(ScrArea *area, int test)
if (node_link_bezier_points(NULL, NULL, link, coord_array, NODE_LINK_RESOL)) {
float dist = FLT_MAX;
- int i;
/* loop over link coords to find shortest dist to
* upper left node edge of a intersected line segment */
- for (i = 0; i < NODE_LINK_RESOL; i++) {
+ for (int i = 0; i < NODE_LINK_RESOL; i++) {
/* check if the node rect intersetcts the line from this point to next one */
if (BLI_rctf_isect_segment(&select->totr, coord_array[i], coord_array[i + 1])) {
/* store the shortest distance to the upper left edge
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index c5be96470ec..a7e2ad8fc1c 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -500,20 +500,20 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
int totitems;
char name[UI_MAX_NAME_STR];
const char *cur_node_name = NULL;
- int i, num = 0;
+ int num = 0;
int icon = ICON_NONE;
arg->node_type = ntype;
ui_node_link_items(arg, SOCK_OUT, &items, &totitems);
- for (i = 0; i < totitems; i++) {
+ for (int i = 0; i < totitems; i++) {
if (ui_compatible_sockets(items[i].socket_type, sock->type)) {
num++;
}
}
- for (i = 0; i < totitems; i++) {
+ for (int i = 0; i < totitems; i++) {
if (!ui_compatible_sockets(items[i].socket_type, sock->type)) {
continue;
}