Complete NavigationMeshInstance rename
This commit is contained in:
parent
7579a792be
commit
d63bf6dea5
3 changed files with 11 additions and 11 deletions
|
@ -84,13 +84,13 @@ void NavigationMeshEditor::_clear_pressed() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationMeshEditor::edit(NavigationRegion *p_nav_mesh_instance) {
|
void NavigationMeshEditor::edit(NavigationRegion *p_nav_region) {
|
||||||
|
|
||||||
if (p_nav_mesh_instance == NULL || node == p_nav_mesh_instance) {
|
if (p_nav_region == NULL || node == p_nav_region) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
node = p_nav_mesh_instance;
|
node = p_nav_region;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationMeshEditor::_bind_methods() {
|
void NavigationMeshEditor::_bind_methods() {
|
||||||
|
|
|
@ -61,7 +61,7 @@ protected:
|
||||||
void _notification(int p_option);
|
void _notification(int p_option);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void edit(NavigationRegion *p_nav_mesh_instance);
|
void edit(NavigationRegion *p_nav_region);
|
||||||
NavigationMeshEditor();
|
NavigationMeshEditor();
|
||||||
~NavigationMeshEditor();
|
~NavigationMeshEditor();
|
||||||
};
|
};
|
||||||
|
|
|
@ -162,22 +162,22 @@ Ref<NavigationMesh> NavigationRegion::get_navigation_mesh() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct BakeThreadsArgs {
|
struct BakeThreadsArgs {
|
||||||
NavigationRegion *nav_mesh_instance;
|
NavigationRegion *nav_region;
|
||||||
};
|
};
|
||||||
|
|
||||||
void _bake_navigation_mesh(void *p_user_data) {
|
void _bake_navigation_mesh(void *p_user_data) {
|
||||||
BakeThreadsArgs *args = static_cast<BakeThreadsArgs *>(p_user_data);
|
BakeThreadsArgs *args = static_cast<BakeThreadsArgs *>(p_user_data);
|
||||||
|
|
||||||
if (args->nav_mesh_instance->get_navigation_mesh().is_valid()) {
|
if (args->nav_region->get_navigation_mesh().is_valid()) {
|
||||||
Ref<NavigationMesh> nav_mesh = args->nav_mesh_instance->get_navigation_mesh()->duplicate();
|
Ref<NavigationMesh> nav_mesh = args->nav_region->get_navigation_mesh()->duplicate();
|
||||||
|
|
||||||
NavigationServer::get_singleton()->region_bake_navmesh(nav_mesh, args->nav_mesh_instance);
|
NavigationServer::get_singleton()->region_bake_navmesh(nav_mesh, args->nav_region);
|
||||||
args->nav_mesh_instance->call_deferred("_bake_finished", nav_mesh);
|
args->nav_region->call_deferred("_bake_finished", nav_mesh);
|
||||||
memdelete(args);
|
memdelete(args);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
ERR_PRINT("Can't bake the navigation mesh if the `NavigationMesh` resource doesn't exist");
|
ERR_PRINT("Can't bake the navigation mesh if the `NavigationMesh` resource doesn't exist");
|
||||||
args->nav_mesh_instance->call_deferred("_bake_finished", Ref<NavigationMesh>());
|
args->nav_region->call_deferred("_bake_finished", Ref<NavigationMesh>());
|
||||||
memdelete(args);
|
memdelete(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ void NavigationRegion::bake_navigation_mesh() {
|
||||||
ERR_FAIL_COND(bake_thread != NULL);
|
ERR_FAIL_COND(bake_thread != NULL);
|
||||||
|
|
||||||
BakeThreadsArgs *args = memnew(BakeThreadsArgs);
|
BakeThreadsArgs *args = memnew(BakeThreadsArgs);
|
||||||
args->nav_mesh_instance = this;
|
args->nav_region = this;
|
||||||
|
|
||||||
bake_thread = Thread::create(_bake_navigation_mesh, args);
|
bake_thread = Thread::create(_bake_navigation_mesh, args);
|
||||||
ERR_FAIL_COND(bake_thread == NULL);
|
ERR_FAIL_COND(bake_thread == NULL);
|
||||||
|
|
Loading…
Reference in a new issue