You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +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:
committed by
Hugo Locurcio
parent
0f10eafb38
commit
accdd575f6
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user