diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-10-17 10:11:11 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-10-17 10:11:11 -0300 |
commit | e1e04c1dd5f577e2bf9957d9524237f42c26d822 (patch) | |
tree | 7fd7f619a4d738cb331ad819188fdf424d692d05 | |
parent | 1028ab9d8101fef197cfcd4cf83ef4be320dc540 (diff) | |
parent | 1d45c9a04c4c755843a162b872e59680fcb9c94d (diff) |
Merge pull request #2497 from vnen/fix-2490
Make dict2inst set internal members of instance
-rw-r--r-- | modules/gdscript/gd_functions.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
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<GDInstance*>(static_cast<Object*>(r_ret)->get_script_instance()); + Ref<GDScript> gd_ref = ins->get_script(); + + for(Map<StringName,GDScript::MemberInfo>::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: { |