1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

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

@@ -34,6 +34,35 @@
#include "method_bind.h"
uint32_t MethodBind::get_hash() const {
uint32_t hash = hash_djb2_one_32(has_return() ? 1 : 0);
hash = hash_djb2_one_32(get_argument_count(), hash);
#ifndef _MSC_VER
#warning This needs proper class name and argument type for hashing
#endif
#if 0
for (int i = (has_return() ? -1 : 0); i < get_argument_count(); i++) {
PropertyInfo pi = i == -1 ? get_return_info() : get_argument_info(i);
hash = hash_djb2_one_32(get_argument_type(i), hash);
if (pi.class_name != StringName()) {
hash = hash_djb2_one_32(pi.class_name.operator String().hash(), hash);
}
}
#endif
hash = hash_djb2_one_32(get_default_argument_count(), hash);
for (int i = 0; i < get_default_argument_count(); i++) {
Variant v = get_default_argument(i);
hash = hash_djb2_one_32(v.hash(), hash);
}
hash = hash_djb2_one_32(is_const(), hash);
hash = hash_djb2_one_32(is_vararg(), hash);
return hash;
}
#ifdef DEBUG_METHODS_ENABLED
PropertyInfo MethodBind::get_argument_info(int p_argument) const {
ERR_FAIL_INDEX_V(p_argument, get_argument_count(), PropertyInfo());