Merge pull request #56522 from akien-mga/navigation-restore-safe-get_singleton
This commit is contained in:
commit
cbf8757289
|
@ -363,10 +363,10 @@ void NavigationRegion2D::set_enabled(bool p_enabled) {
|
|||
|
||||
if (!enabled) {
|
||||
NavigationServer2D::get_singleton()->region_set_map(region, RID());
|
||||
NavigationServer2D::get_singleton()->disconnect("map_changed", callable_mp(this, &NavigationRegion2D::_map_changed));
|
||||
NavigationServer2D::get_singleton_mut()->disconnect("map_changed", callable_mp(this, &NavigationRegion2D::_map_changed));
|
||||
} else {
|
||||
NavigationServer2D::get_singleton()->region_set_map(region, get_world_2d()->get_navigation_map());
|
||||
NavigationServer2D::get_singleton()->connect("map_changed", callable_mp(this, &NavigationRegion2D::_map_changed));
|
||||
NavigationServer2D::get_singleton_mut()->connect("map_changed", callable_mp(this, &NavigationRegion2D::_map_changed));
|
||||
}
|
||||
|
||||
if (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()) {
|
||||
|
@ -402,7 +402,7 @@ void NavigationRegion2D::_notification(int p_what) {
|
|||
case NOTIFICATION_ENTER_TREE: {
|
||||
if (enabled) {
|
||||
NavigationServer2D::get_singleton()->region_set_map(region, get_world_2d()->get_navigation_map());
|
||||
NavigationServer2D::get_singleton()->connect("map_changed", callable_mp(this, &NavigationRegion2D::_map_changed));
|
||||
NavigationServer2D::get_singleton_mut()->connect("map_changed", callable_mp(this, &NavigationRegion2D::_map_changed));
|
||||
}
|
||||
} break;
|
||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||
|
@ -411,7 +411,7 @@ void NavigationRegion2D::_notification(int p_what) {
|
|||
case NOTIFICATION_EXIT_TREE: {
|
||||
NavigationServer2D::get_singleton()->region_set_map(region, RID());
|
||||
if (enabled) {
|
||||
NavigationServer2D::get_singleton()->disconnect("map_changed", callable_mp(this, &NavigationRegion2D::_map_changed));
|
||||
NavigationServer2D::get_singleton_mut()->disconnect("map_changed", callable_mp(this, &NavigationRegion2D::_map_changed));
|
||||
}
|
||||
} break;
|
||||
case NOTIFICATION_DRAW: {
|
||||
|
|
|
@ -204,7 +204,7 @@ void NavigationServer2D::_bind_methods() {
|
|||
NavigationServer2D::NavigationServer2D() {
|
||||
singleton = this;
|
||||
ERR_FAIL_COND_MSG(!NavigationServer3D::get_singleton(), "The Navigation3D singleton should be initialized before the 2D one.");
|
||||
NavigationServer3D::get_singleton()->connect("map_changed", callable_mp(this, &NavigationServer2D::_emit_map_changed));
|
||||
NavigationServer3D::get_singleton_mut()->connect("map_changed", callable_mp(this, &NavigationServer2D::_emit_map_changed));
|
||||
}
|
||||
|
||||
NavigationServer2D::~NavigationServer2D() {
|
||||
|
|
|
@ -52,7 +52,7 @@ protected:
|
|||
|
||||
public:
|
||||
/// Thread safe, can be used across many threads.
|
||||
static NavigationServer2D *get_singleton() { return singleton; }
|
||||
static const NavigationServer2D *get_singleton() { return singleton; }
|
||||
|
||||
/// MUST be used in single thread!
|
||||
static NavigationServer2D *get_singleton_mut() { return singleton; }
|
||||
|
|
|
@ -84,7 +84,7 @@ void NavigationServer3D::_bind_methods() {
|
|||
ADD_SIGNAL(MethodInfo("map_changed", PropertyInfo(Variant::RID, "map")));
|
||||
}
|
||||
|
||||
NavigationServer3D *NavigationServer3D::get_singleton() {
|
||||
const NavigationServer3D *NavigationServer3D::get_singleton() {
|
||||
return singleton;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ protected:
|
|||
|
||||
public:
|
||||
/// Thread safe, can be used across many threads.
|
||||
static NavigationServer3D *get_singleton();
|
||||
static const NavigationServer3D *get_singleton();
|
||||
|
||||
/// MUST be used in single thread!
|
||||
static NavigationServer3D *get_singleton_mut();
|
||||
|
|
Loading…
Reference in New Issue