summaryrefslogtreecommitdiffstats
path: root/scene/gui/graph_edit_arranger.cpp
diff options
context:
space:
mode:
authorHendrik Brucker <hendrik.brucker@mail.de>2023-08-09 18:31:15 +0200
committerHendrik Brucker <hendrik.brucker@mail.de>2023-09-07 17:29:06 +0200
commit5afe78bd9c7e619ebc2dd2fb43d549d16382b51d (patch)
treecdf9e6e0979a1726fc4fb801fdd1f9591cf48b4f /scene/gui/graph_edit_arranger.cpp
parent08c578c54c352edf85f750992b2156bae5685fb8 (diff)
downloadredot-engine-5afe78bd9c7e619ebc2dd2fb43d549d16382b51d.tar.gz
Clean up/refactor GraphNode and make it more flexible
Split GraphNode into GraphElement and GraphNode, add custom titlebar, and adjust theming.
Diffstat (limited to 'scene/gui/graph_edit_arranger.cpp')
-rw-r--r--scene/gui/graph_edit_arranger.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/scene/gui/graph_edit_arranger.cpp b/scene/gui/graph_edit_arranger.cpp
index f4d9dcbf95..c1750a7b0f 100644
--- a/scene/gui/graph_edit_arranger.cpp
+++ b/scene/gui/graph_edit_arranger.cpp
@@ -408,8 +408,8 @@ void GraphEditArranger::_calculate_inner_shifts(Dictionary &r_inner_shifts, cons
int port_from = ports.first;
int port_to = ports.second;
- Vector2 pos_from = gnode_from->get_connection_output_position(port_from) * graph_edit->get_zoom();
- Vector2 pos_to = gnode_to->get_connection_input_position(port_to) * graph_edit->get_zoom();
+ Vector2 pos_from = gnode_from->get_output_port_position(port_from) * graph_edit->get_zoom();
+ Vector2 pos_to = gnode_to->get_input_port_position(port_to) * graph_edit->get_zoom();
real_t s = (real_t)r_inner_shifts[u] + (pos_from.y - pos_to.y) / graph_edit->get_zoom();
r_inner_shifts[v] = s;
@@ -459,8 +459,8 @@ float GraphEditArranger::_calculate_threshold(StringName p_v, StringName p_w, co
if (incoming.from_node != StringName()) {
GraphNode *gnode_from = Object::cast_to<GraphNode>(r_node_names[incoming.from_node]);
GraphNode *gnode_to = Object::cast_to<GraphNode>(r_node_names[p_w]);
- Vector2 pos_from = gnode_from->get_connection_output_position(incoming.from_port) * graph_edit->get_zoom();
- Vector2 pos_to = gnode_to->get_connection_input_position(incoming.to_port) * graph_edit->get_zoom();
+ Vector2 pos_from = gnode_from->get_output_port_position(incoming.from_port) * graph_edit->get_zoom();
+ Vector2 pos_to = gnode_to->get_input_port_position(incoming.to_port) * graph_edit->get_zoom();
// If connected block node is selected, calculate thershold or add current block to list.
if (gnode_from->is_selected()) {
@@ -491,8 +491,8 @@ float GraphEditArranger::_calculate_threshold(StringName p_v, StringName p_w, co
if (outgoing.to_node != StringName()) {
GraphNode *gnode_from = Object::cast_to<GraphNode>(r_node_names[p_w]);
GraphNode *gnode_to = Object::cast_to<GraphNode>(r_node_names[outgoing.to_node]);
- Vector2 pos_from = gnode_from->get_connection_output_position(outgoing.from_port) * graph_edit->get_zoom();
- Vector2 pos_to = gnode_to->get_connection_input_position(outgoing.to_port) * graph_edit->get_zoom();
+ Vector2 pos_from = gnode_from->get_output_port_position(outgoing.from_port) * graph_edit->get_zoom();
+ Vector2 pos_to = gnode_to->get_input_port_position(outgoing.to_port) * graph_edit->get_zoom();
// If connected block node is selected, calculate thershold or add current block to list.
if (gnode_to->is_selected()) {