diff options
36 files changed, 253 insertions, 131 deletions
diff --git a/doc/classes/Navigation.xml b/doc/classes/Navigation.xml index 0000ca6bd5..93170bca4a 100644 --- a/doc/classes/Navigation.xml +++ b/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> diff --git a/doc/classes/Navigation2D.xml b/doc/classes/Navigation2D.xml index 0d016a3210..dcbfbc2350 100644 --- a/doc/classes/Navigation2D.xml +++ b/doc/classes/Navigation2D.xml @@ -4,7 +4,7 @@ 2D navigation and pathfinding node. </brief_description> <description> - Navigation2D provides navigation and pathfinding within a 2D area, specified as a collection of [NavigationPolygon] resources. These are automatically collected from child [NavigationPolygonInstance] nodes. + Navigation2D provides navigation and pathfinding within a 2D area, specified as a collection of [NavigationPolygon] resources. These are automatically collected from child [NavigationRegion2D] nodes. </description> <tutorials> </tutorials> diff --git a/doc/classes/NavigationPolygon.xml b/doc/classes/NavigationPolygon.xml index da291b7337..b0f77dff83 100644 --- a/doc/classes/NavigationPolygon.xml +++ b/doc/classes/NavigationPolygon.xml @@ -11,7 +11,7 @@ var outline = PackedVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)]) polygon.add_outline(outline) polygon.make_polygons_from_outlines() - $NavigationPolygonInstance.navpoly = polygon + $NavigationRegion2D.navpoly = polygon [/codeblock] Using [method add_polygon] and indices of the vertices array. [codeblock] @@ -20,7 +20,7 @@ polygon.set_vertices(vertices) var indices = PackedInt32Array(0, 3, 1) polygon.add_polygon(indices) - $NavigationPolygonInstance.navpoly = polygon + $NavigationRegion2D.navpoly = polygon [/codeblock] </description> <tutorials> diff --git a/doc/classes/NavigationMeshInstance.xml b/doc/classes/NavigationRegion.xml index 75bd62e278..41fac70654 100644 --- a/doc/classes/NavigationMeshInstance.xml +++ b/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. diff --git a/doc/classes/NavigationPolygonInstance.xml b/doc/classes/NavigationRegion2D.xml index 34c6b09859..aef114e1db 100644 --- a/doc/classes/NavigationPolygonInstance.xml +++ b/doc/classes/NavigationRegion2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="NavigationPolygonInstance" inherits="Node2D" version="4.0"> +<class name="NavigationRegion2D" inherits="Node2D" version="4.0"> <brief_description> </brief_description> <description> diff --git a/doc/classes/PhysicsServer.xml b/doc/classes/PhysicsServer.xml index 592d3d8e4e..c9f4accee2 100644 --- a/doc/classes/PhysicsServer.xml +++ b/doc/classes/PhysicsServer.xml @@ -1467,7 +1467,7 @@ If [code]set[/code] there is a linear motor on this axis that targets a specific velocity. </constant> <constant name="SHAPE_PLANE" value="0" enum="ShapeType"> - The [Shape] is a [PlaneShape]. + The [Shape] is a [WorldMarginShape]. </constant> <constant name="SHAPE_RAY" value="1" enum="ShapeType"> The [Shape] is a [RayShape]. diff --git a/doc/classes/PlaneShape.xml b/doc/classes/WorldMarginShape.xml index b40e133d00..54f76a066b 100644 --- a/doc/classes/PlaneShape.xml +++ b/doc/classes/WorldMarginShape.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PlaneShape" inherits="Shape" version="4.0"> +<class name="WorldMarginShape" inherits="Shape" version="4.0"> <brief_description> Infinite plane shape for 3D collisions. </brief_description> <description> - An infinite plane shape for 3D collisions. Note that the [Plane]'s normal matters; anything "below" the plane will collide with it. If the [PlaneShape] is used in a [PhysicsBody], it will cause colliding objects placed "below" it to teleport "above" the plane. + An infinite plane shape for 3D collisions. Note that the [Plane]'s normal matters; anything "below" the plane will collide with it. If the [WorldMarginShape] is used in a [PhysicsBody], it will cause colliding objects placed "below" it to teleport "above" the plane. </description> <tutorials> </tutorials> @@ -12,7 +12,7 @@ </methods> <members> <member name="plane" type="Plane" setter="set_plane" getter="get_plane" default="Plane( 0, 1, 0, 0 )"> - The [Plane] used by the [PlaneShape] for collision. + The [Plane] used by the [WorldMarginShape] for collision. </member> </members> <constants> diff --git a/editor/icons/NavigationMeshInstance.svg b/editor/icons/NavigationMeshInstance.svg deleted file mode 100644 index 737d9c319d..0000000000 --- a/editor/icons/NavigationMeshInstance.svg +++ /dev/null @@ -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>
\ No newline at end of file diff --git a/editor/icons/NavigationPolygonInstance.svg b/editor/icons/NavigationPolygonInstance.svg deleted file mode 100644 index e16d10614e..0000000000 --- a/editor/icons/NavigationPolygonInstance.svg +++ /dev/null @@ -1 +0,0 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#a5b7f3" fill-opacity=".98824" fill-rule="evenodd" transform="translate(0 -1036.4)"><path d="m2 1a1.0001 1.0001 0 0 0 -1 1v12a1.0001 1.0001 0 0 0 1 1h4.9023a2.1002 2.1002 0 0 1 .13086-.73633l.47461-1.2637h-4.5078v-10h8.5859l-4.293 4.293a1.0001 1.0001 0 0 0 0 1.4141l1.3262 1.3262 1.4141-3.7695a2.1002 2.1002 0 0 1 1.9922-1.3613 2.1002 2.1002 0 0 1 .43555.050781l2.2461-2.2461a1.0001 1.0001 0 0 0 -.70703-1.707h-12z" transform="translate(0 1036.4)"/><path d="m15 1051.4-3-8-3 8 3-2z"/></g></svg>
\ No newline at end of file diff --git a/editor/icons/NavigationRegion.svg b/editor/icons/NavigationRegion.svg new file mode 100644 index 0000000000..92cc9afd91 --- /dev/null +++ b/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> diff --git a/editor/icons/NavigationRegion2D.svg b/editor/icons/NavigationRegion2D.svg new file mode 100644 index 0000000000..a297216cb7 --- /dev/null +++ b/editor/icons/NavigationRegion2D.svg @@ -0,0 +1,67 @@ +<?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_polygon_instance.svg" + id="svg8" + version="1.1" + width="16" + viewBox="0 0 16 16" + height="16"> + <metadata + id="metadata14"> + <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="defs12" /> + <sodipodi:namedview + inkscape:current-layer="svg8" + inkscape:window-maximized="0" + inkscape:window-y="18" + inkscape:window-x="0" + inkscape:cy="10.058435" + inkscape:cx="5.8836841" + inkscape:zoom="19.64431" + showgrid="false" + id="namedview10" + 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" /> + <g + id="g6" + transform="translate(0 -1036.4)" + fill-rule="evenodd" + fill-opacity=".98824" + fill="#a5b7f3"> + <path + sodipodi:nodetypes="cccccccccccccc" + inkscape:connector-curvature="0" + id="path2" + transform="translate(0,1036.4)" + d="M 2,1 C 1.4477381,1.0000552 1.0000552,1.4477381 1,2 v 12 c 5.52e-5,0.552262 0.4477381,0.999945 1,1 h 4.9023 c -7.836e-4,-0.251296 0.043539,-0.500692 0.13086,-0.73633 l 0.47461,-1.2637 2.5254,-6.7362 c 0.311135,-0.8280197 1.107723,-1.3723398 1.9922,-1.3613 0.146558,0.00168 0.292536,0.018702 0.43555,0.050781 l 2.2461,-2.2461 c 0.629502,-0.6299963 0.18357,-1.7066217 -0.70703,-1.707 h -12 z" /> + <path + id="path4" + d="m15 1051.4-3-8-3 8 3-2z" /> + </g> +</svg> diff --git a/editor/icons/PlaneMesh.svg b/editor/icons/PlaneMesh.svg deleted file mode 100644 index ddcc623c67..0000000000 --- a/editor/icons/PlaneMesh.svg +++ /dev/null @@ -1 +0,0 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m2 12h12l-3-8h-6z" fill="none" stroke="#ffd684" stroke-linejoin="round" stroke-width="2"/></svg>
\ No newline at end of file diff --git a/editor/icons/WorldMarginShape.svg b/editor/icons/WorldMarginShape.svg new file mode 100644 index 0000000000..2c90cf6d53 --- /dev/null +++ b/editor/icons/WorldMarginShape.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 1044.4 7 3 7-3-7-3z" fill="#a2d2ff" fill-rule="evenodd" transform="translate(0 -1036.4)"/></svg>
\ No newline at end of file diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 9fb6be50d9..5651197fa3 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -41,10 +41,10 @@ #include "scene/resources/animation.h" #include "scene/resources/box_shape.h" #include "scene/resources/packed_scene.h" -#include "scene/resources/plane_shape.h" #include "scene/resources/ray_shape.h" #include "scene/resources/resource_format_text.h" #include "scene/resources/sphere_shape.h" +#include "scene/resources/world_margin_shape.h" uint32_t EditorSceneImporter::get_import_flags() const { @@ -446,9 +446,9 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh> colshape->set_name("RayShape"); Object::cast_to<Spatial>(sb)->rotate_x(Math_PI / 2); } else if (empty_draw_type == "IMAGE") { - PlaneShape *planeShape = memnew(PlaneShape); - colshape->set_shape(planeShape); - colshape->set_name("PlaneShape"); + WorldMarginShape *world_margin_shape = memnew(WorldMarginShape); + colshape->set_shape(world_margin_shape); + colshape->set_name("WorldMarginShape"); } else { SphereShape *sphereShape = memnew(SphereShape); sphereShape->set_radius(1); @@ -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); diff --git a/editor/plugins/mesh_instance_editor_plugin.cpp b/editor/plugins/mesh_instance_editor_plugin.cpp index 37cf16de58..c285bb4e1a 100644 --- a/editor/plugins/mesh_instance_editor_plugin.cpp +++ b/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(); diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index ea8842a56f..863ea451b5 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/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()) diff --git a/editor/plugins/navigation_polygon_editor_plugin.cpp b/editor/plugins/navigation_polygon_editor_plugin.cpp index c4e61f2488..6671d0b6b4 100644 --- a/editor/plugins/navigation_polygon_editor_plugin.cpp +++ b/editor/plugins/navigation_polygon_editor_plugin.cpp @@ -48,7 +48,7 @@ Node2D *NavigationPolygonEditor::_get_node() const { void NavigationPolygonEditor::_set_node(Node *p_polygon) { - node = Object::cast_to<NavigationPolygonInstance>(p_polygon); + node = Object::cast_to<NavigationRegion2D>(p_polygon); } int NavigationPolygonEditor::_get_polygon_count() const { @@ -127,5 +127,5 @@ NavigationPolygonEditor::NavigationPolygonEditor(EditorNode *p_editor) : } NavigationPolygonEditorPlugin::NavigationPolygonEditorPlugin(EditorNode *p_node) : - AbstractPolygon2DEditorPlugin(p_node, memnew(NavigationPolygonEditor(p_node)), "NavigationPolygonInstance") { + AbstractPolygon2DEditorPlugin(p_node, memnew(NavigationPolygonEditor(p_node)), "NavigationRegion2D") { } diff --git a/editor/plugins/navigation_polygon_editor_plugin.h b/editor/plugins/navigation_polygon_editor_plugin.h index 1cab336381..10f8cbc0a5 100644 --- a/editor/plugins/navigation_polygon_editor_plugin.h +++ b/editor/plugins/navigation_polygon_editor_plugin.h @@ -38,7 +38,7 @@ class NavigationPolygonEditor : public AbstractPolygon2DEditor { GDCLASS(NavigationPolygonEditor, AbstractPolygon2DEditor); - NavigationPolygonInstance *node; + NavigationRegion2D *node; Ref<NavigationPolygon> _ensure_navpoly() const; diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index a61b291029..0d5741d84a 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -109,8 +109,8 @@ void TileSetEditor::_import_node(Node *p_node, Ref<TileSet> p_library) { Node *child2 = mi->get_child(j); - if (Object::cast_to<NavigationPolygonInstance>(child2)) - nav_poly = Object::cast_to<NavigationPolygonInstance>(child2)->get_navigation_polygon(); + if (Object::cast_to<NavigationRegion2D>(child2)) + nav_poly = Object::cast_to<NavigationRegion2D>(child2)->get_navigation_polygon(); if (Object::cast_to<LightOccluder2D>(child2)) occluder = Object::cast_to<LightOccluder2D>(child2)->get_occluder_polygon(); diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index 40e1be665c..c155430eae 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/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" @@ -58,11 +58,11 @@ #include "scene/resources/convex_polygon_shape.h" #include "scene/resources/cylinder_shape.h" #include "scene/resources/height_map_shape.h" -#include "scene/resources/plane_shape.h" #include "scene/resources/primitive_meshes.h" #include "scene/resources/ray_shape.h" #include "scene/resources/sphere_shape.h" #include "scene/resources/surface_tool.h" +#include "scene/resources/world_margin_shape.h" #define HANDLE_HALF_SIZE 9.5 @@ -3575,9 +3575,9 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { p_gizmo->add_handles(handles, handles_material); } - if (Object::cast_to<PlaneShape>(*s)) { + if (Object::cast_to<WorldMarginShape>(*s)) { - Ref<PlaneShape> ps = s; + Ref<WorldMarginShape> ps = s; Plane p = ps->get_plane(); Vector<Vector3> points; @@ -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); diff --git a/main/tests/test_physics.cpp b/main/tests/test_physics.cpp index 43958a9493..0304e8f6dd 100644 --- a/main/tests/test_physics.cpp +++ b/main/tests/test_physics.cpp @@ -110,13 +110,13 @@ protected: PhysicsServer *ps = PhysicsServer::get_singleton(); - RID plane_shape = ps->shape_create(PhysicsServer::SHAPE_PLANE); - ps->shape_set_data(plane_shape, p_plane); + RID world_margin_shape = ps->shape_create(PhysicsServer::SHAPE_PLANE); + ps->shape_set_data(world_margin_shape, p_plane); RID b = ps->body_create(PhysicsServer::BODY_MODE_STATIC); ps->body_set_space(b, space); //todo set space - ps->body_add_shape(b, plane_shape); + ps->body_add_shape(b, world_margin_shape); return b; } diff --git a/modules/gdnavigation/navigation_mesh_editor_plugin.cpp b/modules/gdnavigation/navigation_mesh_editor_plugin.cpp index 28fe0bfd06..4ab90ac7eb 100644 --- a/modules/gdnavigation/navigation_mesh_editor_plugin.cpp +++ b/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) { diff --git a/modules/gdnavigation/navigation_mesh_editor_plugin.h b/modules/gdnavigation/navigation_mesh_editor_plugin.h index f5833f3d7f..7c3faebf57 100644 --- a/modules/gdnavigation/navigation_mesh_editor_plugin.h +++ b/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(); }; diff --git a/modules/gdnavigation/navigation_mesh_generator.cpp b/modules/gdnavigation/navigation_mesh_generator.cpp index 7f8761dac8..e7038b38a2 100644 --- a/modules/gdnavigation/navigation_mesh_generator.cpp +++ b/modules/gdnavigation/navigation_mesh_generator.cpp @@ -42,10 +42,10 @@ #include "scene/resources/concave_polygon_shape.h" #include "scene/resources/convex_polygon_shape.h" #include "scene/resources/cylinder_shape.h" -#include "scene/resources/plane_shape.h" #include "scene/resources/primitive_meshes.h" #include "scene/resources/shape.h" #include "scene/resources/sphere_shape.h" +#include "scene/resources/world_margin_shape.h" #include "modules/modules_enabled.gen.h" #ifdef TOOLS_ENABLED diff --git a/modules/gdnavigation/navigation_mesh_generator.h b/modules/gdnavigation/navigation_mesh_generator.h index 27a56e1d7a..d1f2e4b56f 100644 --- a/modules/gdnavigation/navigation_mesh_generator.h +++ b/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> diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index 41f29c4072..8fb9a8427e 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -374,7 +374,7 @@ NavigationPolygon::NavigationPolygon() : NavigationPolygon::~NavigationPolygon() { } -void NavigationPolygonInstance::set_enabled(bool p_enabled) { +void NavigationRegion2D::set_enabled(bool p_enabled) { if (enabled == p_enabled) return; @@ -398,25 +398,25 @@ void NavigationPolygonInstance::set_enabled(bool p_enabled) { update(); } -bool NavigationPolygonInstance::is_enabled() const { +bool NavigationRegion2D::is_enabled() const { return enabled; } ///////////////////////////// #ifdef TOOLS_ENABLED -Rect2 NavigationPolygonInstance::_edit_get_rect() const { +Rect2 NavigationRegion2D::_edit_get_rect() const { return navpoly.is_valid() ? navpoly->_edit_get_rect() : Rect2(); } -bool NavigationPolygonInstance::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { +bool NavigationRegion2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { return navpoly.is_valid() ? navpoly->_edit_is_selected_on_click(p_point, p_tolerance) : false; } #endif -void NavigationPolygonInstance::_notification(int p_what) { +void NavigationRegion2D::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { @@ -500,7 +500,7 @@ void NavigationPolygonInstance::_notification(int p_what) { } } -void NavigationPolygonInstance::set_navigation_polygon(const Ref<NavigationPolygon> &p_navpoly) { +void NavigationRegion2D::set_navigation_polygon(const Ref<NavigationPolygon> &p_navpoly) { if (p_navpoly == navpoly) { return; @@ -522,18 +522,18 @@ void NavigationPolygonInstance::set_navigation_polygon(const Ref<NavigationPolyg update_configuration_warning(); } -Ref<NavigationPolygon> NavigationPolygonInstance::get_navigation_polygon() const { +Ref<NavigationPolygon> NavigationRegion2D::get_navigation_polygon() const { return navpoly; } -void NavigationPolygonInstance::_navpoly_changed() { +void NavigationRegion2D::_navpoly_changed() { if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint())) update(); } -String NavigationPolygonInstance::get_configuration_warning() const { +String NavigationRegion2D::get_configuration_warning() const { if (!is_visible_in_tree() || !is_inside_tree()) return String(); @@ -551,24 +551,24 @@ String NavigationPolygonInstance::get_configuration_warning() const { c = Object::cast_to<Node2D>(c->get_parent()); } - return TTR("NavigationPolygonInstance must be a child or grandchild to a Navigation2D node. It only provides navigation data."); + return TTR("NavigationRegion2D must be a child or grandchild to a Navigation2D node. It only provides navigation data."); } -void NavigationPolygonInstance::_bind_methods() { +void NavigationRegion2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_navigation_polygon", "navpoly"), &NavigationPolygonInstance::set_navigation_polygon); - ClassDB::bind_method(D_METHOD("get_navigation_polygon"), &NavigationPolygonInstance::get_navigation_polygon); + ClassDB::bind_method(D_METHOD("set_navigation_polygon", "navpoly"), &NavigationRegion2D::set_navigation_polygon); + ClassDB::bind_method(D_METHOD("get_navigation_polygon"), &NavigationRegion2D::get_navigation_polygon); - ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationPolygonInstance::set_enabled); - ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationPolygonInstance::is_enabled); + ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationRegion2D::set_enabled); + ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationRegion2D::is_enabled); - ClassDB::bind_method(D_METHOD("_navpoly_changed"), &NavigationPolygonInstance::_navpoly_changed); + ClassDB::bind_method(D_METHOD("_navpoly_changed"), &NavigationRegion2D::_navpoly_changed); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "navpoly", PROPERTY_HINT_RESOURCE_TYPE, "NavigationPolygon"), "set_navigation_polygon", "get_navigation_polygon"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled"); } -NavigationPolygonInstance::NavigationPolygonInstance() { +NavigationRegion2D::NavigationRegion2D() { enabled = true; set_notify_transform(true); @@ -577,6 +577,6 @@ NavigationPolygonInstance::NavigationPolygonInstance() { navigation = NULL; } -NavigationPolygonInstance::~NavigationPolygonInstance() { +NavigationRegion2D::~NavigationRegion2D() { Navigation2DServer::get_singleton()->free(region); } diff --git a/scene/2d/navigation_polygon.h b/scene/2d/navigation_polygon.h index 70804358f6..579d6b0e0e 100644 --- a/scene/2d/navigation_polygon.h +++ b/scene/2d/navigation_polygon.h @@ -94,9 +94,9 @@ public: class Navigation2D; -class NavigationPolygonInstance : public Node2D { +class NavigationRegion2D : public Node2D { - GDCLASS(NavigationPolygonInstance, Node2D); + GDCLASS(NavigationRegion2D, Node2D); bool enabled; RID region; @@ -123,8 +123,8 @@ public: String get_configuration_warning() const; - NavigationPolygonInstance(); - ~NavigationPolygonInstance(); + NavigationRegion2D(); + ~NavigationRegion2D(); }; #endif // NAVIGATIONPOLYGON_H diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp index d0d775d557..c7a92b66e1 100644 --- a/scene/3d/collision_shape.cpp +++ b/scene/3d/collision_shape.cpp @@ -33,9 +33,9 @@ #include "scene/resources/capsule_shape.h" #include "scene/resources/concave_polygon_shape.h" #include "scene/resources/convex_polygon_shape.h" -#include "scene/resources/plane_shape.h" #include "scene/resources/ray_shape.h" #include "scene/resources/sphere_shape.h" +#include "scene/resources/world_margin_shape.h" #include "servers/visual_server.h" //TODO: Implement CylinderShape and HeightMapShape? #include "core/math/quick_hull.h" @@ -123,10 +123,6 @@ String CollisionShape::get_configuration_warning() const { return TTR("A shape must be provided for CollisionShape to function. Please create a shape resource for it."); } - if (shape->is_class("PlaneShape")) { - return TTR("Plane shapes don't work well and will be removed in future versions. Please don't use them."); - } - return String(); } diff --git a/scene/3d/navigation.h b/scene/3d/navigation.h index 85887651ff..08f306611f 100644 --- a/scene/3d/navigation.h +++ b/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 { diff --git a/scene/3d/navigation_mesh_instance.cpp b/scene/3d/navigation_region.cpp index 8f8574ba2d..d96d095797 100644 --- a/scene/3d/navigation_mesh_instance.cpp +++ b/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); diff --git a/scene/3d/navigation_mesh_instance.h b/scene/3d/navigation_region.h index 1135bf47d2..f215e92c97 100644 --- a/scene/3d/navigation_mesh_instance.h +++ b/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 diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 6288598ce2..dd00565929 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -151,7 +151,6 @@ #include "scene/resources/packed_scene.h" #include "scene/resources/particles_material.h" #include "scene/resources/physics_material.h" -#include "scene/resources/plane_shape.h" #include "scene/resources/polygon_path_finder.h" #include "scene/resources/primitive_meshes.h" #include "scene/resources/ray_shape.h" @@ -169,6 +168,7 @@ #include "scene/resources/visual_shader_nodes.h" #include "scene/resources/world.h" #include "scene/resources/world_2d.h" +#include "scene/resources/world_margin_shape.h" #include "scene/scene_string_names.h" #ifndef _3D_DISABLED @@ -190,8 +190,8 @@ #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_obstacle.h" +#include "scene/3d/navigation_region.h" #include "scene/3d/particles.h" #include "scene/3d/path.h" #include "scene/3d/physics_body.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>(); @@ -643,7 +643,7 @@ void register_scene_types() { ClassDB::register_class<CapsuleShape>(); ClassDB::register_class<CylinderShape>(); ClassDB::register_class<HeightMapShape>(); - ClassDB::register_class<PlaneShape>(); + ClassDB::register_class<WorldMarginShape>(); ClassDB::register_class<ConvexPolygonShape>(); ClassDB::register_class<ConcavePolygonShape>(); @@ -726,7 +726,7 @@ void register_scene_types() { ClassDB::register_class<Navigation2D>(); ClassDB::register_class<NavigationPolygon>(); - ClassDB::register_class<NavigationPolygonInstance>(); + ClassDB::register_class<NavigationRegion2D>(); ClassDB::register_class<NavigationAgent2D>(); ClassDB::register_class<NavigationObstacle2D>(); @@ -746,6 +746,9 @@ void register_scene_types() { ClassDB::add_compatibility_class("VisualShaderNodeScalarUniform", "VisualShaderNodeFloatUniform"); ClassDB::add_compatibility_class("VisualShaderNodeScalarOp", "VisualShaderNodeFloatOp"); ClassDB::add_compatibility_class("VisualShaderNodeScalarFunc", "VisualShaderNodeFloatFunc"); + ClassDB::add_compatibility_class("NavigationMeshInstance", "NavigationRegion"); + ClassDB::add_compatibility_class("NavigationPolygonInstance", "NavigationRegion2D"); + ClassDB::add_compatibility_class("PlaneShape", "WorldMarginShape"); #endif OS::get_singleton()->yield(); //may take time to init diff --git a/scene/resources/mesh_library.h b/scene/resources/mesh_library.h index 9155975f47..b256e86b96 100644 --- a/scene/resources/mesh_library.h +++ b/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 { diff --git a/scene/resources/plane_shape.cpp b/scene/resources/world_margin_shape.cpp index ddc820233e..b5b701327c 100644 --- a/scene/resources/plane_shape.cpp +++ b/scene/resources/world_margin_shape.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* plane_shape.cpp */ +/* world_margin_shape.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "plane_shape.h" +#include "world_margin_shape.h" #include "servers/physics_server.h" -Vector<Vector3> PlaneShape::get_debug_mesh_lines() { +Vector<Vector3> WorldMarginShape::get_debug_mesh_lines() { Plane p = get_plane(); Vector<Vector3> points; @@ -61,13 +61,13 @@ Vector<Vector3> PlaneShape::get_debug_mesh_lines() { return points; } -void PlaneShape::_update_shape() { +void WorldMarginShape::_update_shape() { PhysicsServer::get_singleton()->shape_set_data(get_shape(), plane); Shape::_update_shape(); } -void PlaneShape::set_plane(Plane p_plane) { +void WorldMarginShape::set_plane(Plane p_plane) { plane = p_plane; _update_shape(); @@ -75,20 +75,20 @@ void PlaneShape::set_plane(Plane p_plane) { _change_notify("plane"); } -Plane PlaneShape::get_plane() const { +Plane WorldMarginShape::get_plane() const { return plane; } -void PlaneShape::_bind_methods() { +void WorldMarginShape::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_plane", "plane"), &PlaneShape::set_plane); - ClassDB::bind_method(D_METHOD("get_plane"), &PlaneShape::get_plane); + ClassDB::bind_method(D_METHOD("set_plane", "plane"), &WorldMarginShape::set_plane); + ClassDB::bind_method(D_METHOD("get_plane"), &WorldMarginShape::get_plane); ADD_PROPERTY(PropertyInfo(Variant::PLANE, "plane"), "set_plane", "get_plane"); } -PlaneShape::PlaneShape() : +WorldMarginShape::WorldMarginShape() : Shape(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_PLANE)) { set_plane(Plane(0, 1, 0, 0)); diff --git a/scene/resources/plane_shape.h b/scene/resources/world_margin_shape.h index 360f9dbbe9..78ea570212 100644 --- a/scene/resources/plane_shape.h +++ b/scene/resources/world_margin_shape.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* plane_shape.h */ +/* world_margin_shape.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef PLANE_SHAPE_H -#define PLANE_SHAPE_H +#ifndef WORLD_MARGIN_SHAPE_H +#define WORLD_MARGIN_SHAPE_H #include "scene/resources/shape.h" -class PlaneShape : public Shape { +class WorldMarginShape : public Shape { - GDCLASS(PlaneShape, Shape); + GDCLASS(WorldMarginShape, Shape); Plane plane; protected: @@ -52,6 +52,6 @@ public: return 0; } - PlaneShape(); + WorldMarginShape(); }; -#endif // PLANE_SHAPE_H +#endif // WORLD_MARGIN_SHAPE_H diff --git a/servers/navigation_server.h b/servers/navigation_server.h index 2587e53ab2..7c9b6ba595 100644 --- a/servers/navigation_server.h +++ b/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 |