Quellcode durchsuchen

Renamed NavigationMeshInstance to NavigationRegion

Andrea Catania vor 5 Jahren
Ursprung
Commit
3b64ecbc4b

+ 1 - 1
doc/classes/Navigation.xml

@@ -4,7 +4,7 @@
 		Mesh-based navigation and pathfinding node.
 	</brief_description>
 	<description>
-		Provides navigation and pathfinding within a collection of [NavigationMesh]es. These will be automatically collected from child [NavigationMeshInstance] nodes. In addition to basic pathfinding, this class also assists with aligning navigation agents with the meshes they are navigating on.
+		Provides navigation and pathfinding within a collection of [NavigationMesh]es. These will be automatically collected from child [NavigationRegion] nodes. In addition to basic pathfinding, this class also assists with aligning navigation agents with the meshes they are navigating on.
 	</description>
 	<tutorials>
 	</tutorials>

+ 4 - 4
doc/classes/NavigationMeshInstance.xml → doc/classes/NavigationRegion.xml

@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<class name="NavigationMeshInstance" inherits="Spatial" version="4.0">
+<class name="NavigationRegion" inherits="Spatial" version="4.0">
 	<brief_description>
-		An instance of a [NavigationMesh].
+		A region of the navigation map.
 	</brief_description>
 	<description>
-		An instance of a [NavigationMesh]. It tells the [Navigation] node what can be navigated and what cannot, based on the [NavigationMesh] resource. This should be a child of a [Navigation] node.
+		A region of the navigation map. It tells the [Navigation] node what can be navigated and what cannot, based on the [NavigationMesh] resource. This should be a child of a [Navigation] node (even not a direct child).
 	</description>
 	<tutorials>
 	</tutorials>
@@ -19,7 +19,7 @@
 	</methods>
 	<members>
 		<member name="enabled" type="bool" setter="set_enabled" getter="is_enabled" default="true">
-			Determines if the [NavigationMeshInstance] is enabled or disabled.
+			Determines if the [NavigationRegion] is enabled or disabled.
 		</member>
 		<member name="navmesh" type="NavigationMesh" setter="set_navigation_mesh" getter="get_navigation_mesh">
 			The [NavigationMesh] resource to use.

+ 0 - 1
editor/icons/NavigationMeshInstance.svg

@@ -1 +0,0 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 1a2 2 0 0 0 -2 2 2 2 0 0 0 1 1.7305v6.541a2 2 0 0 0 -1 1.7285 2 2 0 0 0 2 2 2 2 0 0 0 1.7305-1h2.5078l.75-2h-3.2598a2 2 0 0 0 -.72852-.73047v-5.8555l4.6973 4.6973.77148-2.0566-4.0547-4.0547h5.8574a2 2 0 0 0 .72852.73047v.27148a2.0002 2.0002 0 0 1 .023438 0 2.0002 2.0002 0 0 1 1.8496 1.2969l.12695.33789v-1.9082a2 2 0 0 0 1-1.7285 2 2 0 0 0 -2-2 2 2 0 0 0 -1.7305 1h-6.541a2 2 0 0 0 -1.7285-1zm9 6-3 8 3-2 3 2z" fill="#fc9c9c" fill-opacity=".99608"/></svg>

+ 58 - 0
editor/icons/NavigationRegion.svg

@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   inkscape:version="1.0beta2 (unknown)"
+   sodipodi:docname="icon_navigation_region.svg"
+   id="svg4"
+   version="1.1"
+   width="16"
+   viewBox="0 0 16 16"
+   height="16">
+  <metadata
+     id="metadata10">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs8" />
+  <sodipodi:namedview
+     inkscape:current-layer="svg4"
+     inkscape:window-maximized="0"
+     inkscape:window-y="18"
+     inkscape:window-x="0"
+     inkscape:cy="6.4771531"
+     inkscape:cx="15.373896"
+     inkscape:zoom="32"
+     showgrid="false"
+     id="namedview6"
+     inkscape:window-height="1041"
+     inkscape:window-width="1916"
+     inkscape:pageshadow="2"
+     inkscape:pageopacity="0"
+     guidetolerance="10"
+     gridtolerance="10"
+     objecttolerance="10"
+     borderopacity="1"
+     inkscape:document-rotation="0"
+     bordercolor="#666666"
+     pagecolor="#ffffff" />
+  <path
+     sodipodi:nodetypes="ccccccccccccccccccc"
+     inkscape:connector-curvature="0"
+     d="M 3,1 C 1.895431,1 1,1.895431 1,3 v 10 c 0,1.104569 0.895431,2 2,2 L 7.2383,14 C 8.917345,11.151816 9.09393,5.498579 11.99998,5.00198 h 0.02344 c 0.825004,0.0095 1.559551,0.524505 1.8496,1.2969 l 0.12695,0.33789 1,-3.6367 c 0,-1.104569 -0.895431,-2 -2,-2 H 8.20155 2.99997 Z m 9,6 -3,8 3,-2 3,2 z"
+     fill="#fc9c9c"
+     fill-opacity=".99608"
+     id="path2-3" />
+</svg>

+ 1 - 1
editor/import/resource_importer_scene.cpp

@@ -559,7 +559,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
 
 		Ref<ArrayMesh> mesh = mi->get_mesh();
 		ERR_FAIL_COND_V(mesh.is_null(), NULL);
-		NavigationMeshInstance *nmi = memnew(NavigationMeshInstance);
+		NavigationRegion *nmi = memnew(NavigationRegion);
 
 		nmi->set_name(_fixstr(name, "navmesh"));
 		Ref<NavigationMesh> nmesh = memnew(NavigationMesh);

+ 2 - 2
editor/plugins/mesh_instance_editor_plugin.cpp

@@ -32,7 +32,7 @@
 
 #include "editor/editor_scale.h"
 #include "scene/3d/collision_shape.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
 #include "scene/3d/physics_body.h"
 #include "scene/gui/box_container.h"
 #include "spatial_editor_plugin.h"
@@ -233,7 +233,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
 				return;
 
 			nmesh->create_from_mesh(mesh);
-			NavigationMeshInstance *nmi = memnew(NavigationMeshInstance);
+			NavigationRegion *nmi = memnew(NavigationRegion);
 			nmi->set_navigation_mesh(nmesh);
 
 			Node *owner = node == get_tree()->get_edited_scene_root() ? node : node->get_owner();

+ 3 - 3
editor/plugins/mesh_library_editor_plugin.cpp

@@ -34,7 +34,7 @@
 #include "editor/editor_settings.h"
 #include "main/main.h"
 #include "scene/3d/mesh_instance.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
 #include "scene/3d/physics_body.h"
 #include "scene/main/viewport.h"
 #include "scene/resources/packed_scene.h"
@@ -152,9 +152,9 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
 		Transform navmesh_transform;
 		for (int j = 0; j < mi->get_child_count(); j++) {
 			Node *child2 = mi->get_child(j);
-			if (!Object::cast_to<NavigationMeshInstance>(child2))
+			if (!Object::cast_to<NavigationRegion>(child2))
 				continue;
-			NavigationMeshInstance *sb = Object::cast_to<NavigationMeshInstance>(child2);
+			NavigationRegion *sb = Object::cast_to<NavigationRegion>(child2);
 			navmesh = sb->get_navigation_mesh();
 			navmesh_transform = sb->get_transform();
 			if (!navmesh.is_null())

+ 4 - 4
editor/spatial_editor_gizmos.cpp

@@ -41,7 +41,7 @@
 #include "scene/3d/light.h"
 #include "scene/3d/listener.h"
 #include "scene/3d/mesh_instance.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
 #include "scene/3d/particles.h"
 #include "scene/3d/physics_joint.h"
 #include "scene/3d/position_3d.h"
@@ -3720,11 +3720,11 @@ NavigationMeshSpatialGizmoPlugin::NavigationMeshSpatialGizmoPlugin() {
 }
 
 bool NavigationMeshSpatialGizmoPlugin::has_gizmo(Spatial *p_spatial) {
-	return Object::cast_to<NavigationMeshInstance>(p_spatial) != NULL;
+	return Object::cast_to<NavigationRegion>(p_spatial) != NULL;
 }
 
 String NavigationMeshSpatialGizmoPlugin::get_name() const {
-	return "NavigationMeshInstance";
+	return "NavigationRegion";
 }
 
 int NavigationMeshSpatialGizmoPlugin::get_priority() const {
@@ -3733,7 +3733,7 @@ int NavigationMeshSpatialGizmoPlugin::get_priority() const {
 
 void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
 
-	NavigationMeshInstance *navmesh = Object::cast_to<NavigationMeshInstance>(p_gizmo->get_spatial_node());
+	NavigationRegion *navmesh = Object::cast_to<NavigationRegion>(p_gizmo->get_spatial_node());
 
 	Ref<Material> edge_material = get_material("navigation_edge_material", p_gizmo);
 	Ref<Material> edge_material_disabled = get_material("navigation_edge_material_disabled", p_gizmo);

+ 3 - 3
modules/gdnavigation/navigation_mesh_editor_plugin.cpp

@@ -84,7 +84,7 @@ void NavigationMeshEditor::_clear_pressed() {
 	}
 }
 
-void NavigationMeshEditor::edit(NavigationMeshInstance *p_nav_mesh_instance) {
+void NavigationMeshEditor::edit(NavigationRegion *p_nav_mesh_instance) {
 
 	if (p_nav_mesh_instance == NULL || node == p_nav_mesh_instance) {
 		return;
@@ -128,12 +128,12 @@ NavigationMeshEditor::~NavigationMeshEditor() {
 
 void NavigationMeshEditorPlugin::edit(Object *p_object) {
 
-	navigation_mesh_editor->edit(Object::cast_to<NavigationMeshInstance>(p_object));
+	navigation_mesh_editor->edit(Object::cast_to<NavigationRegion>(p_object));
 }
 
 bool NavigationMeshEditorPlugin::handles(Object *p_object) const {
 
-	return p_object->is_class("NavigationMeshInstance");
+	return p_object->is_class("NavigationRegion");
 }
 
 void NavigationMeshEditorPlugin::make_visible(bool p_visible) {

+ 3 - 3
modules/gdnavigation/navigation_mesh_editor_plugin.h

@@ -36,7 +36,7 @@
 #include "editor/editor_node.h"
 #include "editor/editor_plugin.h"
 
-class NavigationMeshInstance;
+class NavigationRegion;
 
 class NavigationMeshEditor : public Control {
 	friend class NavigationMeshEditorPlugin;
@@ -50,7 +50,7 @@ class NavigationMeshEditor : public Control {
 	ToolButton *button_reset;
 	Label *bake_info;
 
-	NavigationMeshInstance *node;
+	NavigationRegion *node;
 
 	void _bake_pressed();
 	void _clear_pressed();
@@ -61,7 +61,7 @@ protected:
 	void _notification(int p_option);
 
 public:
-	void edit(NavigationMeshInstance *p_nav_mesh_instance);
+	void edit(NavigationRegion *p_nav_mesh_instance);
 	NavigationMeshEditor();
 	~NavigationMeshEditor();
 };

+ 1 - 1
modules/gdnavigation/navigation_mesh_generator.h

@@ -33,7 +33,7 @@
 
 #ifndef _3D_DISABLED
 
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
 
 #include <Recast.h>
 

+ 1 - 1
scene/3d/navigation.h

@@ -31,7 +31,7 @@
 #ifndef NAVIGATION_H
 #define NAVIGATION_H
 
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
 #include "scene/3d/spatial.h"
 
 class Navigation : public Spatial {

+ 22 - 22
scene/3d/navigation_mesh_instance.cpp → scene/3d/navigation_region.cpp

@@ -1,5 +1,5 @@
 /*************************************************************************/
-/*  navigation_mesh_instance.cpp                                         */
+/*  navigation_region.cpp                                                */
 /*************************************************************************/
 /*                       This file is part of:                           */
 /*                           GODOT ENGINE                                */
@@ -28,13 +28,13 @@
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /*************************************************************************/
 
-#include "navigation_mesh_instance.h"
+#include "navigation_region.h"
 #include "core/os/thread.h"
 #include "mesh_instance.h"
 #include "navigation.h"
 #include "servers/navigation_server.h"
 
-void NavigationMeshInstance::set_enabled(bool p_enabled) {
+void NavigationRegion::set_enabled(bool p_enabled) {
 
 	if (enabled == p_enabled)
 		return;
@@ -66,14 +66,14 @@ void NavigationMeshInstance::set_enabled(bool p_enabled) {
 	update_gizmo();
 }
 
-bool NavigationMeshInstance::is_enabled() const {
+bool NavigationRegion::is_enabled() const {
 
 	return enabled;
 }
 
 /////////////////////////////
 
-void NavigationMeshInstance::_notification(int p_what) {
+void NavigationRegion::_notification(int p_what) {
 
 	switch (p_what) {
 		case NOTIFICATION_ENTER_TREE: {
@@ -129,7 +129,7 @@ void NavigationMeshInstance::_notification(int p_what) {
 	}
 }
 
-void NavigationMeshInstance::set_navigation_mesh(const Ref<NavigationMesh> &p_navmesh) {
+void NavigationRegion::set_navigation_mesh(const Ref<NavigationMesh> &p_navmesh) {
 
 	if (p_navmesh == navmesh)
 		return;
@@ -156,13 +156,13 @@ void NavigationMeshInstance::set_navigation_mesh(const Ref<NavigationMesh> &p_na
 	update_configuration_warning();
 }
 
-Ref<NavigationMesh> NavigationMeshInstance::get_navigation_mesh() const {
+Ref<NavigationMesh> NavigationRegion::get_navigation_mesh() const {
 
 	return navmesh;
 }
 
 struct BakeThreadsArgs {
-	NavigationMeshInstance *nav_mesh_instance;
+	NavigationRegion *nav_mesh_instance;
 };
 
 void _bake_navigation_mesh(void *p_user_data) {
@@ -182,7 +182,7 @@ void _bake_navigation_mesh(void *p_user_data) {
 	}
 }
 
-void NavigationMeshInstance::bake_navigation_mesh() {
+void NavigationRegion::bake_navigation_mesh() {
 	ERR_FAIL_COND(bake_thread != NULL);
 
 	BakeThreadsArgs *args = memnew(BakeThreadsArgs);
@@ -192,12 +192,12 @@ void NavigationMeshInstance::bake_navigation_mesh() {
 	ERR_FAIL_COND(bake_thread == NULL);
 }
 
-void NavigationMeshInstance::_bake_finished(Ref<NavigationMesh> p_nav_mesh) {
+void NavigationRegion::_bake_finished(Ref<NavigationMesh> p_nav_mesh) {
 	set_navigation_mesh(p_nav_mesh);
 	bake_thread = NULL;
 }
 
-String NavigationMeshInstance::get_configuration_warning() const {
+String NavigationRegion::get_configuration_warning() const {
 
 	if (!is_visible_in_tree() || !is_inside_tree())
 		return String();
@@ -214,19 +214,19 @@ String NavigationMeshInstance::get_configuration_warning() const {
 		c = Object::cast_to<Spatial>(c->get_parent());
 	}
 
-	return TTR("NavigationMeshInstance must be a child or grandchild to a Navigation node. It only provides navigation data.");
+	return TTR("NavigationRegion must be a child or grandchild to a Navigation node. It only provides navigation data.");
 }
 
-void NavigationMeshInstance::_bind_methods() {
+void NavigationRegion::_bind_methods() {
 
-	ClassDB::bind_method(D_METHOD("set_navigation_mesh", "navmesh"), &NavigationMeshInstance::set_navigation_mesh);
-	ClassDB::bind_method(D_METHOD("get_navigation_mesh"), &NavigationMeshInstance::get_navigation_mesh);
+	ClassDB::bind_method(D_METHOD("set_navigation_mesh", "navmesh"), &NavigationRegion::set_navigation_mesh);
+	ClassDB::bind_method(D_METHOD("get_navigation_mesh"), &NavigationRegion::get_navigation_mesh);
 
-	ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationMeshInstance::set_enabled);
-	ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationMeshInstance::is_enabled);
+	ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationRegion::set_enabled);
+	ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationRegion::is_enabled);
 
-	ClassDB::bind_method(D_METHOD("bake_navigation_mesh"), &NavigationMeshInstance::bake_navigation_mesh);
-	ClassDB::bind_method(D_METHOD("_bake_finished", "nav_mesh"), &NavigationMeshInstance::_bake_finished);
+	ClassDB::bind_method(D_METHOD("bake_navigation_mesh"), &NavigationRegion::bake_navigation_mesh);
+	ClassDB::bind_method(D_METHOD("_bake_finished", "nav_mesh"), &NavigationRegion::_bake_finished);
 
 	ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "navmesh", PROPERTY_HINT_RESOURCE_TYPE, "NavigationMesh"), "set_navigation_mesh", "get_navigation_mesh");
 	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled");
@@ -235,12 +235,12 @@ void NavigationMeshInstance::_bind_methods() {
 	ADD_SIGNAL(MethodInfo("bake_finished"));
 }
 
-void NavigationMeshInstance::_changed_callback(Object *p_changed, const char *p_prop) {
+void NavigationRegion::_changed_callback(Object *p_changed, const char *p_prop) {
 	update_gizmo();
 	update_configuration_warning();
 }
 
-NavigationMeshInstance::NavigationMeshInstance() {
+NavigationRegion::NavigationRegion() {
 
 	enabled = true;
 	set_notify_transform(true);
@@ -251,7 +251,7 @@ NavigationMeshInstance::NavigationMeshInstance() {
 	bake_thread = NULL;
 }
 
-NavigationMeshInstance::~NavigationMeshInstance() {
+NavigationRegion::~NavigationRegion() {
 	if (navmesh.is_valid())
 		navmesh->remove_change_receptor(this);
 	NavigationServer::get_singleton()->free(region);

+ 8 - 8
scene/3d/navigation_mesh_instance.h → scene/3d/navigation_region.h

@@ -1,5 +1,5 @@
 /*************************************************************************/
-/*  navigation_mesh_instance.h                                           */
+/*  navigation_region.h                                                  */
 /*************************************************************************/
 /*                       This file is part of:                           */
 /*                           GODOT ENGINE                                */
@@ -28,8 +28,8 @@
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /*************************************************************************/
 
-#ifndef NAVIGATION_MESH_INSTANCE_H
-#define NAVIGATION_MESH_INSTANCE_H
+#ifndef navigation_region_H
+#define navigation_region_H
 
 #include "scene/3d/spatial.h"
 #include "scene/resources/mesh.h"
@@ -37,9 +37,9 @@
 
 class Navigation;
 
-class NavigationMeshInstance : public Spatial {
+class NavigationRegion : public Spatial {
 
-	GDCLASS(NavigationMeshInstance, Spatial);
+	GDCLASS(NavigationRegion, Spatial);
 
 	bool enabled;
 	RID region;
@@ -68,8 +68,8 @@ public:
 
 	String get_configuration_warning() const;
 
-	NavigationMeshInstance();
-	~NavigationMeshInstance();
+	NavigationRegion();
+	~NavigationRegion();
 };
 
-#endif // NAVIGATION_MESH_INSTANCE_H
+#endif // navigation_region_H

+ 2 - 2
scene/register_scene_types.cpp

@@ -190,7 +190,7 @@
 #include "scene/3d/multimesh_instance.h"
 #include "scene/3d/navigation.h"
 #include "scene/3d/navigation_agent.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
 #include "scene/3d/navigation_obstacle.h"
 #include "scene/3d/particles.h"
 #include "scene/3d/path.h"
@@ -470,7 +470,7 @@ void register_scene_types() {
 	ClassDB::register_class<Generic6DOFJoint>();
 
 	ClassDB::register_class<Navigation>();
-	ClassDB::register_class<NavigationMeshInstance>();
+	ClassDB::register_class<NavigationRegion>();
 	ClassDB::register_class<NavigationAgent>();
 	ClassDB::register_class<NavigationObstacle>();
 

+ 1 - 1
scene/resources/mesh_library.h

@@ -34,7 +34,7 @@
 #include "core/map.h"
 #include "core/resource.h"
 #include "mesh.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
 #include "shape.h"
 
 class MeshLibrary : public Resource {

+ 1 - 1
servers/navigation_server.h

@@ -37,7 +37,7 @@
 
 #include "core/object.h"
 #include "core/rid.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
 
 /// This server uses the concept of internal mutability.
 /// All the constant functions can be called in multithread because internally