mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Remove multilevel calls
In general they are more confusing to users because they expect inheritance to fully override parent methods. This behavior can be enabled by script writers using a simple super() call.
This commit is contained in:
parent
b7dc08fcf6
commit
2b9d9bc364
17 changed files with 19 additions and 264 deletions
|
@ -991,7 +991,8 @@ void NativeScriptInstance::notification(int p_notification) {
|
|||
|
||||
Variant value = p_notification;
|
||||
const Variant *args[1] = { &value };
|
||||
call_multilevel("_notification", args, 1);
|
||||
Callable::CallError error;
|
||||
call("_notification", args, 1, error);
|
||||
}
|
||||
|
||||
String NativeScriptInstance::to_string(bool *r_valid) {
|
||||
|
@ -1087,31 +1088,6 @@ ScriptLanguage *NativeScriptInstance::get_language() {
|
|||
return NativeScriptLanguage::get_singleton();
|
||||
}
|
||||
|
||||
void NativeScriptInstance::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) {
|
||||
NativeScriptDesc *script_data = GET_SCRIPT_DESC();
|
||||
|
||||
while (script_data) {
|
||||
Map<StringName, NativeScriptDesc::Method>::Element *E = script_data->methods.find(p_method);
|
||||
if (E) {
|
||||
godot_variant res = E->get().method.method((godot_object *)owner,
|
||||
E->get().method.method_data,
|
||||
userdata,
|
||||
p_argcount,
|
||||
(godot_variant **)p_args);
|
||||
godot_variant_destroy(&res);
|
||||
}
|
||||
script_data = script_data->base_data;
|
||||
}
|
||||
}
|
||||
|
||||
void NativeScriptInstance::call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount) {
|
||||
NativeScriptDesc *script_data = GET_SCRIPT_DESC();
|
||||
|
||||
if (script_data) {
|
||||
_ml_call_reversed(script_data, p_method, p_args, p_argcount);
|
||||
}
|
||||
}
|
||||
|
||||
NativeScriptInstance::~NativeScriptInstance() {
|
||||
NativeScriptDesc *script_data = GET_SCRIPT_DESC();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue