Allow free() to be used as Callable
This method is registered in a special way so ClassDB doesn't naturally know about its existence. Here it is hardcoded if any other option fail to check if it is about the `free()` method and, if so, say it exists and return a Callable.
This commit is contained in:
@ -31,6 +31,7 @@
|
||||
#include "class_db.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/core_string_names.h"
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/object/script_language.h"
|
||||
#include "core/os/mutex.h"
|
||||
@ -1299,6 +1300,12 @@ bool ClassDB::get_property(Object *p_object, const StringName &p_property, Varia
|
||||
check = check->inherits_ptr;
|
||||
}
|
||||
|
||||
// The "free()" method is special, so we assume it exists and return a Callable.
|
||||
if (p_property == CoreStringNames::get_singleton()->_free) {
|
||||
r_value = Callable(p_object, p_property);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user