Skip to content

Commit

Permalink
Merge pull request #46786 from groud/navigation
Browse files Browse the repository at this point in the history
Remove Navigation2D/3D nodes
  • Loading branch information
akien-mga authored Mar 10, 2021
2 parents 469ac1e + ba13444 commit bc229cd
Show file tree
Hide file tree
Showing 59 changed files with 639 additions and 1,043 deletions.
2 changes: 2 additions & 0 deletions core/core_constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,10 @@ void register_global_constants() {

BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_2D_RENDER);
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_2D_PHYSICS);
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_2D_NAVIGATION);
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_3D_RENDER);
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_3D_PHYSICS);
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_3D_NAVIGATION);

BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_FILE);
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_DIR);
Expand Down
2 changes: 2 additions & 0 deletions core/object/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ enum PropertyHint {
PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags)
PROPERTY_HINT_LAYERS_2D_RENDER,
PROPERTY_HINT_LAYERS_2D_PHYSICS,
PROPERTY_HINT_LAYERS_2D_NAVIGATION,
PROPERTY_HINT_LAYERS_3D_RENDER,
PROPERTY_HINT_LAYERS_3D_PHYSICS,
PROPERTY_HINT_LAYERS_3D_NAVIGATION,
PROPERTY_HINT_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
PROPERTY_HINT_DIR, ///< a directory path must be passed
PROPERTY_HINT_GLOBAL_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
Expand Down
32 changes: 19 additions & 13 deletions doc/classes/@GlobalScope.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2409,43 +2409,49 @@
<constant name="PROPERTY_HINT_LAYERS_2D_PHYSICS" value="9" enum="PropertyHint">
Hints that an integer property is a bitmask using the optionally named 2D physics layers.
</constant>
<constant name="PROPERTY_HINT_LAYERS_3D_RENDER" value="10" enum="PropertyHint">
<constant name="PROPERTY_HINT_LAYERS_2D_NAVIGATION" value="10" enum="PropertyHint">
Hints that an integer property is a bitmask using the optionally named 2D navigation layers.
</constant>
<constant name="PROPERTY_HINT_LAYERS_3D_RENDER" value="11" enum="PropertyHint">
Hints that an integer property is a bitmask using the optionally named 3D render layers.
</constant>
<constant name="PROPERTY_HINT_LAYERS_3D_PHYSICS" value="11" enum="PropertyHint">
<constant name="PROPERTY_HINT_LAYERS_3D_PHYSICS" value="12" enum="PropertyHint">
Hints that an integer property is a bitmask using the optionally named 3D physics layers.
</constant>
<constant name="PROPERTY_HINT_FILE" value="12" enum="PropertyHint">
<constant name="PROPERTY_HINT_LAYERS_3D_NAVIGATION" value="13" enum="PropertyHint">
Hints that an integer property is a bitmask using the optionally named 2D navigation layers.
</constant>
<constant name="PROPERTY_HINT_FILE" value="14" enum="PropertyHint">
Hints that a string property is a path to a file. Editing it will show a file dialog for picking the path. The hint string can be a set of filters with wildcards like [code]"*.png,*.jpg"[/code].
</constant>
<constant name="PROPERTY_HINT_DIR" value="13" enum="PropertyHint">
<constant name="PROPERTY_HINT_DIR" value="15" enum="PropertyHint">
Hints that a string property is a path to a directory. Editing it will show a file dialog for picking the path.
</constant>
<constant name="PROPERTY_HINT_GLOBAL_FILE" value="14" enum="PropertyHint">
<constant name="PROPERTY_HINT_GLOBAL_FILE" value="16" enum="PropertyHint">
Hints that a string property is an absolute path to a file outside the project folder. Editing it will show a file dialog for picking the path. The hint string can be a set of filters with wildcards like [code]"*.png,*.jpg"[/code].
</constant>
<constant name="PROPERTY_HINT_GLOBAL_DIR" value="15" enum="PropertyHint">
<constant name="PROPERTY_HINT_GLOBAL_DIR" value="17" enum="PropertyHint">
Hints that a string property is an absolute path to a directory outside the project folder. Editing it will show a file dialog for picking the path.
</constant>
<constant name="PROPERTY_HINT_RESOURCE_TYPE" value="16" enum="PropertyHint">
<constant name="PROPERTY_HINT_RESOURCE_TYPE" value="18" enum="PropertyHint">
Hints that a property is an instance of a [Resource]-derived type, optionally specified via the hint string (e.g. [code]"Texture2D"[/code]). Editing it will show a popup menu of valid resource types to instantiate.
</constant>
<constant name="PROPERTY_HINT_MULTILINE_TEXT" value="17" enum="PropertyHint">
<constant name="PROPERTY_HINT_MULTILINE_TEXT" value="19" enum="PropertyHint">
Hints that a string property is text with line breaks. Editing it will show a text input field where line breaks can be typed.
</constant>
<constant name="PROPERTY_HINT_PLACEHOLDER_TEXT" value="18" enum="PropertyHint">
<constant name="PROPERTY_HINT_PLACEHOLDER_TEXT" value="20" enum="PropertyHint">
Hints that a string property should have a placeholder text visible on its input field, whenever the property is empty. The hint string is the placeholder text to use.
</constant>
<constant name="PROPERTY_HINT_COLOR_NO_ALPHA" value="19" enum="PropertyHint">
<constant name="PROPERTY_HINT_COLOR_NO_ALPHA" value="21" enum="PropertyHint">
Hints that a color property should be edited without changing its alpha component, i.e. only R, G and B channels are edited.
</constant>
<constant name="PROPERTY_HINT_IMAGE_COMPRESS_LOSSY" value="20" enum="PropertyHint">
<constant name="PROPERTY_HINT_IMAGE_COMPRESS_LOSSY" value="22" enum="PropertyHint">
Hints that an image is compressed using lossy compression.
</constant>
<constant name="PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS" value="21" enum="PropertyHint">
<constant name="PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS" value="23" enum="PropertyHint">
Hints that an image is compressed using lossless compression.
</constant>
<constant name="PROPERTY_HINT_TYPE_STRING" value="23" enum="PropertyHint">
<constant name="PROPERTY_HINT_TYPE_STRING" value="25" enum="PropertyHint">
Hint that a property represents a particular type. If a property is [constant TYPE_STRING], allows to set a type from the create dialog. If you need to create an [Array] to contain elements of a specific type, the [code]hint_string[/code] must encode nested types using [code]":"[/code] and [code]"/"[/code] for specifying [Resource] types. For instance:
[codeblock]
hint_string = "%s:" % [TYPE_INT] # Array of inteters.
Expand Down
59 changes: 0 additions & 59 deletions doc/classes/Navigation2D.xml

This file was deleted.

84 changes: 0 additions & 84 deletions doc/classes/Navigation3D.xml

This file was deleted.

18 changes: 1 addition & 17 deletions doc/classes/NavigationAgent2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
2D Agent used in navigation for collision avoidance.
</brief_description>
<description>
2D Agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. This can be done by having the agent as a child of a [Navigation2D] node, or using [method set_navigation]. [NavigationAgent2D] is physics safe.
2D Agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. [NavigationAgent2D] is physics safe.
</description>
<tutorials>
</tutorials>
Expand Down Expand Up @@ -37,13 +37,6 @@
Returns which index the agent is currently on in the navigation path's [PackedVector2Array].
</description>
</method>
<method name="get_navigation" qualifiers="const">
<return type="Node">
</return>
<description>
Returns the [Navigation2D] node that the agent is using for its navigation system.
</description>
</method>
<method name="get_next_location">
<return type="Vector2">
</return>
Expand Down Expand Up @@ -79,15 +72,6 @@
Returns true if the target location is reached. The target location is set using [method set_target_location]. It may not always be possible to reach the target location. It should always be possible to reach the final location though. See [method get_final_location].
</description>
</method>
<method name="set_navigation">
<return type="void">
</return>
<argument index="0" name="navigation" type="Node">
</argument>
<description>
Sets the [Navigation2D] node used by the agent. Useful when you don't want to make the agent a child of a [Navigation2D] node.
</description>
</method>
<method name="set_target_location">
<return type="void">
</return>
Expand Down
18 changes: 1 addition & 17 deletions doc/classes/NavigationAgent3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
3D Agent used in navigation for collision avoidance.
</brief_description>
<description>
3D Agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. This can be done by having the agent as a child of a [Navigation3D] node, or using [method set_navigation]. [NavigationAgent3D] is physics safe.
3D Agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. [NavigationAgent3D] is physics safe.
</description>
<tutorials>
</tutorials>
Expand Down Expand Up @@ -37,13 +37,6 @@
Returns which index the agent is currently on in the navigation path's [PackedVector3Array].
</description>
</method>
<method name="get_navigation" qualifiers="const">
<return type="Node">
</return>
<description>
Returns the [Navigation3D] node that the agent is using for its navigation system.
</description>
</method>
<method name="get_next_location">
<return type="Vector3">
</return>
Expand Down Expand Up @@ -79,15 +72,6 @@
Returns true if the target location is reached. The target location is set using [method set_target_location]. It may not always be possible to reach the target location. It should always be possible to reach the final location though. See [method get_final_location].
</description>
</method>
<method name="set_navigation">
<return type="void">
</return>
<argument index="0" name="navigation" type="Node">
</argument>
<description>
Sets the [Navigation3D] node used by the agent. Useful when you don't want to make the agent a child of a [Navigation3D] node.
</description>
</method>
<method name="set_target_location">
<return type="void">
</return>
Expand Down
18 changes: 1 addition & 17 deletions doc/classes/NavigationObstacle2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,11 @@
2D Obstacle used in navigation for collision avoidance.
</brief_description>
<description>
2D Obstacle used in navigation for collision avoidance. The obstacle needs navigation data to work correctly. This can be done by having the obstacle as a child of a [Navigation2D] node, or using [method set_navigation]. [NavigationObstacle2D] is physics safe.
2D Obstacle used in navigation for collision avoidance. The obstacle needs navigation data to work correctly. [NavigationObstacle2D] is physics safe.
</description>
<tutorials>
</tutorials>
<methods>
<method name="get_navigation" qualifiers="const">
<return type="Node">
</return>
<description>
Returns the [Navigation2D] node that the obstacle is using for its navigation system.
</description>
</method>
<method name="set_navigation">
<return type="void">
</return>
<argument index="0" name="navigation" type="Node">
</argument>
<description>
Sets the [Navigation2D] node used by the obstacle. Useful when you don't want to make the obstacle a child of a [Navigation2D] node.
</description>
</method>
</methods>
<constants>
</constants>
Expand Down
18 changes: 1 addition & 17 deletions doc/classes/NavigationObstacle3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,11 @@
3D Obstacle used in navigation for collision avoidance.
</brief_description>
<description>
3D Obstacle used in navigation for collision avoidance. The obstacle needs navigation data to work correctly. This can be done by having the obstacle as a child of a [Navigation3D] node, or using [method set_navigation]. [NavigationObstacle3D] is physics safe.
3D Obstacle used in navigation for collision avoidance. The obstacle needs navigation data to work correctly. [NavigationObstacle3D] is physics safe.
</description>
<tutorials>
</tutorials>
<methods>
<method name="get_navigation" qualifiers="const">
<return type="Node">
</return>
<description>
Returns the [Navigation3D] node that the obstacle is using for its navigation system.
</description>
</method>
<method name="set_navigation">
<return type="void">
</return>
<argument index="0" name="navigation" type="Node">
</argument>
<description>
Sets the [Navigation3D] node used by the obstacle. Useful when you don't want to make the obstacle a child of a [Navigation3D] node.
</description>
</method>
</methods>
<constants>
</constants>
Expand Down
9 changes: 9 additions & 0 deletions doc/classes/NavigationRegion2D.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="NavigationRegion2D" inherits="Node2D" version="4.0">
<brief_description>
A region of the 2D navigation map.
</brief_description>
<description>
A region of the navigation map. It tells the [NavigationServer2D] what can be navigated and what cannot, based on its [NavigationPolygon] resource.
Two regions can be connected to each other if they share a similar edge. You can set the minimum distance between two vertices required to connect two edges by using [method NavigationServer2D.map_set_edge_connection_margin].
[b]Note:[/b] Overlapping two regions' polygons is not enough for connecting two regions. They must share a similar edge.
</description>
<tutorials>
</tutorials>
<methods>
</methods>
<members>
<member name="enabled" type="bool" setter="set_enabled" getter="is_enabled" default="true">
Determines if the [NavigationRegion2D] is enabled or disabled.
</member>
<member name="layers" type="int" setter="set_layers" getter="get_layers" default="1">
A bitfield determining all layers the region belongs to. These layers can be checked upon when requesting a path with [method NavigationServer2D.map_get_path].
</member>
<member name="navpoly" type="NavigationPolygon" setter="set_navigation_polygon" getter="get_navigation_polygon">
The [NavigationPolygon] resource to use.
</member>
</members>
<constants>
Expand Down
Loading

0 comments on commit bc229cd

Please sign in to comment.