Implement native extension system

* Deprecates GDNative in favor of a simpler, lower level interface.
* New extension system allows registering core engine classes.
* Simple header interface in gdnative_interace.h
This commit is contained in:
reduz
2021-06-19 12:58:49 -03:00
parent c8444c3ee0
commit b1d15c51bc
50 changed files with 3316 additions and 224 deletions

View File

@ -1126,6 +1126,25 @@ bool Variant::is_builtin_method_vararg(Variant::Type p_type, const StringName &p
return method->is_vararg;
}
uint32_t Variant::get_builtin_method_hash(Variant::Type p_type, const StringName &p_method) {
ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, 0);
const VariantBuiltInMethodInfo *method = builtin_method_info[p_type].lookup_ptr(p_method);
ERR_FAIL_COND_V(!method, 0);
uint32_t hash = hash_djb2_one_32(method->is_const);
hash = hash_djb2_one_32(method->is_static, hash);
hash = hash_djb2_one_32(method->is_vararg, hash);
hash = hash_djb2_one_32(method->has_return_type, hash);
if (method->has_return_type) {
hash = hash_djb2_one_32(method->return_type, hash);
}
hash = hash_djb2_one_32(method->argument_count, hash);
for (int i = 0; i < method->argument_count; i++) {
hash = method->get_argument_type(i);
}
return hash;
}
void Variant::get_method_list(List<MethodInfo> *p_list) const {
if (type == OBJECT) {
Object *obj = get_validated_object();