Create GDExtension clases for PhysicsServer3D
* Allows creating a GDExtension based 3D Physics Server (for Bullet, PhysX, etc. support) * Some changes on native struct binding for PhysicsServer This allows a 3D Physics server created entirely from GDExtension. Once it works, the idea is to port the 2D one to it.
This commit is contained in:
@ -1606,7 +1606,7 @@ Variant ClassDB::class_get_default_property_value(const StringName &p_class, con
|
||||
if (Engine::get_singleton()->has_singleton(p_class)) {
|
||||
c = Engine::get_singleton()->get_singleton_object(p_class);
|
||||
cleanup_c = false;
|
||||
} else if (ClassDB::can_instantiate(p_class)) {
|
||||
} else if (ClassDB::can_instantiate(p_class) && !ClassDB::is_virtual(p_class)) {
|
||||
c = ClassDB::instantiate(p_class);
|
||||
cleanup_c = true;
|
||||
}
|
||||
@ -1694,6 +1694,30 @@ void ClassDB::unregister_extension_class(const StringName &p_class) {
|
||||
classes.erase(p_class);
|
||||
}
|
||||
|
||||
Map<StringName, ClassDB::NativeStruct> ClassDB::native_structs;
|
||||
void ClassDB::register_native_struct(const StringName &p_name, const String &p_code, uint64_t p_current_size) {
|
||||
NativeStruct ns;
|
||||
ns.ccode = p_code;
|
||||
ns.struct_size = p_current_size;
|
||||
native_structs[p_name] = ns;
|
||||
}
|
||||
|
||||
void ClassDB::get_native_struct_list(List<StringName> *r_names) {
|
||||
for (const KeyValue<StringName, NativeStruct> &E : native_structs) {
|
||||
r_names->push_back(E.key);
|
||||
}
|
||||
}
|
||||
|
||||
String ClassDB::get_native_struct_code(const StringName &p_name) {
|
||||
ERR_FAIL_COND_V(!native_structs.has(p_name), String());
|
||||
return native_structs[p_name].ccode;
|
||||
}
|
||||
|
||||
uint64_t ClassDB::get_native_struct_size(const StringName &p_name) {
|
||||
ERR_FAIL_COND_V(!native_structs.has(p_name), 0);
|
||||
return native_structs[p_name].struct_size;
|
||||
}
|
||||
|
||||
RWLock ClassDB::lock;
|
||||
|
||||
void ClassDB::cleanup_defaults() {
|
||||
@ -1717,6 +1741,7 @@ void ClassDB::cleanup() {
|
||||
classes.clear();
|
||||
resource_base_extensions.clear();
|
||||
compat_classes.clear();
|
||||
native_structs.clear();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user