summaryrefslogtreecommitdiffstats
path: root/modules/visual_script/visual_script_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/visual_script/visual_script_editor.cpp')
-rw-r--r--modules/visual_script/visual_script_editor.cpp849
1 files changed, 425 insertions, 424 deletions
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 37bd730d08..d0ab29f184 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -481,7 +481,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
continue;
Ref<VisualScriptNode> node = script->get_node(edited_func, E->get());
- Vector2 pos = script->get_node_pos(edited_func, E->get());
+ Vector2 pos = script->get_node_position(edited_func, E->get());
GraphNode *gnode = memnew(GraphNode);
gnode->set_title(node->get_caption());
@@ -491,11 +491,6 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
gnode->set_overlay(GraphNode::OVERLAY_BREAKPOINT);
}
- if (EditorSettings::get_singleton()->has("editors/visual_script/color_" + node->get_category())) {
- Color c = EditorSettings::get_singleton()->get("editors/visual_script/color_" + node->get_category());
- gnode->set_self_modulate(c);
- }
-
gnode->set_meta("__vnode", node);
gnode->set_name(itos(E->get()));
gnode->connect("dragged", this, "_node_moved", varray(E->get()));
@@ -506,7 +501,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
gnode->set_show_close_button(true);
}
- if (Object::cast_to<VisualScriptExpression>(*node)) {
+ if (Object::cast_to<VisualScriptExpression>(node.ptr())) {
LineEdit *line_edit = memnew(LineEdit);
line_edit->set_text(node->get_text());
@@ -520,7 +515,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
gnode->add_child(text);
}
- if (Object::cast_to<VisualScriptExpression>(*node)) {
+ if (Object::cast_to<VisualScriptComment>(node.ptr())) {
Ref<VisualScriptComment> vsc = node;
gnode->set_comment(true);
gnode->set_resizable(true);
@@ -528,6 +523,25 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
gnode->connect("resize_request", this, "_comment_node_resized", varray(E->get()));
}
+ if (node_styles.has(node->get_category())) {
+ Ref<StyleBoxFlat> sbf = node_styles[node->get_category()];
+ if (gnode->is_comment())
+ sbf = EditorNode::get_singleton()->get_theme_base()->get_theme()->get_stylebox("comment", "GraphNode");
+
+ Color c = sbf->get_border_color(MARGIN_TOP);
+ c.a = 1;
+ if (EditorSettings::get_singleton()->get("interface/theme/use_graph_node_headers")) {
+ Color mono_color = ((c.r + c.g + c.b) / 3) < 0.5 ? Color(1.0, 1.0, 1.0) : Color(0, 0, 0);
+ mono_color.a = 0.85;
+ c = mono_color;
+ }
+
+ gnode->add_color_override("title_color", c);
+ c.a = 0.7;
+ gnode->add_color_override("close_color", c);
+ gnode->add_style_override("frame", sbf);
+ }
+
int slot_idx = 0;
bool single_seq_output = node->get_output_sequence_port_count() == 1 && node->get_output_sequence_port_text(0) == String();
@@ -926,48 +940,6 @@ void VisualScriptEditor::_member_edited() {
}
}
-void VisualScriptEditor::_override_pressed(int p_id) {
-
- //override a virtual function or method from base type
-
- ERR_FAIL_COND(!virtuals_in_menu.has(p_id));
-
- VirtualInMenu vim = virtuals_in_menu[p_id];
-
- String name = _validate_name(vim.name);
- selected = name;
- edited_func = selected;
- Ref<VisualScriptFunction> func_node;
- func_node.instance();
- func_node->set_name(vim.name);
-
- undo_redo->create_action(TTR("Add Function"));
- undo_redo->add_do_method(script.ptr(), "add_function", name);
- for (int i = 0; i < vim.args.size(); i++) {
- func_node->add_argument(vim.args[i].first, vim.args[i].second);
- }
-
- undo_redo->add_do_method(script.ptr(), "add_node", name, script->get_available_id(), func_node);
- if (vim.ret != Variant::NIL || vim.ret_variant) {
- Ref<VisualScriptReturn> ret_node;
- ret_node.instance();
- ret_node->set_return_type(vim.ret);
- ret_node->set_enable_return_value(true);
- ret_node->set_name(vim.name);
- undo_redo->add_do_method(script.ptr(), "add_node", name, script->get_available_id() + 1, ret_node, Vector2(500, 0));
- }
-
- undo_redo->add_undo_method(script.ptr(), "remove_function", name);
- undo_redo->add_do_method(this, "_update_members");
- undo_redo->add_undo_method(this, "_update_members");
- undo_redo->add_do_method(this, "_update_graph");
- undo_redo->add_undo_method(this, "_update_graph");
-
- undo_redo->commit_action();
-
- _update_graph();
-}
-
void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_button) {
TreeItem *ti = Object::cast_to<TreeItem>(p_item);
@@ -980,64 +952,9 @@ void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_butt
//add function, this one uses menu
if (p_button == 1) {
- new_function_menu->clear();
- new_function_menu->set_size(Size2(0, 0));
- int idx = 0;
-
- virtuals_in_menu.clear();
-
- List<MethodInfo> mi;
- ClassDB::get_method_list(script->get_instance_base_type(), &mi);
- for (List<MethodInfo>::Element *E = mi.front(); E; E = E->next()) {
- MethodInfo mi = E->get();
- if (mi.flags & METHOD_FLAG_VIRTUAL) {
-
- VirtualInMenu vim;
- vim.name = mi.name;
- vim.ret = mi.return_val.type;
- if (mi.return_val.name != String())
- vim.ret_variant = true;
- else
- vim.ret_variant = false;
-
- String desc;
-
- if (mi.return_val.type == Variant::NIL)
- desc = "var";
- else
- desc = Variant::get_type_name(mi.return_val.type);
- desc += " " + mi.name + " ( ";
-
- for (int i = 0; i < mi.arguments.size(); i++) {
-
- if (i > 0)
- desc += ", ";
-
- if (mi.arguments[i].type == Variant::NIL)
- desc += "var ";
- else
- desc += Variant::get_type_name(mi.arguments[i].type) + " ";
-
- desc += mi.arguments[i].name;
-
- Pair<Variant::Type, String> p;
- p.first = mi.arguments[i].type;
- p.second = mi.arguments[i].name;
- vim.args.push_back(p);
- }
-
- desc += " )";
- virtuals_in_menu[idx] = vim;
+ new_virtual_method_select->select_method_from_base_type(script->get_instance_base_type(), String(), true);
- new_function_menu->add_item(desc, idx);
- idx++;
- }
- }
-
- Rect2 pos = members->get_item_rect(ti);
- new_function_menu->set_position(members->get_global_position() + pos.position + Vector2(0, pos.size.y));
- new_function_menu->popup();
return;
} else if (p_button == 0) {
@@ -1148,7 +1065,7 @@ void VisualScriptEditor::_available_node_doubleclicked() {
List<int> existing;
script->get_node_list(edited_func, &existing);
for (List<int>::Element *E = existing.front(); E; E = E->next()) {
- Point2 pos = script->get_node_pos(edited_func, E->get());
+ Point2 pos = script->get_node_position(edited_func, E->get());
if (pos.distance_to(ofs) < 15) {
ofs += Vector2(graph->get_snap(), graph->get_snap());
exists = true;
@@ -1269,7 +1186,7 @@ void VisualScriptEditor::_on_nodes_delete() {
for (List<int>::Element *F = to_erase.front(); F; F = F->next()) {
undo_redo->add_do_method(script.ptr(), "remove_node", edited_func, F->get());
- undo_redo->add_undo_method(script.ptr(), "add_node", edited_func, F->get(), script->get_node(edited_func, F->get()), script->get_node_pos(edited_func, F->get()));
+ undo_redo->add_undo_method(script.ptr(), "add_node", edited_func, F->get(), script->get_node(edited_func, F->get()), script->get_node_position(edited_func, F->get()));
List<VisualScript::SequenceConnection> sequence_conns;
script->get_sequence_connection_list(edited_func, &sequence_conns);
@@ -1326,7 +1243,7 @@ void VisualScriptEditor::_on_nodes_duplicate() {
int new_id = idc++;
to_select.insert(new_id);
- undo_redo->add_do_method(script.ptr(), "add_node", edited_func, new_id, dupe, script->get_node_pos(edited_func, F->get()) + Vector2(20, 20));
+ undo_redo->add_do_method(script.ptr(), "add_node", edited_func, new_id, dupe, script->get_node_position(edited_func, F->get()) + Vector2(20, 20));
undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, new_id);
}
undo_redo->add_do_method(this, "_update_graph");
@@ -1360,7 +1277,7 @@ Variant VisualScriptEditor::get_drag_data_fw(const Point2 &p_point, Control *p_f
if (p_from == nodes) {
- TreeItem *it = nodes->get_item_at_pos(p_point);
+ TreeItem *it = nodes->get_item_at_position(p_point);
if (!it)
return Variant();
String type = it->get_metadata(0);
@@ -1379,7 +1296,7 @@ Variant VisualScriptEditor::get_drag_data_fw(const Point2 &p_point, Control *p_f
if (p_from == members) {
- TreeItem *it = members->get_item_at_pos(p_point);
+ TreeItem *it = members->get_item_at_position(p_point);
if (!it)
return Variant();
@@ -1495,415 +1412,424 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const
void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
- if (p_from == graph) {
+ if (p_from != graph) {
+ return;
+ }
- Dictionary d = p_data;
- if (d.has("type") && String(d["type"]) == "visual_script_node_drag") {
+ Dictionary d = p_data;
- Vector2 ofs = graph->get_scroll_ofs() + p_point;
+ if (!d.has("type")) {
+ return;
+ }
- if (graph->is_using_snap()) {
- int snap = graph->get_snap();
- ofs = ofs.snapped(Vector2(snap, snap));
- }
+ if (String(d["type"]) == "visual_script_node_drag") {
+ if (!d.has("node_type") || String(d["node_type"]) == "Null") {
+ return;
+ }
- ofs /= EDSCALE;
+ Vector2 ofs = graph->get_scroll_ofs() + p_point;
- Ref<VisualScriptNode> vnode = VisualScriptLanguage::singleton->create_node_from_name(d["node_type"]);
- int new_id = script->get_available_id();
+ if (graph->is_using_snap()) {
+ int snap = graph->get_snap();
+ ofs = ofs.snapped(Vector2(snap, snap));
+ }
- undo_redo->create_action(TTR("Add Node"));
- undo_redo->add_do_method(script.ptr(), "add_node", edited_func, new_id, vnode, ofs);
- undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, new_id);
- undo_redo->add_do_method(this, "_update_graph");
- undo_redo->add_undo_method(this, "_update_graph");
- undo_redo->commit_action();
+ ofs /= EDSCALE;
- Node *node = graph->get_node(itos(new_id));
- if (node) {
- graph->set_selected(node);
- _node_selected(node);
- }
+ Ref<VisualScriptNode> vnode = VisualScriptLanguage::singleton->create_node_from_name(d["node_type"]);
+ int new_id = script->get_available_id();
+
+ undo_redo->create_action(TTR("Add Node"));
+ undo_redo->add_do_method(script.ptr(), "add_node", edited_func, new_id, vnode, ofs);
+ undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, new_id);
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+
+ Node *node = graph->get_node(itos(new_id));
+ if (node) {
+ graph->set_selected(node);
+ _node_selected(node);
}
+ }
- if (d.has("type") && String(d["type"]) == "visual_script_variable_drag") {
+ if (String(d["type"]) == "visual_script_variable_drag") {
#ifdef OSX_ENABLED
- bool use_set = Input::get_singleton()->is_key_pressed(KEY_META);
+ bool use_set = Input::get_singleton()->is_key_pressed(KEY_META);
#else
- bool use_set = Input::get_singleton()->is_key_pressed(KEY_CONTROL);
+ bool use_set = Input::get_singleton()->is_key_pressed(KEY_CONTROL);
#endif
- Vector2 ofs = graph->get_scroll_ofs() + p_point;
- if (graph->is_using_snap()) {
- int snap = graph->get_snap();
- ofs = ofs.snapped(Vector2(snap, snap));
- }
+ Vector2 ofs = graph->get_scroll_ofs() + p_point;
+ if (graph->is_using_snap()) {
+ int snap = graph->get_snap();
+ ofs = ofs.snapped(Vector2(snap, snap));
+ }
- ofs /= EDSCALE;
+ ofs /= EDSCALE;
- Ref<VisualScriptNode> vnode;
- if (use_set) {
- Ref<VisualScriptVariableSet> vnodes;
- vnodes.instance();
- vnodes->set_variable(d["variable"]);
- vnode = vnodes;
- } else {
+ Ref<VisualScriptNode> vnode;
+ if (use_set) {
+ Ref<VisualScriptVariableSet> vnodes;
+ vnodes.instance();
+ vnodes->set_variable(d["variable"]);
+ vnode = vnodes;
+ } else {
- Ref<VisualScriptVariableGet> vnodeg;
- vnodeg.instance();
- vnodeg->set_variable(d["variable"]);
- vnode = vnodeg;
- }
+ Ref<VisualScriptVariableGet> vnodeg;
+ vnodeg.instance();
+ vnodeg->set_variable(d["variable"]);
+ vnode = vnodeg;
+ }
- int new_id = script->get_available_id();
+ int new_id = script->get_available_id();
- undo_redo->create_action(TTR("Add Node"));
- undo_redo->add_do_method(script.ptr(), "add_node", edited_func, new_id, vnode, ofs);
- undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, new_id);
- undo_redo->add_do_method(this, "_update_graph");
- undo_redo->add_undo_method(this, "_update_graph");
- undo_redo->commit_action();
+ undo_redo->create_action(TTR("Add Node"));
+ undo_redo->add_do_method(script.ptr(), "add_node", edited_func, new_id, vnode, ofs);
+ undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, new_id);
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
- Node *node = graph->get_node(itos(new_id));
- if (node) {
- graph->set_selected(node);
- _node_selected(node);
- }
+ Node *node = graph->get_node(itos(new_id));
+ if (node) {
+ graph->set_selected(node);
+ _node_selected(node);
}
+ }
- if (d.has("type") && String(d["type"]) == "visual_script_function_drag") {
+ if (String(d["type"]) == "visual_script_function_drag") {
- Vector2 ofs = graph->get_scroll_ofs() + p_point;
- if (graph->is_using_snap()) {
- int snap = graph->get_snap();
- ofs = ofs.snapped(Vector2(snap, snap));
- }
+ Vector2 ofs = graph->get_scroll_ofs() + p_point;
+ if (graph->is_using_snap()) {
+ int snap = graph->get_snap();
+ ofs = ofs.snapped(Vector2(snap, snap));
+ }
- ofs /= EDSCALE;
+ ofs /= EDSCALE;
- Ref<VisualScriptFunctionCall> vnode;
- vnode.instance();
- vnode->set_call_mode(VisualScriptFunctionCall::CALL_MODE_SELF);
+ Ref<VisualScriptFunctionCall> vnode;
+ vnode.instance();
+ vnode->set_call_mode(VisualScriptFunctionCall::CALL_MODE_SELF);
- int new_id = script->get_available_id();
+ int new_id = script->get_available_id();
- undo_redo->create_action(TTR("Add Node"));
- undo_redo->add_do_method(script.ptr(), "add_node", edited_func, new_id, vnode, ofs);
- undo_redo->add_do_method(vnode.ptr(), "set_base_type", script->get_instance_base_type());
- undo_redo->add_do_method(vnode.ptr(), "set_function", d["function"]);
+ undo_redo->create_action(TTR("Add Node"));
+ undo_redo->add_do_method(script.ptr(), "add_node", edited_func, new_id, vnode, ofs);
+ undo_redo->add_do_method(vnode.ptr(), "set_base_type", script->get_instance_base_type());
+ undo_redo->add_do_method(vnode.ptr(), "set_function", d["function"]);
- undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, new_id);
- undo_redo->add_do_method(this, "_update_graph");
- undo_redo->add_undo_method(this, "_update_graph");
- undo_redo->commit_action();
+ undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, new_id);
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
- Node *node = graph->get_node(itos(new_id));
- if (node) {
- graph->set_selected(node);
- _node_selected(node);
- }
+ Node *node = graph->get_node(itos(new_id));
+ if (node) {
+ graph->set_selected(node);
+ _node_selected(node);
}
+ }
- if (d.has("type") && String(d["type"]) == "visual_script_signal_drag") {
+ if (String(d["type"]) == "visual_script_signal_drag") {
- Vector2 ofs = graph->get_scroll_ofs() + p_point;
- if (graph->is_using_snap()) {
- int snap = graph->get_snap();
- ofs = ofs.snapped(Vector2(snap, snap));
- }
+ Vector2 ofs = graph->get_scroll_ofs() + p_point;
+ if (graph->is_using_snap()) {
+ int snap = graph->get_snap();
+ ofs = ofs.snapped(Vector2(snap, snap));
+ }
- ofs /= EDSCALE;
+ ofs /= EDSCALE;
- Ref<VisualScriptEmitSignal> vnode;
- vnode.instance();
- vnode->set_signal(d["signal"]);
+ Ref<VisualScriptEmitSignal> vnode;
+ vnode.instance();
+ vnode->set_signal(d["signal"]);
- int new_id = script->get_available_id();
+ int new_id = script->get_available_id();
- undo_redo->create_action(TTR("Add Node"));
- undo_redo->add_do_method(script.ptr(), "add_node", edited_func, new_id, vnode, ofs);
- undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, new_id);
- undo_redo->add_do_method(this, "_update_graph");
- undo_redo->add_undo_method(this, "_update_graph");
- undo_redo->commit_action();
+ undo_redo->create_action(TTR("Add Node"));
+ undo_redo->add_do_method(script.ptr(), "add_node", edited_func, new_id, vnode, ofs);
+ undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, new_id);
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
- Node *node = graph->get_node(itos(new_id));
- if (node) {
- graph->set_selected(node);
- _node_selected(node);
- }
+ Node *node = graph->get_node(itos(new_id));
+ if (node) {
+ graph->set_selected(node);
+ _node_selected(node);
}
+ }
- if (d.has("type") && String(d["type"]) == "resource") {
+ if (String(d["type"]) == "resource") {
- Vector2 ofs = graph->get_scroll_ofs() + p_point;
- if (graph->is_using_snap()) {
- int snap = graph->get_snap();
- ofs = ofs.snapped(Vector2(snap, snap));
- }
+ Vector2 ofs = graph->get_scroll_ofs() + p_point;
+ if (graph->is_using_snap()) {
+ int snap = graph->get_snap();
+ ofs = ofs.snapped(Vector2(snap, snap));
+ }
- ofs /= EDSCALE;
+ ofs /= EDSCALE;
- Ref<VisualScriptPreload> prnode;
- prnode.instance();
- prnode->set_preload(d["resource"]);
+ Ref<VisualScriptPreload> prnode;
+ prnode.instance();
+ prnode->set_preload(d["resource"]);
- int new_id = script->get_available_id();
+ int new_id = script->get_available_id();
- undo_redo->create_action(TTR("Add Preload Node"));
- undo_redo->add_do_method(script.ptr(), "add_node", edited_func, new_id, prnode, ofs);
- undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, new_id);
- undo_redo->add_do_method(this, "_update_graph");
- undo_redo->add_undo_method(this, "_update_graph");
- undo_redo->commit_action();
+ undo_redo->create_action(TTR("Add Preload Node"));
+ undo_redo->add_do_method(script.ptr(), "add_node", edited_func, new_id, prnode, ofs);
+ undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, new_id);
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
- Node *node = graph->get_node(itos(new_id));
- if (node) {
- graph->set_selected(node);
- _node_selected(node);
- }
+ Node *node = graph->get_node(itos(new_id));
+ if (node) {
+ graph->set_selected(node);
+ _node_selected(node);
}
+ }
- if (d.has("type") && String(d["type"]) == "files") {
-
- Vector2 ofs = graph->get_scroll_ofs() + p_point;
- if (graph->is_using_snap()) {
- int snap = graph->get_snap();
- ofs = ofs.snapped(Vector2(snap, snap));
- }
+ if (String(d["type"]) == "files") {
- ofs /= EDSCALE;
+ Vector2 ofs = graph->get_scroll_ofs() + p_point;
+ if (graph->is_using_snap()) {
+ int snap = graph->get_snap();
+ ofs = ofs.snapped(Vector2(snap, snap));
+ }
- Array files = d["files"];
+ ofs /= EDSCALE;
- List<int> new_ids;
- int new_id = script->get_available_id();
+ Array files = d["files"];
- if (files.size()) {
- undo_redo->create_action(TTR("Add Preload Node"));
+ List<int> new_ids;
+ int new_id = script->get_available_id();
- for (int i = 0; i < files.size(); i++) {
+ if (files.size()) {
+ undo_redo->create_action(TTR("Add Preload Node"));
- Ref<Resource> res = ResourceLoader::load(files[i]);
- if (!res.is_valid())
- continue;
+ for (int i = 0; i < files.size(); i++) {
- Ref<VisualScriptPreload> prnode;
- prnode.instance();
- prnode->set_preload(res);
+ Ref<Resource> res = ResourceLoader::load(files[i]);
+ if (!res.is_valid())
+ continue;
- undo_redo->add_do_method(script.ptr(), "add_node", edited_func, new_id, prnode, ofs);
- undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, new_id);
- new_ids.push_back(new_id);
- new_id++;
- ofs += Vector2(20, 20) * EDSCALE;
- }
+ Ref<VisualScriptPreload> prnode;
+ prnode.instance();
+ prnode->set_preload(res);
- undo_redo->add_do_method(this, "_update_graph");
- undo_redo->add_undo_method(this, "_update_graph");
- undo_redo->commit_action();
+ undo_redo->add_do_method(script.ptr(), "add_node", edited_func, new_id, prnode, ofs);
+ undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, new_id);
+ new_ids.push_back(new_id);
+ new_id++;
+ ofs += Vector2(20, 20) * EDSCALE;
}
- for (List<int>::Element *E = new_ids.front(); E; E = E->next()) {
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+ }
- Node *node = graph->get_node(itos(E->get()));
- if (node) {
- graph->set_selected(node);
- _node_selected(node);
- }
+ for (List<int>::Element *E = new_ids.front(); E; E = E->next()) {
+
+ Node *node = graph->get_node(itos(E->get()));
+ if (node) {
+ graph->set_selected(node);
+ _node_selected(node);
}
}
+ }
- if (d.has("type") && String(d["type"]) == "nodes") {
+ if (String(d["type"]) == "nodes") {
- Node *sn = _find_script_node(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root(), script);
+ Node *sn = _find_script_node(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root(), script);
- if (!sn) {
- EditorNode::get_singleton()->show_warning("Can't drop nodes because script '" + get_name() + "' is not used in this scene.");
- return;
- }
+ if (!sn) {
+ EditorNode::get_singleton()->show_warning("Can't drop nodes because script '" + get_name() + "' is not used in this scene.");
+ return;
+ }
#ifdef OSX_ENABLED
- bool use_node = Input::get_singleton()->is_key_pressed(KEY_META);
+ bool use_node = Input::get_singleton()->is_key_pressed(KEY_META);
#else
- bool use_node = Input::get_singleton()->is_key_pressed(KEY_CONTROL);
+ bool use_node = Input::get_singleton()->is_key_pressed(KEY_CONTROL);
#endif
- Array nodes = d["nodes"];
-
- Vector2 ofs = graph->get_scroll_ofs() + p_point;
+ Array nodes = d["nodes"];
- if (graph->is_using_snap()) {
- int snap = graph->get_snap();
- ofs = ofs.snapped(Vector2(snap, snap));
- }
- ofs /= EDSCALE;
+ Vector2 ofs = graph->get_scroll_ofs() + p_point;
- undo_redo->create_action(TTR("Add Node(s) From Tree"));
- int base_id = script->get_available_id();
+ if (graph->is_using_snap()) {
+ int snap = graph->get_snap();
+ ofs = ofs.snapped(Vector2(snap, snap));
+ }
+ ofs /= EDSCALE;
- if (nodes.size() > 1) {
- use_node = true;
- }
+ undo_redo->create_action(TTR("Add Node(s) From Tree"));
+ int base_id = script->get_available_id();
- for (int i = 0; i < nodes.size(); i++) {
+ if (nodes.size() > 1) {
+ use_node = true;
+ }
- NodePath np = nodes[i];
- Node *node = get_node(np);
- if (!node) {
- continue;
- }
+ for (int i = 0; i < nodes.size(); i++) {
- Ref<VisualScriptNode> n;
+ NodePath np = nodes[i];
+ Node *node = get_node(np);
+ if (!node) {
+ continue;
+ }
- if (use_node) {
- Ref<VisualScriptSceneNode> scene_node;
- scene_node.instance();
- scene_node->set_node_path(sn->get_path_to(node));
- n = scene_node;
+ Ref<VisualScriptNode> n;
- } else {
- Ref<VisualScriptFunctionCall> call;
- call.instance();
- call->set_call_mode(VisualScriptFunctionCall::CALL_MODE_NODE_PATH);
- call->set_base_path(sn->get_path_to(node));
- call->set_base_type(node->get_class());
- n = call;
-
- method_select->select_method_from_instance(node);
- selecting_method_id = base_id;
- }
+ if (use_node) {
+ Ref<VisualScriptSceneNode> scene_node;
+ scene_node.instance();
+ scene_node->set_node_path(sn->get_path_to(node));
+ n = scene_node;
- undo_redo->add_do_method(script.ptr(), "add_node", edited_func, base_id, n, ofs);
- undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, base_id);
+ } else {
+ Ref<VisualScriptFunctionCall> call;
+ call.instance();
+ call->set_call_mode(VisualScriptFunctionCall::CALL_MODE_NODE_PATH);
+ call->set_base_path(sn->get_path_to(node));
+ call->set_base_type(node->get_class());
+ n = call;
- base_id++;
- ofs += Vector2(25, 25);
+ method_select->select_method_from_instance(node);
+ selecting_method_id = base_id;
}
- undo_redo->add_do_method(this, "_update_graph");
- undo_redo->add_undo_method(this, "_update_graph");
- undo_redo->commit_action();
+
+ undo_redo->add_do_method(script.ptr(), "add_node", edited_func, base_id, n, ofs);
+ undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, base_id);
+
+ base_id++;
+ ofs += Vector2(25, 25);
}
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+ }
- if (d.has("type") && String(d["type"]) == "obj_property") {
+ if (String(d["type"]) == "obj_property") {
- Node *sn = _find_script_node(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root(), script);
+ Node *sn = _find_script_node(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root(), script);
- if (!sn && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
- EditorNode::get_singleton()->show_warning("Can't drop properties because script '" + get_name() + "' is not used in this scene.\nDrop holding 'Shift' to just copy the signature.");
- return;
- }
+ if (!sn && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+ EditorNode::get_singleton()->show_warning("Can't drop properties because script '" + get_name() + "' is not used in this scene.\nDrop holding 'Shift' to just copy the signature.");
+ return;
+ }
- Object *obj = d["object"];
+ Object *obj = d["object"];
- if (!obj)
- return;
+ if (!obj)
+ return;
- Node *node = Object::cast_to<Node>(obj);
- Vector2 ofs = graph->get_scroll_ofs() + p_point;
+ Node *node = Object::cast_to<Node>(obj);
+ Vector2 ofs = graph->get_scroll_ofs() + p_point;
- if (graph->is_using_snap()) {
- int snap = graph->get_snap();
- ofs = ofs.snapped(Vector2(snap, snap));
- }
+ if (graph->is_using_snap()) {
+ int snap = graph->get_snap();
+ ofs = ofs.snapped(Vector2(snap, snap));
+ }
- ofs /= EDSCALE;
+ ofs /= EDSCALE;
#ifdef OSX_ENABLED
- bool use_get = Input::get_singleton()->is_key_pressed(KEY_META);
+ bool use_get = Input::get_singleton()->is_key_pressed(KEY_META);
#else
- bool use_get = Input::get_singleton()->is_key_pressed(KEY_CONTROL);
+ bool use_get = Input::get_singleton()->is_key_pressed(KEY_CONTROL);
#endif
- if (!node || Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+ if (!node || Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
- if (use_get)
- undo_redo->create_action(TTR("Add Getter Property"));
- else
- undo_redo->create_action(TTR("Add Setter Property"));
+ if (use_get)
+ undo_redo->create_action(TTR("Add Getter Property"));
+ else
+ undo_redo->create_action(TTR("Add Setter Property"));
- int base_id = script->get_available_id();
+ int base_id = script->get_available_id();
- Ref<VisualScriptNode> vnode;
+ Ref<VisualScriptNode> vnode;
- if (!use_get) {
+ if (!use_get) {
- Ref<VisualScriptPropertySet> pset;
- pset.instance();
- pset->set_call_mode(VisualScriptPropertySet::CALL_MODE_INSTANCE);
- pset->set_base_type(obj->get_class());
- /*if (use_value) {
+ Ref<VisualScriptPropertySet> pset;
+ pset.instance();
+ pset->set_call_mode(VisualScriptPropertySet::CALL_MODE_INSTANCE);
+ pset->set_base_type(obj->get_class());
+ /*if (use_value) {
pset->set_use_builtin_value(true);
pset->set_builtin_value(d["value"]);
}*/
- vnode = pset;
- } else {
-
- Ref<VisualScriptPropertyGet> pget;
- pget.instance();
- pget->set_call_mode(VisualScriptPropertyGet::CALL_MODE_INSTANCE);
- pget->set_base_type(obj->get_class());
+ vnode = pset;
+ } else {
- vnode = pget;
- }
+ Ref<VisualScriptPropertyGet> pget;
+ pget.instance();
+ pget->set_call_mode(VisualScriptPropertyGet::CALL_MODE_INSTANCE);
+ pget->set_base_type(obj->get_class());
- undo_redo->add_do_method(script.ptr(), "add_node", edited_func, base_id, vnode, ofs);
- undo_redo->add_do_method(vnode.ptr(), "set_property", d["property"]);
- if (!use_get) {
- undo_redo->add_do_method(vnode.ptr(), "set_default_input_value", 0, d["value"]);
- }
+ vnode = pget;
+ }
- undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, base_id);
+ undo_redo->add_do_method(script.ptr(), "add_node", edited_func, base_id, vnode, ofs);
+ undo_redo->add_do_method(vnode.ptr(), "set_property", d["property"]);
+ if (!use_get) {
+ undo_redo->add_do_method(vnode.ptr(), "set_default_input_value", 0, d["value"]);
+ }
- undo_redo->add_do_method(this, "_update_graph");
- undo_redo->add_undo_method(this, "_update_graph");
- undo_redo->commit_action();
+ undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, base_id);
- } else {
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
- if (use_get)
- undo_redo->create_action(TTR("Add Getter Property"));
- else
- undo_redo->create_action(TTR("Add Setter Property"));
+ } else {
- int base_id = script->get_available_id();
+ if (use_get)
+ undo_redo->create_action(TTR("Add Getter Property"));
+ else
+ undo_redo->create_action(TTR("Add Setter Property"));
- Ref<VisualScriptNode> vnode;
+ int base_id = script->get_available_id();
- if (!use_get) {
+ Ref<VisualScriptNode> vnode;
- Ref<VisualScriptPropertySet> pset;
- pset.instance();
- if (sn == node) {
- pset->set_call_mode(VisualScriptPropertySet::CALL_MODE_SELF);
- } else {
- pset->set_call_mode(VisualScriptPropertySet::CALL_MODE_NODE_PATH);
- pset->set_base_path(sn->get_path_to(node));
- }
+ if (!use_get) {
- vnode = pset;
+ Ref<VisualScriptPropertySet> pset;
+ pset.instance();
+ if (sn == node) {
+ pset->set_call_mode(VisualScriptPropertySet::CALL_MODE_SELF);
} else {
-
- Ref<VisualScriptPropertyGet> pget;
- pget.instance();
- if (sn == node) {
- pget->set_call_mode(VisualScriptPropertyGet::CALL_MODE_SELF);
- } else {
- pget->set_call_mode(VisualScriptPropertyGet::CALL_MODE_NODE_PATH);
- pget->set_base_path(sn->get_path_to(node));
- }
- vnode = pget;
- }
- undo_redo->add_do_method(script.ptr(), "add_node", edited_func, base_id, vnode, ofs);
- undo_redo->add_do_method(vnode.ptr(), "set_property", d["property"]);
- if (!use_get) {
- undo_redo->add_do_method(vnode.ptr(), "set_default_input_value", 0, d["value"]);
+ pset->set_call_mode(VisualScriptPropertySet::CALL_MODE_NODE_PATH);
+ pset->set_base_path(sn->get_path_to(node));
}
- undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, base_id);
- undo_redo->add_do_method(this, "_update_graph");
- undo_redo->add_undo_method(this, "_update_graph");
- undo_redo->commit_action();
+ vnode = pset;
+ } else {
+
+ Ref<VisualScriptPropertyGet> pget;
+ pget.instance();
+ if (sn == node) {
+ pget->set_call_mode(VisualScriptPropertyGet::CALL_MODE_SELF);
+ } else {
+ pget->set_call_mode(VisualScriptPropertyGet::CALL_MODE_NODE_PATH);
+ pget->set_base_path(sn->get_path_to(node));
+ }
+ vnode = pget;
+ }
+ undo_redo->add_do_method(script.ptr(), "add_node", edited_func, base_id, vnode, ofs);
+ undo_redo->add_do_method(vnode.ptr(), "set_property", d["property"]);
+ if (!use_get) {
+ undo_redo->add_do_method(vnode.ptr(), "set_default_input_value", 0, d["value"]);
}
+ undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, base_id);
+
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
}
}
}
@@ -2271,7 +2197,7 @@ void VisualScriptEditor::_move_node(String func, int p_id, const Vector2 &p_to)
if (Object::cast_to<GraphNode>(node))
Object::cast_to<GraphNode>(node)->set_offset(p_to);
}
- script->set_node_pos(edited_func, p_id, p_to / EDSCALE);
+ script->set_node_position(edited_func, p_id, p_to / EDSCALE);
}
void VisualScriptEditor::_node_moved(Vector2 p_from, Vector2 p_to, int p_id) {
@@ -2285,7 +2211,7 @@ void VisualScriptEditor::_remove_node(int p_id) {
undo_redo->create_action(TTR("Remove VisualScript Node"));
undo_redo->add_do_method(script.ptr(), "remove_node", edited_func, p_id);
- undo_redo->add_undo_method(script.ptr(), "add_node", edited_func, p_id, script->get_node(edited_func, p_id), script->get_node_pos(edited_func, p_id));
+ undo_redo->add_undo_method(script.ptr(), "add_node", edited_func, p_id, script->get_node(edited_func, p_id), script->get_node_position(edited_func, p_id));
List<VisualScript::SequenceConnection> sequence_conns;
script->get_sequence_connection_list(edited_func, &sequence_conns);
@@ -2686,21 +2612,21 @@ void VisualScriptEditor::_selected_connect_node_method_or_setget(const String &p
Ref<VisualScriptNode> vsn = script->get_node(edited_func, port_action_new_node);
- if (Object::cast_to<VisualScriptFunctionCall>(*vsn)) {
+ if (Object::cast_to<VisualScriptFunctionCall>(vsn.ptr())) {
Ref<VisualScriptFunctionCall> vsfc = vsn;
vsfc->set_function(p_text);
script->data_connect(edited_func, port_action_node, port_action_output, port_action_new_node, 0);
}
- if (Object::cast_to<VisualScriptPropertySet>(*vsn)) {
+ if (Object::cast_to<VisualScriptPropertySet>(vsn.ptr())) {
Ref<VisualScriptPropertySet> vsp = vsn;
vsp->set_property(p_text);
script->data_connect(edited_func, port_action_node, port_action_output, port_action_new_node, 0);
}
- if (Object::cast_to<VisualScriptPropertyGet>(*vsn)) {
+ if (Object::cast_to<VisualScriptPropertyGet>(vsn.ptr())) {
Ref<VisualScriptPropertyGet> vsp = vsn;
vsp->set_property(p_text);
@@ -2711,6 +2637,63 @@ void VisualScriptEditor::_selected_connect_node_method_or_setget(const String &p
_update_graph_connections();
}
+void VisualScriptEditor::_selected_new_virtual_method(const String &p_text) {
+
+ String name = p_text;
+ if (script->has_function(name)) {
+ EditorNode::get_singleton()->show_warning(vformat(TTR("Script already has function '%s'"), name));
+ return;
+ }
+
+ MethodInfo minfo;
+ {
+ List<MethodInfo> methods;
+ bool found = false;
+ ClassDB::get_virtual_methods(script->get_instance_base_type(), &methods);
+ for (List<MethodInfo>::Element *E = methods.front(); E; E = E->next()) {
+ if (E->get().name == name) {
+ minfo = E->get();
+ found = true;
+ }
+ }
+
+ ERR_FAIL_COND(!found);
+ }
+
+ selected = name;
+ edited_func = selected;
+ Ref<VisualScriptFunction> func_node;
+ func_node.instance();
+ func_node->set_name(name);
+
+ undo_redo->create_action(TTR("Add Function"));
+ undo_redo->add_do_method(script.ptr(), "add_function", name);
+
+ for (int i = 0; i < minfo.arguments.size(); i++) {
+ func_node->add_argument(minfo.arguments[i].type, minfo.arguments[i].name);
+ }
+
+ undo_redo->add_do_method(script.ptr(), "add_node", name, script->get_available_id(), func_node);
+ if (minfo.return_val.type != Variant::NIL || minfo.return_val.usage & PROPERTY_USAGE_NIL_IS_VARIANT) {
+ Ref<VisualScriptReturn> ret_node;
+ ret_node.instance();
+ ret_node->set_return_type(minfo.return_val.type);
+ ret_node->set_enable_return_value(true);
+ ret_node->set_name(name);
+ undo_redo->add_do_method(script.ptr(), "add_node", name, script->get_available_id() + 1, ret_node, Vector2(500, 0));
+ }
+
+ undo_redo->add_undo_method(script.ptr(), "remove_function", name);
+ undo_redo->add_do_method(this, "_update_members");
+ undo_redo->add_undo_method(this, "_update_members");
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+
+ undo_redo->commit_action();
+
+ _update_graph();
+}
+
void VisualScriptEditor::_cancel_connect_node_method_or_setget() {
script->remove_node(edited_func, port_action_new_node);
@@ -2783,6 +2766,27 @@ void VisualScriptEditor::_notification(int p_what) {
node_filter->add_icon_override("right_icon", Control::get_icon("Search", "EditorIcons"));
variable_editor->connect("changed", this, "_update_members");
signal_editor->connect("changed", this, "_update_members");
+
+ List<Pair<String, Color> > colors;
+ colors.push_back(Pair<String, Color>("flow_control", Color::html("#f4f4f4")));
+ colors.push_back(Pair<String, Color>("functions", Color::html("#f58581")));
+ colors.push_back(Pair<String, Color>("data", Color::html("#80f6cf")));
+ colors.push_back(Pair<String, Color>("operators", Color::html("#ab97df")));
+ colors.push_back(Pair<String, Color>("custom", Color::html("#80bbf6")));
+ colors.push_back(Pair<String, Color>("constants", Color::html("#f680b0")));
+
+ for (List<Pair<String, Color> >::Element *E = colors.front(); E; E = E->next()) {
+ print_line(E->get().first);
+ Ref<StyleBoxFlat> sb = EditorNode::get_singleton()->get_theme_base()->get_theme()->get_stylebox("frame", "GraphNode");
+ if (sb != NULL) {
+ Ref<StyleBoxFlat> frame_style = sb->duplicate();
+ Color c = sb->get_border_color(MARGIN_TOP);
+ Color cn = E->get().second;
+ cn.a = c.a;
+ frame_style->set_border_color_all(cn);
+ node_styles[E->get().first] = frame_style;
+ }
+ }
}
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
left_vsplit->set_visible(is_visible_in_tree());
@@ -2891,7 +2895,7 @@ void VisualScriptEditor::_menu_option(int p_what) {
}
if (node.is_valid()) {
clipboard->nodes[id] = node->duplicate();
- clipboard->nodes_positions[id] = script->get_node_pos(edited_func, id);
+ clipboard->nodes_positions[id] = script->get_node_position(edited_func, id);
}
}
}
@@ -2951,7 +2955,7 @@ void VisualScriptEditor::_menu_option(int p_what) {
List<int> nodes;
script->get_node_list(edited_func, &nodes);
for (List<int>::Element *E = nodes.front(); E; E = E->next()) {
- Vector2 pos = script->get_node_pos(edited_func, E->get()).snapped(Vector2(2, 2));
+ Vector2 pos = script->get_node_position(edited_func, E->get()).snapped(Vector2(2, 2));
existing_positions.insert(pos);
}
}
@@ -3014,7 +3018,7 @@ void VisualScriptEditor::_member_rmb_selected(const Vector2 &p_pos) {
TreeItem *root = members->get_root();
- Ref<Texture> del_icon = Control::get_icon("Del", "EditorIcons");
+ Ref<Texture> del_icon = Control::get_icon("Remove", "EditorIcons");
Ref<Texture> edit_icon = Control::get_icon("Edit", "EditorIcons");
@@ -3065,7 +3069,7 @@ void VisualScriptEditor::_member_option(int p_option) {
List<int> nodes;
script->get_node_list(name, &nodes);
for (List<int>::Element *E = nodes.front(); E; E = E->next()) {
- undo_redo->add_undo_method(script.ptr(), "add_node", name, E->get(), script->get_node(name, E->get()), script->get_node_pos(name, E->get()));
+ undo_redo->add_undo_method(script.ptr(), "add_node", name, E->get(), script->get_node(name, E->get()), script->get_node_position(name, E->get()));
}
List<VisualScript::SequenceConnection> seq_connections;
@@ -3147,7 +3151,6 @@ void VisualScriptEditor::_bind_methods() {
ClassDB::bind_method("_update_members", &VisualScriptEditor::_update_members);
ClassDB::bind_method("_change_base_type", &VisualScriptEditor::_change_base_type);
ClassDB::bind_method("_change_base_type_callback", &VisualScriptEditor::_change_base_type_callback);
- ClassDB::bind_method("_override_pressed", &VisualScriptEditor::_override_pressed);
ClassDB::bind_method("_node_selected", &VisualScriptEditor::_node_selected);
ClassDB::bind_method("_node_moved", &VisualScriptEditor::_node_moved);
ClassDB::bind_method("_move_node", &VisualScriptEditor::_move_node);
@@ -3166,6 +3169,8 @@ void VisualScriptEditor::_bind_methods() {
ClassDB::bind_method("_button_resource_previewed", &VisualScriptEditor::_button_resource_previewed);
ClassDB::bind_method("_port_action_menu", &VisualScriptEditor::_port_action_menu);
ClassDB::bind_method("_selected_connect_node_method_or_setget", &VisualScriptEditor::_selected_connect_node_method_or_setget);
+ ClassDB::bind_method("_selected_new_virtual_method", &VisualScriptEditor::_selected_new_virtual_method);
+
ClassDB::bind_method("_cancel_connect_node_method_or_setget", &VisualScriptEditor::_cancel_connect_node_method_or_setget);
ClassDB::bind_method("_expression_text_changed", &VisualScriptEditor::_expression_text_changed);
@@ -3344,9 +3349,6 @@ VisualScriptEditor::VisualScriptEditor() {
undo_redo = EditorNode::get_singleton()->get_undo_redo();
- new_function_menu = memnew(PopupMenu);
- new_function_menu->connect("id_pressed", this, "_override_pressed");
- add_child(new_function_menu);
updating_members = false;
set_process_input(true); //for revert on drag
@@ -3366,6 +3368,11 @@ VisualScriptEditor::VisualScriptEditor() {
new_connect_node_select->connect("selected", this, "_selected_connect_node_method_or_setget");
new_connect_node_select->get_cancel()->connect("pressed", this, "_cancel_connect_node_method_or_setget");
+ new_virtual_method_select = memnew(PropertySelector);
+ add_child(new_virtual_method_select);
+ new_virtual_method_select->connect("selected", this, "_selected_new_virtual_method");
+ new_virtual_method_select->get_cancel()->connect("pressed", this, "_selected_new_virtual_method");
+
port_action_popup = memnew(PopupMenu);
add_child(port_action_popup);
port_action_popup->connect("id_pressed", this, "_port_action_menu");
@@ -3403,12 +3410,6 @@ void VisualScriptEditor::free_clipboard() {
static void register_editor_callback() {
ScriptEditor::register_create_script_editor_function(create_editor);
- EditorSettings::get_singleton()->set("editors/visual_script/color_functions", Color(1, 0.9, 0.9));
- EditorSettings::get_singleton()->set("editors/visual_script/color_data", Color(0.9, 1.0, 0.9));
- EditorSettings::get_singleton()->set("editors/visual_script/color_operators", Color(0.9, 0.9, 1.0));
- EditorSettings::get_singleton()->set("editors/visual_script/color_flow_control", Color(1.0, 1.0, 1.0));
- EditorSettings::get_singleton()->set("editors/visual_script/color_custom", Color(0.8, 1.0, 1.0));
- EditorSettings::get_singleton()->set("editors/visual_script/color_constants", Color(1.0, 0.8, 1.0));
ED_SHORTCUT("visual_script_editor/delete_selected", TTR("Delete Selected"));
ED_SHORTCUT("visual_script_editor/toggle_breakpoint", TTR("Toggle Breakpoint"), KEY_F9);