From dd09ae50e117f618381480d4f1281536b557ae0b Mon Sep 17 00:00:00 2001 From: Ovnuniarchos Date: Mon, 20 Jul 2015 20:02:46 +0200 Subject: Added FLAGS to int hint to make an int a bitmask on the editor. --- modules/gdscript/gd_parser.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'modules/gdscript/gd_parser.cpp') diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index afe8c9aa71..50036e7b83 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -2315,6 +2315,17 @@ void GDParser::_parse_class(ClassNode *p_class) { case Variant::INT: { + if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier()=="FLAGS") { + + current_export.hint=PROPERTY_HINT_ALL_FLAGS; + tokenizer->advance(); + if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_CLOSE) { + _set_error("Expected ')' in hint."); + return; + } + break; + } + if (tokenizer->get_token()==GDTokenizer::TK_CONSTANT && tokenizer->get_token_constant().get_type()==Variant::STRING) { //enumeration current_export.hint=PROPERTY_HINT_ENUM; -- cgit v1.2.3 From 7843ec6633625455e689e711aa62e9d8337689fa Mon Sep 17 00:00:00 2001 From: Gen Date: Sat, 1 Aug 2015 14:02:10 +0800 Subject: add flag and multiline hits in GDScript `export (flag) var test` for PROPERTY_HINT_ALL_FLAGS `export (multiline) var test` for PROPERTY_HINT_MULTILINE_TEXT --- modules/gdscript/gd_parser.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'modules/gdscript/gd_parser.cpp') diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index afe8c9aa71..755997ef31 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -2542,16 +2542,23 @@ void GDParser::_parse_class(ClassNode *p_class) { } else if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER) { String identifier = tokenizer->get_token_identifier(); - if (!ObjectTypeDB::is_type(identifier,"Resource")) { - - current_export=PropertyInfo(); - _set_error("Export hint not a type or resource."); + if (identifier == "flag") { + current_export.type=Variant::INT; + current_export.hint=PROPERTY_HINT_ALL_FLAGS; + }else if (identifier == "multiline"){ + current_export.type=Variant::STRING; + current_export.hint=PROPERTY_HINT_MULTILINE_TEXT; + } else { + if (!ObjectTypeDB::is_type(identifier,"Resource")) { + + current_export=PropertyInfo(); + _set_error("Export hint not a type or resource."); + } + + current_export.type=Variant::OBJECT; + current_export.hint=PROPERTY_HINT_RESOURCE_TYPE; + current_export.hint_string=identifier; } - - current_export.type=Variant::OBJECT; - current_export.hint=PROPERTY_HINT_RESOURCE_TYPE; - current_export.hint_string=identifier; - tokenizer->advance(); } -- cgit v1.2.3