summaryrefslogtreecommitdiff
path: root/modules/gdscript
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript')
-rw-r--r--modules/gdscript/SCsub3
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.cpp (renamed from modules/gdscript/gdscript_highlighter.cpp)73
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.h (renamed from modules/gdscript/gdscript_highlighter.h)14
-rw-r--r--modules/gdscript/gdscript.cpp9
-rw-r--r--modules/gdscript/gdscript.h6
-rw-r--r--modules/gdscript/gdscript_compiler.cpp27
-rw-r--r--modules/gdscript/gdscript_compiler.h3
-rw-r--r--modules/gdscript/gdscript_editor.cpp35
-rw-r--r--modules/gdscript/gdscript_function.cpp17
-rw-r--r--modules/gdscript/gdscript_function.h10
-rw-r--r--modules/gdscript/gdscript_functions.cpp40
-rw-r--r--modules/gdscript/gdscript_functions.h1
-rw-r--r--modules/gdscript/gdscript_parser.cpp58
-rw-r--r--modules/gdscript/register_types.cpp2
14 files changed, 248 insertions, 50 deletions
diff --git a/modules/gdscript/SCsub b/modules/gdscript/SCsub
index 13870170a5..73f09f1659 100644
--- a/modules/gdscript/SCsub
+++ b/modules/gdscript/SCsub
@@ -7,4 +7,7 @@ env_gdscript = env_modules.Clone()
env_gdscript.add_source_files(env.modules_sources, "*.cpp")
+if env['tools']:
+ env_gdscript.add_source_files(env.modules_sources, "./editor/*.cpp")
+
Export('env')
diff --git a/modules/gdscript/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp
index 4e89851bf2..ea3efff9cf 100644
--- a/modules/gdscript/gdscript_highlighter.cpp
+++ b/modules/gdscript/editor/gdscript_highlighter.cpp
@@ -29,6 +29,8 @@
/*************************************************************************/
#include "gdscript_highlighter.h"
+#include "../gdscript_tokenizer.h"
+#include "editor/editor_settings.h"
#include "scene/gui/text_edit.h"
inline bool _is_symbol(CharType c) {
@@ -61,12 +63,20 @@ static bool _is_hex_symbol(CharType c) {
Map<int, TextEdit::HighlighterInfo> GDScriptSyntaxHighlighter::_get_line_syntax_highlighting(int p_line) {
Map<int, TextEdit::HighlighterInfo> color_map;
+ Type next_type = NONE;
+ Type current_type = NONE;
+ Type previous_type = NONE;
+
+ String previous_text = "";
+ int previous_column = 0;
+
bool prev_is_char = false;
bool prev_is_number = false;
bool in_keyword = false;
bool in_word = false;
bool in_function_name = false;
bool in_member_variable = false;
+ bool in_node_path = false;
bool is_hex_notation = false;
Color keyword_color;
Color color;
@@ -214,18 +224,64 @@ Map<int, TextEdit::HighlighterInfo> GDScriptSyntaxHighlighter::_get_line_syntax_
in_member_variable = false;
}
- if (in_region >= 0)
+ if (!in_node_path && in_region == -1 && str[j] == '$') {
+ in_node_path = true;
+ } else if (in_region != -1 || (is_symbol && str[j] != '/')) {
+ in_node_path = false;
+ }
+
+ if (in_region >= 0) {
+ next_type = REGION;
color = text_editor->_get_color_region(in_region).color;
- else if (in_keyword)
+ } else if (in_node_path) {
+ next_type = NODE_PATH;
+ color = node_path_color;
+ } else if (in_keyword) {
+ next_type = KEYWORD;
color = keyword_color;
- else if (in_member_variable)
+ } else if (in_member_variable) {
+ next_type = MEMBER;
color = member_color;
- else if (in_function_name)
- color = function_color;
- else if (is_symbol)
+ } else if (in_function_name) {
+ next_type = FUNCTION;
+
+ if (previous_text == GDScriptTokenizer::get_token_name(GDScriptTokenizer::TK_PR_FUNCTION)) {
+ color = function_definition_color;
+ } else {
+ color = function_color;
+ }
+ } else if (is_symbol) {
+ next_type = SYMBOL;
color = symbol_color;
- else if (is_number)
+ } else if (is_number) {
+ next_type = NUMBER;
color = number_color;
+ } else {
+ next_type = IDENTIFIER;
+ }
+
+ if (next_type != current_type) {
+ if (current_type == NONE) {
+ current_type = next_type;
+ } else {
+ previous_type = current_type;
+ current_type = next_type;
+
+ // no need to store regions...
+ if (previous_type == REGION) {
+ previous_text = "";
+ previous_column = j;
+ } else {
+ String text = str.substr(previous_column, j - previous_column).strip_edges();
+ previous_column = j;
+
+ // ignore if just whitespace
+ if (text != "") {
+ previous_text = text;
+ }
+ }
+ }
+ }
prev_is_char = is_char;
prev_is_number = is_number;
@@ -255,6 +311,9 @@ void GDScriptSyntaxHighlighter::_update_cache() {
function_color = text_editor->get_color("function_color");
number_color = text_editor->get_color("number_color");
member_color = text_editor->get_color("member_variable_color");
+
+ function_definition_color = EDITOR_DEF("text_editor/highlighting/gdscript/function_definition_color", Color::html("#01e1ff"));
+ node_path_color = EDITOR_DEF("text_editor/highlighting/gdscript/node_path_color", Color::html("#64c15a"));
}
SyntaxHighlighter *GDScriptSyntaxHighlighter::create() {
diff --git a/modules/gdscript/gdscript_highlighter.h b/modules/gdscript/editor/gdscript_highlighter.h
index ef1bdd4103..0296ab7652 100644
--- a/modules/gdscript/gdscript_highlighter.h
+++ b/modules/gdscript/editor/gdscript_highlighter.h
@@ -35,13 +35,27 @@
class GDScriptSyntaxHighlighter : public SyntaxHighlighter {
private:
+ enum Type {
+ NONE,
+ REGION,
+ NODE_PATH,
+ SYMBOL,
+ NUMBER,
+ FUNCTION,
+ KEYWORD,
+ MEMBER,
+ IDENTIFIER
+ };
+
// colours
Color font_color;
Color symbol_color;
Color function_color;
+ Color function_definition_color;
Color built_in_type_color;
Color number_color;
Color member_color;
+ Color node_path_color;
public:
static SyntaxHighlighter *create();
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 4e3ee4d22c..14bdce50ec 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -1333,6 +1333,15 @@ void GDScriptLanguage::add_global_constant(const StringName &p_variable, const V
_add_global(p_variable, p_value);
}
+void GDScriptLanguage::add_named_global_constant(const StringName &p_name, const Variant &p_value) {
+ named_globals[p_name] = p_value;
+}
+
+void GDScriptLanguage::remove_named_global_constant(const StringName &p_name) {
+ ERR_FAIL_COND(!named_globals.has(p_name));
+ named_globals.erase(p_name);
+}
+
void GDScriptLanguage::init() {
//populate global constants
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index 9566e3b32e..6885fbb7fe 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -262,6 +262,7 @@ class GDScriptLanguage : public ScriptLanguage {
Variant *_global_array;
Vector<Variant> global_array;
Map<StringName, int> globals;
+ Map<StringName, Variant> named_globals;
struct CallLevel {
@@ -369,7 +370,8 @@ public:
_FORCE_INLINE_ int get_global_array_size() const { return global_array.size(); }
_FORCE_INLINE_ Variant *get_global_array() { return _global_array; }
- _FORCE_INLINE_ const Map<StringName, int> &get_global_map() { return globals; }
+ _FORCE_INLINE_ const Map<StringName, int> &get_global_map() const { return globals; }
+ _FORCE_INLINE_ const Map<StringName, Variant> &get_named_globals_map() const { return named_globals; }
_FORCE_INLINE_ static GDScriptLanguage *get_singleton() { return singleton; }
@@ -403,6 +405,8 @@ public:
virtual String _get_indentation() const;
virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const;
virtual void add_global_constant(const StringName &p_variable, const Variant &p_value);
+ virtual void add_named_global_constant(const StringName &p_name, const Variant &p_value);
+ virtual void remove_named_global_constant(const StringName &p_name);
/* DEBUGGER FUNCTIONS */
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index 048948dada..5c834966c5 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -278,6 +278,18 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
return idx | (GDScriptFunction::ADDR_TYPE_GLOBAL << GDScriptFunction::ADDR_BITS); //argument (stack root)
}
+#ifdef TOOLS_ENABLED
+ if (GDScriptLanguage::get_singleton()->get_named_globals_map().has(identifier)) {
+
+ int idx = codegen.named_globals.find(identifier);
+ if (idx == -1) {
+ idx = codegen.named_globals.size();
+ codegen.named_globals.push_back(identifier);
+ }
+ return idx | (GDScriptFunction::ADDR_TYPE_NAMED_GLOBAL << GDScriptFunction::ADDR_BITS);
+ }
+#endif
+
//not found, error
_set_error("Identifier not found: " + String(identifier), p_expression);
@@ -726,6 +738,9 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
case GDScriptParser::OperatorNode::OP_NEG: {
if (!_create_unary_operator(codegen, on, Variant::OP_NEGATE, p_stack_level)) return -1;
} break;
+ case GDScriptParser::OperatorNode::OP_POS: {
+ if (!_create_unary_operator(codegen, on, Variant::OP_POSITIVE, p_stack_level)) return -1;
+ } break;
case GDScriptParser::OperatorNode::OP_NOT: {
if (!_create_unary_operator(codegen, on, Variant::OP_NOT, p_stack_level)) return -1;
} break;
@@ -1511,6 +1526,18 @@ Error GDScriptCompiler::_parse_function(GDScript *p_script, const GDScriptParser
gdfunc->_global_names_count = 0;
}
+#ifdef TOOLS_ENABLED
+ // Named globals
+ if (codegen.named_globals.size()) {
+ gdfunc->named_globals.resize(codegen.named_globals.size());
+ gdfunc->_named_globals_ptr = gdfunc->named_globals.ptr();
+ for (int i = 0; i < codegen.named_globals.size(); i++) {
+ gdfunc->named_globals[i] = codegen.named_globals[i];
+ }
+ gdfunc->_named_globals_count = gdfunc->named_globals.size();
+ }
+#endif
+
if (codegen.opcodes.size()) {
gdfunc->code = codegen.opcodes;
diff --git a/modules/gdscript/gdscript_compiler.h b/modules/gdscript/gdscript_compiler.h
index 62aafdbe01..237b0de9e7 100644
--- a/modules/gdscript/gdscript_compiler.h
+++ b/modules/gdscript/gdscript_compiler.h
@@ -94,6 +94,9 @@ class GDScriptCompiler {
HashMap<Variant, int, VariantHasher, VariantComparator> constant_map;
Map<StringName, int> name_map;
+#ifdef TOOLS_ENABLED
+ Vector<StringName> named_globals;
+#endif
int get_name_map_pos(const StringName &p_identifier) {
int ret;
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 0d52f0a995..4286412c14 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -61,7 +61,7 @@ Ref<Script> GDScriptLanguage::get_template(const String &p_class_name, const Str
"# var b = \"textvar\"\n\n" +
"func _ready():\n" +
"%TS%# Called when the node is added to the scene for the first time.\n" +
- "%TS%# Initialization here\n" +
+ "%TS%# Initialization here.\n" +
"%TS%pass\n\n" +
"#func _process(delta):\n" +
"#%TS%# Called every frame. Delta is time since last frame.\n" +
@@ -416,7 +416,7 @@ String GDScriptLanguage::make_function(const String &p_class, const String &p_na
s += p_args[i].get_slice(":", 0);
}
}
- s += "):\n" + _get_indentation() + "pass # replace with function body\n";
+ s += "):\n" + _get_indentation() + "pass # Replace with function body.\n";
return s;
}
@@ -430,6 +430,9 @@ struct GDScriptCompletionIdentifier {
Ref<GDScript> script;
Variant::Type type;
Variant value; //im case there is a value, also return it
+
+ GDScriptCompletionIdentifier() :
+ type(Variant::NIL) {}
};
static GDScriptCompletionIdentifier _get_type_from_variant(const Variant &p_variant, bool p_allow_gdnative_class = false) {
@@ -551,9 +554,7 @@ static Ref<Reference> _get_parent_class(GDScriptCompletionContext &context) {
static GDScriptCompletionIdentifier _get_native_class(GDScriptCompletionContext &context) {
- //eeh...
GDScriptCompletionIdentifier id;
- id.type = Variant::NIL;
REF pc = _get_parent_class(context);
if (!pc.is_valid()) {
@@ -1521,6 +1522,13 @@ static void _find_identifiers(GDScriptCompletionContext &context, int p_line, bo
result.insert(_type_names[i]);
}
+ List<String> reserved_words;
+ GDScriptLanguage::get_singleton()->get_reserved_words(&reserved_words);
+
+ for (List<String>::Element *E = reserved_words.front(); E; E = E->next()) {
+ result.insert(E->get());
+ }
+
//autoload singletons
List<PropertyInfo> props;
ProjectSettings::get_singleton()->get_property_list(&props);
@@ -2628,6 +2636,13 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol
}
}
+ if ("PI" == p_symbol || "TAU" == p_symbol || "INF" == p_symbol || "NAN" == p_symbol) {
+ r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT;
+ r_result.class_name = "@GDScript";
+ r_result.class_member = p_symbol;
+ return OK;
+ }
+
GDScriptParser p;
p.parse(p_code, p_base_path, false, "", true);
@@ -2641,6 +2656,18 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol
context.function = p.get_completion_function();
context.base = p_owner;
context.base_path = p_base_path;
+
+ if (context._class && context._class->extends_class.size() > 0) {
+ bool success = false;
+ ClassDB::get_integer_constant(context._class->extends_class[0], p_symbol, &success);
+ if (success) {
+ r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT;
+ r_result.class_name = context._class->extends_class[0];
+ r_result.class_member = p_symbol;
+ return OK;
+ }
+ }
+
bool isfunction = false;
switch (p.get_completion_type()) {
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp
index d32ce25d3c..dac7da3a28 100644
--- a/modules/gdscript/gdscript_function.cpp
+++ b/modules/gdscript/gdscript_function.cpp
@@ -108,6 +108,21 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
#endif
return &GDScriptLanguage::get_singleton()->get_global_array()[address];
} break;
+#ifdef TOOLS_ENABLED
+ case ADDR_TYPE_NAMED_GLOBAL: {
+#ifdef DEBUG_ENABLED
+ ERR_FAIL_INDEX_V(address, _named_globals_count, NULL);
+#endif
+ StringName id = _named_globals_ptr[address];
+
+ if (GDScriptLanguage::get_singleton()->get_named_globals_map().has(id)) {
+ return (Variant *)&GDScriptLanguage::get_singleton()->get_named_globals_map()[id];
+ } else {
+ r_error = "Autoload singleton '" + String(id) + "' has been removed.";
+ return NULL;
+ }
+ } break;
+#endif
case ADDR_TYPE_NIL: {
return &nil;
} break;
@@ -1311,9 +1326,9 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
GDScriptLanguage::get_singleton()->script_frame_time += time_taken - function_call_time;
}
-#endif
if (ScriptDebugger::get_singleton())
GDScriptLanguage::get_singleton()->exit_function();
+#endif
if (_stack_size) {
//free stack
diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h
index dff4bdfaf2..ea009dcd96 100644
--- a/modules/gdscript/gdscript_function.h
+++ b/modules/gdscript/gdscript_function.h
@@ -92,7 +92,8 @@ public:
ADDR_TYPE_STACK = 5,
ADDR_TYPE_STACK_VARIABLE = 6,
ADDR_TYPE_GLOBAL = 7,
- ADDR_TYPE_NIL = 8
+ ADDR_TYPE_NAMED_GLOBAL = 8,
+ ADDR_TYPE_NIL = 9
};
enum RPCMode {
@@ -121,6 +122,10 @@ private:
int _constant_count;
const StringName *_global_names_ptr;
int _global_names_count;
+#ifdef TOOLS_ENABLED
+ const StringName *_named_globals_ptr;
+ int _named_globals_count;
+#endif
const int *_default_arg_ptr;
int _default_arg_count;
const int *_code_ptr;
@@ -137,6 +142,9 @@ private:
StringName name;
Vector<Variant> constants;
Vector<StringName> global_names;
+#ifdef TOOLS_ENABLED
+ Vector<StringName> named_globals;
+#endif
Vector<int> default_arguments;
Vector<int> code;
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp
index 278585cb01..a88ba477c6 100644
--- a/modules/gdscript/gdscript_functions.cpp
+++ b/modules/gdscript/gdscript_functions.cpp
@@ -122,6 +122,7 @@ const char *GDScriptFunctions::get_func_name(Function p_func) {
"print_stack",
"instance_from_id",
"len",
+ "is_instance_valid",
};
return _names[p_func];
@@ -329,10 +330,24 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
} break;
case MATH_LERP: {
VALIDATE_ARG_COUNT(3);
- VALIDATE_ARG_NUM(0);
- VALIDATE_ARG_NUM(1);
VALIDATE_ARG_NUM(2);
- r_ret = Math::lerp((double)*p_args[0], (double)*p_args[1], (double)*p_args[2]);
+ const double t = (double)*p_args[2];
+ switch (p_args[0]->get_type() == p_args[1]->get_type() ? p_args[0]->get_type() : Variant::REAL) {
+ case Variant::VECTOR2: {
+ r_ret = ((Vector2)*p_args[0]).linear_interpolate((Vector2)*p_args[1], t);
+ } break;
+ case Variant::VECTOR3: {
+ r_ret = ((Vector3)*p_args[0]).linear_interpolate((Vector3)*p_args[1], t);
+ } break;
+ case Variant::COLOR: {
+ r_ret = ((Color)*p_args[0]).linear_interpolate((Color)*p_args[1], t);
+ } break;
+ default: {
+ VALIDATE_ARG_NUM(0);
+ VALIDATE_ARG_NUM(1);
+ r_ret = Math::lerp((double)*p_args[0], (double)*p_args[1], t);
+ } break;
+ }
} break;
case MATH_INVERSE_LERP: {
VALIDATE_ARG_COUNT(3);
@@ -1277,6 +1292,17 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
}
} break;
+ case IS_INSTANCE_VALID: {
+
+ VALIDATE_ARG_COUNT(1);
+ if (p_args[0]->get_type() != Variant::OBJECT) {
+ r_ret = false;
+ } else {
+ Object *obj = *p_args[0];
+ r_ret = ObjectDB::instance_validate(obj);
+ }
+
+ } break;
case FUNC_MAX: {
ERR_FAIL();
@@ -1488,7 +1514,7 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) {
return mi;
} break;
case MATH_LERP: {
- MethodInfo mi("lerp", PropertyInfo(Variant::REAL, "from"), PropertyInfo(Variant::REAL, "to"), PropertyInfo(Variant::REAL, "weight"));
+ MethodInfo mi("lerp", PropertyInfo(Variant::NIL, "from"), PropertyInfo(Variant::NIL, "to"), PropertyInfo(Variant::REAL, "weight"));
mi.return_val.type = Variant::REAL;
return mi;
} break;
@@ -1798,7 +1824,11 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) {
mi.return_val.type = Variant::INT;
return mi;
} break;
-
+ case IS_INSTANCE_VALID: {
+ MethodInfo mi("is_instance_valid", PropertyInfo(Variant::OBJECT, "instance"));
+ mi.return_val.type = Variant::BOOL;
+ return mi;
+ } break;
case FUNC_MAX: {
ERR_FAIL_V(MethodInfo());
diff --git a/modules/gdscript/gdscript_functions.h b/modules/gdscript/gdscript_functions.h
index 1d54006084..c4731d17a4 100644
--- a/modules/gdscript/gdscript_functions.h
+++ b/modules/gdscript/gdscript_functions.h
@@ -113,6 +113,7 @@ public:
PRINT_STACK,
INSTANCE_FROM_ID,
LEN,
+ IS_INSTANCE_VALID,
FUNC_MAX
};
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 774e9e62ee..e7b0700e76 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -3440,6 +3440,22 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_OPEN) {
tokenizer->advance();
+
+ String hint_prefix = "";
+ bool is_arrayed = false;
+
+ while (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_TYPE &&
+ tokenizer->get_token_type() == Variant::ARRAY &&
+ tokenizer->get_token(1) == GDScriptTokenizer::TK_COMMA) {
+ tokenizer->advance(); // Array
+ tokenizer->advance(); // Comma
+ if (is_arrayed) {
+ hint_prefix += itos(Variant::ARRAY) + ":";
+ } else {
+ is_arrayed = true;
+ }
+ }
+
if (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_TYPE) {
Variant::Type type = tokenizer->get_token_type();
@@ -3455,28 +3471,6 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
current_export.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE;
tokenizer->advance();
- String hint_prefix = "";
-
- if (type == Variant::ARRAY && tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) {
- tokenizer->advance();
-
- while (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_TYPE) {
- type = tokenizer->get_token_type();
-
- tokenizer->advance();
-
- if (type == Variant::ARRAY) {
- hint_prefix += itos(Variant::ARRAY) + ":";
- if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) {
- tokenizer->advance();
- }
- } else {
- hint_prefix += itos(type);
- break;
- }
- }
- }
-
if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) {
// hint expected next!
tokenizer->advance();
@@ -3830,13 +3824,6 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
} break;
}
}
- if (current_export.type == Variant::ARRAY && !hint_prefix.empty()) {
- if (current_export.hint) {
- hint_prefix += "/" + itos(current_export.hint);
- }
- current_export.hint_string = hint_prefix + ":" + current_export.hint_string;
- current_export.hint = PROPERTY_HINT_NONE;
- }
} else {
@@ -3923,6 +3910,16 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
return;
}
+ if (is_arrayed) {
+ hint_prefix += itos(current_export.type);
+ if (current_export.hint) {
+ hint_prefix += "/" + itos(current_export.hint);
+ }
+ current_export.hint_string = hint_prefix + ":" + current_export.hint_string;
+ current_export.hint = PROPERTY_HINT_TYPE_STRING;
+ current_export.type = Variant::ARRAY;
+ }
+
tokenizer->advance();
}
@@ -4090,7 +4087,8 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
member._export.type=Variant::DICTIONARY;
- } else*/ {
+ } else*/
+ {
if (subexpr->type != Node::TYPE_CONSTANT) {
diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp
index 85c94c3596..422223370b 100644
--- a/modules/gdscript/register_types.cpp
+++ b/modules/gdscript/register_types.cpp
@@ -30,8 +30,8 @@
#include "register_types.h"
+#include "editor/gdscript_highlighter.h"
#include "gdscript.h"
-#include "gdscript_highlighter.h"
#include "gdscript_tokenizer.h"
#include "io/file_access_encrypted.h"
#include "io/resource_loader.h"