Merge pull request #70786 from Calinou/gdscript-fix-dict2inst-init-parameters-3.x
[3.x] Make `dict2inst` to work with arbitrary `_init` parameters
This commit is contained in:
commit
aa9265928c
|
@ -110,6 +110,9 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco
|
|||
instances.insert(instance->owner);
|
||||
GDScriptLanguage::singleton->lock.unlock();
|
||||
|
||||
if (p_argcount < 0) {
|
||||
return instance;
|
||||
}
|
||||
initializer->call(instance, p_args, p_argcount, r_error);
|
||||
|
||||
if (r_error.error != Variant::CallError::CALL_OK) {
|
||||
|
@ -123,9 +126,8 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco
|
|||
GDScriptLanguage::singleton->lock.unlock();
|
||||
#endif
|
||||
|
||||
ERR_FAIL_COND_V(r_error.error != Variant::CallError::CALL_OK, nullptr); //error constructing
|
||||
ERR_FAIL_V_MSG(nullptr, "Error constructing a GDScriptInstance.");
|
||||
}
|
||||
|
||||
//@TODO make thread safe
|
||||
return instance;
|
||||
}
|
||||
|
|
|
@ -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…
Reference in New Issue