Merge pull request #61843 from akien-mga/3.x-cherrypicks
This commit is contained in:
commit
19fec70580
20 changed files with 188 additions and 70 deletions
|
@ -197,6 +197,14 @@ void Dictionary::clear() {
|
|||
_p->variant_map.clear();
|
||||
}
|
||||
|
||||
void Dictionary::merge(const Dictionary &p_dictionary, bool p_overwrite) {
|
||||
for (OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = p_dictionary._p->variant_map.front(); E; E = E.next()) {
|
||||
if (p_overwrite || !has(E.key())) {
|
||||
this->operator[](E.key()) = E.value();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Dictionary::_unref() const {
|
||||
ERR_FAIL_COND(!_p);
|
||||
if (_p->refcount.unref()) {
|
||||
|
|
|
@ -62,6 +62,7 @@ public:
|
|||
int size() const;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
void merge(const Dictionary &p_dictionary, bool p_overwrite = false);
|
||||
|
||||
bool has(const Variant &p_key) const;
|
||||
bool has_all(const Array &p_keys) const;
|
||||
|
|
|
@ -634,6 +634,7 @@ void register_global_constants() {
|
|||
BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAG_REVERSE);
|
||||
BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAG_VIRTUAL);
|
||||
BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAG_FROM_SCRIPT);
|
||||
BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAG_VARARG);
|
||||
BIND_GLOBAL_ENUM_CONSTANT(METHOD_FLAGS_DEFAULT);
|
||||
|
||||
BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_NIL", Variant::NIL);
|
||||
|
|
|
@ -549,6 +549,7 @@ struct _VariantCall {
|
|||
VCALL_LOCALMEM0R(Dictionary, size);
|
||||
VCALL_LOCALMEM0R(Dictionary, empty);
|
||||
VCALL_LOCALMEM0(Dictionary, clear);
|
||||
VCALL_LOCALMEM2(Dictionary, merge);
|
||||
VCALL_LOCALMEM1R(Dictionary, has);
|
||||
VCALL_LOCALMEM1R(Dictionary, has_all);
|
||||
VCALL_LOCALMEM1R(Dictionary, erase);
|
||||
|
@ -1919,6 +1920,7 @@ void register_variant_methods() {
|
|||
ADDFUNC0R(DICTIONARY, INT, Dictionary, size, varray());
|
||||
ADDFUNC0R(DICTIONARY, BOOL, Dictionary, empty, varray());
|
||||
ADDFUNC0NC(DICTIONARY, NIL, Dictionary, clear, varray());
|
||||
ADDFUNC2NC(DICTIONARY, NIL, Dictionary, merge, DICTIONARY, "dictionary", BOOL, "overwrite", varray(false));
|
||||
ADDFUNC1R(DICTIONARY, BOOL, Dictionary, has, NIL, "key", varray());
|
||||
ADDFUNC1R(DICTIONARY, BOOL, Dictionary, has_all, ARRAY, "keys", varray());
|
||||
ADDFUNC1RNC(DICTIONARY, BOOL, Dictionary, erase, NIL, "key", varray());
|
||||
|
|
|
@ -1545,6 +1545,8 @@
|
|||
<constant name="METHOD_FLAG_FROM_SCRIPT" value="64" enum="MethodFlags">
|
||||
Deprecated method flag, unused.
|
||||
</constant>
|
||||
<constant name="METHOD_FLAG_VARARG" value="128" enum="MethodFlags">
|
||||
</constant>
|
||||
<constant name="METHOD_FLAGS_DEFAULT" value="1" enum="MethodFlags">
|
||||
Default method flags.
|
||||
</constant>
|
||||
|
|
|
@ -164,6 +164,13 @@
|
|||
Returns the list of keys in the [Dictionary].
|
||||
</description>
|
||||
</method>
|
||||
<method name="merge">
|
||||
<argument index="0" name="dictionary" type="Dictionary" />
|
||||
<argument index="1" name="overwrite" type="bool" default="false" />
|
||||
<description>
|
||||
Adds elements from [code]dictionary[/code] to this [Dictionary]. By default, duplicate keys will not be copied over, unless [code]overwrite[/code] is [code]true[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="size">
|
||||
<return type="int" />
|
||||
<description>
|
||||
|
|
|
@ -310,7 +310,15 @@
|
|||
<method name="get_state" qualifiers="virtual">
|
||||
<return type="Dictionary" />
|
||||
<description>
|
||||
Gets the state of your plugin editor. This is used when saving the scene (so state is kept when opening it again) and for switching tabs (so state can be restored when the tab returns).
|
||||
Override this method to provide a state data you want to be saved, like view position, grid settings, folding, etc. This is used when saving the scene (so state is kept when opening it again) and for switching tabs (so state can be restored when the tab returns). This data is automatically saved for each scene in an [code]editstate[/code] file in the editor metadata folder. If you want to store global (scene-independent) editor data for your plugin, you can use [method get_window_layout] instead.
|
||||
Use [method set_state] to restore your saved state.
|
||||
[b]Note:[/b] This method should not be used to save important settings that should persist with the project.
|
||||
[b]Note:[/b] You must implement [method get_plugin_name] for the state to be stored and restored correctly.
|
||||
[codeblock]
|
||||
func get_state():
|
||||
var state = {"zoom": zoom, "preferred_color": my_color}
|
||||
return state
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_undo_redo">
|
||||
|
@ -323,7 +331,13 @@
|
|||
<return type="void" />
|
||||
<argument index="0" name="layout" type="ConfigFile" />
|
||||
<description>
|
||||
Gets the GUI layout of the plugin. This is used to save the project's editor layout when [method queue_save_layout] is called or the editor layout was changed(For example changing the position of a dock).
|
||||
Override this method to provide the GUI layout of the plugin or any other data you want to be stored. This is used to save the project's editor layout when [method queue_save_layout] is called or the editor layout was changed (for example changing the position of a dock). The data is stored in the [code]editor_layout.cfg[/code] file in the editor metadata directory.
|
||||
Use [method set_window_layout] to restore your saved layout.
|
||||
[codeblock]
|
||||
func get_window_layout(configuration):
|
||||
configuration.set_value("MyPlugin", "window_position", $Window.position)
|
||||
configuration.set_value("MyPlugin", "icon_color", $Icon.modulate)
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
<method name="handles" qualifiers="virtual">
|
||||
|
@ -466,14 +480,25 @@
|
|||
<return type="void" />
|
||||
<argument index="0" name="state" type="Dictionary" />
|
||||
<description>
|
||||
Restore the state saved by [method get_state].
|
||||
Restore the state saved by [method get_state]. This method is called when the current scene tab is changed in the editor.
|
||||
[b]Note:[/b] Your plugin must implement [method get_plugin_name], otherwise it will not be recognized and this method will not be called.
|
||||
[codeblock]
|
||||
func set_state(data):
|
||||
zoom = data.get("zoom", 1.0)
|
||||
preferred_color = data.get("my_color", Color.white)
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_window_layout" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<argument index="0" name="layout" type="ConfigFile" />
|
||||
<description>
|
||||
Restore the plugin GUI layout saved by [method get_window_layout].
|
||||
Restore the plugin GUI layout and data saved by [method get_window_layout]. This method is called for every plugin on editor startup. Use the provided [code]configuration[/code] file to read your saved data.
|
||||
[codeblock]
|
||||
func set_window_layout(configuration):
|
||||
$Window.position = configuration.get_value("MyPlugin", "window_position", Vector2())
|
||||
$Icon.modulate = configuration.get_value("MyPlugin", "icon_color", Color.white)
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
<method name="update_overlays" qualifiers="const">
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
</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 (Reciprocal Velocity Obstacles) collision avoidance. The agent needs navigation data to work correctly. This can be done by having the agent as a child of a [Navigation] node, or using [method set_navigation]. [NavigationAgent] is physics safe.
|
||||
[b]Note:[/b] After [method set_target_location] is used it is required to use the [method get_next_location] function once every physics frame to update the internal path logic of the NavigationAgent. The returned vector position from this function should be used as the next movement position for the agent's parent Node.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -24,7 +25,7 @@
|
|||
<method name="get_nav_path" qualifiers="const">
|
||||
<return type="PoolVector3Array" />
|
||||
<description>
|
||||
Returns the path from start to finish in global coordinates.
|
||||
Returns this agent's current path from start to finish in global coordinates. The path only updates when the target location is changed or the agent requires a repath. The path array is not intended to be used in direct path movement as the agent has its own internal path logic that would get corrupted by changing the path array manually. Use the intended [method get_next_location] once every physics frame to receive the next path point for the agents movement as this function also updates the internal path logic.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_nav_path_index" qualifiers="const">
|
||||
|
@ -42,7 +43,7 @@
|
|||
<method name="get_next_location">
|
||||
<return type="Vector3" />
|
||||
<description>
|
||||
Returns a [Vector3] in global coordinates, that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the origin of the agent's parent.
|
||||
Returns the next location in global coordinates that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. The use of this function once every physics frame is required to update the internal path logic of the NavigationAgent.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_rid" qualifiers="const">
|
||||
|
@ -99,7 +100,7 @@
|
|||
</methods>
|
||||
<members>
|
||||
<member name="agent_height_offset" type="float" setter="set_agent_height_offset" getter="get_agent_height_offset" default="0.0">
|
||||
The agent height offset to match the navigation mesh height.
|
||||
The NavigationAgent height offset is subtracted from the y-axis value of any vector path position for this NavigationAgent. The NavigationAgent height offset does not change or influence the navigation mesh or pathfinding query result. Additional navigation maps that use regions with navigation meshes that the developer baked with appropriate agent radius or height values are required to support different-sized agents.
|
||||
</member>
|
||||
<member name="avoidance_enabled" type="bool" setter="set_avoidance_enabled" getter="get_avoidance_enabled" default="false">
|
||||
If [code]true[/code] the agent is registered for an RVO avoidance callback on the [NavigationServer]. When [method set_velocity] is used and the processing is completed a [code]safe_velocity[/code] Vector3 is received with a signal connection to [signal velocity_computed]. Avoidance processing with many registered agents has a significant performance cost and should only be enabled on agents that currently require it.
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
</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 (Reciprocal Velocity Obstacles) 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.
|
||||
[b]Note:[/b] After [method set_target_location] is used it is required to use the [method get_next_location] function once every physics frame to update the internal path logic of the NavigationAgent. The returned vector position from this function should be used as the next movement position for the agent's parent Node.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -24,7 +25,7 @@
|
|||
<method name="get_nav_path" qualifiers="const">
|
||||
<return type="PoolVector2Array" />
|
||||
<description>
|
||||
Returns the path from start to finish in global coordinates.
|
||||
Returns this agent's current path from start to finish in global coordinates. The path only updates when the target location is changed or the agent requires a repath. The path array is not intended to be used in direct path movement as the agent has its own internal path logic that would get corrupted by changing the path array manually. Use the intended [method get_next_location] once every physics frame to receive the next path point for the agents movement as this function also updates the internal path logic.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_nav_path_index" qualifiers="const">
|
||||
|
@ -42,7 +43,7 @@
|
|||
<method name="get_next_location">
|
||||
<return type="Vector2" />
|
||||
<description>
|
||||
Returns a [Vector2] in global coordinates, that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent.
|
||||
Returns the next location in global coordinates that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. The use of this function once every physics frame is required to update the internal path logic of the NavigationAgent.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_rid" qualifiers="const">
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<return type="bool" />
|
||||
<argument index="0" name="bit" type="int" />
|
||||
<description>
|
||||
Returns whether the specified [code]bit[/code] of the [member geometry/collision_mask] is set.
|
||||
Returns whether the specified [code]bit[/code] of the [member geometry_collision_mask] is set.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_polygon">
|
||||
|
@ -61,8 +61,8 @@
|
|||
<argument index="0" name="bit" type="int" />
|
||||
<argument index="1" name="value" type="bool" />
|
||||
<description>
|
||||
If [code]value[/code] is [code]true[/code], sets the specified [code]bit[/code] in the [member geometry/collision_mask].
|
||||
If [code]value[/code] is [code]false[/code], clears the specified [code]bit[/code] in the [member geometry/collision_mask].
|
||||
If [code]value[/code] is [code]true[/code], sets the specified [code]bit[/code] in the [member geometry_collision_mask].
|
||||
If [code]value[/code] is [code]false[/code], clears the specified [code]bit[/code] in the [member geometry_collision_mask].
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_vertices">
|
||||
|
@ -74,75 +74,75 @@
|
|||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="agent/height" type="float" setter="set_agent_height" getter="get_agent_height" default="1.5">
|
||||
<member name="agent_height" type="float" setter="set_agent_height" getter="get_agent_height" default="1.5">
|
||||
The minimum floor to ceiling height that will still allow the floor area to be considered walkable.
|
||||
[b]Note:[/b] While baking, this value will be rounded up to the nearest multiple of [member cell/height].
|
||||
[b]Note:[/b] While baking, this value will be rounded up to the nearest multiple of [member cell_height].
|
||||
</member>
|
||||
<member name="agent/max_climb" type="float" setter="set_agent_max_climb" getter="get_agent_max_climb" default="0.25">
|
||||
<member name="agent_max_climb" type="float" setter="set_agent_max_climb" getter="get_agent_max_climb" default="0.25">
|
||||
The minimum ledge height that is considered to still be traversable.
|
||||
[b]Note:[/b] While baking, this value will be rounded down to the nearest multiple of [member cell/height].
|
||||
[b]Note:[/b] While baking, this value will be rounded down to the nearest multiple of [member cell_height].
|
||||
</member>
|
||||
<member name="agent/max_slope" type="float" setter="set_agent_max_slope" getter="get_agent_max_slope" default="45.0">
|
||||
<member name="agent_max_slope" type="float" setter="set_agent_max_slope" getter="get_agent_max_slope" default="45.0">
|
||||
The maximum slope that is considered walkable, in degrees.
|
||||
</member>
|
||||
<member name="agent/radius" type="float" setter="set_agent_radius" getter="get_agent_radius" default="0.5">
|
||||
<member name="agent_radius" type="float" setter="set_agent_radius" getter="get_agent_radius" default="0.5">
|
||||
The distance to erode/shrink the walkable area of the heightfield away from obstructions.
|
||||
[b]Note:[/b] While baking, this value will be rounded up to the nearest multiple of [member cell/size].
|
||||
[b]Note:[/b] While baking, this value will be rounded up to the nearest multiple of [member cell_size].
|
||||
</member>
|
||||
<member name="cell/height" type="float" setter="set_cell_height" getter="get_cell_height" default="0.25">
|
||||
<member name="cell_height" type="float" setter="set_cell_height" getter="get_cell_height" default="0.25">
|
||||
The Y axis cell size to use for fields.
|
||||
</member>
|
||||
<member name="cell/size" type="float" setter="set_cell_size" getter="get_cell_size" default="0.25">
|
||||
<member name="cell_size" type="float" setter="set_cell_size" getter="get_cell_size" default="0.25">
|
||||
The XZ plane cell size to use for fields.
|
||||
</member>
|
||||
<member name="detail/sample_distance" type="float" setter="set_detail_sample_distance" getter="get_detail_sample_distance" default="6.0">
|
||||
<member name="detail_sample_distance" type="float" setter="set_detail_sample_distance" getter="get_detail_sample_distance" default="6.0">
|
||||
The sampling distance to use when generating the detail mesh, in cell unit.
|
||||
</member>
|
||||
<member name="detail/sample_max_error" type="float" setter="set_detail_sample_max_error" getter="get_detail_sample_max_error" default="5.0">
|
||||
<member name="detail_sample_max_error" type="float" setter="set_detail_sample_max_error" getter="get_detail_sample_max_error" default="5.0">
|
||||
The maximum distance the detail mesh surface should deviate from heightfield, in cell unit.
|
||||
</member>
|
||||
<member name="edge/max_error" type="float" setter="set_edge_max_error" getter="get_edge_max_error" default="1.3">
|
||||
<member name="edge_max_error" type="float" setter="set_edge_max_error" getter="get_edge_max_error" default="1.3">
|
||||
The maximum distance a simplfied contour's border edges should deviate the original raw contour.
|
||||
</member>
|
||||
<member name="edge/max_length" type="float" setter="set_edge_max_length" getter="get_edge_max_length" default="12.0">
|
||||
<member name="edge_max_length" type="float" setter="set_edge_max_length" getter="get_edge_max_length" default="12.0">
|
||||
The maximum allowed length for contour edges along the border of the mesh.
|
||||
[b]Note:[/b] While baking, this value will be rounded up to the nearest multiple of [member cell/size].
|
||||
[b]Note:[/b] While baking, this value will be rounded up to the nearest multiple of [member cell_size].
|
||||
</member>
|
||||
<member name="filter/filter_walkable_low_height_spans" type="bool" setter="set_filter_walkable_low_height_spans" getter="get_filter_walkable_low_height_spans" default="false">
|
||||
If [code]true[/code], marks walkable spans as not walkable if the clearance above the span is less than [member agent/height].
|
||||
</member>
|
||||
<member name="filter/ledge_spans" type="bool" setter="set_filter_ledge_spans" getter="get_filter_ledge_spans" default="false">
|
||||
<member name="filter_ledge_spans" type="bool" setter="set_filter_ledge_spans" getter="get_filter_ledge_spans" default="false">
|
||||
If [code]true[/code], marks spans that are ledges as non-walkable.
|
||||
</member>
|
||||
<member name="filter/low_hanging_obstacles" type="bool" setter="set_filter_low_hanging_obstacles" getter="get_filter_low_hanging_obstacles" default="false">
|
||||
If [code]true[/code], marks non-walkable spans as walkable if their maximum is within [member agent/max_climb] of a walkable neighbor.
|
||||
<member name="filter_low_hanging_obstacles" type="bool" setter="set_filter_low_hanging_obstacles" getter="get_filter_low_hanging_obstacles" default="false">
|
||||
If [code]true[/code], marks non-walkable spans as walkable if their maximum is within [member agent_max_climb] of a walkable neighbor.
|
||||
</member>
|
||||
<member name="geometry/collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask">
|
||||
<member name="filter_walkable_low_height_spans" type="bool" setter="set_filter_walkable_low_height_spans" getter="get_filter_walkable_low_height_spans" default="false">
|
||||
If [code]true[/code], marks walkable spans as not walkable if the clearance above the span is less than [member agent_height].
|
||||
</member>
|
||||
<member name="geometry_collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="4294967295">
|
||||
The physics layers to scan for static colliders.
|
||||
Only used when [member geometry/parsed_geometry_type] is [constant PARSED_GEOMETRY_STATIC_COLLIDERS] or [constant PARSED_GEOMETRY_BOTH].
|
||||
Only used when [member geometry_parsed_geometry_type] is [constant PARSED_GEOMETRY_STATIC_COLLIDERS] or [constant PARSED_GEOMETRY_BOTH].
|
||||
</member>
|
||||
<member name="geometry/parsed_geometry_type" type="int" setter="set_parsed_geometry_type" getter="get_parsed_geometry_type" enum="NavigationMesh.ParsedGeometryType" default="0">
|
||||
<member name="geometry_parsed_geometry_type" type="int" setter="set_parsed_geometry_type" getter="get_parsed_geometry_type" enum="NavigationMesh.ParsedGeometryType" default="0">
|
||||
Determines which type of nodes will be parsed as geometry. See [enum ParsedGeometryType] for possible values.
|
||||
</member>
|
||||
<member name="geometry/source_geometry_mode" type="int" setter="set_source_geometry_mode" getter="get_source_geometry_mode" enum="NavigationMesh.SourceGeometryMode" default="0">
|
||||
<member name="geometry_source_geometry_mode" type="int" setter="set_source_geometry_mode" getter="get_source_geometry_mode" enum="NavigationMesh.SourceGeometryMode" default="0">
|
||||
The source of the geometry used when baking. See [enum SourceGeometryMode] for possible values.
|
||||
</member>
|
||||
<member name="geometry/source_group_name" type="String" setter="set_source_group_name" getter="get_source_group_name">
|
||||
<member name="geometry_source_group_name" type="String" setter="set_source_group_name" getter="get_source_group_name" default=""navmesh"">
|
||||
The name of the group to scan for geometry.
|
||||
Only used when [member geometry/source_geometry_mode] is [constant SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN] or [constant SOURCE_GEOMETRY_GROUPS_EXPLICIT].
|
||||
Only used when [member geometry_source_geometry_mode] is [constant SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN] or [constant SOURCE_GEOMETRY_GROUPS_EXPLICIT].
|
||||
</member>
|
||||
<member name="polygon/verts_per_poly" type="float" setter="set_verts_per_poly" getter="get_verts_per_poly" default="6.0">
|
||||
<member name="polygon_verts_per_poly" type="float" setter="set_verts_per_poly" getter="get_verts_per_poly" default="6.0">
|
||||
The maximum number of vertices allowed for polygons generated during the contour to polygon conversion process.
|
||||
</member>
|
||||
<member name="region/merge_size" type="float" setter="set_region_merge_size" getter="get_region_merge_size" default="20.0">
|
||||
<member name="region_merge_size" type="float" setter="set_region_merge_size" getter="get_region_merge_size" default="20.0">
|
||||
Any regions with a size smaller than this will be merged with larger regions if possible.
|
||||
[b]Note:[/b] This value will be squared to calculate the number of cells. For example, a value of 20 will set the number of cells to 400.
|
||||
</member>
|
||||
<member name="region/min_size" type="float" setter="set_region_min_size" getter="get_region_min_size" default="2.0">
|
||||
<member name="region_min_size" type="float" setter="set_region_min_size" getter="get_region_min_size" default="2.0">
|
||||
The minimum size of a region for it to be created.
|
||||
[b]Note:[/b] This value will be squared to calculate the minimum number of cells allowed to form isolated island areas. For example, a value of 8 will set the number of cells to 64.
|
||||
</member>
|
||||
<member name="sample_partition_type/sample_partition_type" type="int" setter="set_sample_partition_type" getter="get_sample_partition_type" enum="NavigationMesh.SamplePartitionType" default="0">
|
||||
<member name="sample_partition_type" type="int" setter="set_sample_partition_type" getter="get_sample_partition_type" enum="NavigationMesh.SamplePartitionType" default="0">
|
||||
Partitioning algorithm for creating the navigation mesh polys. See [enum SamplePartitionType] for possible values.
|
||||
</member>
|
||||
</members>
|
||||
|
@ -163,7 +163,7 @@
|
|||
Parses mesh instances as geometry. This includes [MeshInstance], [CSGShape], and [GridMap] nodes.
|
||||
</constant>
|
||||
<constant name="PARSED_GEOMETRY_STATIC_COLLIDERS" value="1" enum="ParsedGeometryType">
|
||||
Parses [StaticBody] colliders as geometry. The collider should be in any of the layers specified by [member geometry/collision_mask].
|
||||
Parses [StaticBody] colliders as geometry. The collider should be in any of the layers specified by [member geometry_collision_mask].
|
||||
</constant>
|
||||
<constant name="PARSED_GEOMETRY_BOTH" value="2" enum="ParsedGeometryType">
|
||||
Both [constant PARSED_GEOMETRY_MESH_INSTANCES] and [constant PARSED_GEOMETRY_STATIC_COLLIDERS].
|
||||
|
@ -175,10 +175,10 @@
|
|||
Scans the child nodes of [NavigationMeshInstance] recursively for geometry.
|
||||
</constant>
|
||||
<constant name="SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN" value="1" enum="SourceGeometryMode">
|
||||
Scans nodes in a group and their child nodes recursively for geometry. The group is specified by [member geometry/source_group_name].
|
||||
Scans nodes in a group and their child nodes recursively for geometry. The group is specified by [member geometry_source_group_name].
|
||||
</constant>
|
||||
<constant name="SOURCE_GEOMETRY_GROUPS_EXPLICIT" value="2" enum="SourceGeometryMode">
|
||||
Uses nodes in a group for geometry. The group is specified by [member geometry/source_group_name].
|
||||
Uses nodes in a group for geometry. The group is specified by [member geometry_source_group_name].
|
||||
</constant>
|
||||
<constant name="SOURCE_GEOMETRY_MAX" value="3" enum="SourceGeometryMode">
|
||||
Represents the size of the [enum SourceGeometryMode] enum.
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<argument index="0" name="nav_mesh" type="NavigationMesh" />
|
||||
<argument index="1" name="root_node" type="Node" />
|
||||
<description>
|
||||
Bakes navigation data to the provided [code]nav_mesh[/code] by parsing child nodes under the provided [code]root_node[/code] or a specific group of nodes for potential source geometry. The parse behavior can be controlled with the [member NavigationMesh.geometry/parsed_geometry_type] and [member NavigationMesh.geometry/source_geometry_mode] properties on the [NavigationMesh] resource.
|
||||
Bakes navigation data to the provided [code]nav_mesh[/code] by parsing child nodes under the provided [code]root_node[/code] or a specific group of nodes for potential source geometry. The parse behavior can be controlled with the [member NavigationMesh.geometry_parsed_geometry_type] and [member NavigationMesh.geometry_source_geometry_mode] properties on the [NavigationMesh] resource.
|
||||
</description>
|
||||
</method>
|
||||
<method name="clear">
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
</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 [Navigation] node, or using [method set_navigation]. [NavigationObstacle] is physics safe.
|
||||
[b]Note:[/b] Obstacles are intended as a last resort option for constantly moving objects that cannot be (re)baked to a navigation mesh efficiently.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
</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.
|
||||
[b]Note:[/b] Obstacles are intended as a last resort option for constantly moving objects that cannot be (re)baked to a navigation mesh efficiently.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
|
|
@ -61,6 +61,12 @@
|
|||
Clears the array of polygons, but it doesn't clear the array of outlines and vertices.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_mesh">
|
||||
<return type="NavigationMesh" />
|
||||
<description>
|
||||
Returns the [NavigationMesh] resulting from this navigation polygon. This navmesh can be used to update the navmesh of a region with the [method NavigationServer.region_set_navmesh] API directly (as 2D uses the 3D server behind the scene).
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_outline" qualifiers="const">
|
||||
<return type="PoolVector2Array" />
|
||||
<argument index="0" name="idx" type="int" />
|
||||
|
|
|
@ -331,7 +331,7 @@ void DependencyEditorOwners::show(const String &p_path) {
|
|||
_fill_owners(EditorFileSystem::get_singleton()->get_filesystem());
|
||||
popup_centered_ratio();
|
||||
|
||||
set_title(TTR("Owners Of:") + " " + p_path.get_file());
|
||||
set_title(vformat(TTR("Owners of: %s (Total: %d)"), p_path.get_file(), owners->get_item_count()));
|
||||
}
|
||||
|
||||
DependencyEditorOwners::DependencyEditorOwners(EditorNode *p_editor) {
|
||||
|
|
|
@ -398,6 +398,7 @@ void EditorSpinSlider::_notification(int p_what) {
|
|||
if (grabbing_spinner) {
|
||||
grabber->hide();
|
||||
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
|
||||
Input::get_singleton()->warp_mouse_position(grabbing_spinner_mouse_pos);
|
||||
grabbing_spinner = false;
|
||||
grabbing_spinner_attempt = false;
|
||||
}
|
||||
|
|
|
@ -326,6 +326,7 @@ void NavigationPolygon::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_polygon_count"), &NavigationPolygon::get_polygon_count);
|
||||
ClassDB::bind_method(D_METHOD("get_polygon", "idx"), &NavigationPolygon::get_polygon);
|
||||
ClassDB::bind_method(D_METHOD("clear_polygons"), &NavigationPolygon::clear_polygons);
|
||||
ClassDB::bind_method(D_METHOD("get_mesh"), &NavigationPolygon::get_mesh);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("add_outline", "outline"), &NavigationPolygon::add_outline);
|
||||
ClassDB::bind_method(D_METHOD("add_outline_at_index", "outline", "index"), &NavigationPolygon::add_outline_at_index);
|
||||
|
|
|
@ -139,6 +139,17 @@ void NavigationMeshInstance::set_navigation_mesh(const Ref<NavigationMesh> &p_na
|
|||
|
||||
NavigationServer::get_singleton()->region_set_navmesh(region, p_navmesh);
|
||||
|
||||
if (debug_view == nullptr && is_inside_tree() && navmesh.is_valid() && get_tree()->is_debugging_navigation_hint()) {
|
||||
MeshInstance *dm = memnew(MeshInstance);
|
||||
dm->set_mesh(navmesh->get_debug_mesh());
|
||||
if (is_enabled()) {
|
||||
dm->set_material_override(get_tree()->get_debug_navigation_material());
|
||||
} else {
|
||||
dm->set_material_override(get_tree()->get_debug_navigation_disabled_material());
|
||||
}
|
||||
add_child(dm);
|
||||
debug_view = dm;
|
||||
}
|
||||
if (debug_view && navmesh.is_valid()) {
|
||||
Object::cast_to<MeshInstance>(debug_view)->set_mesh(navmesh->get_debug_mesh());
|
||||
}
|
||||
|
|
|
@ -479,29 +479,36 @@ void NavigationMesh::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "vertices", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_vertices", "get_vertices");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "polygons", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_polygons", "_get_polygons");
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "sample_partition_type/sample_partition_type", PROPERTY_HINT_ENUM, "Watershed,Monotone,Layers"), "set_sample_partition_type", "get_sample_partition_type");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry/parsed_geometry_type", PROPERTY_HINT_ENUM, "Mesh Instances,Static Colliders,Both"), "set_parsed_geometry_type", "get_parsed_geometry_type");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry/collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry/source_geometry_mode", PROPERTY_HINT_ENUM, "Navmesh Children, Group With Children, Group Explicit"), "set_source_geometry_mode", "get_source_geometry_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "geometry/source_group_name"), "set_source_group_name", "get_source_group_name");
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell/size", PROPERTY_HINT_RANGE, "0.01,500.0,0.01,or_greater"), "set_cell_size", "get_cell_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell/height", PROPERTY_HINT_RANGE, "0.01,500.0,0.01,or_greater"), "set_cell_height", "get_cell_height");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/height", PROPERTY_HINT_RANGE, "0.0,500.0,0.01,or_greater"), "set_agent_height", "get_agent_height");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/radius", PROPERTY_HINT_RANGE, "0.0,500.0,0.01,or_greater"), "set_agent_radius", "get_agent_radius");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/max_climb", PROPERTY_HINT_RANGE, "0.0,500.0,0.01,or_greater"), "set_agent_max_climb", "get_agent_max_climb");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/max_slope", PROPERTY_HINT_RANGE, "0.02,90.0,0.01"), "set_agent_max_slope", "get_agent_max_slope");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "region/min_size", PROPERTY_HINT_RANGE, "0.0,150.0,0.01,or_greater"), "set_region_min_size", "get_region_min_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "region/merge_size", PROPERTY_HINT_RANGE, "0.0,150.0,0.01,or_greater"), "set_region_merge_size", "get_region_merge_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "edge/max_length", PROPERTY_HINT_RANGE, "0.0,50.0,0.01,or_greater"), "set_edge_max_length", "get_edge_max_length");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "edge/max_error", PROPERTY_HINT_RANGE, "0.1,3.0,0.01,or_greater"), "set_edge_max_error", "get_edge_max_error");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "polygon/verts_per_poly", PROPERTY_HINT_RANGE, "3.0,12.0,1.0,or_greater"), "set_verts_per_poly", "get_verts_per_poly");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "detail/sample_distance", PROPERTY_HINT_RANGE, "0.1,16.0,0.01,or_greater"), "set_detail_sample_distance", "get_detail_sample_distance");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "detail/sample_max_error", PROPERTY_HINT_RANGE, "0.0,16.0,0.01,or_greater"), "set_detail_sample_max_error", "get_detail_sample_max_error");
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter/low_hanging_obstacles"), "set_filter_low_hanging_obstacles", "get_filter_low_hanging_obstacles");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter/ledge_spans"), "set_filter_ledge_spans", "get_filter_ledge_spans");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter/filter_walkable_low_height_spans"), "set_filter_walkable_low_height_spans", "get_filter_walkable_low_height_spans");
|
||||
ADD_GROUP("Sampling", "sample_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "sample_partition_type", PROPERTY_HINT_ENUM, "Watershed,Monotone,Layers"), "set_sample_partition_type", "get_sample_partition_type");
|
||||
ADD_GROUP("Geometry", "geometry_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry_parsed_geometry_type", PROPERTY_HINT_ENUM, "Mesh Instances,Static Colliders,Both"), "set_parsed_geometry_type", "get_parsed_geometry_type");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry_collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry_source_geometry_mode", PROPERTY_HINT_ENUM, "Navmesh Children, Group With Children, Group Explicit"), "set_source_geometry_mode", "get_source_geometry_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "geometry_source_group_name"), "set_source_group_name", "get_source_group_name");
|
||||
ADD_GROUP("Cells", "cell_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell_size", PROPERTY_HINT_RANGE, "0.01,500.0,0.01,or_greater"), "set_cell_size", "get_cell_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell_height", PROPERTY_HINT_RANGE, "0.01,500.0,0.01,or_greater"), "set_cell_height", "get_cell_height");
|
||||
ADD_GROUP("Agents", "agent_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent_height", PROPERTY_HINT_RANGE, "0.0,500.0,0.01,or_greater"), "set_agent_height", "get_agent_height");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent_radius", PROPERTY_HINT_RANGE, "0.0,500.0,0.01,or_greater"), "set_agent_radius", "get_agent_radius");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent_max_climb", PROPERTY_HINT_RANGE, "0.0,500.0,0.01,or_greater"), "set_agent_max_climb", "get_agent_max_climb");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent_max_slope", PROPERTY_HINT_RANGE, "0.02,90.0,0.01"), "set_agent_max_slope", "get_agent_max_slope");
|
||||
ADD_GROUP("Regions", "region_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "region_min_size", PROPERTY_HINT_RANGE, "0.0,150.0,0.01,or_greater"), "set_region_min_size", "get_region_min_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "region_merge_size", PROPERTY_HINT_RANGE, "0.0,150.0,0.01,or_greater"), "set_region_merge_size", "get_region_merge_size");
|
||||
ADD_GROUP("Edges", "edge_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "edge_max_length", PROPERTY_HINT_RANGE, "0.0,50.0,0.01,or_greater"), "set_edge_max_length", "get_edge_max_length");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "edge_max_error", PROPERTY_HINT_RANGE, "0.1,3.0,0.01,or_greater"), "set_edge_max_error", "get_edge_max_error");
|
||||
ADD_GROUP("Polygons", "polygon_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "polygon_verts_per_poly", PROPERTY_HINT_RANGE, "3.0,12.0,1.0,or_greater"), "set_verts_per_poly", "get_verts_per_poly");
|
||||
ADD_GROUP("Details", "detail_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "detail_sample_distance", PROPERTY_HINT_RANGE, "0.1,16.0,0.01,or_greater"), "set_detail_sample_distance", "get_detail_sample_distance");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "detail_sample_max_error", PROPERTY_HINT_RANGE, "0.0,16.0,0.01,or_greater"), "set_detail_sample_max_error", "get_detail_sample_max_error");
|
||||
ADD_GROUP("Filters", "filter_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter_low_hanging_obstacles"), "set_filter_low_hanging_obstacles", "get_filter_low_hanging_obstacles");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter_ledge_spans"), "set_filter_ledge_spans", "get_filter_ledge_spans");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter_walkable_low_height_spans"), "set_filter_walkable_low_height_spans", "get_filter_walkable_low_height_spans");
|
||||
|
||||
BIND_ENUM_CONSTANT(SAMPLE_PARTITION_WATERSHED);
|
||||
BIND_ENUM_CONSTANT(SAMPLE_PARTITION_MONOTONE);
|
||||
|
@ -535,6 +542,43 @@ void NavigationMesh::_validate_property(PropertyInfo &property) const {
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool NavigationMesh::_set(const StringName &p_name, const Variant &p_value) {
|
||||
String name = p_name;
|
||||
if (name.find("/") != -1) {
|
||||
// Compatibility with pre-3.5 "category/path" property names.
|
||||
name = name.replace("/", "_");
|
||||
if (name == "sample_partition_type_sample_partition_type") {
|
||||
set("sample_partition_type", p_value);
|
||||
} else if (name == "filter_filter_walkable_low_height_spans") {
|
||||
set("filter_walkable_low_height_spans", p_value);
|
||||
} else {
|
||||
set(name, p_value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NavigationMesh::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
String name = p_name;
|
||||
if (name.find("/") != -1) {
|
||||
// Compatibility with pre-3.5 "category/path" property names.
|
||||
name = name.replace("/", "_");
|
||||
if (name == "sample_partition_type_sample_partition_type") {
|
||||
r_ret = get("sample_partition_type");
|
||||
} else if (name == "filter_filter_walkable_low_height_spans") {
|
||||
r_ret = get("filter_walkable_low_height_spans");
|
||||
} else {
|
||||
r_ret = get(name);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
NavigationMesh::NavigationMesh() {
|
||||
cell_size = 0.25f;
|
||||
cell_height = 0.25f;
|
||||
|
|
|
@ -59,6 +59,11 @@ protected:
|
|||
static void _bind_methods();
|
||||
virtual void _validate_property(PropertyInfo &property) const;
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
bool _set(const StringName &p_name, const Variant &p_value);
|
||||
bool _get(const StringName &p_name, Variant &r_ret) const;
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
void _set_polygons(const Array &p_array);
|
||||
Array _get_polygons() const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue