mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 06:01:14 +00:00
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:
parent
0f10eafb38
commit
accdd575f6
2 changed files with 5 additions and 4 deletions
|
|
@ -1153,8 +1153,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);
|
||||
|
||||
if (r_error.error != Variant::CallError::CALL_OK) {
|
||||
r_ret = Variant();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue