You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Add option to use handles to RID
Adds an option to compile an alternative implementation for RIDs, which allows checks for erroneous usage patterns as well as providing leak tests.
This commit is contained in:
@@ -70,7 +70,7 @@ bool GridMap::_set(const StringName &p_name, const Variant &p_value) {
|
||||
BakedMesh bm;
|
||||
bm.mesh = meshes[i];
|
||||
ERR_CONTINUE(!bm.mesh.is_valid());
|
||||
bm.instance = VS::get_singleton()->instance_create();
|
||||
bm.instance = RID_PRIME(VS::get_singleton()->instance_create());
|
||||
VS::get_singleton()->get_singleton()->instance_set_base(bm.instance, bm.mesh->get_rid());
|
||||
VS::get_singleton()->instance_attach_object_instance_id(bm.instance, get_instance_id());
|
||||
if (is_inside_tree()) {
|
||||
@@ -295,15 +295,15 @@ void GridMap::set_cell_item(int p_x, int p_y, int p_z, int p_item, int p_rot) {
|
||||
//create octant because it does not exist
|
||||
Octant *g = memnew(Octant);
|
||||
g->dirty = true;
|
||||
g->static_body = PhysicsServer::get_singleton()->body_create(PhysicsServer::BODY_MODE_STATIC);
|
||||
g->static_body = RID_PRIME(PhysicsServer::get_singleton()->body_create(PhysicsServer::BODY_MODE_STATIC));
|
||||
PhysicsServer::get_singleton()->body_attach_object_instance_id(g->static_body, get_instance_id());
|
||||
PhysicsServer::get_singleton()->body_set_collision_layer(g->static_body, collision_layer);
|
||||
PhysicsServer::get_singleton()->body_set_collision_mask(g->static_body, collision_mask);
|
||||
SceneTree *st = SceneTree::get_singleton();
|
||||
|
||||
if (st && st->is_debugging_collisions_hint()) {
|
||||
g->collision_debug = VisualServer::get_singleton()->mesh_create();
|
||||
g->collision_debug_instance = VisualServer::get_singleton()->instance_create();
|
||||
g->collision_debug = RID_PRIME(VisualServer::get_singleton()->mesh_create());
|
||||
g->collision_debug_instance = RID_PRIME(VisualServer::get_singleton()->instance_create());
|
||||
VisualServer::get_singleton()->instance_set_base(g->collision_debug_instance, g->collision_debug);
|
||||
}
|
||||
|
||||
@@ -499,7 +499,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
||||
for (Map<int, List<Pair<Transform, IndexKey>>>::Element *E = multimesh_items.front(); E; E = E->next()) {
|
||||
Octant::MultimeshInstance mmi;
|
||||
|
||||
RID mm = VS::get_singleton()->multimesh_create();
|
||||
RID mm = RID_PRIME(VS::get_singleton()->multimesh_create());
|
||||
VS::get_singleton()->multimesh_allocate(mm, E->get().size(), VS::MULTIMESH_TRANSFORM_3D, VS::MULTIMESH_COLOR_NONE);
|
||||
VS::get_singleton()->multimesh_set_mesh(mm, mesh_library->get_item_mesh(E->key())->get_rid());
|
||||
|
||||
@@ -518,7 +518,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
||||
idx++;
|
||||
}
|
||||
|
||||
RID instance = VS::get_singleton()->instance_create();
|
||||
RID instance = RID_PRIME(VS::get_singleton()->instance_create());
|
||||
VS::get_singleton()->instance_set_base(instance, mm);
|
||||
|
||||
if (is_inside_tree()) {
|
||||
@@ -1024,7 +1024,7 @@ void GridMap::make_baked_meshes(bool p_gen_lightmap_uv, float p_lightmap_uv_texe
|
||||
|
||||
BakedMesh bm;
|
||||
bm.mesh = mesh;
|
||||
bm.instance = VS::get_singleton()->instance_create();
|
||||
bm.instance = RID_PRIME(VS::get_singleton()->instance_create());
|
||||
VS::get_singleton()->get_singleton()->instance_set_base(bm.instance, bm.mesh->get_rid());
|
||||
VS::get_singleton()->instance_attach_object_instance_id(bm.instance, get_instance_id());
|
||||
if (is_inside_tree()) {
|
||||
|
||||
Reference in New Issue
Block a user