Make dict2inst to work with arbitrary _init parameters
This is achieved by skipping initializer call while creating an instance of a GDScript. This is implemented by passing -1 as an argument count to `_new` and interpreting any value below 0 to mean that the initializer should not be called during instantiation, because internal members of an instance are going to be overridden afterwards.
This commit is contained in:
@ -1197,8 +1197,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
r_ret = gdscr->_new(nullptr, 0, r_error);
|
||||
r_ret = gdscr->_new(nullptr, -1 /*skip initializer*/, r_error);
|
||||
|
||||
GDScriptInstance *ins = static_cast<GDScriptInstance *>(static_cast<Object *>(r_ret)->get_script_instance());
|
||||
Ref<GDScript> gd_ref = ins->get_script();
|
||||
|
||||
Reference in New Issue
Block a user