diff options
23 files changed, 891 insertions, 171 deletions
diff --git a/core/io/image_loader.h b/core/io/image_loader.h index cb64d2310e..bf78005e40 100644 --- a/core/io/image_loader.h +++ b/core/io/image_loader.h @@ -52,6 +52,7 @@ public: enum LoaderFlags { FLAG_NONE = 0, FLAG_FORCE_LINEAR = 1, + FLAG_CONVERT_COLORS = 2, }; virtual ~ImageFormatLoader() {} diff --git a/core/io/resource_importer.cpp b/core/io/resource_importer.cpp index aa7f96a047..d923522317 100644 --- a/core/io/resource_importer.cpp +++ b/core/io/resource_importer.cpp @@ -108,6 +108,15 @@ Error ResourceFormatImporter::_get_path_and_type(const String &p_path, PathAndTy } } +#ifdef TOOLS_ENABLED + if (r_path_and_type.metadata && !r_path_and_type.path.is_empty()) { + Dictionary metadata = r_path_and_type.metadata; + if (metadata.has("has_editor_variant")) { + r_path_and_type.path = r_path_and_type.path.get_basename() + ".editor." + r_path_and_type.path.get_extension(); + } + } +#endif + if (r_path_and_type.path.is_empty() || r_path_and_type.type.is_empty()) { return ERR_FILE_CORRUPT; } diff --git a/doc/classes/NavigationObstacle2D.xml b/doc/classes/NavigationObstacle2D.xml index 4ecdc06645..6d05e220e3 100644 --- a/doc/classes/NavigationObstacle2D.xml +++ b/doc/classes/NavigationObstacle2D.xml @@ -10,12 +10,25 @@ <tutorials> </tutorials> <methods> + <method name="get_navigation_map" qualifiers="const"> + <return type="RID" /> + <description> + Returns the [RID] of the navigation map for this NavigationObstacle node. This function returns always the map set on the NavigationObstacle node and not the map of the abstract agent on the NavigationServer. If the agent map is changed directly with the NavigationServer API the NavigationObstacle node will not be aware of the map change. Use [method set_navigation_map] to change the navigation map for the NavigationObstacle and also update the agent on the NavigationServer. + </description> + </method> <method name="get_rid" qualifiers="const"> <return type="RID" /> <description> Returns the [RID] of this obstacle on the [NavigationServer2D]. </description> </method> + <method name="set_navigation_map"> + <return type="void" /> + <param index="0" name="navigation_map" type="RID" /> + <description> + Sets the [RID] of the navigation map this NavigationObstacle node should use and also updates the [code]agent[/code] on the NavigationServer. + </description> + </method> </methods> <members> <member name="estimate_radius" type="bool" setter="set_estimate_radius" getter="is_radius_estimated" default="true"> diff --git a/doc/classes/NavigationObstacle3D.xml b/doc/classes/NavigationObstacle3D.xml index ed8af3883c..f5a0bde089 100644 --- a/doc/classes/NavigationObstacle3D.xml +++ b/doc/classes/NavigationObstacle3D.xml @@ -10,12 +10,25 @@ <tutorials> </tutorials> <methods> + <method name="get_navigation_map" qualifiers="const"> + <return type="RID" /> + <description> + Returns the [RID] of the navigation map for this NavigationObstacle node. This function returns always the map set on the NavigationObstacle node and not the map of the abstract agent on the NavigationServer. If the agent map is changed directly with the NavigationServer API the NavigationObstacle node will not be aware of the map change. Use [method set_navigation_map] to change the navigation map for the NavigationObstacle and also update the agent on the NavigationServer. + </description> + </method> <method name="get_rid" qualifiers="const"> <return type="RID" /> <description> Returns the [RID] of this obstacle on the [NavigationServer3D]. </description> </method> + <method name="set_navigation_map"> + <return type="void" /> + <param index="0" name="navigation_map" type="RID" /> + <description> + Sets the [RID] of the navigation map this NavigationObstacle node should use and also updates the [code]agent[/code] on the NavigationServer. + </description> + </method> </methods> <members> <member name="estimate_radius" type="bool" setter="set_estimate_radius" getter="is_radius_estimated" default="true"> diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 92beefa5fc..d8ad65082f 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -514,7 +514,7 @@ <param index="0" name="child_node" type="Node" /> <param index="1" name="to_position" type="int" /> <description> - Moves a child node to a different position (order) among the other children. Since calls, signals, etc are performed by tree order, changing the order of children nodes may be useful. + Moves a child node to a different position (order) among the other children. Since calls, signals, etc are performed by tree order, changing the order of children nodes may be useful. If [param to_position] is negative, the index will be counted from the end. [b]Note:[/b] Internal children can only be moved within their expected "internal range" (see [code]internal[/code] parameter in [method add_child]). </description> </method> @@ -577,12 +577,6 @@ Queues a node for deletion at the end of the current frame. When deleted, all of its child nodes will be deleted as well. This method ensures it's safe to delete the node, contrary to [method Object.free]. Use [method Object.is_queued_for_deletion] to check whether a node will be deleted at the end of the frame. </description> </method> - <method name="remove_and_skip"> - <return type="void" /> - <description> - Removes a node and sets all its children as children of the parent node (if it exists). All event subscriptions that pass by the removed node will be unsubscribed. - </description> - </method> <method name="remove_child"> <return type="void" /> <param index="0" name="node" type="Node" /> diff --git a/doc/classes/PhysicsServer2DExtension.xml b/doc/classes/PhysicsServer2DExtension.xml index 4a5425bd63..a63aa8a30f 100644 --- a/doc/classes/PhysicsServer2DExtension.xml +++ b/doc/classes/PhysicsServer2DExtension.xml @@ -142,6 +142,13 @@ <description> </description> </method> + <method name="_area_set_pickable" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="area" type="RID" /> + <param index="1" name="pickable" type="bool" /> + <description> + </description> + </method> <method name="_area_set_shape" qualifiers="virtual"> <return type="void" /> <param index="0" name="area" type="RID" /> @@ -282,6 +289,19 @@ <description> </description> </method> + <method name="_body_collide_shape" qualifiers="virtual"> + <return type="bool" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="body_shape" type="int" /> + <param index="2" name="shape" type="RID" /> + <param index="3" name="shape_xform" type="Transform2D" /> + <param index="4" name="motion" type="Vector2" /> + <param index="5" name="results" type="void*" /> + <param index="6" name="result_max" type="int" /> + <param index="7" name="result_count" type="int32_t*" /> + <description> + </description> + </method> <method name="_body_create" qualifiers="virtual"> <return type="RID" /> <description> @@ -293,6 +313,12 @@ <description> </description> </method> + <method name="_body_get_collision_exceptions" qualifiers="virtual const"> + <return type="RID[]" /> + <param index="0" name="body" type="RID" /> + <description> + </description> + </method> <method name="_body_get_collision_layer" qualifiers="virtual const"> <return type="int" /> <param index="0" name="body" type="RID" /> @@ -323,6 +349,12 @@ <description> </description> </method> + <method name="_body_get_contacts_reported_depth_threshold" qualifiers="virtual const"> + <return type="float" /> + <param index="0" name="body" type="RID" /> + <description> + </description> + </method> <method name="_body_get_continuous_collision_detection_mode" qualifiers="virtual const"> <return type="int" enum="PhysicsServer2D.CCDMode" /> <param index="0" name="body" type="RID" /> @@ -461,6 +493,13 @@ <description> </description> </method> + <method name="_body_set_contacts_reported_depth_threshold" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="threshold" type="float" /> + <description> + </description> + </method> <method name="_body_set_continuous_collision_detection_mode" qualifiers="virtual"> <return type="void" /> <param index="0" name="body" type="RID" /> @@ -505,6 +544,13 @@ <description> </description> </method> + <method name="_body_set_pickable" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="pickable" type="bool" /> + <description> + </description> + </method> <method name="_body_set_shape" qualifiers="virtual"> <return type="void" /> <param index="0" name="body" type="RID" /> @@ -553,6 +599,13 @@ <description> </description> </method> + <method name="_body_set_state_sync_callback" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="callback" type="PhysicsServer2DExtensionStateCallback*" /> + <description> + </description> + </method> <method name="_body_test_motion" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="body" type="RID" /> @@ -648,6 +701,13 @@ <description> </description> </method> + <method name="_joint_disable_collisions_between_bodies" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="joint" type="RID" /> + <param index="1" name="disable" type="bool" /> + <description> + </description> + </method> <method name="_joint_get_param" qualifiers="virtual const"> <return type="float" /> <param index="0" name="joint" type="RID" /> @@ -661,6 +721,12 @@ <description> </description> </method> + <method name="_joint_is_disabled_collisions_between_bodies" qualifiers="virtual const"> + <return type="bool" /> + <param index="0" name="joint" type="RID" /> + <description> + </description> + </method> <method name="_joint_make_damped_spring" qualifiers="virtual"> <return type="void" /> <param index="0" name="joint" type="RID" /> @@ -735,6 +801,26 @@ <description> </description> </method> + <method name="_shape_collide" qualifiers="virtual"> + <return type="bool" /> + <param index="0" name="shape_A" type="RID" /> + <param index="1" name="xform_A" type="Transform2D" /> + <param index="2" name="motion_A" type="Vector2" /> + <param index="3" name="shape_B" type="RID" /> + <param index="4" name="xform_B" type="Transform2D" /> + <param index="5" name="motion_B" type="Vector2" /> + <param index="6" name="results" type="void*" /> + <param index="7" name="result_max" type="int" /> + <param index="8" name="result_count" type="int32_t*" /> + <description> + </description> + </method> + <method name="_shape_get_custom_solver_bias" qualifiers="virtual const"> + <return type="float" /> + <param index="0" name="shape" type="RID" /> + <description> + </description> + </method> <method name="_shape_get_data" qualifiers="virtual const"> <return type="Variant" /> <param index="0" name="shape" type="RID" /> @@ -747,6 +833,13 @@ <description> </description> </method> + <method name="_shape_set_custom_solver_bias" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="shape" type="RID" /> + <param index="1" name="bias" type="float" /> + <description> + </description> + </method> <method name="_shape_set_data" qualifiers="virtual"> <return type="void" /> <param index="0" name="shape" type="RID" /> @@ -759,6 +852,18 @@ <description> </description> </method> + <method name="_space_get_contact_count" qualifiers="virtual const"> + <return type="int" /> + <param index="0" name="space" type="RID" /> + <description> + </description> + </method> + <method name="_space_get_contacts" qualifiers="virtual const"> + <return type="PackedVector2Array" /> + <param index="0" name="space" type="RID" /> + <description> + </description> + </method> <method name="_space_get_direct_state" qualifiers="virtual"> <return type="PhysicsDirectSpaceState2D" /> <param index="0" name="space" type="RID" /> @@ -785,6 +890,13 @@ <description> </description> </method> + <method name="_space_set_debug_contacts" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="space" type="RID" /> + <param index="1" name="max_contacts" type="int" /> + <description> + </description> + </method> <method name="_space_set_param" qualifiers="virtual"> <return type="void" /> <param index="0" name="space" type="RID" /> diff --git a/doc/classes/PhysicsServer3DExtension.xml b/doc/classes/PhysicsServer3DExtension.xml index 46d3c8ae3e..f42276ddd8 100644 --- a/doc/classes/PhysicsServer3DExtension.xml +++ b/doc/classes/PhysicsServer3DExtension.xml @@ -274,6 +274,12 @@ <description> </description> </method> + <method name="_body_get_collision_exceptions" qualifiers="virtual const"> + <return type="RID[]" /> + <param index="0" name="body" type="RID" /> + <description> + </description> + </method> <method name="_body_get_collision_layer" qualifiers="virtual const"> <return type="int" /> <param index="0" name="body" type="RID" /> @@ -304,6 +310,12 @@ <description> </description> </method> + <method name="_body_get_contacts_reported_depth_threshold" qualifiers="virtual const"> + <return type="float" /> + <param index="0" name="body" type="RID" /> + <description> + </description> + </method> <method name="_body_get_direct_state" qualifiers="virtual"> <return type="PhysicsDirectBodyState3D" /> <param index="0" name="body" type="RID" /> @@ -368,6 +380,12 @@ <description> </description> </method> + <method name="_body_get_user_flags" qualifiers="virtual const"> + <return type="int" /> + <param index="0" name="body" type="RID" /> + <description> + </description> + </method> <method name="_body_is_axis_locked" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="body" type="RID" /> @@ -457,6 +475,13 @@ <description> </description> </method> + <method name="_body_set_contacts_reported_depth_threshold" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="threshold" type="float" /> + <description> + </description> + </method> <method name="_body_set_enable_continuous_collision_detection" qualifiers="virtual"> <return type="void" /> <param index="0" name="body" type="RID" /> @@ -547,6 +572,20 @@ <description> </description> </method> + <method name="_body_set_state_sync_callback" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="callback" type="PhysicsServer3DExtensionStateCallback*" /> + <description> + </description> + </method> + <method name="_body_set_user_flags" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="flags" type="int" /> + <description> + </description> + </method> <method name="_body_test_motion" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="body" type="RID" /> @@ -763,6 +802,18 @@ <description> </description> </method> + <method name="_joint_make_hinge_simple" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="joint" type="RID" /> + <param index="1" name="body_A" type="RID" /> + <param index="2" name="pivot_A" type="Vector3" /> + <param index="3" name="axis_A" type="Vector3" /> + <param index="4" name="body_B" type="RID" /> + <param index="5" name="pivot_B" type="Vector3" /> + <param index="6" name="axis_B" type="Vector3" /> + <description> + </description> + </method> <method name="_joint_make_pin" qualifiers="virtual"> <return type="void" /> <param index="0" name="joint" type="RID" /> @@ -842,18 +893,37 @@ <description> </description> </method> + <method name="_shape_get_custom_solver_bias" qualifiers="virtual const"> + <return type="float" /> + <param index="0" name="shape" type="RID" /> + <description> + </description> + </method> <method name="_shape_get_data" qualifiers="virtual const"> <return type="Variant" /> <param index="0" name="shape" type="RID" /> <description> </description> </method> + <method name="_shape_get_margin" qualifiers="virtual const"> + <return type="float" /> + <param index="0" name="shape" type="RID" /> + <description> + </description> + </method> <method name="_shape_get_type" qualifiers="virtual const"> <return type="int" enum="PhysicsServer3D.ShapeType" /> <param index="0" name="shape" type="RID" /> <description> </description> </method> + <method name="_shape_set_custom_solver_bias" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="shape" type="RID" /> + <param index="1" name="bias" type="float" /> + <description> + </description> + </method> <method name="_shape_set_data" qualifiers="virtual"> <return type="void" /> <param index="0" name="shape" type="RID" /> @@ -861,6 +931,13 @@ <description> </description> </method> + <method name="_shape_set_margin" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="shape" type="RID" /> + <param index="1" name="margin" type="float" /> + <description> + </description> + </method> <method name="_slider_joint_get_param" qualifiers="virtual const"> <return type="float" /> <param index="0" name="joint" type="RID" /> @@ -876,17 +953,250 @@ <description> </description> </method> + <method name="_soft_body_add_collision_exception" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="body_b" type="RID" /> + <description> + </description> + </method> + <method name="_soft_body_create" qualifiers="virtual"> + <return type="RID" /> + <description> + </description> + </method> <method name="_soft_body_get_bounds" qualifiers="virtual const"> <return type="AABB" /> <param index="0" name="body" type="RID" /> <description> </description> </method> + <method name="_soft_body_get_collision_exceptions" qualifiers="virtual const"> + <return type="RID[]" /> + <param index="0" name="body" type="RID" /> + <description> + </description> + </method> + <method name="_soft_body_get_collision_layer" qualifiers="virtual const"> + <return type="int" /> + <param index="0" name="body" type="RID" /> + <description> + </description> + </method> + <method name="_soft_body_get_collision_mask" qualifiers="virtual const"> + <return type="int" /> + <param index="0" name="body" type="RID" /> + <description> + </description> + </method> + <method name="_soft_body_get_damping_coefficient" qualifiers="virtual const"> + <return type="float" /> + <param index="0" name="body" type="RID" /> + <description> + </description> + </method> + <method name="_soft_body_get_drag_coefficient" qualifiers="virtual const"> + <return type="float" /> + <param index="0" name="body" type="RID" /> + <description> + </description> + </method> + <method name="_soft_body_get_linear_stiffness" qualifiers="virtual const"> + <return type="float" /> + <param index="0" name="body" type="RID" /> + <description> + </description> + </method> + <method name="_soft_body_get_point_global_position" qualifiers="virtual const"> + <return type="Vector3" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="point_index" type="int" /> + <description> + </description> + </method> + <method name="_soft_body_get_pressure_coefficient" qualifiers="virtual const"> + <return type="float" /> + <param index="0" name="body" type="RID" /> + <description> + </description> + </method> + <method name="_soft_body_get_simulation_precision" qualifiers="virtual const"> + <return type="int" /> + <param index="0" name="body" type="RID" /> + <description> + </description> + </method> + <method name="_soft_body_get_space" qualifiers="virtual const"> + <return type="RID" /> + <param index="0" name="body" type="RID" /> + <description> + </description> + </method> + <method name="_soft_body_get_state" qualifiers="virtual const"> + <return type="Variant" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="state" type="int" enum="PhysicsServer3D.BodyState" /> + <description> + </description> + </method> + <method name="_soft_body_get_total_mass" qualifiers="virtual const"> + <return type="float" /> + <param index="0" name="body" type="RID" /> + <description> + </description> + </method> + <method name="_soft_body_is_point_pinned" qualifiers="virtual const"> + <return type="bool" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="point_index" type="int" /> + <description> + </description> + </method> + <method name="_soft_body_move_point" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="point_index" type="int" /> + <param index="2" name="global_position" type="Vector3" /> + <description> + </description> + </method> + <method name="_soft_body_pin_point" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="point_index" type="int" /> + <param index="2" name="pin" type="bool" /> + <description> + </description> + </method> + <method name="_soft_body_remove_all_pinned_points" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <description> + </description> + </method> + <method name="_soft_body_remove_collision_exception" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="body_b" type="RID" /> + <description> + </description> + </method> + <method name="_soft_body_set_collision_layer" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="layer" type="int" /> + <description> + </description> + </method> + <method name="_soft_body_set_collision_mask" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="mask" type="int" /> + <description> + </description> + </method> + <method name="_soft_body_set_damping_coefficient" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="damping_coefficient" type="float" /> + <description> + </description> + </method> + <method name="_soft_body_set_drag_coefficient" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="drag_coefficient" type="float" /> + <description> + </description> + </method> + <method name="_soft_body_set_linear_stiffness" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="linear_stiffness" type="float" /> + <description> + </description> + </method> + <method name="_soft_body_set_mesh" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="mesh" type="RID" /> + <description> + </description> + </method> + <method name="_soft_body_set_pressure_coefficient" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="pressure_coefficient" type="float" /> + <description> + </description> + </method> + <method name="_soft_body_set_ray_pickable" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="enable" type="bool" /> + <description> + </description> + </method> + <method name="_soft_body_set_simulation_precision" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="simulation_precision" type="int" /> + <description> + </description> + </method> + <method name="_soft_body_set_space" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="space" type="RID" /> + <description> + </description> + </method> + <method name="_soft_body_set_state" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="state" type="int" enum="PhysicsServer3D.BodyState" /> + <param index="2" name="variant" type="Variant" /> + <description> + </description> + </method> + <method name="_soft_body_set_total_mass" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="total_mass" type="float" /> + <description> + </description> + </method> + <method name="_soft_body_set_transform" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="transform" type="Transform3D" /> + <description> + </description> + </method> + <method name="_soft_body_update_rendering_server" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="body" type="RID" /> + <param index="1" name="rendering_server_handler" type="PhysicsServer3DRenderingServerHandler" /> + <description> + </description> + </method> <method name="_space_create" qualifiers="virtual"> <return type="RID" /> <description> </description> </method> + <method name="_space_get_contact_count" qualifiers="virtual const"> + <return type="int" /> + <param index="0" name="space" type="RID" /> + <description> + </description> + </method> + <method name="_space_get_contacts" qualifiers="virtual const"> + <return type="PackedVector3Array" /> + <param index="0" name="space" type="RID" /> + <description> + </description> + </method> <method name="_space_get_direct_state" qualifiers="virtual"> <return type="PhysicsDirectSpaceState3D" /> <param index="0" name="space" type="RID" /> @@ -913,6 +1223,13 @@ <description> </description> </method> + <method name="_space_set_debug_contacts" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="space" type="RID" /> + <param index="1" name="max_contacts" type="int" /> + <description> + </description> + </method> <method name="_space_set_param" qualifiers="virtual"> <return type="void" /> <param index="0" name="space" type="RID" /> diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 1bd7a8eae5..b00127f5b1 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3377,6 +3377,8 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed Ref<Texture2D> icon = p_editor->get_icon(); if (icon.is_valid()) { tb->set_icon(icon); + // Make sure the control is updated if the icon is reimported. + icon->connect("changed", callable_mp((Control *)tb, &Control::update_minimum_size)); } else if (singleton->gui_base->has_theme_icon(p_editor->get_name(), SNAME("EditorIcons"))) { tb->set_icon(singleton->gui_base->get_theme_icon(p_editor->get_name(), SNAME("EditorIcons"))); } diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 9e983839f9..64ddecc588 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -447,6 +447,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { // Colors bool dark_theme = EditorSettings::get_singleton()->is_dark_theme(); +#ifdef MODULE_SVG_ENABLED + if (dark_theme) { + ImageLoaderSVG::set_forced_color_map(HashMap<Color, Color>()); + } else { + ImageLoaderSVG::set_forced_color_map(EditorColorMap::get()); + } +#endif + // Ensure base colors are in the 0..1 luminance range to avoid 8-bit integer overflow or text rendering issues. // Some places in the editor use 8-bit integer colors. const Color dark_color_1 = base_color.lerp(Color(0, 0, 0, 1), contrast).clamp(); diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index 17b94ec706..c06756ff0b 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -36,6 +36,8 @@ #include "core/version.h" #include "editor/editor_file_system.h" #include "editor/editor_node.h" +#include "editor/editor_scale.h" +#include "editor/editor_settings.h" void ResourceImporterTexture::_texture_reimport_roughness(const Ref<CompressedTexture2D> &p_tex, const String &p_normal_path, RS::TextureDetectRoughnessChannel p_channel) { ERR_FAIL_COND(p_tex.is_null()); @@ -233,6 +235,10 @@ void ResourceImporterTexture::get_import_options(const String &p_path, List<Impo if (p_path.get_extension() == "svg") { r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "svg/scale", PROPERTY_HINT_RANGE, "0.001,100,0.001"), 1.0)); + + // Editor use only, applies to SVG. + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "editor/scale_with_editor_scale"), false)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "editor/convert_colors_with_editor_theme"), false)); } } @@ -447,6 +453,14 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String scale = p_options["svg/scale"]; } + // Editor-specific options. + bool use_editor_scale = p_options.has("editor/scale_with_editor_scale") && p_options["editor/scale_with_editor_scale"]; + bool convert_editor_colors = p_options.has("editor/convert_colors_with_editor_theme") && p_options["editor/convert_colors_with_editor_theme"]; + + // Start importing images. + List<Ref<Image>> images_imported; + + // Load the normal image. Ref<Image> normal_image; Image::RoughnessChannel roughness_channel = Image::ROUGHNESS_CHANNEL_R; if (mipmaps && roughness > 1 && FileAccess::exists(normal_map)) { @@ -456,88 +470,117 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String } } + // Load the main image. Ref<Image> image; image.instantiate(); Error err = ImageLoader::load_image(p_source_file, image, nullptr, loader_flags, scale); if (err != OK) { return err; } + images_imported.push_back(image); - Array formats_imported; - - if (size_limit > 0 && (image->get_width() > size_limit || image->get_height() > size_limit)) { - //limit size - if (image->get_width() >= image->get_height()) { - int new_width = size_limit; - int new_height = image->get_height() * new_width / image->get_width(); - - image->resize(new_width, new_height, Image::INTERPOLATE_CUBIC); - } else { - int new_height = size_limit; - int new_width = image->get_width() * new_height / image->get_height(); + // Load the editor-only image. + Ref<Image> editor_image; + bool import_editor_image = use_editor_scale || convert_editor_colors; + if (import_editor_image) { + float editor_scale = scale; + if (use_editor_scale) { + editor_scale = scale * EDSCALE; + } - image->resize(new_width, new_height, Image::INTERPOLATE_CUBIC); + int32_t editor_loader_flags = loader_flags; + if (convert_editor_colors) { + editor_loader_flags |= ImageFormatLoader::FLAG_CONVERT_COLORS; } - if (normal == 1) { - image->normalize(); + editor_image.instantiate(); + err = ImageLoader::load_image(p_source_file, editor_image, nullptr, editor_loader_flags, editor_scale); + if (err != OK) { + WARN_PRINT("Failed to import an image resource for editor use from '" + p_source_file + "'"); + } else { + images_imported.push_back(editor_image); } } - if (fix_alpha_border) { - image->fix_alpha_edges(); - } + for (Ref<Image> &target_image : images_imported) { + // Apply the size limit. + if (size_limit > 0 && (target_image->get_width() > size_limit || target_image->get_height() > size_limit)) { + if (target_image->get_width() >= target_image->get_height()) { + int new_width = size_limit; + int new_height = target_image->get_height() * new_width / target_image->get_width(); - if (premult_alpha) { - image->premultiply_alpha(); - } + target_image->resize(new_width, new_height, Image::INTERPOLATE_CUBIC); + } else { + int new_height = size_limit; + int new_width = target_image->get_width() * new_height / target_image->get_height(); - if (normal_map_invert_y) { - // Inverting the green channel can be used to flip a normal map's direction. - // There's no standard when it comes to normal map Y direction, so this is - // sometimes needed when using a normal map exported from another program. - // See <http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates>. - const int height = image->get_height(); - const int width = image->get_width(); + target_image->resize(new_width, new_height, Image::INTERPOLATE_CUBIC); + } - for (int i = 0; i < width; i++) { - for (int j = 0; j < height; j++) { - const Color color = image->get_pixel(i, j); - image->set_pixel(i, j, Color(color.r, 1 - color.g, color.b)); + if (normal == 1) { + target_image->normalize(); } } - } - if (hdr_clamp_exposure) { - // Clamp HDR exposure following Filament's tonemapping formula. - // This can be used to reduce fireflies in environment maps or reduce the influence - // of the sun from an HDRI panorama on environment lighting (when a DirectionalLight3D is used instead). - const int height = image->get_height(); - const int width = image->get_width(); - - // These values are chosen arbitrarily and seem to produce good results with 4,096 samples. - const float linear = 4096.0; - const float compressed = 16384.0; + // Fix alpha border. + if (fix_alpha_border) { + target_image->fix_alpha_edges(); + } - for (int i = 0; i < width; i++) { - for (int j = 0; j < height; j++) { - const Color color = image->get_pixel(i, j); - const float luma = color.get_luminance(); + // Premultiply the alpha. + if (premult_alpha) { + target_image->premultiply_alpha(); + } - Color clamped_color; - if (luma <= linear) { - clamped_color = color; - } else { - clamped_color = (color / luma) * ((linear * linear - compressed * luma) / (2 * linear - compressed - luma)); + // Invert the green channel of the image to flip the normal map it contains. + if (normal_map_invert_y) { + // Inverting the green channel can be used to flip a normal map's direction. + // There's no standard when it comes to normal map Y direction, so this is + // sometimes needed when using a normal map exported from another program. + // See <http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates>. + const int height = target_image->get_height(); + const int width = target_image->get_width(); + + for (int i = 0; i < width; i++) { + for (int j = 0; j < height; j++) { + const Color color = target_image->get_pixel(i, j); + target_image->set_pixel(i, j, Color(color.r, 1 - color.g, color.b)); } + } + } - image->set_pixel(i, j, clamped_color); + // Clamp HDR exposure. + if (hdr_clamp_exposure) { + // Clamp HDR exposure following Filament's tonemapping formula. + // This can be used to reduce fireflies in environment maps or reduce the influence + // of the sun from an HDRI panorama on environment lighting (when a DirectionalLight3D is used instead). + const int height = target_image->get_height(); + const int width = target_image->get_width(); + + // These values are chosen arbitrarily and seem to produce good results with 4,096 samples. + const float linear = 4096.0; + const float compressed = 16384.0; + + for (int i = 0; i < width; i++) { + for (int j = 0; j < height; j++) { + const Color color = target_image->get_pixel(i, j); + const float luma = color.get_luminance(); + + Color clamped_color; + if (luma <= linear) { + clamped_color = color; + } else { + clamped_color = (color / luma) * ((linear * linear - compressed * luma) / (2 * linear - compressed - luma)); + } + + target_image->set_pixel(i, j, clamped_color); + } } } } if (compress_mode == COMPRESS_BASIS_UNIVERSAL && image->get_format() >= Image::FORMAT_RF) { - //basis universal does not support float formats, fall back + // Basis universal does not support float formats, fallback. compress_mode = COMPRESS_VRAM_COMPRESSED; } @@ -547,9 +590,11 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String bool force_normal = normal == 1; bool srgb_friendly_pack = pack_channels == 0; + Array formats_imported; + if (compress_mode == COMPRESS_VRAM_COMPRESSED) { - //must import in all formats, in order of priority (so platform choses the best supported one. IE, etc2 over etc). - //Android, GLES 2.x + // Must import in all formats, in order of priority (so platform choses the best supported one. IE, etc2 over etc). + // Android, GLES 2.x const bool is_hdr = (image->get_format() >= Image::FORMAT_RF && image->get_format() <= Image::FORMAT_RGBE9995); bool is_ldr = (image->get_format() >= Image::FORMAT_L8 && image->get_format() <= Image::FORMAT_RGB565); @@ -557,7 +602,7 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String const bool can_s3tc = ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_s3tc"); if (can_bptc) { - //add to the list anyway + // Add to the list anyway. formats_imported.push_back("bptc"); } @@ -566,9 +611,9 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String if (is_hdr && can_compress_hdr) { if (has_alpha) { - //can compress hdr, but hdr with alpha is not compressible + // Can compress HDR, but HDR with alpha is not compressible. if (hdr_compression == 2) { - //but user selected to compress hdr anyway, so force an alpha-less format. + // But user selected to compress HDR anyway, so force an alpha-less format. if (image->get_format() == Image::FORMAT_RGBAF) { image->convert(Image::FORMAT_RGBF); } else if (image->get_format() == Image::FORMAT_RGBAH) { @@ -580,7 +625,7 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String } if (!can_compress_hdr) { - //fallback to RGBE99995 + // Fallback to RGBE99995. if (image->get_format() != Image::FORMAT_RGBE9995) { image->convert(Image::FORMAT_RGBE9995); } @@ -615,16 +660,31 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String EditorNode::add_io_error(vformat(TTR("%s: No suitable desktop VRAM compression algorithm enabled in Project Settings (S3TC or BPTC). This texture may not display correctly on desktop platforms."), p_source_file)); } } else { - //import normally + // Import normally. _save_ctex(image, p_save_path + ".ctex", compress_mode, lossy, Image::COMPRESS_S3TC /*this is ignored */, mipmaps, stream, detect_3d, detect_roughness, detect_normal, force_normal, srgb_friendly_pack, false, mipmap_limit, normal_image, roughness_channel); } + if (editor_image.is_valid()) { + _save_ctex(editor_image, p_save_path + ".editor.ctex", compress_mode, lossy, Image::COMPRESS_S3TC /*this is ignored */, mipmaps, stream, detect_3d, detect_roughness, detect_normal, force_normal, srgb_friendly_pack, false, mipmap_limit, normal_image, roughness_channel); + } + if (r_metadata) { Dictionary metadata; metadata["vram_texture"] = compress_mode == COMPRESS_VRAM_COMPRESSED; if (formats_imported.size()) { metadata["imported_formats"] = formats_imported; } + + if (editor_image.is_valid()) { + metadata["has_editor_variant"] = true; + if (use_editor_scale) { + metadata["editor_scale"] = EDSCALE; + } + if (convert_editor_colors) { + metadata["editor_dark_theme"] = EditorSettings::get_singleton()->is_dark_theme(); + } + } + *r_metadata = metadata; } return OK; @@ -657,13 +717,22 @@ bool ResourceImporterTexture::are_import_settings_valid(const String &p_path) co //will become invalid if formats are missing to import Dictionary metadata = ResourceFormatImporter::get_singleton()->get_resource_metadata(p_path); + if (metadata.has("has_editor_variant")) { + if (metadata.has("editor_scale") && (float)metadata["editor_scale"] != EDSCALE) { + return false; + } + if (metadata.has("editor_dark_theme") && (bool)metadata["editor_dark_theme"] != EditorSettings::get_singleton()->is_dark_theme()) { + return false; + } + } + if (!metadata.has("vram_texture")) { return false; } bool vram = metadata["vram_texture"]; if (!vram) { - return true; //do not care about non vram + return true; // Do not care about non-VRAM. } Vector<String> formats_imported; diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp index 5f839bd979..cd6081f91b 100644 --- a/modules/svg/image_loader_svg.cpp +++ b/modules/svg/image_loader_svg.cpp @@ -35,6 +35,12 @@ #include <thorvg.h> +HashMap<Color, Color> ImageLoaderSVG::forced_color_map = HashMap<Color, Color>(); + +void ImageLoaderSVG::set_forced_color_map(const HashMap<Color, Color> &p_color_map) { + forced_color_map = p_color_map; +} + void ImageLoaderSVG::_replace_color_property(const HashMap<Color, Color> &p_color_map, const String &p_prefix, String &r_string) { // Replace colors in the SVG based on what is passed in `p_color_map`. // Used to change the colors of editor icons based on the used theme. @@ -138,7 +144,13 @@ void ImageLoaderSVG::get_recognized_extensions(List<String> *p_extensions) const Error ImageLoaderSVG::load_image(Ref<Image> p_image, Ref<FileAccess> p_fileaccess, uint32_t p_flags, float p_scale) { String svg = p_fileaccess->get_as_utf8_string(); - create_image_from_string(p_image, svg, p_scale, false, HashMap<Color, Color>()); + + if (p_flags & FLAG_CONVERT_COLORS) { + create_image_from_string(p_image, svg, p_scale, false, forced_color_map); + } else { + create_image_from_string(p_image, svg, p_scale, false, HashMap<Color, Color>()); + } + ERR_FAIL_COND_V(p_image->is_empty(), FAILED); if (p_flags & FLAG_FORCE_LINEAR) { p_image->srgb_to_linear(); diff --git a/modules/svg/image_loader_svg.h b/modules/svg/image_loader_svg.h index fc89b63edb..e6f73ab18f 100644 --- a/modules/svg/image_loader_svg.h +++ b/modules/svg/image_loader_svg.h @@ -34,9 +34,13 @@ #include "core/io/image_loader.h" class ImageLoaderSVG : public ImageFormatLoader { + static HashMap<Color, Color> forced_color_map; + void _replace_color_property(const HashMap<Color, Color> &p_color_map, const String &p_prefix, String &r_string); public: + static void set_forced_color_map(const HashMap<Color, Color> &p_color_map); + void create_image_from_string(Ref<Image> p_image, String p_string, float p_scale, bool p_upsample, const HashMap<Color, Color> &p_color_map); virtual Error load_image(Ref<Image> p_image, Ref<FileAccess> p_fileaccess, uint32_t p_flags, float p_scale) override; diff --git a/scene/2d/navigation_obstacle_2d.cpp b/scene/2d/navigation_obstacle_2d.cpp index a592d20cba..1850e00ecd 100644 --- a/scene/2d/navigation_obstacle_2d.cpp +++ b/scene/2d/navigation_obstacle_2d.cpp @@ -38,6 +38,9 @@ void NavigationObstacle2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_rid"), &NavigationObstacle2D::get_rid); + ClassDB::bind_method(D_METHOD("set_navigation_map", "navigation_map"), &NavigationObstacle2D::set_navigation_map); + ClassDB::bind_method(D_METHOD("get_navigation_map"), &NavigationObstacle2D::get_navigation_map); + ClassDB::bind_method(D_METHOD("set_estimate_radius", "estimate_radius"), &NavigationObstacle2D::set_estimate_radius); ClassDB::bind_method(D_METHOD("is_radius_estimated"), &NavigationObstacle2D::is_radius_estimated); ClassDB::bind_method(D_METHOD("set_radius", "radius"), &NavigationObstacle2D::set_radius); @@ -57,28 +60,26 @@ void NavigationObstacle2D::_validate_property(PropertyInfo &p_property) const { void NavigationObstacle2D::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: { - parent_node2d = Object::cast_to<Node2D>(get_parent()); - reevaluate_agent_radius(); - if (parent_node2d != nullptr) { - // place agent on navigation map first or else the RVO agent callback creation fails silently later - NavigationServer2D::get_singleton()->agent_set_map(get_rid(), parent_node2d->get_world_2d()->get_navigation_map()); - } + case NOTIFICATION_POST_ENTER_TREE: { + set_agent_parent(get_parent()); set_physics_process_internal(true); } break; case NOTIFICATION_EXIT_TREE: { - parent_node2d = nullptr; + set_agent_parent(nullptr); set_physics_process_internal(false); } break; case NOTIFICATION_PARENTED: { - parent_node2d = Object::cast_to<Node2D>(get_parent()); - reevaluate_agent_radius(); + if (is_inside_tree() && (get_parent() != parent_node2d)) { + set_agent_parent(get_parent()); + set_physics_process_internal(true); + } } break; case NOTIFICATION_UNPARENTED: { - parent_node2d = nullptr; + set_agent_parent(nullptr); + set_physics_process_internal(false); } break; case NOTIFICATION_PAUSED: { @@ -182,6 +183,35 @@ real_t NavigationObstacle2D::estimate_agent_radius() const { return 1.0; // Never a 0 radius } +void NavigationObstacle2D::set_agent_parent(Node *p_agent_parent) { + if (Object::cast_to<Node2D>(p_agent_parent) != nullptr) { + parent_node2d = Object::cast_to<Node2D>(p_agent_parent); + if (map_override.is_valid()) { + NavigationServer2D::get_singleton()->agent_set_map(get_rid(), map_override); + } else { + NavigationServer2D::get_singleton()->agent_set_map(get_rid(), parent_node2d->get_world_2d()->get_navigation_map()); + } + reevaluate_agent_radius(); + } else { + parent_node2d = nullptr; + NavigationServer2D::get_singleton()->agent_set_map(get_rid(), RID()); + } +} + +void NavigationObstacle2D::set_navigation_map(RID p_navigation_map) { + map_override = p_navigation_map; + NavigationServer2D::get_singleton()->agent_set_map(agent, map_override); +} + +RID NavigationObstacle2D::get_navigation_map() const { + if (map_override.is_valid()) { + return map_override; + } else if (parent_node2d != nullptr) { + return parent_node2d->get_world_2d()->get_navigation_map(); + } + return RID(); +} + void NavigationObstacle2D::set_estimate_radius(bool p_estimate_radius) { estimate_radius = p_estimate_radius; notify_property_list_changed(); diff --git a/scene/2d/navigation_obstacle_2d.h b/scene/2d/navigation_obstacle_2d.h index 5795c6c94f..6eff95adec 100644 --- a/scene/2d/navigation_obstacle_2d.h +++ b/scene/2d/navigation_obstacle_2d.h @@ -38,8 +38,10 @@ class NavigationObstacle2D : public Node { GDCLASS(NavigationObstacle2D, Node); Node2D *parent_node2d = nullptr; + RID agent; RID map_before_pause; + RID map_override; bool estimate_radius = true; real_t radius = 1.0; @@ -57,6 +59,11 @@ public: return agent; } + void set_agent_parent(Node *p_agent_parent); + + void set_navigation_map(RID p_navigation_map); + RID get_navigation_map() const; + void set_estimate_radius(bool p_estimate_radius); bool is_radius_estimated() const { return estimate_radius; diff --git a/scene/3d/navigation_obstacle_3d.cpp b/scene/3d/navigation_obstacle_3d.cpp index 953e52e591..9b49238333 100644 --- a/scene/3d/navigation_obstacle_3d.cpp +++ b/scene/3d/navigation_obstacle_3d.cpp @@ -37,6 +37,9 @@ void NavigationObstacle3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_rid"), &NavigationObstacle3D::get_rid); + ClassDB::bind_method(D_METHOD("set_navigation_map", "navigation_map"), &NavigationObstacle3D::set_navigation_map); + ClassDB::bind_method(D_METHOD("get_navigation_map"), &NavigationObstacle3D::get_navigation_map); + ClassDB::bind_method(D_METHOD("set_estimate_radius", "estimate_radius"), &NavigationObstacle3D::set_estimate_radius); ClassDB::bind_method(D_METHOD("is_radius_estimated"), &NavigationObstacle3D::is_radius_estimated); ClassDB::bind_method(D_METHOD("set_radius", "radius"), &NavigationObstacle3D::set_radius); @@ -56,28 +59,26 @@ void NavigationObstacle3D::_validate_property(PropertyInfo &p_property) const { void NavigationObstacle3D::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: { - parent_node3d = Object::cast_to<Node3D>(get_parent()); - reevaluate_agent_radius(); - if (parent_node3d != nullptr) { - // place agent on navigation map first or else the RVO agent callback creation fails silently later - NavigationServer3D::get_singleton()->agent_set_map(get_rid(), parent_node3d->get_world_3d()->get_navigation_map()); - } + case NOTIFICATION_POST_ENTER_TREE: { + set_agent_parent(get_parent()); set_physics_process_internal(true); } break; case NOTIFICATION_EXIT_TREE: { - parent_node3d = nullptr; + set_agent_parent(nullptr); set_physics_process_internal(false); } break; case NOTIFICATION_PARENTED: { - parent_node3d = Object::cast_to<Node3D>(get_parent()); - reevaluate_agent_radius(); + if (is_inside_tree() && (get_parent() != parent_node3d)) { + set_agent_parent(get_parent()); + set_physics_process_internal(true); + } } break; case NOTIFICATION_UNPARENTED: { - parent_node3d = nullptr; + set_agent_parent(nullptr); + set_physics_process_internal(false); } break; case NOTIFICATION_PAUSED: { @@ -189,6 +190,35 @@ real_t NavigationObstacle3D::estimate_agent_radius() const { return 1.0; // Never a 0 radius } +void NavigationObstacle3D::set_agent_parent(Node *p_agent_parent) { + if (Object::cast_to<Node3D>(p_agent_parent) != nullptr) { + parent_node3d = Object::cast_to<Node3D>(p_agent_parent); + if (map_override.is_valid()) { + NavigationServer3D::get_singleton()->agent_set_map(get_rid(), map_override); + } else { + NavigationServer3D::get_singleton()->agent_set_map(get_rid(), parent_node3d->get_world_3d()->get_navigation_map()); + } + reevaluate_agent_radius(); + } else { + parent_node3d = nullptr; + NavigationServer3D::get_singleton()->agent_set_map(get_rid(), RID()); + } +} + +void NavigationObstacle3D::set_navigation_map(RID p_navigation_map) { + map_override = p_navigation_map; + NavigationServer3D::get_singleton()->agent_set_map(agent, map_override); +} + +RID NavigationObstacle3D::get_navigation_map() const { + if (map_override.is_valid()) { + return map_override; + } else if (parent_node3d != nullptr) { + return parent_node3d->get_world_3d()->get_navigation_map(); + } + return RID(); +} + void NavigationObstacle3D::set_estimate_radius(bool p_estimate_radius) { estimate_radius = p_estimate_radius; notify_property_list_changed(); diff --git a/scene/3d/navigation_obstacle_3d.h b/scene/3d/navigation_obstacle_3d.h index 7f6af668b6..24caf50680 100644 --- a/scene/3d/navigation_obstacle_3d.h +++ b/scene/3d/navigation_obstacle_3d.h @@ -37,8 +37,10 @@ class NavigationObstacle3D : public Node { GDCLASS(NavigationObstacle3D, Node); Node3D *parent_node3d = nullptr; + RID agent; RID map_before_pause; + RID map_override; bool estimate_radius = true; real_t radius = 1.0; @@ -56,6 +58,11 @@ public: return agent; } + void set_agent_parent(Node *p_agent_parent); + + void set_navigation_map(RID p_navigation_map); + RID get_navigation_map() const; + void set_estimate_radius(bool p_estimate_radius); bool is_radius_estimated() const { return estimate_radius; diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp index 093e4a8cd3..05d86f77f2 100644 --- a/scene/main/canvas_item.cpp +++ b/scene/main/canvas_item.cpp @@ -373,7 +373,7 @@ void CanvasItem::move_to_front() { if (!get_parent()) { return; } - get_parent()->move_child(this, get_parent()->get_child_count() - 1); + get_parent()->move_child(this, -1); } void CanvasItem::set_modulate(const Color &p_modulate) { diff --git a/scene/main/node.cpp b/scene/main/node.cpp index f01ec99205..29f4d4fb1c 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -328,12 +328,21 @@ void Node::move_child(Node *p_child, int p_pos) { // We need to check whether node is internal and move it only in the relevant node range. if (p_child->_is_internal_front()) { + if (p_pos < 0) { + p_pos += data.internal_children_front; + } ERR_FAIL_INDEX_MSG(p_pos, data.internal_children_front, vformat("Invalid new child position: %d. Child is internal.", p_pos)); _move_child(p_child, p_pos); } else if (p_child->_is_internal_back()) { + if (p_pos < 0) { + p_pos += data.internal_children_back; + } ERR_FAIL_INDEX_MSG(p_pos, data.internal_children_back, vformat("Invalid new child position: %d. Child is internal.", p_pos)); _move_child(p_child, data.children.size() - data.internal_children_back + p_pos); } else { + if (p_pos < 0) { + p_pos += get_child_count(false); + } ERR_FAIL_INDEX_MSG(p_pos, data.children.size() + 1 - data.internal_children_front - data.internal_children_back, vformat("Invalid new child position: %d.", p_pos)); _move_child(p_child, p_pos + data.internal_children_front); } @@ -1907,43 +1916,6 @@ Ref<Tween> Node::create_tween() { return tween; } -void Node::remove_and_skip() { - ERR_FAIL_COND(!data.parent); - - Node *new_owner = get_owner(); - - List<Node *> children; - - while (true) { - bool clear = true; - for (int i = 0; i < data.children.size(); i++) { - Node *c_node = data.children[i]; - if (!c_node->get_owner()) { - continue; - } - - remove_child(c_node); - c_node->_propagate_replace_owner(this, nullptr); - children.push_back(c_node); - clear = false; - break; - } - - if (clear) { - break; - } - } - - while (!children.is_empty()) { - Node *c_node = children.front()->get(); - data.parent->add_child(c_node); - c_node->_propagate_replace_owner(nullptr, new_owner); - children.pop_front(); - } - - data.parent->remove_child(this); -} - void Node::set_scene_file_path(const String &p_scene_file_path) { data.scene_file_path = p_scene_file_path; } @@ -2803,7 +2775,6 @@ void Node::_bind_methods() { ClassDB::bind_method(D_METHOD("get_groups"), &Node::_get_groups); ClassDB::bind_method(D_METHOD("set_owner", "owner"), &Node::set_owner); ClassDB::bind_method(D_METHOD("get_owner"), &Node::get_owner); - ClassDB::bind_method(D_METHOD("remove_and_skip"), &Node::remove_and_skip); ClassDB::bind_method(D_METHOD("get_index", "include_internal"), &Node::get_index, DEFVAL(false)); ClassDB::bind_method(D_METHOD("print_tree"), &Node::print_tree); ClassDB::bind_method(D_METHOD("print_tree_pretty"), &Node::print_tree_pretty); diff --git a/scene/main/node.h b/scene/main/node.h index 9f07bc28bc..39225b1358 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -356,7 +356,6 @@ public: void set_unique_name_in_owner(bool p_enabled); bool is_unique_name_in_owner() const; - void remove_and_skip(); int get_index(bool p_include_internal = true) const; Ref<Tween> create_tween(); diff --git a/servers/extensions/physics_server_2d_extension.cpp b/servers/extensions/physics_server_2d_extension.cpp index c56f31e6f9..36f3be2468 100644 --- a/servers/extensions/physics_server_2d_extension.cpp +++ b/servers/extensions/physics_server_2d_extension.cpp @@ -123,6 +123,8 @@ bool PhysicsServer2DExtension::body_test_motion_is_excluding_object(ObjectID p_o } void PhysicsServer2DExtension::_bind_methods() { + /* SHAPE API */ + GDVIRTUAL_BIND(_world_boundary_shape_create); GDVIRTUAL_BIND(_separation_ray_shape_create); GDVIRTUAL_BIND(_segment_shape_create); @@ -133,18 +135,32 @@ void PhysicsServer2DExtension::_bind_methods() { GDVIRTUAL_BIND(_concave_polygon_shape_create); GDVIRTUAL_BIND(_shape_set_data, "shape", "data"); + GDVIRTUAL_BIND(_shape_set_custom_solver_bias, "shape", "bias"); GDVIRTUAL_BIND(_shape_get_type, "shape"); GDVIRTUAL_BIND(_shape_get_data, "shape"); + GDVIRTUAL_BIND(_shape_get_custom_solver_bias, "shape"); + GDVIRTUAL_BIND(_shape_collide, "shape_A", "xform_A", "motion_A", "shape_B", "xform_B", "motion_B", "results", "result_max", "result_count"); + + /* SPACE API */ GDVIRTUAL_BIND(_space_create); GDVIRTUAL_BIND(_space_set_active, "space", "active"); GDVIRTUAL_BIND(_space_is_active, "space"); + GDVIRTUAL_BIND(_space_set_param, "space", "param", "value"); GDVIRTUAL_BIND(_space_get_param, "space", "param"); + GDVIRTUAL_BIND(_space_get_direct_state, "space"); + GDVIRTUAL_BIND(_space_set_debug_contacts, "space", "max_contacts"); + GDVIRTUAL_BIND(_space_get_contacts, "space"); + GDVIRTUAL_BIND(_space_get_contact_count, "space"); + + /* AREA API */ + GDVIRTUAL_BIND(_area_create); + GDVIRTUAL_BIND(_area_set_space, "area", "space"); GDVIRTUAL_BIND(_area_get_space, "area"); @@ -160,8 +176,11 @@ void PhysicsServer2DExtension::_bind_methods() { GDVIRTUAL_BIND(_area_remove_shape, "area", "shape_idx"); GDVIRTUAL_BIND(_area_clear_shapes, "area"); - GDVIRTUAL_BIND(_area_set_collision_layer, "area", "layer"); - GDVIRTUAL_BIND(_area_set_collision_mask, "area", "mask"); + GDVIRTUAL_BIND(_area_attach_object_instance_id, "area", "id"); + GDVIRTUAL_BIND(_area_get_object_instance_id, "area"); + + GDVIRTUAL_BIND(_area_attach_canvas_instance_id, "area", "id"); + GDVIRTUAL_BIND(_area_get_canvas_instance_id, "area"); GDVIRTUAL_BIND(_area_set_param, "area", "param", "value"); GDVIRTUAL_BIND(_area_set_transform, "area", "transform"); @@ -169,15 +188,16 @@ void PhysicsServer2DExtension::_bind_methods() { GDVIRTUAL_BIND(_area_get_param, "area", "param"); GDVIRTUAL_BIND(_area_get_transform, "area"); - GDVIRTUAL_BIND(_area_attach_object_instance_id, "area", "id"); - GDVIRTUAL_BIND(_area_get_object_instance_id, "area"); + GDVIRTUAL_BIND(_area_set_collision_layer, "area", "layer"); + GDVIRTUAL_BIND(_area_set_collision_mask, "area", "mask"); - GDVIRTUAL_BIND(_area_attach_canvas_instance_id, "area", "id"); - GDVIRTUAL_BIND(_area_get_canvas_instance_id, "area"); + GDVIRTUAL_BIND(_area_set_monitorable, "area", "monitorable"); + GDVIRTUAL_BIND(_area_set_pickable, "area", "pickable"); GDVIRTUAL_BIND(_area_set_monitor_callback, "area", "callback"); GDVIRTUAL_BIND(_area_set_area_monitor_callback, "area", "callback"); - GDVIRTUAL_BIND(_area_set_monitorable, "area", "monitorable"); + + /* BODY API */ GDVIRTUAL_BIND(_body_create); @@ -195,12 +215,12 @@ void PhysicsServer2DExtension::_bind_methods() { GDVIRTUAL_BIND(_body_get_shape, "body", "shape_idx"); GDVIRTUAL_BIND(_body_get_shape_transform, "body", "shape_idx"); - GDVIRTUAL_BIND(_body_remove_shape, "body", "shape_idx"); - GDVIRTUAL_BIND(_body_clear_shapes, "body"); - GDVIRTUAL_BIND(_body_set_shape_disabled, "body", "shape_idx", "disabled"); GDVIRTUAL_BIND(_body_set_shape_as_one_way_collision, "body", "shape_idx", "enable", "margin"); + GDVIRTUAL_BIND(_body_remove_shape, "body", "shape_idx"); + GDVIRTUAL_BIND(_body_clear_shapes, "body"); + GDVIRTUAL_BIND(_body_attach_object_instance_id, "body", "id"); GDVIRTUAL_BIND(_body_get_object_instance_id, "body"); @@ -249,25 +269,39 @@ void PhysicsServer2DExtension::_bind_methods() { GDVIRTUAL_BIND(_body_add_collision_exception, "body", "excepted_body"); GDVIRTUAL_BIND(_body_remove_collision_exception, "body", "excepted_body"); + GDVIRTUAL_BIND(_body_get_collision_exceptions, "body"); GDVIRTUAL_BIND(_body_set_max_contacts_reported, "body", "amount"); GDVIRTUAL_BIND(_body_get_max_contacts_reported, "body"); + GDVIRTUAL_BIND(_body_set_contacts_reported_depth_threshold, "body", "threshold"); + GDVIRTUAL_BIND(_body_get_contacts_reported_depth_threshold, "body"); + GDVIRTUAL_BIND(_body_set_omit_force_integration, "body", "enable"); GDVIRTUAL_BIND(_body_is_omitting_force_integration, "body"); + GDVIRTUAL_BIND(_body_set_state_sync_callback, "body", "callback"); GDVIRTUAL_BIND(_body_set_force_integration_callback, "body", "callable", "userdata"); - GDVIRTUAL_BIND(_body_test_motion, "body", "from", "motion", "margin", "collide_separation_ray", "recovery_as_collision", "result"); + GDVIRTUAL_BIND(_body_collide_shape, "body", "body_shape", "shape", "shape_xform", "motion", "results", "result_max", "result_count"); + + GDVIRTUAL_BIND(_body_set_pickable, "body", "pickable"); GDVIRTUAL_BIND(_body_get_direct_state, "body"); + GDVIRTUAL_BIND(_body_test_motion, "body", "from", "motion", "margin", "collide_separation_ray", "recovery_as_collision", "result"); + + /* JOINT API */ + GDVIRTUAL_BIND(_joint_create); GDVIRTUAL_BIND(_joint_clear, "joint"); GDVIRTUAL_BIND(_joint_set_param, "joint", "param", "value"); GDVIRTUAL_BIND(_joint_get_param, "joint", "param"); + GDVIRTUAL_BIND(_joint_disable_collisions_between_bodies, "joint", "disable"); + GDVIRTUAL_BIND(_joint_is_disabled_collisions_between_bodies, "joint"); + GDVIRTUAL_BIND(_joint_make_pin, "joint", "anchor", "body_a", "body_b"); GDVIRTUAL_BIND(_joint_make_groove, "joint", "a_groove1", "a_groove2", "b_anchor", "body_a", "body_b"); GDVIRTUAL_BIND(_joint_make_damped_spring, "joint", "anchor_a", "anchor_b", "body_a", "body_b"); @@ -280,6 +314,8 @@ void PhysicsServer2DExtension::_bind_methods() { GDVIRTUAL_BIND(_joint_get_type, "joint"); + /* MISC */ + GDVIRTUAL_BIND(_free_rid, "rid"); GDVIRTUAL_BIND(_set_active, "active"); diff --git a/servers/extensions/physics_server_2d_extension.h b/servers/extensions/physics_server_2d_extension.h index 4c83664b14..3bd3d642c8 100644 --- a/servers/extensions/physics_server_2d_extension.h +++ b/servers/extensions/physics_server_2d_extension.h @@ -204,6 +204,8 @@ protected: public: // The warning is valid, but unavoidable. If the function is not overridden it will error anyway. + /* SHAPE API */ + EXBIND0R(RID, world_boundary_shape_create) EXBIND0R(RID, separation_ray_shape_create) EXBIND0R(RID, segment_shape_create) @@ -252,6 +254,7 @@ public: EXBIND4(area_add_shape, RID, RID, const Transform2D &, bool) EXBIND3(area_set_shape, RID, int, RID) EXBIND3(area_set_shape_transform, RID, int, const Transform2D &) + EXBIND3(area_set_shape_disabled, RID, int, bool) EXBIND1RC(int, area_get_shape_count, RID) EXBIND2RC(RID, area_get_shape, RID, int) @@ -260,8 +263,6 @@ public: EXBIND2(area_remove_shape, RID, int) EXBIND1(area_clear_shapes, RID) - EXBIND3(area_set_shape_disabled, RID, int, bool) - EXBIND2(area_attach_object_instance_id, RID, ObjectID) EXBIND1RC(ObjectID, area_get_object_instance_id, RID) @@ -415,7 +416,6 @@ public: /* JOINT API */ EXBIND0R(RID, joint_create) - EXBIND1(joint_clear, RID) EXBIND3(joint_set_param, RID, JointParam, real_t) diff --git a/servers/extensions/physics_server_3d_extension.cpp b/servers/extensions/physics_server_3d_extension.cpp index 6ed5dca968..800284dc60 100644 --- a/servers/extensions/physics_server_3d_extension.cpp +++ b/servers/extensions/physics_server_3d_extension.cpp @@ -125,6 +125,8 @@ bool PhysicsServer3DExtension::body_test_motion_is_excluding_object(ObjectID p_o } void PhysicsServer3DExtension::_bind_methods() { + /* SHAPE API */ + GDVIRTUAL_BIND(_world_boundary_shape_create); GDVIRTUAL_BIND(_separation_ray_shape_create); GDVIRTUAL_BIND(_sphere_shape_create); @@ -137,18 +139,34 @@ void PhysicsServer3DExtension::_bind_methods() { GDVIRTUAL_BIND(_custom_shape_create); GDVIRTUAL_BIND(_shape_set_data, "shape", "data"); + GDVIRTUAL_BIND(_shape_set_custom_solver_bias, "shape", "bias"); + + GDVIRTUAL_BIND(_shape_set_margin, "shape", "margin"); + GDVIRTUAL_BIND(_shape_get_margin, "shape"); GDVIRTUAL_BIND(_shape_get_type, "shape"); GDVIRTUAL_BIND(_shape_get_data, "shape"); + GDVIRTUAL_BIND(_shape_get_custom_solver_bias, "shape"); + + /* SPACE API */ GDVIRTUAL_BIND(_space_create); GDVIRTUAL_BIND(_space_set_active, "space", "active"); GDVIRTUAL_BIND(_space_is_active, "space"); + GDVIRTUAL_BIND(_space_set_param, "space", "param", "value"); GDVIRTUAL_BIND(_space_get_param, "space", "param"); + GDVIRTUAL_BIND(_space_get_direct_state, "space"); + GDVIRTUAL_BIND(_space_set_debug_contacts, "space", "max_contacts"); + GDVIRTUAL_BIND(_space_get_contacts, "space"); + GDVIRTUAL_BIND(_space_get_contact_count, "space"); + + /* AREA API */ + GDVIRTUAL_BIND(_area_create); + GDVIRTUAL_BIND(_area_set_space, "area", "space"); GDVIRTUAL_BIND(_area_get_space, "area"); @@ -164,8 +182,8 @@ void PhysicsServer3DExtension::_bind_methods() { GDVIRTUAL_BIND(_area_remove_shape, "area", "shape_idx"); GDVIRTUAL_BIND(_area_clear_shapes, "area"); - GDVIRTUAL_BIND(_area_set_collision_layer, "area", "layer"); - GDVIRTUAL_BIND(_area_set_collision_mask, "area", "mask"); + GDVIRTUAL_BIND(_area_attach_object_instance_id, "area", "id"); + GDVIRTUAL_BIND(_area_get_object_instance_id, "area"); GDVIRTUAL_BIND(_area_set_param, "area", "param", "value"); GDVIRTUAL_BIND(_area_set_transform, "area", "transform"); @@ -173,14 +191,16 @@ void PhysicsServer3DExtension::_bind_methods() { GDVIRTUAL_BIND(_area_get_param, "area", "param"); GDVIRTUAL_BIND(_area_get_transform, "area"); - GDVIRTUAL_BIND(_area_attach_object_instance_id, "area", "id"); - GDVIRTUAL_BIND(_area_get_object_instance_id, "area"); + GDVIRTUAL_BIND(_area_set_collision_layer, "area", "layer"); + GDVIRTUAL_BIND(_area_set_collision_mask, "area", "mask"); + + GDVIRTUAL_BIND(_area_set_monitorable, "area", "monitorable"); + GDVIRTUAL_BIND(_area_set_ray_pickable, "area", "enable"); GDVIRTUAL_BIND(_area_set_monitor_callback, "area", "callback"); GDVIRTUAL_BIND(_area_set_area_monitor_callback, "area", "callback"); - GDVIRTUAL_BIND(_area_set_monitorable, "area", "monitorable"); - GDVIRTUAL_BIND(_area_set_ray_pickable, "area", "enable"); + /* BODY API */ GDVIRTUAL_BIND(_body_create); @@ -190,15 +210,6 @@ void PhysicsServer3DExtension::_bind_methods() { GDVIRTUAL_BIND(_body_set_mode, "body", "mode"); GDVIRTUAL_BIND(_body_get_mode, "body"); - GDVIRTUAL_BIND(_body_set_collision_layer, "body", "layer"); - GDVIRTUAL_BIND(_body_get_collision_layer, "body"); - - GDVIRTUAL_BIND(_body_set_collision_mask, "body", "mask"); - GDVIRTUAL_BIND(_body_get_collision_mask, "body"); - - GDVIRTUAL_BIND(_body_set_collision_priority, "body", "priority"); - GDVIRTUAL_BIND(_body_get_collision_priority, "body"); - GDVIRTUAL_BIND(_body_add_shape, "body", "shape", "transform", "disabled"); GDVIRTUAL_BIND(_body_set_shape, "body", "shape_idx", "shape"); GDVIRTUAL_BIND(_body_set_shape_transform, "body", "shape_idx", "transform"); @@ -217,6 +228,18 @@ void PhysicsServer3DExtension::_bind_methods() { GDVIRTUAL_BIND(_body_set_enable_continuous_collision_detection, "body", "enable"); GDVIRTUAL_BIND(_body_is_continuous_collision_detection_enabled, "body"); + GDVIRTUAL_BIND(_body_set_collision_layer, "body", "layer"); + GDVIRTUAL_BIND(_body_get_collision_layer, "body"); + + GDVIRTUAL_BIND(_body_set_collision_mask, "body", "mask"); + GDVIRTUAL_BIND(_body_get_collision_mask, "body"); + + GDVIRTUAL_BIND(_body_set_collision_priority, "body", "priority"); + GDVIRTUAL_BIND(_body_get_collision_priority, "body"); + + GDVIRTUAL_BIND(_body_set_user_flags, "body", "flags"); + GDVIRTUAL_BIND(_body_get_user_flags, "body"); + GDVIRTUAL_BIND(_body_set_param, "body", "param", "value"); GDVIRTUAL_BIND(_body_get_param, "body", "param"); @@ -250,13 +273,18 @@ void PhysicsServer3DExtension::_bind_methods() { GDVIRTUAL_BIND(_body_add_collision_exception, "body", "excepted_body"); GDVIRTUAL_BIND(_body_remove_collision_exception, "body", "excepted_body"); + GDVIRTUAL_BIND(_body_get_collision_exceptions, "body"); GDVIRTUAL_BIND(_body_set_max_contacts_reported, "body", "amount"); GDVIRTUAL_BIND(_body_get_max_contacts_reported, "body"); + GDVIRTUAL_BIND(_body_set_contacts_reported_depth_threshold, "body", "threshold"); + GDVIRTUAL_BIND(_body_get_contacts_reported_depth_threshold, "body"); + GDVIRTUAL_BIND(_body_set_omit_force_integration, "body", "enable"); GDVIRTUAL_BIND(_body_is_omitting_force_integration, "body"); + GDVIRTUAL_BIND(_body_set_state_sync_callback, "body", "callback"); GDVIRTUAL_BIND(_body_set_force_integration_callback, "body", "callable", "userdata"); GDVIRTUAL_BIND(_body_set_ray_pickable, "body", "enable"); @@ -265,12 +293,68 @@ void PhysicsServer3DExtension::_bind_methods() { GDVIRTUAL_BIND(_body_get_direct_state, "body"); + /* SOFT BODY API */ + + GDVIRTUAL_BIND(_soft_body_create); + + GDVIRTUAL_BIND(_soft_body_update_rendering_server, "body", "rendering_server_handler"); + + GDVIRTUAL_BIND(_soft_body_set_space, "body", "space"); + GDVIRTUAL_BIND(_soft_body_get_space, "body"); + + GDVIRTUAL_BIND(_soft_body_set_ray_pickable, "body", "enable"); + + GDVIRTUAL_BIND(_soft_body_set_collision_layer, "body", "layer"); + GDVIRTUAL_BIND(_soft_body_get_collision_layer, "body"); + + GDVIRTUAL_BIND(_soft_body_set_collision_mask, "body", "mask"); + GDVIRTUAL_BIND(_soft_body_get_collision_mask, "body"); + + GDVIRTUAL_BIND(_soft_body_add_collision_exception, "body", "body_b"); + GDVIRTUAL_BIND(_soft_body_remove_collision_exception, "body", "body_b"); + GDVIRTUAL_BIND(_soft_body_get_collision_exceptions, "body"); + + GDVIRTUAL_BIND(_soft_body_set_state, "body", "state", "variant"); + GDVIRTUAL_BIND(_soft_body_get_state, "body", "state"); + + GDVIRTUAL_BIND(_soft_body_set_transform, "body", "transform"); + + GDVIRTUAL_BIND(_soft_body_set_simulation_precision, "body", "simulation_precision"); + GDVIRTUAL_BIND(_soft_body_get_simulation_precision, "body"); + + GDVIRTUAL_BIND(_soft_body_set_total_mass, "body", "total_mass"); + GDVIRTUAL_BIND(_soft_body_get_total_mass, "body"); + + GDVIRTUAL_BIND(_soft_body_set_linear_stiffness, "body", "linear_stiffness"); + GDVIRTUAL_BIND(_soft_body_get_linear_stiffness, "body"); + + GDVIRTUAL_BIND(_soft_body_set_pressure_coefficient, "body", "pressure_coefficient"); + GDVIRTUAL_BIND(_soft_body_get_pressure_coefficient, "body"); + + GDVIRTUAL_BIND(_soft_body_set_damping_coefficient, "body", "damping_coefficient"); + GDVIRTUAL_BIND(_soft_body_get_damping_coefficient, "body"); + + GDVIRTUAL_BIND(_soft_body_set_drag_coefficient, "body", "drag_coefficient"); + GDVIRTUAL_BIND(_soft_body_get_drag_coefficient, "body"); + + GDVIRTUAL_BIND(_soft_body_set_mesh, "body", "mesh"); + GDVIRTUAL_BIND(_soft_body_get_bounds, "body"); + GDVIRTUAL_BIND(_soft_body_move_point, "body", "point_index", "global_position"); + GDVIRTUAL_BIND(_soft_body_get_point_global_position, "body", "point_index"); + + GDVIRTUAL_BIND(_soft_body_remove_all_pinned_points, "body"); + GDVIRTUAL_BIND(_soft_body_pin_point, "body", "point_index", "pin"); + GDVIRTUAL_BIND(_soft_body_is_point_pinned, "body", "point_index"); + + /* JOINT API */ + GDVIRTUAL_BIND(_joint_create); GDVIRTUAL_BIND(_joint_clear, "joint"); GDVIRTUAL_BIND(_joint_make_pin, "joint", "body_A", "local_A", "body_B", "local_B"); + GDVIRTUAL_BIND(_pin_joint_set_param, "joint", "param", "value"); GDVIRTUAL_BIND(_pin_joint_get_param, "joint", "param"); @@ -281,6 +365,7 @@ void PhysicsServer3DExtension::_bind_methods() { GDVIRTUAL_BIND(_pin_joint_get_local_b, "joint"); GDVIRTUAL_BIND(_joint_make_hinge, "joint", "body_A", "hinge_A", "body_B", "hinge_B"); + GDVIRTUAL_BIND(_joint_make_hinge_simple, "joint", "body_A", "pivot_A", "axis_A", "body_B", "pivot_B", "axis_B"); GDVIRTUAL_BIND(_hinge_joint_set_param, "joint", "param", "value"); GDVIRTUAL_BIND(_hinge_joint_get_param, "joint", "param"); @@ -298,11 +383,6 @@ void PhysicsServer3DExtension::_bind_methods() { GDVIRTUAL_BIND(_cone_twist_joint_set_param, "joint", "param", "value"); GDVIRTUAL_BIND(_cone_twist_joint_get_param, "joint", "param"); - GDVIRTUAL_BIND(_joint_get_type, "joint"); - - GDVIRTUAL_BIND(_joint_set_solver_priority, "joint", "priority"); - GDVIRTUAL_BIND(_joint_get_solver_priority, "joint"); - GDVIRTUAL_BIND(_joint_make_generic_6dof, "joint", "body_A", "local_ref_A", "body_B", "local_ref_B"); GDVIRTUAL_BIND(_generic_6dof_joint_set_param, "joint", "axis", "param", "value"); @@ -311,6 +391,11 @@ void PhysicsServer3DExtension::_bind_methods() { GDVIRTUAL_BIND(_generic_6dof_joint_set_flag, "joint", "axis", "flag", "enable"); GDVIRTUAL_BIND(_generic_6dof_joint_get_flag, "joint", "axis", "flag"); + GDVIRTUAL_BIND(_joint_get_type, "joint"); + + GDVIRTUAL_BIND(_joint_set_solver_priority, "joint", "priority"); + GDVIRTUAL_BIND(_joint_get_solver_priority, "joint"); + GDVIRTUAL_BIND(_free_rid, "rid"); GDVIRTUAL_BIND(_set_active, "active"); diff --git a/servers/extensions/physics_server_3d_extension.h b/servers/extensions/physics_server_3d_extension.h index c84582bf31..b6ed346a3d 100644 --- a/servers/extensions/physics_server_3d_extension.h +++ b/servers/extensions/physics_server_3d_extension.h @@ -210,6 +210,8 @@ protected: public: // The warning is valid, but unavoidable. If the function is not overridden it will error anyway. + /* SHAPE API */ + EXBIND0R(RID, world_boundary_shape_create) EXBIND0R(RID, separation_ray_shape_create) EXBIND0R(RID, sphere_shape_create) @@ -262,6 +264,7 @@ public: EXBIND1RC(int, area_get_shape_count, RID) EXBIND2RC(RID, area_get_shape, RID, int) EXBIND2RC(Transform3D, area_get_shape_transform, RID, int) + EXBIND2(area_remove_shape, RID, int) EXBIND1(area_clear_shapes, RID) @@ -297,12 +300,11 @@ public: EXBIND4(body_add_shape, RID, RID, const Transform3D &, bool) EXBIND3(body_set_shape, RID, int, RID) EXBIND3(body_set_shape_transform, RID, int, const Transform3D &) + EXBIND3(body_set_shape_disabled, RID, int, bool) EXBIND1RC(int, body_get_shape_count, RID) - EXBIND2RC(Transform3D, body_get_shape_transform, RID, int) EXBIND2RC(RID, body_get_shape, RID, int) - - EXBIND3(body_set_shape_disabled, RID, int, bool) + EXBIND2RC(Transform3D, body_get_shape_transform, RID, int) EXBIND2(body_remove_shape, RID, int) EXBIND1(body_clear_shapes, RID) @@ -333,9 +335,9 @@ public: EXBIND3(body_set_state, RID, BodyState, const Variant &) EXBIND2RC(Variant, body_get_state, RID, BodyState) - EXBIND2(body_apply_torque_impulse, RID, const Vector3 &) EXBIND2(body_apply_central_impulse, RID, const Vector3 &) EXBIND3(body_apply_impulse, RID, const Vector3 &, const Vector3 &) + EXBIND2(body_apply_torque_impulse, RID, const Vector3 &) EXBIND2(body_apply_central_force, RID, const Vector3 &) EXBIND3(body_apply_force, RID, const Vector3 &, const Vector3 &) @@ -476,7 +478,6 @@ public: /* JOINT API */ EXBIND0R(RID, joint_create) - EXBIND1(joint_clear, RID) EXBIND5(joint_make_pin, RID, RID, const Vector3 &, RID, const Vector3 &) |