Skip to content

Commit

Permalink
GH-666 Correctly handle Toggle Breakpoint keybind
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Aug 4, 2024
1 parent 25c6c37 commit 5822095
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/editor/graph/graph_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <godot_cpp/classes/geometry2d.hpp>
#include <godot_cpp/classes/input.hpp>
#include <godot_cpp/classes/input_event_action.hpp>
#include <godot_cpp/classes/input_event_key.hpp>
#include <godot_cpp/classes/input_event_mouse_button.hpp>
#include <godot_cpp/classes/input_event_mouse_motion.hpp>
#include <godot_cpp/classes/method_tweener.hpp>
Expand Down Expand Up @@ -530,6 +531,15 @@ void OrchestratorGraphEdit::_gui_input(const Ref<InputEvent>& p_event)
}
}
}

Ref<InputEventKey> key_event = p_event;
if (key_event.is_valid() && key_event->is_pressed() && key_event->get_keycode() == KEY_F9)
{
for_each_graph_node([](OrchestratorGraphNode* node) {
if (node->is_selected())
node->toggle_breakpoint();
});
}
}

bool OrchestratorGraphEdit::_can_drop_data(const Vector2& p_position, const Variant& p_data) const
Expand Down
3 changes: 3 additions & 0 deletions src/editor/graph/graph_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ class OrchestratorGraphNode : public GraphNode
/// @return the script node reference
Ref<OScriptNode> get_script_node() { return _node; }

/// Toggles breakpoint on this node
void toggle_breakpoint() { _handle_context_menu(CM_TOGGLE_BREAKPOINT); }

/// Get the graph node input pin at a given port
/// @param p_port the port or slot index
/// @return the editor graph node pin, or null if not found
Expand Down

0 comments on commit 5822095

Please sign in to comment.