Unify and streamline connecting to Resource changes
This commit is contained in:
@ -138,11 +138,11 @@
|
||||
Returns the position of a grid cell in the GridMap's local coordinate space. To convert the returned value into global coordinates, use [method Node3D.to_global]. See also [method map_to_local].
|
||||
</description>
|
||||
</method>
|
||||
<method name="resource_changed">
|
||||
<method name="resource_changed" is_deprecated="true">
|
||||
<return type="void" />
|
||||
<param index="0" name="resource" type="Resource" />
|
||||
<description>
|
||||
Notifies the [GridMap] about changed resource and recreates octant data.
|
||||
[i]Obsoleted.[/i] Use [signal Resource.changed] instead.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_cell_item">
|
||||
|
||||
@ -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));
|
||||
|
||||
@ -203,7 +203,9 @@ class GridMap : public Node3D {
|
||||
void _queue_octants_dirty();
|
||||
void _update_octants_callback();
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
void resource_changed(const Ref<Resource> &p_res);
|
||||
#endif
|
||||
|
||||
void _clear_internal();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user