summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/gdscript/gd_parser.cpp21
-rw-r--r--modules/visual_script/visual_script_editor.cpp8
-rw-r--r--modules/visual_script/visual_script_editor.h1
3 files changed, 29 insertions, 1 deletions
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index 7d3857266e..b349b6b9a8 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -1894,7 +1894,26 @@ GDParser::PatternNode *GDParser::_parse_pattern(bool p_static) {
return NULL;
}
- if (value->type != Node::TYPE_IDENTIFIER && value->type != Node::TYPE_CONSTANT) {
+ if (value->type == Node::TYPE_OPERATOR) {
+ // Maybe it's SomeEnum.VALUE
+ Node *current_value = value;
+
+ while (current_value->type == Node::TYPE_OPERATOR) {
+ OperatorNode *op_node = static_cast<OperatorNode *>(current_value);
+
+ if (op_node->op != OperatorNode::OP_INDEX_NAMED) {
+ _set_error("Invalid operator in pattern. Only index (`A.B`) is allowed");
+ return NULL;
+ }
+ current_value = op_node->arguments[0];
+ }
+
+ if (current_value->type != Node::TYPE_IDENTIFIER) {
+ _set_error("Only constant expression or variables allowed in a pattern");
+ return NULL;
+ }
+
+ } else if (value->type != Node::TYPE_IDENTIFIER && value->type != Node::TYPE_CONSTANT) {
_set_error("Only constant expressions or variables allowed in a pattern");
return NULL;
}
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index b9e7a6ffc4..e7aaf0aa4a 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -2716,6 +2716,12 @@ void VisualScriptEditor::_selected_connect_node_method_or_setget(const String &p
_update_graph_connections();
}
+void VisualScriptEditor::_cancel_connect_node_method_or_setget() {
+
+ script->remove_node(edited_func, port_action_new_node);
+ _update_graph();
+}
+
void VisualScriptEditor::_default_value_changed() {
Ref<VisualScriptNode> vsn = script->get_node(edited_func, editing_id);
@@ -3167,6 +3173,7 @@ 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("_cancel_connect_node_method_or_setget", &VisualScriptEditor::_cancel_connect_node_method_or_setget);
ClassDB::bind_method("_expression_text_changed", &VisualScriptEditor::_expression_text_changed);
ClassDB::bind_method("get_drag_data_fw", &VisualScriptEditor::get_drag_data_fw);
@@ -3364,6 +3371,7 @@ VisualScriptEditor::VisualScriptEditor() {
new_connect_node_select = memnew(PropertySelector);
add_child(new_connect_node_select);
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");
port_action_popup = memnew(PopupMenu);
add_child(port_action_popup);
diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h
index fee4e27bd5..e68711a036 100644
--- a/modules/visual_script/visual_script_editor.h
+++ b/modules/visual_script/visual_script_editor.h
@@ -176,6 +176,7 @@ class VisualScriptEditor : public ScriptEditorBase {
int port_action_new_node;
void _port_action_menu(int p_option);
void _selected_connect_node_method_or_setget(const String &p_text);
+ void _cancel_connect_node_method_or_setget();
int error_line;