diff options
author | Josh Jones <kilauea.jones@gmail.com> | 2022-12-21 14:21:43 -0800 |
---|---|---|
committer | Josh Jones <kilauea.jones@gmail.com> | 2023-01-07 17:29:00 -0800 |
commit | a0715b30f94430078422ff05d81b9cfa85ddb4ce (patch) | |
tree | 207c64c952c9fc5f30c9a091e9deb38d45ab633f /scene/3d | |
parent | fcba87e696d58912838d8a4a6987b10efa28e78f (diff) |
Rework const on NavigationServer methods
`const` is used on all methods, even when they cause modification of the server. This reworks the methods of the server to only use `const` on method that don't change the state of the server.
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/navigation_link_3d.cpp | 8 | ||||
-rw-r--r-- | scene/3d/navigation_region_3d.cpp | 26 |
2 files changed, 17 insertions, 17 deletions
diff --git a/scene/3d/navigation_link_3d.cpp b/scene/3d/navigation_link_3d.cpp index b64cf11c05..e058ef62d0 100644 --- a/scene/3d/navigation_link_3d.cpp +++ b/scene/3d/navigation_link_3d.cpp @@ -133,8 +133,8 @@ void NavigationLink3D::_update_debug_mesh() { RS::get_singleton()->instance_set_scenario(debug_instance, get_world_3d()->get_scenario()); RS::get_singleton()->instance_set_visible(debug_instance, is_visible_in_tree()); - Ref<StandardMaterial3D> link_material = NavigationServer3D::get_singleton_mut()->get_debug_navigation_link_connections_material(); - Ref<StandardMaterial3D> disabled_link_material = NavigationServer3D::get_singleton_mut()->get_debug_navigation_link_connections_disabled_material(); + Ref<StandardMaterial3D> link_material = NavigationServer3D::get_singleton()->get_debug_navigation_link_connections_material(); + Ref<StandardMaterial3D> disabled_link_material = NavigationServer3D::get_singleton()->get_debug_navigation_link_connections_disabled_material(); if (enabled) { RS::get_singleton()->instance_set_surface_override_material(debug_instance, 0, link_material->get_rid()); @@ -262,10 +262,10 @@ void NavigationLink3D::set_enabled(bool p_enabled) { #ifdef DEBUG_ENABLED if (debug_instance.is_valid() && debug_mesh.is_valid()) { if (enabled) { - Ref<StandardMaterial3D> link_material = NavigationServer3D::get_singleton_mut()->get_debug_navigation_link_connections_material(); + Ref<StandardMaterial3D> link_material = NavigationServer3D::get_singleton()->get_debug_navigation_link_connections_material(); RS::get_singleton()->instance_set_surface_override_material(debug_instance, 0, link_material->get_rid()); } else { - Ref<StandardMaterial3D> disabled_link_material = NavigationServer3D::get_singleton_mut()->get_debug_navigation_link_connections_disabled_material(); + Ref<StandardMaterial3D> disabled_link_material = NavigationServer3D::get_singleton()->get_debug_navigation_link_connections_disabled_material(); RS::get_singleton()->instance_set_surface_override_material(debug_instance, 0, disabled_link_material->get_rid()); } } diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp index d5b79690dd..22a6ec3517 100644 --- a/scene/3d/navigation_region_3d.cpp +++ b/scene/3d/navigation_region_3d.cpp @@ -55,10 +55,10 @@ void NavigationRegion3D::set_enabled(bool p_enabled) { if (!is_enabled()) { if (debug_mesh.is_valid()) { if (debug_mesh->get_surface_count() > 0) { - RS::get_singleton()->instance_set_surface_override_material(debug_instance, 0, NavigationServer3D::get_singleton_mut()->get_debug_navigation_geometry_face_disabled_material()->get_rid()); + RS::get_singleton()->instance_set_surface_override_material(debug_instance, 0, NavigationServer3D::get_singleton()->get_debug_navigation_geometry_face_disabled_material()->get_rid()); } if (debug_mesh->get_surface_count() > 1) { - RS::get_singleton()->instance_set_surface_override_material(debug_instance, 1, NavigationServer3D::get_singleton_mut()->get_debug_navigation_geometry_edge_disabled_material()->get_rid()); + RS::get_singleton()->instance_set_surface_override_material(debug_instance, 1, NavigationServer3D::get_singleton()->get_debug_navigation_geometry_edge_disabled_material()->get_rid()); } } } else { @@ -365,9 +365,9 @@ NavigationRegion3D::NavigationRegion3D() { NavigationServer3D::get_singleton()->region_set_travel_cost(region, get_travel_cost()); #ifdef DEBUG_ENABLED - NavigationServer3D::get_singleton_mut()->connect("map_changed", callable_mp(this, &NavigationRegion3D::_navigation_map_changed)); - NavigationServer3D::get_singleton_mut()->connect("navigation_debug_changed", callable_mp(this, &NavigationRegion3D::_update_debug_mesh)); - NavigationServer3D::get_singleton_mut()->connect("navigation_debug_changed", callable_mp(this, &NavigationRegion3D::_update_debug_edge_connections_mesh)); + NavigationServer3D::get_singleton()->connect("map_changed", callable_mp(this, &NavigationRegion3D::_navigation_map_changed)); + NavigationServer3D::get_singleton()->connect("navigation_debug_changed", callable_mp(this, &NavigationRegion3D::_update_debug_mesh)); + NavigationServer3D::get_singleton()->connect("navigation_debug_changed", callable_mp(this, &NavigationRegion3D::_update_debug_edge_connections_mesh)); #endif // DEBUG_ENABLED } @@ -379,9 +379,9 @@ NavigationRegion3D::~NavigationRegion3D() { NavigationServer3D::get_singleton()->free(region); #ifdef DEBUG_ENABLED - NavigationServer3D::get_singleton_mut()->disconnect("map_changed", callable_mp(this, &NavigationRegion3D::_navigation_map_changed)); - NavigationServer3D::get_singleton_mut()->disconnect("navigation_debug_changed", callable_mp(this, &NavigationRegion3D::_update_debug_mesh)); - NavigationServer3D::get_singleton_mut()->disconnect("navigation_debug_changed", callable_mp(this, &NavigationRegion3D::_update_debug_edge_connections_mesh)); + NavigationServer3D::get_singleton()->disconnect("map_changed", callable_mp(this, &NavigationRegion3D::_navigation_map_changed)); + NavigationServer3D::get_singleton()->disconnect("navigation_debug_changed", callable_mp(this, &NavigationRegion3D::_update_debug_mesh)); + NavigationServer3D::get_singleton()->disconnect("navigation_debug_changed", callable_mp(this, &NavigationRegion3D::_update_debug_edge_connections_mesh)); ERR_FAIL_NULL(RenderingServer::get_singleton()); if (debug_instance.is_valid()) { @@ -459,8 +459,8 @@ void NavigationRegion3D::_update_debug_mesh() { Color debug_navigation_geometry_face_color = NavigationServer3D::get_singleton()->get_debug_navigation_geometry_face_color(); - Ref<StandardMaterial3D> face_material = NavigationServer3D::get_singleton_mut()->get_debug_navigation_geometry_face_material(); - Ref<StandardMaterial3D> line_material = NavigationServer3D::get_singleton_mut()->get_debug_navigation_geometry_edge_material(); + Ref<StandardMaterial3D> face_material = NavigationServer3D::get_singleton()->get_debug_navigation_geometry_face_material(); + Ref<StandardMaterial3D> line_material = NavigationServer3D::get_singleton()->get_debug_navigation_geometry_edge_material(); RandomPCG rand; Color polygon_color = debug_navigation_geometry_face_color; @@ -518,10 +518,10 @@ void NavigationRegion3D::_update_debug_mesh() { if (!is_enabled()) { if (debug_mesh.is_valid()) { if (debug_mesh->get_surface_count() > 0) { - RS::get_singleton()->instance_set_surface_override_material(debug_instance, 0, NavigationServer3D::get_singleton_mut()->get_debug_navigation_geometry_face_disabled_material()->get_rid()); + RS::get_singleton()->instance_set_surface_override_material(debug_instance, 0, NavigationServer3D::get_singleton()->get_debug_navigation_geometry_face_disabled_material()->get_rid()); } if (debug_mesh->get_surface_count() > 1) { - RS::get_singleton()->instance_set_surface_override_material(debug_instance, 1, NavigationServer3D::get_singleton_mut()->get_debug_navigation_geometry_edge_disabled_material()->get_rid()); + RS::get_singleton()->instance_set_surface_override_material(debug_instance, 1, NavigationServer3D::get_singleton()->get_debug_navigation_geometry_edge_disabled_material()->get_rid()); } } } else { @@ -610,7 +610,7 @@ void NavigationRegion3D::_update_debug_edge_connections_mesh() { return; } - Ref<StandardMaterial3D> edge_connections_material = NavigationServer3D::get_singleton_mut()->get_debug_navigation_edge_connections_material(); + Ref<StandardMaterial3D> edge_connections_material = NavigationServer3D::get_singleton()->get_debug_navigation_edge_connections_material(); Array mesh_array; mesh_array.resize(Mesh::ARRAY_MAX); |