From 1d45c9a04c4c755843a162b872e59680fcb9c94d Mon Sep 17 00:00:00 2001 From: George Marques Date: Sun, 20 Sep 2015 16:17:30 -0300 Subject: Make dict2inst set internal members of instance Fix #2490 --- modules/gdscript/gd_functions.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'modules/gdscript') diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp index 37ddb2bc41..6f51ac5312 100644 --- a/modules/gdscript/gd_functions.cpp +++ b/modules/gdscript/gd_functions.cpp @@ -904,6 +904,15 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va r_ret = gdscr->_new(NULL,0,r_error); + GDInstance *ins = static_cast(static_cast(r_ret)->get_script_instance()); + Ref gd_ref = ins->get_script(); + + for(Map::Element *E = gd_ref->member_indices.front(); E; E = E->next()) { + if(d.has(E->key())) { + ins->members[E->get().index] = d[E->key()]; + } + } + } break; case HASH: { -- cgit v1.2.3 From e18c1ba05b5a92c15b987d604a84749b26929ded Mon Sep 17 00:00:00 2001 From: eska Date: Fri, 16 Oct 2015 16:18:46 +0200 Subject: Revert "add flag and multiline hits in GDScript" This reverts commit 7843ec6633625455e689e711aa62e9d8337689fa. --- modules/gdscript/gd_parser.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'modules/gdscript') diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index 9c39051b7f..32c24909a8 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -2607,23 +2607,16 @@ void GDParser::_parse_class(ClassNode *p_class) { } else if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER) { String identifier = tokenizer->get_token_identifier(); - 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; + 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; + tokenizer->advance(); } -- cgit v1.2.3 From 57b2c4b0c6334b37d150a1945dfef45fb0783e94 Mon Sep 17 00:00:00 2001 From: eska Date: Fri, 16 Oct 2015 16:39:59 +0200 Subject: Add multiline string GDScript export hint `export(String, MULTILINE)` --- modules/gdscript/gd_parser.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'modules/gdscript') diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index 32c24909a8..47f39e9e81 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -2571,6 +2571,17 @@ void GDParser::_parse_class(ClassNode *p_class) { } break; } + + if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier()=="MULTILINE") { + + current_export.hint=PROPERTY_HINT_MULTILINE_TEXT; + tokenizer->advance(); + if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_CLOSE) { + _set_error("Expected ')' in hint."); + return; + } + break; + } } break; case Variant::COLOR: { -- cgit v1.2.3 From eb9621624fbb508635d192f29089b043e8bee5d0 Mon Sep 17 00:00:00 2001 From: eska Date: Fri, 16 Oct 2015 20:37:13 +0200 Subject: Add GDScript export hint for real numbers with easing `export(float, EASE)` --- modules/gdscript/gd_parser.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'modules/gdscript') diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index 47f39e9e81..313fb57d0e 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -2421,6 +2421,16 @@ void GDParser::_parse_class(ClassNode *p_class) { }; //fallthrough to use the same case Variant::REAL: { + if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier()=="EASE") { + current_export.hint=PROPERTY_HINT_EXP_EASING; + tokenizer->advance(); + if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_CLOSE) { + _set_error("Expected ')' in hint."); + return; + } + break; + } + float sign=1.0; if (tokenizer->get_token()==GDTokenizer::TK_OP_SUB) { -- cgit v1.2.3