You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Unify and streamline connecting to Resource changes
This commit is contained in:
@@ -258,11 +258,11 @@ RID GridMap::get_navigation_map() const {
|
||||
|
||||
void GridMap::set_mesh_library(const Ref<MeshLibrary> &p_mesh_library) {
|
||||
if (!mesh_library.is_null()) {
|
||||
mesh_library->unregister_owner(this);
|
||||
mesh_library->disconnect_changed(callable_mp(this, &GridMap::_recreate_octant_data));
|
||||
}
|
||||
mesh_library = p_mesh_library;
|
||||
if (!mesh_library.is_null()) {
|
||||
mesh_library->register_owner(this);
|
||||
mesh_library->connect_changed(callable_mp(this, &GridMap::_recreate_octant_data));
|
||||
}
|
||||
|
||||
_recreate_octant_data();
|
||||
@@ -1005,9 +1005,10 @@ void GridMap::clear() {
|
||||
clear_baked_meshes();
|
||||
}
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
void GridMap::resource_changed(const Ref<Resource> &p_res) {
|
||||
_recreate_octant_data();
|
||||
}
|
||||
#endif
|
||||
|
||||
void GridMap::_update_octants_callback() {
|
||||
if (!awaiting_update) {
|
||||
@@ -1079,7 +1080,9 @@ void GridMap::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("map_to_local", "map_position"), &GridMap::map_to_local);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_update_octants_callback"), &GridMap::_update_octants_callback);
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
ClassDB::bind_method(D_METHOD("resource_changed", "resource"), &GridMap::resource_changed);
|
||||
#endif
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_center_x", "enable"), &GridMap::set_center_x);
|
||||
ClassDB::bind_method(D_METHOD("get_center_x"), &GridMap::get_center_x);
|
||||
@@ -1336,10 +1339,6 @@ void GridMap::_navigation_map_changed(RID p_map) {
|
||||
#endif // DEBUG_ENABLED
|
||||
|
||||
GridMap::~GridMap() {
|
||||
if (!mesh_library.is_null()) {
|
||||
mesh_library->unregister_owner(this);
|
||||
}
|
||||
|
||||
clear();
|
||||
#ifdef DEBUG_ENABLED
|
||||
NavigationServer3D::get_singleton()->disconnect("map_changed", callable_mp(this, &GridMap::_navigation_map_changed));
|
||||
|
||||
Reference in New Issue
Block a user