diff options
-rw-r--r-- | doc/classes/@GlobalScope.xml | 2 | ||||
-rw-r--r-- | doc/classes/Mutex.xml | 2 | ||||
-rw-r--r-- | doc/classes/NavigationServer3D.xml | 4 | ||||
-rw-r--r-- | doc/classes/NodePath.xml | 1 | ||||
-rw-r--r-- | doc/classes/SceneTree.xml | 2 | ||||
-rw-r--r-- | doc/classes/Window.xml | 3 | ||||
-rw-r--r-- | modules/navigation/godot_navigation_server.cpp | 87 | ||||
-rw-r--r-- | modules/navigation/nav_agent.cpp | 15 | ||||
-rw-r--r-- | modules/navigation/nav_link.cpp | 9 | ||||
-rw-r--r-- | modules/navigation/nav_region.cpp | 12 | ||||
-rw-r--r-- | scene/gui/graph_edit.cpp | 4 | ||||
-rw-r--r-- | scene/main/node.cpp | 7 | ||||
-rw-r--r-- | servers/navigation_server_3d.cpp | 4 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp | 2 |
14 files changed, 68 insertions, 86 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 3c18ff4861..0bdcfb79d0 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -1509,7 +1509,7 @@ The [NavigationServer2D] singleton. </member> <member name="NavigationServer3D" type="NavigationServer3D" setter="" getter=""> - The [NavigationServer2D] singleton. + The [NavigationServer3D] singleton. </member> <member name="OS" type="OS" setter="" getter=""> The [OS] singleton. diff --git a/doc/classes/Mutex.xml b/doc/classes/Mutex.xml index 98da57ed94..75c4e58748 100644 --- a/doc/classes/Mutex.xml +++ b/doc/classes/Mutex.xml @@ -27,7 +27,7 @@ <return type="bool" /> <description> Tries locking this [Mutex], but does not block. Returns [code]true[/code] on success, [code]false[/code] otherwise. - [b]Note:[/b] This function returns [constant OK] if the thread already has ownership of the mutex. + [b]Note:[/b] This function returns [code]true[/code] if the thread already has ownership of the mutex. </description> </method> <method name="unlock"> diff --git a/doc/classes/NavigationServer3D.xml b/doc/classes/NavigationServer3D.xml index 9ee22ab861..97d81af602 100644 --- a/doc/classes/NavigationServer3D.xml +++ b/doc/classes/NavigationServer3D.xml @@ -211,7 +211,7 @@ <return type="void" /> <param index="0" name="navigation_mesh" type="NavigationMesh" /> <param index="1" name="source_geometry_data" type="NavigationMeshSourceGeometryData3D" /> - <param index="2" name="callback" type="Callable" /> + <param index="2" name="callback" type="Callable" default="Callable()" /> <description> Bakes the provided [param navigation_mesh] with the data from the provided [param source_geometry_data]. After the process is finished the optional [param callback] will be called. </description> @@ -681,7 +681,7 @@ <param index="0" name="navigation_mesh" type="NavigationMesh" /> <param index="1" name="source_geometry_data" type="NavigationMeshSourceGeometryData3D" /> <param index="2" name="root_node" type="Node" /> - <param index="3" name="callback" type="Callable" /> + <param index="3" name="callback" type="Callable" default="Callable()" /> <description> Parses the [SceneTree] for source geometry according to the properties of [param navigation_mesh]. Updates the provided [param source_geometry_data] resource with the resulting data. The resource can then be used to bake a navigation mesh with [method bake_from_source_geometry_data]. After the process is finished the optional [param callback] will be called. [b]Note:[/b] This function needs to run on the main thread or with a deferred call as the SceneTree is not thread-safe. diff --git a/doc/classes/NodePath.xml b/doc/classes/NodePath.xml index 1bc44d5680..516498473e 100644 --- a/doc/classes/NodePath.xml +++ b/doc/classes/NodePath.xml @@ -15,6 +15,7 @@ ^"." # The current node. ^".." # The parent node. ^"../C" # A sibling node C. + ^"../.." # The grandparent node. # A leading slash means it is absolute from the SceneTree. ^"/root" # Equivalent to get_tree().get_root(). ^"/root/Main" # If your main scene's root node were named "Main". diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml index ba6a6381fd..7b8eca2229 100644 --- a/doc/classes/SceneTree.xml +++ b/doc/classes/SceneTree.xml @@ -110,6 +110,7 @@ <param index="0" name="for_path" type="NodePath" default="NodePath("")" /> <description> Return the [MultiplayerAPI] configured for the given path, or the default one if [param for_path] is empty. + [b]Note:[/b] Only one [MultiplayerAPI] may be configured for any subpath. If one is configured for [code]"/root/Foo"[/code] then calling this for [code]"/root/Foo/Bar"[/code] will return the one configured for [code]"/root/Foo"[/code], regardless if one is configured for that path. </description> </method> <method name="get_node_count" qualifiers="const"> @@ -208,6 +209,7 @@ <param index="1" name="root_path" type="NodePath" default="NodePath("")" /> <description> Sets a custom [MultiplayerAPI] with the given [param root_path] (controlling also the relative subpaths), or override the default one if [param root_path] is empty. + [b]Note:[/b] Only one [MultiplayerAPI] may be configured for any subpath. If one is configured for [code]"/root/Foo"[/code] setting one for [code]"/root/Foo/Bar"[/code] will be ignored. See [method get_multiplayer]. </description> </method> <method name="unload_current_scene"> diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml index 79ba768b79..725ac92117 100644 --- a/doc/classes/Window.xml +++ b/doc/classes/Window.xml @@ -378,7 +378,8 @@ <return type="void" /> <param index="0" name="ratio" type="float" default="0.8" /> <description> - Popups the [Window] centered inside its parent [Window] and sets its size as a [param ratio] of parent's size. + If [Window] is embedded, popups the [Window] centered inside its embedder and sets its size as a [param ratio] of embedder's size. + If [Window] is a native window, popups the [Window] centered inside the screen of its parent [Window] and sets its size as a [param ratio] of the screen size. </description> </method> <method name="popup_exclusive"> diff --git a/modules/navigation/godot_navigation_server.cpp b/modules/navigation/godot_navigation_server.cpp index 0ec0c9545f..bf34779735 100644 --- a/modules/navigation/godot_navigation_server.cpp +++ b/modules/navigation/godot_navigation_server.cpp @@ -358,22 +358,9 @@ COMMAND_2(region_set_map, RID, p_region, RID, p_map) { NavRegion *region = region_owner.get_or_null(p_region); ERR_FAIL_COND(region == nullptr); - if (region->get_map() != nullptr) { - if (region->get_map()->get_self() == p_map) { - return; // Pointless - } - - region->get_map()->remove_region(region); - region->set_map(nullptr); - } - - if (p_map.is_valid()) { - NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND(map == nullptr); + NavMap *map = map_owner.get_or_null(p_map); - map->add_region(region); - region->set_map(map); - } + region->set_map(map); } COMMAND_2(region_set_transform, RID, p_region, Transform3D, p_transform) { @@ -506,22 +493,9 @@ COMMAND_2(link_set_map, RID, p_link, RID, p_map) { NavLink *link = link_owner.get_or_null(p_link); ERR_FAIL_COND(link == nullptr); - if (link->get_map() != nullptr) { - if (link->get_map()->get_self() == p_map) { - return; // Pointless - } - - link->get_map()->remove_link(link); - link->set_map(nullptr); - } - - if (p_map.is_valid()) { - NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND(map == nullptr); + NavMap *map = map_owner.get_or_null(p_map); - map->add_link(link); - link->set_map(map); - } + link->set_map(map); } RID GodotNavigationServer::link_get_map(const RID p_link) const { @@ -673,27 +647,9 @@ COMMAND_2(agent_set_map, RID, p_agent, RID, p_map) { NavAgent *agent = agent_owner.get_or_null(p_agent); ERR_FAIL_COND(agent == nullptr); - if (agent->get_map()) { - if (agent->get_map()->get_self() == p_map) { - return; // Pointless - } - - agent->get_map()->remove_agent(agent); - } - - agent->set_map(nullptr); - - if (p_map.is_valid()) { - NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND(map == nullptr); - - agent->set_map(map); - map->add_agent(agent); + NavMap *map = map_owner.get_or_null(p_map); - if (agent->has_avoidance_callback()) { - map->set_agent_as_controlled(agent); - } - } + agent->set_map(map); } COMMAND_2(agent_set_paused, RID, p_agent, bool, p_paused) { @@ -875,23 +831,9 @@ COMMAND_2(obstacle_set_map, RID, p_obstacle, RID, p_map) { NavObstacle *obstacle = obstacle_owner.get_or_null(p_obstacle); ERR_FAIL_COND(obstacle == nullptr); - if (obstacle->get_map()) { - if (obstacle->get_map()->get_self() == p_map) { - return; // Pointless - } - - obstacle->get_map()->remove_obstacle(obstacle); - } - - obstacle->set_map(nullptr); - - if (p_map.is_valid()) { - NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND(map == nullptr); + NavMap *map = map_owner.get_or_null(p_map); - obstacle->set_map(map); - map->add_obstacle(obstacle); - } + obstacle->set_map(map); } RID GodotNavigationServer::obstacle_get_map(RID p_obstacle) const { @@ -1050,17 +992,16 @@ void GodotNavigationServer::internal_free_agent(RID p_object) { void GodotNavigationServer::internal_free_obstacle(RID p_object) { NavObstacle *obstacle = obstacle_owner.get_or_null(p_object); if (obstacle) { + NavAgent *obstacle_agent = obstacle->get_agent(); + if (obstacle_agent) { + RID _agent_rid = obstacle_agent->get_self(); + internal_free_agent(_agent_rid); + obstacle->set_agent(nullptr); + } if (obstacle->get_map() != nullptr) { obstacle->get_map()->remove_obstacle(obstacle); obstacle->set_map(nullptr); } - if (obstacle->get_agent()) { - if (obstacle->get_agent()->get_self() != RID()) { - RID _agent_rid = obstacle->get_agent()->get_self(); - obstacle->set_agent(nullptr); - internal_free_agent(_agent_rid); - } - } obstacle_owner.free(p_object); } } diff --git a/modules/navigation/nav_agent.cpp b/modules/navigation/nav_agent.cpp index 19b73dc633..010bd2d7c0 100644 --- a/modules/navigation/nav_agent.cpp +++ b/modules/navigation/nav_agent.cpp @@ -90,8 +90,23 @@ void NavAgent::_update_rvo_agent_properties() { } void NavAgent::set_map(NavMap *p_map) { + if (map == p_map) { + return; + } + + if (map) { + map->remove_agent(this); + } + map = p_map; agent_dirty = true; + + if (map) { + map->add_agent(this); + if (avoidance_enabled) { + map->set_agent_as_controlled(this); + } + } } bool NavAgent::is_map_changed() { diff --git a/modules/navigation/nav_link.cpp b/modules/navigation/nav_link.cpp index 5607a3253e..d712987a46 100644 --- a/modules/navigation/nav_link.cpp +++ b/modules/navigation/nav_link.cpp @@ -36,8 +36,17 @@ void NavLink::set_map(NavMap *p_map) { if (map == p_map) { return; } + + if (map) { + map->remove_link(this); + } + map = p_map; link_dirty = true; + + if (map) { + map->add_link(this); + } } void NavLink::set_bidirectional(bool p_bidirectional) { diff --git a/modules/navigation/nav_region.cpp b/modules/navigation/nav_region.cpp index bf4fec1ac8..867cf5d8fc 100644 --- a/modules/navigation/nav_region.cpp +++ b/modules/navigation/nav_region.cpp @@ -36,10 +36,18 @@ void NavRegion::set_map(NavMap *p_map) { if (map == p_map) { return; } + + if (map) { + map->remove_region(this); + } + map = p_map; polygons_dirty = true; - if (!map) { - connections.clear(); + + connections.clear(); + + if (map) { + map->add_region(this); } } diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index e6f936059b..2c37017fa1 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -822,6 +822,7 @@ bool GraphEdit::_check_clickable_control(Control *p_control, const Vector2 &mpos Rect2 control_rect = p_control->get_rect(); control_rect.position *= zoom; + control_rect.size *= zoom; control_rect.position += p_offset; if (!control_rect.has_point(mpos) || p_control->get_mouse_filter() == MOUSE_FILTER_IGNORE) { @@ -886,9 +887,8 @@ bool GraphEdit::is_in_port_hotzone(const Vector2 &p_pos, const Vector2 &p_mouse_ if (!child) { continue; } - Rect2 child_rect = child->get_rect(); - child_rect.size *= zoom; + Rect2 child_rect = child->get_rect(); if (child_rect.has_point(p_mouse_pos * zoom)) { for (int j = 0; j < child->get_child_count(); j++) { Control *subchild = Object::cast_to<Control>(child->get_child(j)); diff --git a/scene/main/node.cpp b/scene/main/node.cpp index a21866610c..515bd60cca 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -595,9 +595,11 @@ void Node::_propagate_pause_notification(bool p_enable) { notification(NOTIFICATION_UNPAUSED); } + data.blocked++; for (KeyValue<StringName, Node *> &K : data.children) { K.value->_propagate_pause_notification(p_enable); } + data.blocked--; } Node::ProcessMode Node::get_process_mode() const { @@ -615,12 +617,14 @@ void Node::_propagate_process_owner(Node *p_owner, int p_pause_notification, int notification(p_enabled_notification); } + data.blocked++; for (KeyValue<StringName, Node *> &K : data.children) { Node *c = K.value; if (c->data.process_mode == PROCESS_MODE_INHERIT) { c->_propagate_process_owner(p_owner, p_pause_notification, p_enabled_notification); } } + data.blocked--; } void Node::set_multiplayer_authority(int p_peer_id, bool p_recursive) { @@ -1132,7 +1136,8 @@ void Node::_set_name_nocheck(const StringName &p_name) { } void Node::set_name(const String &p_name) { - ERR_FAIL_COND_MSG(data.inside_tree && !Thread::is_main_thread(), "Changing the name to nodes inside the SceneTree is only allowed from the main thread. Use call_deferred(\"set_name\",new_name)."); + ERR_FAIL_COND_MSG(data.inside_tree && !Thread::is_main_thread(), "Changing the name to nodes inside the SceneTree is only allowed from the main thread. Use `set_name.call_deferred(new_name)`."); + ERR_FAIL_COND_MSG(data.parent && data.parent->data.blocked > 0, "Parent node is busy setting up children, `set_name(new_name)` failed. Consider using `set_name.call_deferred(new_name)` instead."); String name = p_name.validate_node_name(); ERR_FAIL_COND(name.is_empty()); diff --git a/servers/navigation_server_3d.cpp b/servers/navigation_server_3d.cpp index 904bbfaf60..dae8ea6dcd 100644 --- a/servers/navigation_server_3d.cpp +++ b/servers/navigation_server_3d.cpp @@ -147,8 +147,8 @@ void NavigationServer3D::_bind_methods() { ClassDB::bind_method(D_METHOD("obstacle_set_vertices", "obstacle", "vertices"), &NavigationServer3D::obstacle_set_vertices); ClassDB::bind_method(D_METHOD("obstacle_set_avoidance_layers", "obstacle", "layers"), &NavigationServer3D::obstacle_set_avoidance_layers); - ClassDB::bind_method(D_METHOD("parse_source_geometry_data", "navigation_mesh", "source_geometry_data", "root_node", "callback"), &NavigationServer3D::parse_source_geometry_data); - ClassDB::bind_method(D_METHOD("bake_from_source_geometry_data", "navigation_mesh", "source_geometry_data", "callback"), &NavigationServer3D::bake_from_source_geometry_data); + ClassDB::bind_method(D_METHOD("parse_source_geometry_data", "navigation_mesh", "source_geometry_data", "root_node", "callback"), &NavigationServer3D::parse_source_geometry_data, DEFVAL(Callable())); + ClassDB::bind_method(D_METHOD("bake_from_source_geometry_data", "navigation_mesh", "source_geometry_data", "callback"), &NavigationServer3D::bake_from_source_geometry_data, DEFVAL(Callable())); ClassDB::bind_method(D_METHOD("free_rid", "rid"), &NavigationServer3D::free); diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp index c7a0f54592..fe4ec70f98 100644 --- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp +++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp @@ -728,7 +728,7 @@ void SceneShaderForwardClustered::init(const String p_defines) { actions.base_texture_binding_index = 1; actions.texture_layout_set = RenderForwardClustered::MATERIAL_UNIFORM_SET; actions.base_uniform_string = "material."; - actions.base_varying_index = 11; + actions.base_varying_index = 12; actions.default_filter = ShaderLanguage::FILTER_LINEAR_MIPMAP; actions.default_repeat = ShaderLanguage::REPEAT_ENABLE; |