Skip to content

Commit

Permalink
GH-365 Add disconnect control flow on drag option
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed May 27, 2024
1 parent 3f2f461 commit 5d3fd53
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/editor/graph/graph_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,9 @@ void OrchestratorGraphEdit::_hide_drag_hint()

void OrchestratorGraphEdit::_on_connection_drag_started(const StringName& p_from, int p_from_port, bool p_output)
{
OrchestratorSettings* os = OrchestratorSettings::get_singleton();
const bool flow_disconnect_on_drag = os->get_setting("ui/graph/disconnect_control_flow_when_dragged", true);

_drag_context.start_drag(p_from, p_from_port, p_output);

if (OrchestratorGraphNode* source = _get_by_name<OrchestratorGraphNode>(p_from))
Expand All @@ -1215,6 +1218,9 @@ void OrchestratorGraphEdit::_on_connection_drag_started(const StringName& p_from
{
// From port is an output
OrchestratorGraphNodePin* pin = source->get_output_pin(p_from_port);
if (pin && pin->is_execution() && flow_disconnect_on_drag)
pin->unlink_all();

for_each_graph_node([&](OrchestratorGraphNode* node) {
node->set_inputs_for_accept_opacity(0.3f, pin);
node->set_all_outputs_opacity(0.3f);
Expand Down
1 change: 1 addition & 0 deletions src/plugin/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ void OrchestratorSettings::_register_settings()

_settings.emplace_back(BOOL_SETTING("ui/actions_menu/center_on_mouse", true));

_settings.emplace_back(BOOL_SETTING("ui/graph/disconnect_control_flow_when_dragged", true));
_settings.emplace_back(BOOL_SETTING("ui/graph/show_minimap", false));
_settings.emplace_back(BOOL_SETTING("ui/graph/show_overlay_action_tooltips", true));
_settings.emplace_back(COLOR_NO_ALPHA_SETTING("ui/graph/knot_selected_color", Color(0.68f, 0.44f, 0.09f)));
Expand Down

0 comments on commit 5d3fd53

Please sign in to comment.