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:
authorLeon Schittek <leon.schittek@gmx.net>2022-03-30 00:39:50 +0300
committerLeon Schittek <leon.schittek@gmx.net>2022-03-30 00:39:50 +0300
commitee1d5fb9e4671a60fc3083dde78c227d9ef73aa2 (patch)
treea0396e8ec9e1d797884eb2e4744e75bf70c1a9a0 /source/blender/editors/space_node/drawnode.cc
parent08b4b657b64fe8632f532e732cebdaec73264d66 (diff)
UI: Fix cosmetic papercuts of the reroute node
Fix small cosmetic issues with the reroute node: 1. Remove special case that allowed curved links to attach vertically. 2. Center align the reroute node's label. The vertically attached node links could lead to kinks in the otherwise smooth curves. This would break the visual flow and make the link potentially intersect the node's label. The center alignment of the label gives more consistent results for different label lengths and also reduces the chance of the label interfering with the node links. Reviewed By: Hans Goudey, Pablo Vazquez Differential Revision: D14457
Diffstat (limited to 'source/blender/editors/space_node/drawnode.cc')
-rw-r--r--source/blender/editors/space_node/drawnode.cc42
1 files changed, 6 insertions, 36 deletions
diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc
index 365a17c0a04..d4b7640cfe3 100644
--- a/source/blender/editors/space_node/drawnode.cc
+++ b/source/blender/editors/space_node/drawnode.cc
@@ -1556,7 +1556,6 @@ bool node_link_bezier_handles(const View2D *v2d,
}
/* in v0 and v3 we put begin/end points */
- int toreroute, fromreroute;
if (link.fromsock) {
vec[0][0] = link.fromsock->locx;
vec[0][1] = link.fromsock->locy;
@@ -1567,14 +1566,12 @@ bool node_link_bezier_handles(const View2D *v2d,
link.fromsock->total_inputs);
copy_v2_v2(vec[0], position);
}
- fromreroute = (link.fromnode && link.fromnode->type == NODE_REROUTE);
}
else {
if (snode == nullptr) {
return false;
}
copy_v2_v2(vec[0], cursor);
- fromreroute = 0;
}
if (link.tosock) {
vec[3][0] = link.tosock->locx;
@@ -1586,14 +1583,12 @@ bool node_link_bezier_handles(const View2D *v2d,
link.tosock->total_inputs);
copy_v2_v2(vec[3], position);
}
- toreroute = (link.tonode && link.tonode->type == NODE_REROUTE);
}
else {
if (snode == nullptr) {
return false;
}
copy_v2_v2(vec[3], cursor);
- toreroute = 0;
}
/* may be called outside of drawing (so pass spacetype) */
@@ -1607,37 +1602,12 @@ bool node_link_bezier_handles(const View2D *v2d,
}
const float dist = curving * 0.10f * fabsf(vec[0][0] - vec[3][0]);
- const float deltax = vec[3][0] - vec[0][0];
- const float deltay = vec[3][1] - vec[0][1];
- /* check direction later, for top sockets */
- if (fromreroute) {
- if (fabsf(deltax) > fabsf(deltay)) {
- vec[1][1] = vec[0][1];
- vec[1][0] = vec[0][0] + (deltax > 0 ? dist : -dist);
- }
- else {
- vec[1][0] = vec[0][0];
- vec[1][1] = vec[0][1] + (deltay > 0 ? dist : -dist);
- }
- }
- else {
- vec[1][0] = vec[0][0] + dist;
- vec[1][1] = vec[0][1];
- }
- if (toreroute) {
- if (fabsf(deltax) > fabsf(deltay)) {
- vec[2][1] = vec[3][1];
- vec[2][0] = vec[3][0] + (deltax > 0 ? -dist : dist);
- }
- else {
- vec[2][0] = vec[3][0];
- vec[2][1] = vec[3][1] + (deltay > 0 ? -dist : dist);
- }
- }
- else {
- vec[2][0] = vec[3][0] - dist;
- vec[2][1] = vec[3][1];
- }
+
+ vec[1][0] = vec[0][0] + dist;
+ vec[1][1] = vec[0][1];
+
+ vec[2][0] = vec[3][0] - dist;
+ vec[2][1] = vec[3][1];
if (v2d && min_ffff(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) > v2d->cur.xmax) {
return false; /* clipped */