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:
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r--source/blender/editors/space_node/node_templates.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index 7b60963e082..64c898cb628 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -218,20 +218,15 @@ static void node_socket_add_replace(const bContext *C, bNodeTree *ntree, bNode *
else if (!node_from) {
node_from = nodeAddStaticNode(C, ntree, type);
if (node_prev != NULL) {
- /* If we're replacing existing node, use it's location. */
+ /* If we're replacing existing node, use its location. */
node_from->locx = node_prev->locx;
node_from->locy = node_prev->locy;
node_from->offsetx = node_prev->offsetx;
node_from->offsety = node_prev->offsety;
}
else {
- /* Avoid exact intersection of nodes.
- * TODO(sergey): Still not ideal, but better than nothing.
- */
- int index = BLI_findindex(&node_to->inputs, sock_to);
- BLI_assert(index != -1);
- node_from->locx = node_to->locx - (node_from->typeinfo->width + 50);
- node_from->locy = node_to->locy - (node_from->typeinfo->height * index);
+ sock_from_tmp = BLI_findlink(&node_from->outputs, item->socket_index);
+ nodePositionRelative(node_from, node_to, sock_from_tmp, sock_to);
}
node_link_item_apply(bmain, node_from, item);