diff options
94 files changed, 405 insertions, 536 deletions
diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml index d75680b4b5..d41bfc009e 100644 --- a/.github/workflows/linux_builds.yml +++ b/.github/workflows/linux_builds.yml @@ -146,7 +146,7 @@ jobs: - name: Open and close editor if: ${{ matrix.proj-test }} run: | - VK_ICD_FILENAMES=$(pwd)/vk_swiftshader_icd.json DRI_PRIME=0 xvfb-run ${{ matrix.bin }} --audio-driver Dummy -e -q --path test_project 2>&1 | tee sanitizers_log.txt || true + VK_ICD_FILENAMES=$(pwd)/vk_swiftshader_icd.json DRI_PRIME=0 xvfb-run ${{ matrix.bin }} --audio-driver Dummy --editor --quit --path test_project 2>&1 | tee sanitizers_log.txt || true misc/scripts/check_ci_log.py sanitizers_log.txt # Run test project diff --git a/core/io/image.cpp b/core/io/image.cpp index 577fc59807..766c84bdbe 100644 --- a/core/io/image.cpp +++ b/core/io/image.cpp @@ -1465,8 +1465,8 @@ template <class Component, int CC, bool renormalize, void (*renormalize_func)(Component *)> static void _generate_po2_mipmap(const Component *p_src, Component *p_dst, uint32_t p_width, uint32_t p_height) { //fast power of 2 mipmap generation - uint32_t dst_w = MAX(p_width >> 1, 1); - uint32_t dst_h = MAX(p_height >> 1, 1); + uint32_t dst_w = MAX(p_width >> 1, 1u); + uint32_t dst_h = MAX(p_height >> 1, 1u); int right_step = (p_width == 1) ? 0 : CC; int down_step = (p_height == 1) ? 0 : (p_width * CC); diff --git a/core/os/thread.cpp b/core/os/thread.cpp index f80e8f4bb3..c8072b7280 100644 --- a/core/os/thread.cpp +++ b/core/os/thread.cpp @@ -28,6 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#include "platform_config.h" #ifndef PLATFORM_THREAD_OVERRIDE // See details in thread.h #include "thread.h" diff --git a/core/os/thread.h b/core/os/thread.h index f4e46059ad..3382dd81f9 100644 --- a/core/os/thread.h +++ b/core/os/thread.h @@ -28,6 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#include "platform_config.h" // Define PLATFORM_THREAD_OVERRIDE in your platform's `platform_config.h` // to use a custom Thread implementation defined in `platform/[your_platform]/platform_thread.h` // Overriding the platform implementation is required in some proprietary platforms diff --git a/core/templates/oa_hash_map.h b/core/templates/oa_hash_map.h index c91d27ebe1..4e712fccf2 100644 --- a/core/templates/oa_hash_map.h +++ b/core/templates/oa_hash_map.h @@ -145,7 +145,7 @@ private: uint32_t old_capacity = capacity; // Capacity can't be 0. - capacity = MAX(1, p_new_capacity); + capacity = MAX(1u, p_new_capacity); TKey *old_keys = keys; TValue *old_values = values; @@ -367,7 +367,7 @@ public: OAHashMap(uint32_t p_initial_capacity = 64) { // Capacity can't be 0. - capacity = MAX(1, p_initial_capacity); + capacity = MAX(1u, p_initial_capacity); keys = static_cast<TKey *>(Memory::alloc_static(sizeof(TKey) * capacity)); values = static_cast<TValue *>(Memory::alloc_static(sizeof(TValue) * capacity)); diff --git a/core/typedefs.h b/core/typedefs.h index 2c32d102da..510b39177c 100644 --- a/core/typedefs.h +++ b/core/typedefs.h @@ -89,34 +89,43 @@ #undef ERROR // override (really stupid) wingdi.h standard definition #undef DELETE // override (another really stupid) winnt.h standard definition #undef MessageBox // override winuser.h standard definition -#undef MIN // override standard definition -#undef MAX // override standard definition -#undef CLAMP // override standard definition #undef Error #undef OK #undef CONNECT_DEFERRED // override from Windows SDK, clashes with Object enum #endif +// Make room for our constexpr's below by overriding potential system-specific macros. +#undef ABS +#undef SIGN +#undef MIN +#undef MAX +#undef CLAMP + // Generic ABS function, for math uses please use Math::abs. -#ifndef ABS -#define ABS(m_v) (((m_v) < 0) ? (-(m_v)) : (m_v)) -#endif +template <typename T> +constexpr T ABS(T m_v) { + return m_v < 0 ? -m_v : m_v; +} -#ifndef SIGN -#define SIGN(m_v) (((m_v) == 0) ? (0.0f) : (((m_v) < 0) ? (-1.0f) : (+1.0f))) -#endif +template <typename T> +constexpr const T SIGN(const T m_v) { + return m_v == 0 ? 0.0f : (m_v < 0 ? -1.0f : +1.0f); +} -#ifndef MIN -#define MIN(m_a, m_b) (((m_a) < (m_b)) ? (m_a) : (m_b)) -#endif +template <typename T, typename T2> +constexpr auto MIN(const T m_a, const T2 m_b) { + return m_a < m_b ? m_a : m_b; +} -#ifndef MAX -#define MAX(m_a, m_b) (((m_a) > (m_b)) ? (m_a) : (m_b)) -#endif +template <typename T, typename T2> +constexpr auto MAX(const T m_a, const T2 m_b) { + return m_a > m_b ? m_a : m_b; +} -#ifndef CLAMP -#define CLAMP(m_a, m_min, m_max) (((m_a) < (m_min)) ? (m_min) : (((m_a) > (m_max)) ? m_max : m_a)) -#endif +template <typename T, typename T2, typename T3> +constexpr auto CLAMP(const T m_a, const T2 m_min, const T3 m_max) { + return m_a < m_min ? m_min : (m_a > m_max ? m_max : m_a); +} // Generic swap template. #ifndef SWAP diff --git a/doc/classes/AABB.xml b/doc/classes/AABB.xml index 6e4a4a2145..db880efaf2 100644 --- a/doc/classes/AABB.xml +++ b/doc/classes/AABB.xml @@ -228,11 +228,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="AABB" /> <description> Returns [code]true[/code] if the vectors are not equal. @@ -248,11 +243,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="AABB" /> <description> Returns [code]true[/code] if the AABBs are exactly equal. diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index 6852fb5228..68cb615209 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -511,11 +511,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="Array" /> <description> </description> @@ -540,11 +535,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="Array" /> <description> </description> diff --git a/doc/classes/Basis.xml b/doc/classes/Basis.xml index f31e962632..3b703884a5 100644 --- a/doc/classes/Basis.xml +++ b/doc/classes/Basis.xml @@ -225,11 +225,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="Basis" /> <description> Returns [code]true[/code] if the [Basis] matrices are not equal. @@ -266,11 +261,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="Basis" /> <description> Returns [code]true[/code] if the [Basis] matrices are exactly equal. diff --git a/doc/classes/BoxShape3D.xml b/doc/classes/BoxShape3D.xml index 154af1221f..c198dd3405 100644 --- a/doc/classes/BoxShape3D.xml +++ b/doc/classes/BoxShape3D.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="BoxShape3D" inherits="Shape3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Box shape resource. + Box shape resource for 3D collisions. </brief_description> <description> - 3D box shape that can be a child of a [PhysicsBody3D] or [Area3D]. + 3D box shape to be added as a [i]direct[/i] child of a [PhysicsBody3D] or [Area3D] using a [CollisionShape3D] node. + [b]Performance:[/b] Being a primitive collision shape, [BoxShape3D] is fast to check collisions against (though not as fast as [SphereShape3D]). </description> <tutorials> <link title="3D Physics Tests Demo">https://godotengine.org/asset-library/asset/675</link> diff --git a/doc/classes/Callable.xml b/doc/classes/Callable.xml index 7c7e37d0a5..efe3e3d091 100644 --- a/doc/classes/Callable.xml +++ b/doc/classes/Callable.xml @@ -150,11 +150,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="Callable" /> <description> Returns [code]true[/code] if both [Callable]s invoke different targets. @@ -162,11 +157,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="Callable" /> <description> Returns [code]true[/code] if both [Callable]s invoke the same custom target. diff --git a/doc/classes/Camera2D.xml b/doc/classes/Camera2D.xml index 3350735ca2..b9373676e2 100644 --- a/doc/classes/Camera2D.xml +++ b/doc/classes/Camera2D.xml @@ -157,7 +157,7 @@ Speed in pixels per second of the camera's smoothing effect when [member smoothing_enabled] is [code]true[/code]. </member> <member name="zoom" type="Vector2" setter="set_zoom" getter="get_zoom" default="Vector2(1, 1)"> - The camera's zoom relative to the viewport. Values larger than [code]Vector2(1, 1)[/code] zoom out and smaller values zoom in. For an example, use [code]Vector2(0.5, 0.5)[/code] for a 2× zoom-in, and [code]Vector2(4, 4)[/code] for a 4× zoom-out. + The camera's zoom. A zoom of [code]Vector(2, 2)[/code] doubles the size seen in the viewport. A zoom of [code]Vector(0.5, 0.5)[/code] halves the size seen in the viewport. </member> </members> <constants> diff --git a/doc/classes/CapsuleShape2D.xml b/doc/classes/CapsuleShape2D.xml index ae8e1ca001..2236d8035f 100644 --- a/doc/classes/CapsuleShape2D.xml +++ b/doc/classes/CapsuleShape2D.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="CapsuleShape2D" inherits="Shape2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Capsule shape for 2D collisions. + Capsule shape resource for 2D physics. </brief_description> <description> - Capsule shape for 2D collisions. + 2D capsule shape to be added as a [i]direct[/i] child of a [PhysicsBody2D] or [Area2D] using a [CollisionShape2D] node. In 2D, a capsule is a rectangle shape with half-circles at both ends. + [b]Performance:[/b] Being a primitive collision shape, [CapsuleShape2D] is fast to check collisions against (though not as fast as [CircleShape2D]). </description> <tutorials> </tutorials> diff --git a/doc/classes/CapsuleShape3D.xml b/doc/classes/CapsuleShape3D.xml index 5f15aaafad..cdcfab76ce 100644 --- a/doc/classes/CapsuleShape3D.xml +++ b/doc/classes/CapsuleShape3D.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="CapsuleShape3D" inherits="Shape3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Capsule shape for collisions. + Capsule shape resource for 3D collisions. </brief_description> <description> - Capsule shape for collisions. + 3D capsule shape to be added as a [i]direct[/i] child of a [PhysicsBody3D] or [Area3D] using a [CollisionShape3D] node. In 3D, a capsule is a cylinder shape with hemispheres at both ends. + [b]Performance:[/b] Being a primitive collision shape, [CapsuleShape3D] is fast to check collisions against (though not as fast as [SphereShape3D]). [CapsuleShape3D] is cheaper to check collisions against compared to [CylinderShape3D]. </description> <tutorials> <link title="3D Physics Tests Demo">https://godotengine.org/asset-library/asset/675</link> diff --git a/doc/classes/CircleShape2D.xml b/doc/classes/CircleShape2D.xml index b0336086dc..6f4989daa3 100644 --- a/doc/classes/CircleShape2D.xml +++ b/doc/classes/CircleShape2D.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="CircleShape2D" inherits="Shape2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Circular shape for 2D collisions. + Circular shape resource for 2D physics. </brief_description> <description> - Circular shape for 2D collisions. This shape is useful for modeling balls or small characters and its collision detection with everything else is very fast. + 2D circular shape to be added as a [i]direct[/i] child of a [PhysicsBody2D] or [Area2D] using a [CollisionShape2D] node. This shape is useful for modeling balls or small characters and its collision detection with everything else is very fast. + [b]Performance:[/b] Being a primitive collision shape, [CircleShape2D] is the fastest collision shape to check collisions against, as it only requires a distance check with the shape's origin. </description> <tutorials> </tutorials> diff --git a/doc/classes/CollisionPolygon2D.xml b/doc/classes/CollisionPolygon2D.xml index 48fd7c19dc..a9d8a85226 100644 --- a/doc/classes/CollisionPolygon2D.xml +++ b/doc/classes/CollisionPolygon2D.xml @@ -4,7 +4,8 @@ Defines a 2D collision polygon. </brief_description> <description> - Provides a 2D collision polygon to a [CollisionObject2D] parent. Polygons can be drawn in the editor or specified by a list of vertices. + Provides a concave or convex 2D collision polygon to a [CollisionObject2D] parent. Polygons can be drawn in the editor or specified by a list of vertices. See also [ConvexPolygonShape2D]. + In the editor, a [CollisionPolygon2D] can be generated from a [Sprite2D]'s outline by selecting a [Sprite2D] node, going to the [b]Sprite2D[/b] menu at the top of the 2D editor viewport then choosing [b]Create CollisionPolygon2D Sibling[/b]. </description> <tutorials> </tutorials> diff --git a/doc/classes/CollisionPolygon3D.xml b/doc/classes/CollisionPolygon3D.xml index c8c3752254..7d718cff27 100644 --- a/doc/classes/CollisionPolygon3D.xml +++ b/doc/classes/CollisionPolygon3D.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="CollisionPolygon3D" inherits="Node3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Editor-only class for defining a collision polygon in 3D space. + Editor-only node for defining a collision polygon in 3D space. </brief_description> <description> - Allows editing a collision polygon's vertices on a selected plane. Can also set a depth perpendicular to that plane. This class is only available in the editor. It will not appear in the scene tree at run-time. Creates a [Shape3D] for gameplay. Properties modified during gameplay will have no effect. + Allows editing a concave or convex collision polygon's vertices on a selected plane. Can also set a depth perpendicular to that plane. This class is only available in the editor. It will not appear in the scene tree at run-time. Creates several [ConvexPolygonShape3D]s at run-time to represent the original polygon using convex decomposition. + [b]Note:[/b] Since this is an editor-only helper, properties modified during gameplay will have no effect. </description> <tutorials> </tutorials> diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index bc0baf42c9..7083157081 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -915,11 +915,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="Color" /> <description> Returns [code]true[/code] if the colors are not equal. @@ -984,11 +979,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="Color" /> <description> Returns [code]true[/code] if the colors are exactly equal. diff --git a/doc/classes/ConcavePolygonShape2D.xml b/doc/classes/ConcavePolygonShape2D.xml index 924178f9bf..f3c245c229 100644 --- a/doc/classes/ConcavePolygonShape2D.xml +++ b/doc/classes/ConcavePolygonShape2D.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ConcavePolygonShape2D" inherits="Shape2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Concave polygon 2D shape resource for physics. + Concave polygon shape resource for 2D physics. </brief_description> <description> - Concave polygon 2D shape resource for physics. It is made out of segments and is optimal for complex polygonal concave collisions. However, it is not advised to use for [RigidDynamicBody2D] nodes. A CollisionPolygon2D in convex decomposition mode (solids) or several convex objects are advised for that instead. Otherwise, a concave polygon 2D shape is better for static collisions. - The main difference between a [ConvexPolygonShape2D] and a [ConcavePolygonShape2D] is that a concave polygon assumes it is concave and uses a more complex method of collision detection, and a convex one forces itself to be convex in order to speed up collision detection. + 2D concave polygon shape to be added as a [i]direct[/i] child of a [PhysicsBody2D] or [Area2D] using a [CollisionShape2D] node. It is made out of segments and is optimal for complex polygonal concave collisions. However, it is not advised to use for [RigidDynamicBody2D] nodes. A CollisionPolygon2D in convex decomposition mode (solids) or several convex objects are advised for that instead. Otherwise, a concave polygon 2D shape is better for static collisions. + The main difference between a [ConvexPolygonShape2D] and a [ConcavePolygonShape2D] is that a concave polygon assumes it is concave and uses a more complex method of collision detection, and a convex one forces itself to be convex to speed up collision detection. + [b]Performance:[/b] Due to its complexity, [ConcavePolygonShape2D] is the slowest collision shape to check collisions against. Its use should generally be limited to level geometry. For convex geometry, using [ConvexPolygonShape2D] will perform better. For dynamic physics bodies that need concave collision, several [ConvexPolygonShape2D]s can be used to represent its collision by using convex decomposition; see [ConvexPolygonShape2D]'s documentation for instructions. However, consider using primitive collision shapes such as [CircleShape2D] or [RectangleShape2D] first. </description> <tutorials> </tutorials> diff --git a/doc/classes/ConcavePolygonShape3D.xml b/doc/classes/ConcavePolygonShape3D.xml index 4e67f91db8..60d7e32492 100644 --- a/doc/classes/ConcavePolygonShape3D.xml +++ b/doc/classes/ConcavePolygonShape3D.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ConcavePolygonShape3D" inherits="Shape3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Concave polygon shape. + Concave polygon shape resource (also called "trimesh") for 3D physics. </brief_description> <description> - Concave polygon shape resource, which can be set into a [PhysicsBody3D] or area. This shape is created by feeding a list of triangles. + 3D concave polygon shape resource (also called "trimesh") to be added as a [i]direct[/i] child of a [PhysicsBody3D] or [Area3D] using a [CollisionShape3D] node. This shape is created by feeding a list of triangles. Despite its name, [ConcavePolygonShape3D] can also store convex polygon shapes. However, unlike [ConvexPolygonShape3D], [ConcavePolygonShape3D] is [i]not[/i] limited to storing convex shapes exclusively. [b]Note:[/b] When used for collision, [ConcavePolygonShape3D] is intended to work with static [PhysicsBody3D] nodes like [StaticBody3D] and will not work with [CharacterBody3D] or [RigidDynamicBody3D] with a mode other than Static. + [b]Performance:[/b] Due to its complexity, [ConcavePolygonShape3D] is the slowest collision shape to check collisions against. Its use should generally be limited to level geometry. For convex geometry, using [ConvexPolygonShape3D] will perform better. For dynamic physics bodies that need concave collision, several [ConvexPolygonShape3D]s can be used to represent its collision by using convex decomposition; see [ConvexPolygonShape3D]'s documentation for instructions. However, consider using primitive collision shapes such as [SphereShape3D] or [BoxShape3D] first. </description> <tutorials> <link title="3D Physics Tests Demo">https://godotengine.org/asset-library/asset/675</link> diff --git a/doc/classes/ConvexPolygonShape2D.xml b/doc/classes/ConvexPolygonShape2D.xml index 449c3132c7..df96b50fc1 100644 --- a/doc/classes/ConvexPolygonShape2D.xml +++ b/doc/classes/ConvexPolygonShape2D.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ConvexPolygonShape2D" inherits="Shape2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Convex polygon shape for 2D physics. + Convex polygon shape resource for 2D physics. </brief_description> <description> - Convex polygon shape for 2D physics. A convex polygon, whatever its shape, is internally decomposed into as many convex polygons as needed to ensure all collision checks against it are always done on convex polygons (which are faster to check). - The main difference between a [ConvexPolygonShape2D] and a [ConcavePolygonShape2D] is that a concave polygon assumes it is concave and uses a more complex method of collision detection, and a convex one forces itself to be convex in order to speed up collision detection. + 2D convex polygon shape to be added as a [i]direct[/i] child of a [PhysicsBody2D] or [Area2D] using a [CollisionShape2D] node. A convex polygon, whatever its shape, is internally decomposed into as many convex polygons as needed to ensure all collision checks against it are always done on convex polygons (which are faster to check). See also [CollisionPolygon2D]. + The main difference between a [ConvexPolygonShape2D] and a [ConcavePolygonShape2D] is that a concave polygon assumes it is concave and uses a more complex method of collision detection, and a convex one forces itself to be convex to speed up collision detection. + [b]Performance:[/b] [ConvexPolygonShape2D] is faster to check collisions against compared to [ConcavePolygonShape2D], but it is slower than primitive collision shapes such as [CircleShape2D] or [RectangleShape2D]. Its use should generally be limited to medium-sized objects that cannot have their collision accurately represented by a primitive shape. </description> <tutorials> </tutorials> diff --git a/doc/classes/ConvexPolygonShape3D.xml b/doc/classes/ConvexPolygonShape3D.xml index d2f110d187..32dc8f673b 100644 --- a/doc/classes/ConvexPolygonShape3D.xml +++ b/doc/classes/ConvexPolygonShape3D.xml @@ -1,10 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ConvexPolygonShape3D" inherits="Shape3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Convex polygon shape for 3D physics. + Convex polygon shape resource for 3D physics. </brief_description> <description> - Convex polygon shape resource, which can be added to a [PhysicsBody3D] or area. + 3D convex polygon shape resource to be added as a [i]direct[/i] child of a [PhysicsBody3D] or [Area3D] using a [CollisionShape3D] node. Unlike [ConcavePolygonShape3D], [ConvexPolygonShape3D] cannot store concave polygon shapes. [ConvexPolygonShape2D]s can be manually drawn in the editor using the [CollisionPolygon3D] node. + [b]Convex decomposition:[/b] Concave objects' collisions can be represented accurately using [i]several[/i] [ConvexPolygonShape3D]s. This allows dynamic physics bodies to have complex concave collisions (at a performance cost). This is available in the editor by selecting the [MeshInstance3D], going to the [b]Mesh[/b] menu and choosing [b]Create Multiple Convex Collision Siblings[/b]. Alternatively, [method MeshInstance3D.create_multiple_convex_collisions] can be called in a script to perform this decomposition at run-time. + [b]Performance:[/b] [ConvexPolygonShape3D] is faster to check collisions against compared to [ConcavePolygonShape3D], but it is slower than primitive collision shapes such as [SphereShape3D] or [BoxShape3D]. Its use should generally be limited to medium-sized objects that cannot have their collision accurately represented by a primitive shape. </description> <tutorials> <link title="3D Physics Tests Demo">https://godotengine.org/asset-library/asset/675</link> diff --git a/doc/classes/CylinderShape3D.xml b/doc/classes/CylinderShape3D.xml index 06ad590bb3..6ff142da59 100644 --- a/doc/classes/CylinderShape3D.xml +++ b/doc/classes/CylinderShape3D.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="CylinderShape3D" inherits="Shape3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Cylinder shape for collisions. + Cylinder shape for 3D collisions. </brief_description> <description> - Cylinder shape for collisions. + Cylinder shape for collisions. Like [CapsuleShape3D], but without hemispheres at the cylinder's ends. + [b]Performance:[/b] Being a primitive collision shape, [CylinderShape3D] is fast to check collisions against (though not as fast as [SphereShape3D]). [CylinderShape3D] is also more demanding compared to [CapsuleShape3D]. </description> <tutorials> <link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link> diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml index ab04366eb7..8ee09ba8f8 100644 --- a/doc/classes/Dictionary.xml +++ b/doc/classes/Dictionary.xml @@ -307,22 +307,12 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="Dictionary" /> <description> </description> </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="Dictionary" /> <description> </description> diff --git a/doc/classes/HeightMapShape3D.xml b/doc/classes/HeightMapShape3D.xml index b8fe094490..206981e547 100644 --- a/doc/classes/HeightMapShape3D.xml +++ b/doc/classes/HeightMapShape3D.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="HeightMapShape3D" inherits="Shape3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Height map shape for 3D physics. + Height map shape resource for 3D physics. </brief_description> <description> - Height map shape resource, which can be added to a [PhysicsBody3D] or [Area3D]. + Height map shape resource, which can be added to a [PhysicsBody3D] or [Area3D]. Heightmap collision is typically used for colliding with terrains. However, since heightmaps cannot store overhangs, collisions with other structures (such as buildings) must be done with other collision shapes such as [ConcavePolygonShape3D]. If needed, "holes" can be created in an [HeightMapShape3D] by assigning very low points (like [code]-100000[/code]) in the desired area. + [b]Performance:[/b] [HeightMapShape3D] is faster to check collisions against compared to [ConcavePolygonShape3D], but it is slower than primitive collision shapes such as [SphereShape3D] or [BoxShape3D]. </description> <tutorials> </tutorials> diff --git a/doc/classes/NodePath.xml b/doc/classes/NodePath.xml index 3d3e139781..3319e5d822 100644 --- a/doc/classes/NodePath.xml +++ b/doc/classes/NodePath.xml @@ -5,21 +5,22 @@ </brief_description> <description> A pre-parsed relative or absolute path in a scene tree, for use with [method Node.get_node] and similar functions. It can reference a node, a resource within a node, or a property of a node or resource. For instance, [code]"Path2D/PathFollow2D/Sprite2D:texture:size"[/code] would refer to the [code]size[/code] property of the [code]texture[/code] resource on the node named [code]"Sprite2D"[/code] which is a child of the other named nodes in the path. - You will usually just pass a string to [method Node.get_node] and it will be automatically converted, but you may occasionally want to parse a path ahead of time with [NodePath] or the literal syntax [code]@"path"[/code]. Exporting a [NodePath] variable will give you a node selection widget in the properties panel of the editor, which can often be useful. + You will usually just pass a string to [method Node.get_node] and it will be automatically converted, but you may occasionally want to parse a path ahead of time with [NodePath] or the literal syntax [code]^"path"[/code]. Exporting a [NodePath] variable will give you a node selection widget in the properties panel of the editor, which can often be useful. A [NodePath] is composed of a list of slash-separated node names (like a filesystem path) and an optional colon-separated list of "subnames" which can be resources or properties. Some examples of NodePaths include the following: [codeblock] # No leading slash means it is relative to the current node. - @"A" # Immediate child A - @"A/B" # A's child B - @"." # The current node. - @".." # The parent node. - @"../C" # A sibling node C. + ^"A" # Immediate child A + ^"A/B" # A's child B + ^"." # The current node. + ^".." # The parent node. + ^"../C" # A sibling node C. # 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". - @"/root/MyAutoload" # If you have an autoloaded node or scene. + ^"/root" # Equivalent to get_tree().get_root(). + ^"/root/Main" # If your main scene's root node were named "Main". + ^"/root/MyAutoload" # If you have an autoloaded node or scene. [/codeblock] + See also [StringName], which is a similar concept for general-purpose string interning. [b]Note:[/b] In the editor, [NodePath] properties are automatically updated when moving, renaming or deleting a node in the scene tree, but they are never updated at runtime. </description> <tutorials> @@ -36,7 +37,7 @@ <return type="NodePath" /> <argument index="0" name="from" type="NodePath" /> <description> - Constructs a [NodePath] as a copy of the given [NodePath]. + Constructs a [NodePath] as a copy of the given [NodePath]. [code]NodePath("example")[/code] is equivalent to [code]^"example"[/code]. </description> </constructor> <constructor name="NodePath"> @@ -172,22 +173,12 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="NodePath" /> <description> </description> </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="NodePath" /> <description> </description> diff --git a/doc/classes/PackedByteArray.xml b/doc/classes/PackedByteArray.xml index be51b1dcf8..a0e67bfa63 100644 --- a/doc/classes/PackedByteArray.xml +++ b/doc/classes/PackedByteArray.xml @@ -418,11 +418,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="PackedByteArray" /> <description> </description> @@ -435,11 +430,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="PackedByteArray" /> <description> </description> diff --git a/doc/classes/PackedColorArray.xml b/doc/classes/PackedColorArray.xml index f98c5c37e4..d1a00b32b1 100644 --- a/doc/classes/PackedColorArray.xml +++ b/doc/classes/PackedColorArray.xml @@ -154,11 +154,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="PackedColorArray" /> <description> </description> @@ -171,11 +166,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="PackedColorArray" /> <description> </description> diff --git a/doc/classes/PackedFloat32Array.xml b/doc/classes/PackedFloat32Array.xml index 393af5f6c4..b351058346 100644 --- a/doc/classes/PackedFloat32Array.xml +++ b/doc/classes/PackedFloat32Array.xml @@ -157,11 +157,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="PackedFloat32Array" /> <description> </description> @@ -174,11 +169,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="PackedFloat32Array" /> <description> </description> diff --git a/doc/classes/PackedFloat64Array.xml b/doc/classes/PackedFloat64Array.xml index 5a80d7b2e9..b4ffa295bd 100644 --- a/doc/classes/PackedFloat64Array.xml +++ b/doc/classes/PackedFloat64Array.xml @@ -157,11 +157,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="PackedFloat64Array" /> <description> </description> @@ -174,11 +169,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="PackedFloat64Array" /> <description> </description> diff --git a/doc/classes/PackedInt32Array.xml b/doc/classes/PackedInt32Array.xml index 17085a9626..b34deb518a 100644 --- a/doc/classes/PackedInt32Array.xml +++ b/doc/classes/PackedInt32Array.xml @@ -157,11 +157,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="PackedInt32Array" /> <description> </description> @@ -174,11 +169,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="PackedInt32Array" /> <description> </description> diff --git a/doc/classes/PackedInt64Array.xml b/doc/classes/PackedInt64Array.xml index 066bc05f54..6a99db778c 100644 --- a/doc/classes/PackedInt64Array.xml +++ b/doc/classes/PackedInt64Array.xml @@ -157,11 +157,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="PackedInt64Array" /> <description> </description> @@ -174,11 +169,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="PackedInt64Array" /> <description> </description> diff --git a/doc/classes/PackedStringArray.xml b/doc/classes/PackedStringArray.xml index 3cf43ecb28..29c72f62de 100644 --- a/doc/classes/PackedStringArray.xml +++ b/doc/classes/PackedStringArray.xml @@ -155,11 +155,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="PackedStringArray" /> <description> </description> @@ -172,11 +167,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="PackedStringArray" /> <description> </description> diff --git a/doc/classes/PackedVector2Array.xml b/doc/classes/PackedVector2Array.xml index 9abc366702..cd78f29595 100644 --- a/doc/classes/PackedVector2Array.xml +++ b/doc/classes/PackedVector2Array.xml @@ -155,11 +155,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="PackedVector2Array" /> <description> </description> @@ -178,11 +173,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="PackedVector2Array" /> <description> </description> diff --git a/doc/classes/PackedVector3Array.xml b/doc/classes/PackedVector3Array.xml index ff9fc6a757..9ae4073fdf 100644 --- a/doc/classes/PackedVector3Array.xml +++ b/doc/classes/PackedVector3Array.xml @@ -154,11 +154,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="PackedVector3Array" /> <description> </description> @@ -177,11 +172,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="PackedVector3Array" /> <description> </description> diff --git a/doc/classes/Plane.xml b/doc/classes/Plane.xml index f037b0bf1e..a42ceba777 100644 --- a/doc/classes/Plane.xml +++ b/doc/classes/Plane.xml @@ -173,11 +173,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="Plane" /> <description> Returns [code]true[/code] if the planes are not equal. @@ -186,11 +181,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="Plane" /> <description> Returns [code]true[/code] if the planes are exactly equal. diff --git a/doc/classes/Quaternion.xml b/doc/classes/Quaternion.xml index c94b649b58..8a440d9024 100644 --- a/doc/classes/Quaternion.xml +++ b/doc/classes/Quaternion.xml @@ -188,11 +188,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="Quaternion" /> <description> Returns [code]true[/code] if the quaternions are not equal. @@ -257,11 +252,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="Quaternion" /> <description> Returns [code]true[/code] if the quaternions are exactly equal. diff --git a/doc/classes/RID.xml b/doc/classes/RID.xml index 6888c1f56c..39be605e1b 100644 --- a/doc/classes/RID.xml +++ b/doc/classes/RID.xml @@ -40,11 +40,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="RID" /> <description> </description> @@ -63,11 +58,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="RID" /> <description> </description> diff --git a/doc/classes/Range.xml b/doc/classes/Range.xml index c150198eb1..8f23c54a2a 100644 --- a/doc/classes/Range.xml +++ b/doc/classes/Range.xml @@ -13,19 +13,20 @@ <return type="void" /> <argument index="0" name="" type="float" /> <description> + Called when the [Range]'s value is changed (following the same conditions as [signal value_changed]). </description> </method> <method name="share"> <return type="void" /> <argument index="0" name="with" type="Node" /> <description> - Binds two ranges together along with any ranges previously grouped with either of them. When any of range's member variables change, it will share the new value with all other ranges in its group. + Binds two [Range]s together along with any ranges previously grouped with either of them. When any of range's member variables change, it will share the new value with all other ranges in its group. </description> </method> <method name="unshare"> <return type="void" /> <description> - Stops range from sharing its member variables with any other. + Stops the [Range] from sharing its member variables with any other. </description> </method> </methods> @@ -70,7 +71,8 @@ <signal name="value_changed"> <argument index="0" name="value" type="float" /> <description> - Emitted when [member value] changes. + Emitted when [member value] changes. When used on a [Slider], this is called continuously while dragging (potentially every frame). If you are performing an expensive operation in a function connected to [signal value_changed], consider using a [i]debouncing[/i] [Timer] to call the function less often. + [b]Note:[/b] Unlike signals such as [signal LineEdit.text_changed], [signal value_changed] is also emitted when [code]value[/code] is set directly via code. </description> </signal> </signals> diff --git a/doc/classes/Rect2.xml b/doc/classes/Rect2.xml index a975382bfa..e4b66a9d53 100644 --- a/doc/classes/Rect2.xml +++ b/doc/classes/Rect2.xml @@ -189,11 +189,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="Rect2" /> <description> Returns [code]true[/code] if the rectangles are not equal. @@ -209,11 +204,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="Rect2" /> <description> Returns [code]true[/code] if the rectangles are exactly equal. diff --git a/doc/classes/Rect2i.xml b/doc/classes/Rect2i.xml index 49fdd8e7e8..c9ae685a15 100644 --- a/doc/classes/Rect2i.xml +++ b/doc/classes/Rect2i.xml @@ -178,11 +178,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="Rect2i" /> <description> Returns [code]true[/code] if the rectangles are not equal. @@ -190,11 +185,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="Rect2i" /> <description> Returns [code]true[/code] if the rectangles are equal. diff --git a/doc/classes/RectangleShape2D.xml b/doc/classes/RectangleShape2D.xml index cc3da8a789..124d752ae0 100644 --- a/doc/classes/RectangleShape2D.xml +++ b/doc/classes/RectangleShape2D.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RectangleShape2D" inherits="Shape2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Rectangle shape for 2D collisions. + Rectangle shape resource for 2D physics. </brief_description> <description> - Rectangle shape for 2D collisions. This shape is useful for modeling box-like 2D objects. + 2D rectangle shape to be added as a [i]direct[/i] child of a [PhysicsBody2D] or [Area2D] using a [CollisionShape2D] node. This shape is useful for modeling box-like 2D objects. + [b]Performance:[/b] Being a primitive collision shape, [RectangleShape2D] is fast to check collisions against (though not as fast as [CircleShape2D]). </description> <tutorials> <link title="2D Pong Demo">https://godotengine.org/asset-library/asset/121</link> diff --git a/doc/classes/SegmentShape2D.xml b/doc/classes/SegmentShape2D.xml index 8109886262..a1809301e5 100644 --- a/doc/classes/SegmentShape2D.xml +++ b/doc/classes/SegmentShape2D.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="SegmentShape2D" inherits="Shape2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Segment shape for 2D collisions. + Segment shape resource for 2D physics. </brief_description> <description> - Segment shape for 2D collisions. Consists of two points, [code]a[/code] and [code]b[/code]. + 2D segment shape to be added as a [i]direct[/i] child of a [PhysicsBody2D] or [Area2D] using a [CollisionShape2D] node. Consists of two points, [code]a[/code] and [code]b[/code]. + [b]Performance:[/b] Being a primitive collision shape, [SegmentShape2D] is fast to check collisions against (though not as fast as [CircleShape2D]). </description> <tutorials> </tutorials> diff --git a/doc/classes/SeparationRayShape2D.xml b/doc/classes/SeparationRayShape2D.xml index 3e7a2857bf..d67c7b4cd9 100644 --- a/doc/classes/SeparationRayShape2D.xml +++ b/doc/classes/SeparationRayShape2D.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="SeparationRayShape2D" inherits="Shape2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Separation ray shape for 2D collisions. + Separation ray shape resource for 2D physics. </brief_description> <description> - Separation ray shape for 2D collisions. A ray is not really a collision body; instead, it tries to separate itself from whatever is touching its far endpoint. It's often useful for characters. + 2D separation ray shape to be added as a [i]direct[/i] child of a [PhysicsBody2D] or [Area2D] using a [CollisionShape2D] node. A ray is not really a collision body; instead, it tries to separate itself from whatever is touching its far endpoint. It's often useful for characters. + [b]Performance:[/b] Being a primitive collision shape, [SeparationRayShape2D] is fast to check collisions against. </description> <tutorials> </tutorials> diff --git a/doc/classes/SeparationRayShape3D.xml b/doc/classes/SeparationRayShape3D.xml index 028c3ba511..0fb4a07457 100644 --- a/doc/classes/SeparationRayShape3D.xml +++ b/doc/classes/SeparationRayShape3D.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="SeparationRayShape3D" inherits="Shape3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Separation ray shape for 3D collisions. + Separation ray shape resource for 3D physics. </brief_description> <description> - Separation ray shape for 3D collisions, which can be set into a [PhysicsBody3D] or [Area3D]. A ray is not really a collision body; instead, it tries to separate itself from whatever is touching its far endpoint. It's often useful for characters. + 3D separation ray shape to be added as a [i]direct[/i] child of a [PhysicsBody3D] or [Area3D] using a [CollisionShape3D] node. A ray is not really a collision body; instead, it tries to separate itself from whatever is touching its far endpoint. It's often useful for characters. + [b]Performance:[/b] Being a primitive collision shape, [SeparationRayShape3D] is fast to check collisions against. </description> <tutorials> </tutorials> diff --git a/doc/classes/Signal.xml b/doc/classes/Signal.xml index 1b67900607..c5855e30a4 100644 --- a/doc/classes/Signal.xml +++ b/doc/classes/Signal.xml @@ -99,22 +99,12 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="Signal" /> <description> </description> </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="Signal" /> <description> </description> diff --git a/doc/classes/SphereShape3D.xml b/doc/classes/SphereShape3D.xml index b5e9c9069b..63084f024e 100644 --- a/doc/classes/SphereShape3D.xml +++ b/doc/classes/SphereShape3D.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="SphereShape3D" inherits="Shape3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Sphere shape for 3D collisions. + Sphere shape resource for 3D collisions. </brief_description> <description> - Sphere shape for 3D collisions, which can be set into a [PhysicsBody3D] or [Area3D]. This shape is useful for modeling sphere-like 3D objects. + 3D sphere shape to be added as a [i]direct[/i] child of a [PhysicsBody3D] or [Area3D] using a [CollisionShape3D] node. This shape is useful for modeling sphere-like 3D objects. + [b]Performance:[/b] Being a primitive collision shape, [SphereShape3D] is the fastest collision shape to check collisions against, as it only requires a distance check with the shape's origin. </description> <tutorials> <link title="3D Physics Tests Demo">https://godotengine.org/asset-library/asset/675</link> diff --git a/doc/classes/String.xml b/doc/classes/String.xml index d85e521f08..ea0bd2adb1 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -865,11 +865,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="String" /> <description> </description> @@ -906,11 +901,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="String" /> <description> </description> diff --git a/doc/classes/StringName.xml b/doc/classes/StringName.xml index c19fce9944..ffa1227500 100644 --- a/doc/classes/StringName.xml +++ b/doc/classes/StringName.xml @@ -4,7 +4,9 @@ An optimized string type for unique names. </brief_description> <description> - [StringName]s are immutable strings designed for general-purpose representation of unique names. [StringName] ensures that only one instance of a given name exists (so two [StringName]s with the same value are the same object). Comparing them is much faster than with regular [String]s, because only the pointers are compared, not the whole strings. + [StringName]s are immutable strings designed for general-purpose representation of unique names (also called "string interning"). [StringName] ensures that only one instance of a given name exists (so two [StringName]s with the same value are the same object). Comparing them is much faster than with regular [String]s, because only the pointers are compared, not the whole strings. + You will usually just pass a [String] to methods expecting a [StringName] and it will be automatically converted, but you may occasionally want to construct a [StringName] ahead of time with [StringName] or the literal syntax [code]&"example"[/code]. + See also [NodePath], which is a similar concept specifically designed to store pre-parsed node paths. </description> <tutorials> </tutorials> @@ -26,18 +28,13 @@ <return type="StringName" /> <argument index="0" name="from" type="String" /> <description> - Creates a new [StringName] from the given [String]. + Creates a new [StringName] from the given [String]. [code]StringName("example")[/code] is equivalent to [code]&"example"[/code]. </description> </constructor> </constructors> <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="String" /> <description> </description> @@ -62,11 +59,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="String" /> <description> </description> diff --git a/doc/classes/Transform2D.xml b/doc/classes/Transform2D.xml index 6c0c3032ec..3ad21ee809 100644 --- a/doc/classes/Transform2D.xml +++ b/doc/classes/Transform2D.xml @@ -206,11 +206,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="Transform2D" /> <description> Returns [code]true[/code] if the transforms are not equal. @@ -261,11 +256,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="Transform2D" /> <description> Returns [code]true[/code] if the transforms are exactly equal. diff --git a/doc/classes/Transform3D.xml b/doc/classes/Transform3D.xml index 67e70f30e4..5a72dc223c 100644 --- a/doc/classes/Transform3D.xml +++ b/doc/classes/Transform3D.xml @@ -148,11 +148,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="Transform3D" /> <description> Returns [code]true[/code] if the transforms are not equal. @@ -203,11 +198,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="Transform3D" /> <description> Returns [code]true[/code] if the transforms are exactly equal. diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index a39ddb8187..f9ef126658 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -359,11 +359,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="Vector2" /> <description> Returns [code]true[/code] if the vectors are not equal. @@ -461,11 +456,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="Vector2" /> <description> Returns [code]true[/code] if the vectors are exactly equal. diff --git a/doc/classes/Vector2i.xml b/doc/classes/Vector2i.xml index 9b41e01c25..28d68b6e44 100644 --- a/doc/classes/Vector2i.xml +++ b/doc/classes/Vector2i.xml @@ -133,11 +133,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="Vector2i" /> <description> Returns [code]true[/code] if the vectors are not equal. @@ -253,11 +248,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="Vector2i" /> <description> Returns [code]true[/code] if the vectors are equal. diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml index ec695f41c1..1653b66003 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -360,11 +360,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="Vector3" /> <description> Returns [code]true[/code] if the vectors are not equal. @@ -476,11 +471,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="Vector3" /> <description> Returns [code]true[/code] if the vectors are exactly equal. diff --git a/doc/classes/Vector3i.xml b/doc/classes/Vector3i.xml index e486d7cfec..4c7f3badc5 100644 --- a/doc/classes/Vector3i.xml +++ b/doc/classes/Vector3i.xml @@ -140,11 +140,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="Vector3i" /> <description> Returns [code]true[/code] if the vectors are not equal. @@ -260,11 +255,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="Vector3i" /> <description> Returns [code]true[/code] if the vectors are equal. diff --git a/doc/classes/WorldBoundaryShape2D.xml b/doc/classes/WorldBoundaryShape2D.xml index cfcaede4a6..5a655520c3 100644 --- a/doc/classes/WorldBoundaryShape2D.xml +++ b/doc/classes/WorldBoundaryShape2D.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="WorldBoundaryShape2D" inherits="Shape2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - World boundary shape for 2D collisions. + World boundary (infinite plane) shape resource for 2D physics. </brief_description> <description> - World boundary shape for 2D collisions. It works like a 2D plane and will not allow any physics body to go to the negative side. Not recommended for rigid bodies, and usually not recommended for static bodies either because it forces checks against it on every frame. + 2D world boundary shape to be added as a [i]direct[/i] child of a [PhysicsBody2D] or [Area2D] using a [CollisionShape2D] node. [WorldBoundaryShape2D] works like an infinite plane and will not allow any physics body to go to the negative side. Note that the [member normal] matters; anything "below" the plane will collide with it. If the [WorldBoundaryShape2D] is used in a [PhysicsBody2D], it will cause colliding objects placed "below" it to teleport "above" the plane. + [b]Performance:[/b] Being a primitive collision shape, [WorldBoundaryShape2D] is fast to check collisions against. </description> <tutorials> </tutorials> diff --git a/doc/classes/WorldBoundaryShape3D.xml b/doc/classes/WorldBoundaryShape3D.xml index a05c404125..4f6b987a8e 100644 --- a/doc/classes/WorldBoundaryShape3D.xml +++ b/doc/classes/WorldBoundaryShape3D.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="WorldBoundaryShape3D" inherits="Shape3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - World boundary shape for 3D collisions. + World boundary (infinite plane) shape resource for 3D physics. </brief_description> <description> - World boundary shape for 3D collisions. It works like an infinite plane and will not allow any physics body to go to the negative side. Note that the [Plane]'s normal matters; anything "below" the plane will collide with it. If the [WorldBoundaryShape3D] is used in a [PhysicsBody3D], it will cause colliding objects placed "below" it to teleport "above" the plane. + 3D world boundary shape to be added as a [i]direct[/i] child of a [PhysicsBody3D] or [Area3D] using a [CollisionShape3D] node. [WorldBoundaryShape3D] works like an infinite plane and will not allow any physics body to go to the negative side. Note that the [Plane]'s normal matters; anything "below" the plane will collide with it. If the [WorldBoundaryShape3D] is used in a [PhysicsBody3D], it will cause colliding objects placed "below" it to teleport "above" the plane. + [b]Performance:[/b] Being a primitive collision shape, [WorldBoundaryShape3D] is fast to check collisions against. </description> <tutorials> </tutorials> diff --git a/doc/classes/bool.xml b/doc/classes/bool.xml index 6b1243b8c0..374b703636 100644 --- a/doc/classes/bool.xml +++ b/doc/classes/bool.xml @@ -123,11 +123,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="bool" /> <description> Returns [code]true[/code] if two bools are different, i.e. one is [code]true[/code] and the other is [code]false[/code]. @@ -142,12 +137,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - Returns [code]true[/code] if two bools are equal, i.e. both are [code]true[/code] or both are [code]false[/code]. - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="bool" /> <description> Returns [code]true[/code] if two bools are equal, i.e. both are [code]true[/code] or both are [code]false[/code]. diff --git a/doc/classes/float.xml b/doc/classes/float.xml index 1fe234c567..50961f9c7f 100644 --- a/doc/classes/float.xml +++ b/doc/classes/float.xml @@ -44,11 +44,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="float" /> <description> Returns [code]true[/code] if two floats are different from each other. @@ -201,11 +196,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="float" /> <description> Returns [code]true[/code] if both floats are exactly equal. diff --git a/doc/classes/int.xml b/doc/classes/int.xml index eac7ee8dfd..609291b69c 100644 --- a/doc/classes/int.xml +++ b/doc/classes/int.xml @@ -70,11 +70,6 @@ <operators> <operator name="operator !="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator !="> - <return type="bool" /> <argument index="0" name="right" type="float" /> <description> Returns [code]true[/code] if operands are different from each other. @@ -273,11 +268,6 @@ </operator> <operator name="operator =="> <return type="bool" /> - <description> - </description> - </operator> - <operator name="operator =="> - <return type="bool" /> <argument index="0" name="right" type="float" /> <description> Returns [code]true[/code] if the integer is equal to the given [float]. diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 451960d772..f25b7047d5 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -605,7 +605,7 @@ void RasterizerCanvasGLES3::_render_item(RID p_render_target, const Item *p_item _bind_canvas_texture(RID(), current_filter, current_repeat, r_index, last_texture, texpixel_size); state.canvas_shader.version_bind_shader(state.current_shader_version, CanvasShaderGLES3::MODE_PRIMITIVE); - for (uint32_t j = 0; j < MIN(3, primitive->point_count); j++) { + for (uint32_t j = 0; j < MIN(3u, primitive->point_count); j++) { state.instance_data_array[r_index].points[j * 2 + 0] = primitive->points[j].x; state.instance_data_array[r_index].points[j * 2 + 1] = primitive->points[j].y; state.instance_data_array[r_index].uvs[j * 2 + 0] = primitive->uvs[j].x; diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index b86b5f1579..a7e3ed95e5 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -1176,7 +1176,7 @@ uint32_t RenderingDeviceVulkan::get_image_format_required_size(DataFormat p_form } w = MAX(blockw, w >> 1); h = MAX(blockh, h >> 1); - d = MAX(1, d >> 1); + d = MAX(1u, d >> 1); } return size; @@ -1184,20 +1184,20 @@ uint32_t RenderingDeviceVulkan::get_image_format_required_size(DataFormat p_form uint32_t RenderingDeviceVulkan::get_image_required_mipmaps(uint32_t p_width, uint32_t p_height, uint32_t p_depth) { //formats and block size don't really matter here since they can all go down to 1px (even if block is larger) - int w = p_width; - int h = p_height; - int d = p_depth; + uint32_t w = p_width; + uint32_t h = p_height; + uint32_t d = p_depth; - int mipmaps = 1; + uint32_t mipmaps = 1; while (true) { if (w == 1 && h == 1 && d == 1) { break; } - w = MAX(1, w >> 1); - h = MAX(1, h >> 1); - d = MAX(1, d >> 1); + w = MAX(1u, w >> 1); + h = MAX(1u, h >> 1); + d = MAX(1u, d >> 1); mipmaps++; } @@ -2556,8 +2556,8 @@ Error RenderingDeviceVulkan::_texture_update(RID p_texture, uint32_t p_layer, co } mipmap_offset = image_total; - logic_width = MAX(1, logic_width >> 1); - logic_height = MAX(1, logic_height >> 1); + logic_width = MAX(1u, logic_width >> 1); + logic_height = MAX(1u, logic_height >> 1); } //barrier to restore layout @@ -2755,9 +2755,9 @@ Vector<uint8_t> RenderingDeviceVulkan::texture_get_data(RID p_texture, uint32_t vkCmdCopyImageToBuffer(command_buffer, tex->image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, tmp_buffer.buffer, 1, &buffer_image_copy); - computed_w = MAX(1, computed_w >> 1); - computed_h = MAX(1, computed_h >> 1); - computed_d = MAX(1, computed_d >> 1); + computed_w = MAX(1u, computed_w >> 1); + computed_h = MAX(1u, computed_h >> 1); + computed_d = MAX(1u, computed_d >> 1); offset += size; } @@ -9050,10 +9050,10 @@ void RenderingDeviceVulkan::initialize(VulkanContext *p_context, bool p_local_de // Note: If adding new project settings here, also duplicate their definition in // rendering_server.cpp for headless doctool. staging_buffer_block_size = GLOBAL_DEF("rendering/vulkan/staging_buffer/block_size_kb", 256); - staging_buffer_block_size = MAX(4, staging_buffer_block_size); + staging_buffer_block_size = MAX(4u, staging_buffer_block_size); staging_buffer_block_size *= 1024; //kb -> bytes staging_buffer_max_size = GLOBAL_DEF("rendering/vulkan/staging_buffer/max_size_mb", 128); - staging_buffer_max_size = MAX(1, staging_buffer_max_size); + staging_buffer_max_size = MAX(1u, staging_buffer_max_size); staging_buffer_max_size *= 1024 * 1024; if (staging_buffer_max_size < staging_buffer_block_size * 4) { diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index 32e3c3679a..4e2e8634e5 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -396,6 +396,7 @@ void EditorProfiler::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: + case NOTIFICATION_THEME_CHANGED: case NOTIFICATION_TRANSLATION_CHANGED: { activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons"))); clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"))); diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp index 885d8bd5c4..2f33a0bc31 100644 --- a/editor/debugger/editor_visual_profiler.cpp +++ b/editor/debugger/editor_visual_profiler.cpp @@ -67,7 +67,7 @@ void EditorVisualProfiler::add_frame_metric(const Metric &p_metric) { updating_frame = true; cursor_metric_edit->set_max(frame_metrics[last_metric].frame_number); - cursor_metric_edit->set_min(MAX(frame_metrics[last_metric].frame_number - frame_metrics.size(), 0)); + cursor_metric_edit->set_min(MAX(frame_metrics[last_metric].frame_number - frame_metrics.size(), 0u)); if (!seeking) { cursor_metric_edit->set_value(frame_metrics[last_metric].frame_number); @@ -426,6 +426,7 @@ void EditorVisualProfiler::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: + case NOTIFICATION_THEME_CHANGED: case NOTIFICATION_TRANSLATION_CHANGED: { if (is_layout_rtl()) { activate->set_icon(get_theme_icon(SNAME("PlayBackwards"), SNAME("EditorIcons"))); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 453e9e3a0c..f6fdd5fc57 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -779,18 +779,20 @@ void ScriptEditorDebugger::_set_reason_text(const String &p_reason, MessageType void ScriptEditorDebugger::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - skip_breakpoints->set_icon(get_theme_icon(SNAME("DebugSkipBreakpointsOff"), SNAME("EditorIcons"))); - copy->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons"))); - - step->set_icon(get_theme_icon(SNAME("DebugStep"), SNAME("EditorIcons"))); - next->set_icon(get_theme_icon(SNAME("DebugNext"), SNAME("EditorIcons"))); - dobreak->set_icon(get_theme_icon(SNAME("Pause"), SNAME("EditorIcons"))); - docontinue->set_icon(get_theme_icon(SNAME("DebugContinue"), SNAME("EditorIcons"))); le_set->connect("pressed", callable_mp(this, &ScriptEditorDebugger::_live_edit_set)); le_clear->connect("pressed", callable_mp(this, &ScriptEditorDebugger::_live_edit_clear)); error_tree->connect("item_selected", callable_mp(this, &ScriptEditorDebugger::_error_selected)); error_tree->connect("item_activated", callable_mp(this, &ScriptEditorDebugger::_error_activated)); breakpoints_tree->connect("item_activated", callable_mp(this, &ScriptEditorDebugger::_breakpoint_tree_clicked)); + [[fallthrough]]; + } + case NOTIFICATION_THEME_CHANGED: { + skip_breakpoints->set_icon(get_theme_icon(skip_breakpoints_value ? SNAME("DebugSkipBreakpointsOn") : SNAME("DebugSkipBreakpointsOff"), SNAME("EditorIcons"))); + copy->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons"))); + step->set_icon(get_theme_icon(SNAME("DebugStep"), SNAME("EditorIcons"))); + next->set_icon(get_theme_icon(SNAME("DebugNext"), SNAME("EditorIcons"))); + dobreak->set_icon(get_theme_icon(SNAME("Pause"), SNAME("EditorIcons"))); + docontinue->set_icon(get_theme_icon(SNAME("DebugContinue"), SNAME("EditorIcons"))); vmem_refresh->set_icon(get_theme_icon(SNAME("Reload"), SNAME("EditorIcons"))); vmem_export->set_icon(get_theme_icon(SNAME("Save"), SNAME("EditorIcons"))); search->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp index a9d18e9dcc..adad8fdba8 100644 --- a/editor/doc_tools.cpp +++ b/editor/doc_tools.cpp @@ -685,6 +685,11 @@ void DocTools::generate(bool p_basic_types) { for (int j = 0; j < Variant::OP_AND; j++) { // Showing above 'and' is pretty confusing and there are a lot of variations. for (int k = 0; k < Variant::VARIANT_MAX; k++) { + // Prevent generating for comparison with null. + if (Variant::Type(k) == Variant::NIL && (Variant::Operator(j) == Variant::OP_EQUAL || Variant::Operator(j) == Variant::OP_NOT_EQUAL)) { + continue; + } + Variant::Type rt = Variant::get_operator_return_type(Variant::Operator(j), Variant::Type(i), Variant::Type(k)); if (rt != Variant::NIL) { // Has operator. // Skip String % operator as it's registered separately for each Variant arg type, diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp index cd9298a122..7b72e09bd7 100644 --- a/editor/editor_fonts.cpp +++ b/editor/editor_fonts.cpp @@ -206,7 +206,8 @@ void editor_register_fonts(Ref<Theme> p_theme) { break; } - int default_font_size = int(EDITOR_GET("interface/editor/main_font_size")) * EDSCALE; + const int default_font_size = int(EDITOR_GET("interface/editor/main_font_size")) * EDSCALE; + const float embolden_strength = 0.6; String custom_font_path = EditorSettings::get_singleton()->get("interface/editor/main_font"); Ref<FontData> CustomFont; @@ -226,6 +227,11 @@ void editor_register_fonts(Ref<Theme> p_theme) { EditorSettings::get_singleton()->set_manually("interface/editor/main_font_bold", ""); } + if (CustomFont.is_valid() && !CustomFontBold.is_valid()) { + CustomFontBold = CustomFont->duplicate(); + CustomFontBold->set_embolden(embolden_strength); + } + /* Custom source code font */ String custom_font_path_source = EditorSettings::get_singleton()->get("interface/editor/code_font"); @@ -268,8 +274,6 @@ void editor_register_fonts(Ref<Theme> p_theme) { Ref<FontData> FontFallback = load_cached_internal_font(_font_DroidSansFallback, _font_DroidSansFallback_size, font_hinting, font_antialiased, true, font_subpixel_positioning); Ref<FontData> FontJapanese = load_cached_internal_font(_font_DroidSansJapanese, _font_DroidSansJapanese_size, font_hinting, font_antialiased, true, font_subpixel_positioning); - const float embolden_strength = 0.6; - Ref<FontData> FontFallbackBold = FontFallback->duplicate(); FontFallbackBold->set_embolden(embolden_strength); Ref<FontData> FontJapaneseBold = FontJapanese->duplicate(); diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index d9ba4139c2..54a55286e9 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -80,6 +80,11 @@ void EditorLog::_update_theme() { type_filter_map[MSG_TYPE_WARNING]->toggle_button->set_icon(get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons"))); type_filter_map[MSG_TYPE_EDITOR]->toggle_button->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons"))); + type_filter_map[MSG_TYPE_STD]->toggle_button->set_theme_type_variation("EditorLogFilterButton"); + type_filter_map[MSG_TYPE_ERROR]->toggle_button->set_theme_type_variation("EditorLogFilterButton"); + type_filter_map[MSG_TYPE_WARNING]->toggle_button->set_theme_type_variation("EditorLogFilterButton"); + type_filter_map[MSG_TYPE_EDITOR]->toggle_button->set_theme_type_variation("EditorLogFilterButton"); + clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"))); copy_button->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons"))); collapse_button->set_icon(get_theme_icon(SNAME("CombineLines"), SNAME("EditorIcons"))); diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index 76d1ada820..f59ba66862 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -253,6 +253,7 @@ void EditorPropertyArray::update_property() { if (vbox) { set_bottom_editor(nullptr); memdelete(vbox); + button_add_item = nullptr; vbox = nullptr; } return; @@ -408,6 +409,7 @@ void EditorPropertyArray::update_property() { if (vbox) { set_bottom_editor(nullptr); memdelete(vbox); + button_add_item = nullptr; vbox = nullptr; } } @@ -816,6 +818,7 @@ void EditorPropertyDictionary::update_property() { if (vbox) { set_bottom_editor(nullptr); memdelete(vbox); + button_add_item = nullptr; vbox = nullptr; } return; @@ -1270,6 +1273,7 @@ void EditorPropertyLocalizableString::update_property() { if (vbox) { set_bottom_editor(nullptr); memdelete(vbox); + button_add_item = nullptr; vbox = nullptr; } return; diff --git a/editor/editor_property_name_processor.cpp b/editor/editor_property_name_processor.cpp index 38003ab2f4..20327cb867 100644 --- a/editor/editor_property_name_processor.cpp +++ b/editor/editor_property_name_processor.cpp @@ -69,7 +69,9 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { // The map name and value definition format should be kept synced with the regex. capitalize_string_remaps["2d"] = "2D"; capitalize_string_remaps["3d"] = "3D"; + capitalize_string_remaps["Aa"] = "AA"; capitalize_string_remaps["Adb"] = "ADB"; + capitalize_string_remaps["Ao"] = "AO"; capitalize_string_remaps["Bptc"] = "BPTC"; capitalize_string_remaps["Bvh"] = "BVH"; capitalize_string_remaps["Csg"] = "CSG"; @@ -81,21 +83,27 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["Fbx"] = "FBX"; capitalize_string_remaps["Fps"] = "FPS"; capitalize_string_remaps["Fov"] = "FOV"; + capitalize_string_remaps["Fsr"] = "FSR"; capitalize_string_remaps["Fs"] = "FS"; capitalize_string_remaps["Fxaa"] = "FXAA"; capitalize_string_remaps["Ggx"] = "GGX"; + capitalize_string_remaps["Gi"] = "GI"; capitalize_string_remaps["Gdscript"] = "GDScript"; capitalize_string_remaps["Gles 2"] = "GLES2"; capitalize_string_remaps["Gles 3"] = "GLES3"; - capitalize_string_remaps["Gi Probe"] = "GI Probe"; + capitalize_string_remaps["Gpu"] = "GPU"; + capitalize_string_remaps["Gui"] = "GUI"; capitalize_string_remaps["Hdr"] = "HDR"; capitalize_string_remaps["Hidpi"] = "hiDPI"; + capitalize_string_remaps["Http"] = "HTTP"; capitalize_string_remaps["Ik"] = "IK"; capitalize_string_remaps["Ios"] = "iOS"; capitalize_string_remaps["Kb"] = "KB"; + capitalize_string_remaps["Lod"] = "LOD"; capitalize_string_remaps["Msaa"] = "MSAA"; capitalize_string_remaps["Macos"] = "macOS"; capitalize_string_remaps["Opentype"] = "OpenType"; + capitalize_string_remaps["Openxr"] = "OpenXR"; capitalize_string_remaps["Png"] = "PNG"; capitalize_string_remaps["Pvs"] = "PVS"; capitalize_string_remaps["Pvrtc"] = "PVRTC"; @@ -104,16 +112,23 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["Srgb"] = "sRGB"; capitalize_string_remaps["Ssao"] = "SSAO"; capitalize_string_remaps["Ssl"] = "SSL"; + capitalize_string_remaps["Ssil"] = "SSIL"; capitalize_string_remaps["Ssh"] = "SSH"; + capitalize_string_remaps["Sdf"] = "SDF"; capitalize_string_remaps["Sdk"] = "SDK"; capitalize_string_remaps["Tcp"] = "TCP"; + capitalize_string_remaps["Url"] = "URL"; capitalize_string_remaps["Uv 1"] = "UV1"; capitalize_string_remaps["Uv 2"] = "UV2"; + capitalize_string_remaps["Uv"] = "UV"; + capitalize_string_remaps["Uwp"] = "UWP"; capitalize_string_remaps["Vram"] = "VRAM"; capitalize_string_remaps["Vsync"] = "V-Sync"; capitalize_string_remaps["Vector 2"] = "Vector2"; + capitalize_string_remaps["Webp"] = "WebP"; capitalize_string_remaps["Webrtc"] = "WebRTC"; capitalize_string_remaps["Websocket"] = "WebSocket"; + capitalize_string_remaps["Xr"] = "XR"; } EditorPropertyNameProcessor::~EditorPropertyNameProcessor() { diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 7eceebb38b..d21049414c 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -702,6 +702,19 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_color("icon_focus_color", "Button", icon_focus_color); theme->set_color("icon_pressed_color", "Button", icon_pressed_color); + // Variation for Editor Log filter buttons + theme->set_type_variation("EditorLogFilterButton", "Button"); + // When pressed, don't tint the icons with the accent color, just leave them normal. + theme->set_color("icon_pressed_color", "EditorLogFilterButton", icon_normal_color); + // When unpressed, dim the icons. + theme->set_color("icon_normal_color", "EditorLogFilterButton", font_disabled_color); + // When pressed, add a small bottom border to the buttons to better show their active state, + // similar to active tabs. + Ref<StyleBoxFlat> editor_log_button_pressed = style_widget_pressed->duplicate(); + editor_log_button_pressed->set_border_width(SIDE_BOTTOM, 2 * EDSCALE); + editor_log_button_pressed->set_border_color(accent_color); + theme->set_stylebox("pressed", "EditorLogFilterButton", editor_log_button_pressed); + // OptionButton theme->set_stylebox("focus", "OptionButton", style_widget_focus); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 4ee4eb86af..d74499621d 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -60,12 +60,12 @@ // Min and Max are power of two in order to play nicely with successive increment. // That way, we can naturally reach a 100% zoom from boundaries. -#define MIN_ZOOM 1. / 128 -#define MAX_ZOOM 128 +constexpr real_t MIN_ZOOM = 1. / 128; +constexpr real_t MAX_ZOOM = 128; #define RULER_WIDTH (15 * EDSCALE) -#define SCALE_HANDLE_DISTANCE 25 -#define MOVE_HANDLE_DISTANCE 25 +constexpr real_t SCALE_HANDLE_DISTANCE = 25; +constexpr real_t MOVE_HANDLE_DISTANCE = 25; class SnapDialog : public ConfirmationDialog { GDCLASS(SnapDialog, ConfirmationDialog); @@ -489,12 +489,12 @@ void CanvasItemEditor::unhandled_key_input(const Ref<InputEvent> &p_ev) { viewport->update(); } - if (k->is_pressed() && !k->is_ctrl_pressed() && !k->is_echo()) { - if ((grid_snap_active || show_grid) && multiply_grid_step_shortcut.is_valid() && multiply_grid_step_shortcut->matches_event(p_ev)) { + if (k->is_pressed() && !k->is_ctrl_pressed() && !k->is_echo() && (grid_snap_active || _is_grid_visible())) { + if (multiply_grid_step_shortcut.is_valid() && multiply_grid_step_shortcut->matches_event(p_ev)) { // Multiply the grid size grid_step_multiplier = MIN(grid_step_multiplier + 1, 12); viewport->update(); - } else if ((grid_snap_active || show_grid) && divide_grid_step_shortcut.is_valid() && divide_grid_step_shortcut->matches_event(p_ev)) { + } else if (divide_grid_step_shortcut.is_valid() && divide_grid_step_shortcut->matches_event(p_ev)) { // Divide the grid size Point2 new_grid_step = grid_step * Math::pow(2.0, grid_step_multiplier - 1); if (new_grid_step.x >= 1.0 && new_grid_step.y >= 1.0) { @@ -938,6 +938,60 @@ void CanvasItemEditor::_reset_create_position() { node_create_position = Point2(); } +bool CanvasItemEditor::_is_grid_visible() const { + switch (grid_visibility) { + case GRID_VISIBILITY_SHOW: + return true; + case GRID_VISIBILITY_SHOW_WHEN_SNAPPING: + return grid_snap_active; + case GRID_VISIBILITY_HIDE: + return false; + } + ERR_FAIL_V_MSG(true, "Unexpected grid_visibility value"); +} + +void CanvasItemEditor::_prepare_grid_menu() { + for (int i = GRID_VISIBILITY_SHOW; i <= GRID_VISIBILITY_HIDE; i++) { + grid_menu->set_item_checked(i, i == grid_visibility); + } +} + +void CanvasItemEditor::_on_grid_menu_id_pressed(int p_id) { + switch (p_id) { + case GRID_VISIBILITY_SHOW: + case GRID_VISIBILITY_SHOW_WHEN_SNAPPING: + case GRID_VISIBILITY_HIDE: + grid_visibility = (GridVisibility)p_id; + viewport->update(); + view_menu->get_popup()->hide(); + return; + } + + // Toggle grid: go to the least restrictive option possible. + if (grid_snap_active) { + switch (grid_visibility) { + case GRID_VISIBILITY_SHOW: + case GRID_VISIBILITY_SHOW_WHEN_SNAPPING: + grid_visibility = GRID_VISIBILITY_HIDE; + break; + case GRID_VISIBILITY_HIDE: + grid_visibility = GRID_VISIBILITY_SHOW_WHEN_SNAPPING; + break; + } + } else { + switch (grid_visibility) { + case GRID_VISIBILITY_SHOW: + grid_visibility = GRID_VISIBILITY_SHOW_WHEN_SNAPPING; + break; + case GRID_VISIBILITY_SHOW_WHEN_SNAPPING: + case GRID_VISIBILITY_HIDE: + grid_visibility = GRID_VISIBILITY_SHOW; + break; + } + } + viewport->update(); +} + bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> b = p_event; Ref<InputEventMouseMotion> m = p_event; @@ -2728,7 +2782,7 @@ void CanvasItemEditor::_draw_rulers() { // The rule transform Transform2D ruler_transform = Transform2D(); - if (show_grid || grid_snap_active) { + if (grid_snap_active || _is_grid_visible()) { List<CanvasItem *> selection = _get_edited_canvas_items(); if (snap_relative && selection.size() > 0) { ruler_transform.translate(_get_encompassing_rect_from_list(selection).position); @@ -2808,7 +2862,7 @@ void CanvasItemEditor::_draw_rulers() { } void CanvasItemEditor::_draw_grid() { - if (show_grid || grid_snap_active) { + if (_is_grid_visible()) { // Draw the grid Vector2 real_grid_offset; const List<CanvasItem *> selection = _get_edited_canvas_items(); @@ -4139,12 +4193,6 @@ void CanvasItemEditor::_update_override_camera_button(bool p_game_running) { void CanvasItemEditor::_popup_callback(int p_op) { last_option = MenuOption(p_op); switch (p_op) { - case SHOW_GRID: { - show_grid = !show_grid; - int idx = view_menu->get_popup()->get_item_index(SHOW_GRID); - view_menu->get_popup()->set_item_checked(idx, show_grid); - viewport->update(); - } break; case SHOW_ORIGIN: { show_origin = !show_origin; int idx = view_menu->get_popup()->get_item_index(SHOW_ORIGIN); @@ -4617,7 +4665,7 @@ Dictionary CanvasItemEditor::get_state() const { state["snap_node_center"] = snap_node_center; state["snap_other_nodes"] = snap_other_nodes; state["snap_guides"] = snap_guides; - state["show_grid"] = show_grid; + state["grid_visibility"] = grid_visibility; state["show_origin"] = show_origin; state["show_viewport"] = show_viewport; state["show_rulers"] = show_rulers; @@ -4719,10 +4767,8 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) { smartsnap_config_popup->set_item_checked(idx, snap_guides); } - if (state.has("show_grid")) { - show_grid = state["show_grid"]; - int idx = view_menu->get_popup()->get_item_index(SHOW_GRID); - view_menu->get_popup()->set_item_checked(idx, show_grid); + if (state.has("grid_visibility")) { + grid_visibility = (GridVisibility)(int)(state["grid_visibility"]); } if (state.has("show_origin")) { @@ -5132,7 +5178,19 @@ CanvasItemEditor::CanvasItemEditor() { p = view_menu->get_popup(); p->set_hide_on_checkable_item_selection(false); - p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_grid", TTR("Always Show Grid"), Key::NUMBERSIGN), SHOW_GRID); + + grid_menu = memnew(PopupMenu); + grid_menu->connect("about_to_popup", callable_mp(this, &CanvasItemEditor::_prepare_grid_menu)); + grid_menu->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_on_grid_menu_id_pressed)); + grid_menu->set_name("GridMenu"); + grid_menu->add_radio_check_item(TTR("Show"), GRID_VISIBILITY_SHOW); + grid_menu->add_radio_check_item(TTR("Show When Snapping"), GRID_VISIBILITY_SHOW_WHEN_SNAPPING); + grid_menu->add_radio_check_item(TTR("Hide"), GRID_VISIBILITY_HIDE); + grid_menu->add_separator(); + grid_menu->add_shortcut(ED_SHORTCUT("canvas_item_editor/toggle_grid", TTR("Toggle Grid"), KeyModifierMask::CMD | Key::APOSTROPHE)); + p->add_child(grid_menu); + p->add_submenu_item(TTR("Grid"), "GridMenu"); + p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_helpers", TTR("Show Helpers"), Key::H), SHOW_HELPERS); p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_rulers", TTR("Show Rulers")), SHOW_RULERS); p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_guides", TTR("Show Guides"), Key::Y), SHOW_GUIDES); diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index e7c265ee02..1a9d49a4a8 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -116,7 +116,6 @@ private: SNAP_RELATIVE, SNAP_CONFIGURE, SNAP_USE_PIXEL, - SHOW_GRID, SHOW_HELPERS, SHOW_RULERS, SHOW_GUIDES, @@ -175,6 +174,12 @@ private: DRAG_KEY_MOVE }; + enum GridVisibility { + GRID_VISIBILITY_SHOW, + GRID_VISIBILITY_SHOW_WHEN_SNAPPING, + GRID_VISIBILITY_HIDE, + }; + bool selection_menu_additive_selection; Tool tool = TOOL_SELECT; @@ -190,7 +195,7 @@ private: HBoxContainer *hbc_context_menu; Transform2D transform; - bool show_grid = false; + GridVisibility grid_visibility = GRID_VISIBILITY_SHOW_WHEN_SNAPPING; bool show_rulers = true; bool show_guides = true; bool show_origin = true; @@ -314,6 +319,7 @@ private: MenuButton *skeleton_menu; Button *override_camera_button; MenuButton *view_menu; + PopupMenu *grid_menu; HBoxContainer *animation_hb; MenuButton *animation_menu; @@ -390,6 +396,9 @@ private: void _node_created(Node *p_node); void _reset_create_position(); void _update_editor_settings(); + bool _is_grid_visible() const; + void _prepare_grid_menu(); + void _on_grid_menu_id_pressed(int p_id); UndoRedo *undo_redo; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index a857a7509e..3f40b4ac30 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -56,31 +56,31 @@ #include "scene/resources/packed_scene.h" #include "scene/resources/surface_tool.h" -#define DISTANCE_DEFAULT 4 +constexpr real_t DISTANCE_DEFAULT = 4; -#define GIZMO_ARROW_SIZE 0.35 -#define GIZMO_RING_HALF_WIDTH 0.1 -#define GIZMO_PLANE_SIZE 0.2 -#define GIZMO_PLANE_DST 0.3 -#define GIZMO_CIRCLE_SIZE 1.1 -#define GIZMO_SCALE_OFFSET (GIZMO_CIRCLE_SIZE + 0.3) -#define GIZMO_ARROW_OFFSET (GIZMO_CIRCLE_SIZE + 0.3) +constexpr real_t GIZMO_ARROW_SIZE = 0.35; +constexpr real_t GIZMO_RING_HALF_WIDTH = 0.1; +constexpr real_t GIZMO_PLANE_SIZE = 0.2; +constexpr real_t GIZMO_PLANE_DST = 0.3; +constexpr real_t GIZMO_CIRCLE_SIZE = 1.1; +constexpr real_t GIZMO_SCALE_OFFSET = GIZMO_CIRCLE_SIZE + 0.3; +constexpr real_t GIZMO_ARROW_OFFSET = GIZMO_CIRCLE_SIZE + 0.3; -#define ZOOM_FREELOOK_MIN 0.01 -#define ZOOM_FREELOOK_MULTIPLIER 1.08 -#define ZOOM_FREELOOK_INDICATOR_DELAY_S 1.5 +constexpr real_t ZOOM_FREELOOK_MIN = 0.01; +constexpr real_t ZOOM_FREELOOK_MULTIPLIER = 1.08; +constexpr real_t ZOOM_FREELOOK_INDICATOR_DELAY_S = 1.5; #ifdef REAL_T_IS_DOUBLE -#define ZOOM_FREELOOK_MAX 1'000'000'000'000 +constexpr double ZOOM_FREELOOK_MAX = 1'000'000'000'000; #else -#define ZOOM_FREELOOK_MAX 10'000 +constexpr float ZOOM_FREELOOK_MAX = 10'000; #endif -#define MIN_Z 0.01 -#define MAX_Z 1000000.0 +constexpr real_t MIN_Z = 0.01; +constexpr real_t MAX_Z = 1000000.0; -#define MIN_FOV 0.01 -#define MAX_FOV 179 +constexpr real_t MIN_FOV = 0.01; +constexpr real_t MAX_FOV = 179; void ViewportRotationControl::_notification(int p_what) { switch (p_what) { diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index b7aef7f1bb..eafc53c72b 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -39,7 +39,8 @@ void ResourcePreloaderEditor::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: { + case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_THEME_CHANGED: { load->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons"))); } break; } diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 02f11bb82f..dbe6ca192c 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -435,8 +435,16 @@ void ShaderEditor::_menu_option(int p_option) { } void ShaderEditor::_notification(int p_what) { - if (p_what == NOTIFICATION_WM_WINDOW_FOCUS_IN) { - _check_for_external_edit(); + switch (p_what) { + case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_THEME_CHANGED: { + PopupMenu *popup = help_menu->get_popup(); + popup->set_item_icon(popup->get_item_index(HELP_DOCS), get_theme_icon(SNAME("Instance"), SNAME("EditorIcons"))); + } break; + + case NOTIFICATION_WM_WINDOW_FOCUS_IN: { + _check_for_external_edit(); + } break; } } @@ -772,7 +780,7 @@ ShaderEditor::ShaderEditor() { help_menu = memnew(MenuButton); help_menu->set_text(TTR("Help")); help_menu->set_switch_on_hover(true); - help_menu->get_popup()->add_icon_item(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), TTR("Online Docs"), HELP_DOCS); + help_menu->get_popup()->add_item(TTR("Online Docs"), HELP_DOCS); help_menu->get_popup()->connect("id_pressed", callable_mp(this, &ShaderEditor::_menu_option)); add_child(main_container); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 4a63080747..87b5b829e0 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -204,15 +204,22 @@ void SpriteFramesEditor::_sheet_scroll_input(const Ref<InputEvent> &p_event) { // to allow performing this action anywhere, even if the cursor isn't // hovering the texture in the workspace. if (mb->get_button_index() == MouseButton::WHEEL_UP && mb->is_pressed() && mb->is_ctrl_pressed()) { - _sheet_zoom_in(); + _sheet_zoom_on_position(scale_ratio, mb->get_position()); // Don't scroll up after zooming in. - accept_event(); + split_sheet_scroll->accept_event(); } else if (mb->get_button_index() == MouseButton::WHEEL_DOWN && mb->is_pressed() && mb->is_ctrl_pressed()) { - _sheet_zoom_out(); + _sheet_zoom_on_position(1 / scale_ratio, mb->get_position()); // Don't scroll down after zooming out. - accept_event(); + split_sheet_scroll->accept_event(); } } + + const Ref<InputEventMouseMotion> mm = p_event; + if (mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_MIDDLE) != MouseButton::NONE) { + const Vector2 dragged = Input::get_singleton()->warp_mouse_motion(mm, split_sheet_scroll->get_global_rect()); + split_sheet_scroll->set_h_scroll(split_sheet_scroll->get_h_scroll() - dragged.x); + split_sheet_scroll->set_v_scroll(split_sheet_scroll->get_v_scroll() - dragged.y); + } } void SpriteFramesEditor::_sheet_add_frames() { @@ -243,20 +250,25 @@ void SpriteFramesEditor::_sheet_add_frames() { undo_redo->commit_action(); } +void SpriteFramesEditor::_sheet_zoom_on_position(float p_zoom, const Vector2 &p_position) { + const float old_zoom = sheet_zoom; + sheet_zoom = CLAMP(sheet_zoom * p_zoom, min_sheet_zoom, max_sheet_zoom); + + const Size2 texture_size = split_sheet_preview->get_texture()->get_size(); + split_sheet_preview->set_custom_minimum_size(texture_size * sheet_zoom); + + Vector2 offset = Vector2(split_sheet_scroll->get_h_scroll(), split_sheet_scroll->get_v_scroll()); + offset = (offset + p_position) / old_zoom * sheet_zoom - p_position; + split_sheet_scroll->set_h_scroll(offset.x); + split_sheet_scroll->set_v_scroll(offset.y); +} + void SpriteFramesEditor::_sheet_zoom_in() { - if (sheet_zoom < max_sheet_zoom) { - sheet_zoom *= scale_ratio; - Size2 texture_size = split_sheet_preview->get_texture()->get_size(); - split_sheet_preview->set_custom_minimum_size(texture_size * sheet_zoom); - } + _sheet_zoom_on_position(scale_ratio, Vector2()); } void SpriteFramesEditor::_sheet_zoom_out() { - if (sheet_zoom > min_sheet_zoom) { - sheet_zoom /= scale_ratio; - Size2 texture_size = split_sheet_preview->get_texture()->get_size(); - split_sheet_preview->set_custom_minimum_size(texture_size * sheet_zoom); - } + _sheet_zoom_on_position(1 / scale_ratio, Vector2()); } void SpriteFramesEditor::_sheet_zoom_reset() { @@ -310,7 +322,8 @@ void SpriteFramesEditor::_prepare_sprite_sheet(const String &p_file) { void SpriteFramesEditor::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: { + case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_THEME_CHANGED: { load->set_icon(get_theme_icon(SNAME("Load"), SNAME("EditorIcons"))); load_sheet->set_icon(get_theme_icon(SNAME("SpriteSheet"), SNAME("EditorIcons"))); copy->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons"))); @@ -328,11 +341,9 @@ void SpriteFramesEditor::_notification(int p_what) { split_sheet_zoom_out->set_icon(get_theme_icon(SNAME("ZoomLess"), SNAME("EditorIcons"))); split_sheet_zoom_reset->set_icon(get_theme_icon(SNAME("ZoomReset"), SNAME("EditorIcons"))); split_sheet_zoom_in->set_icon(get_theme_icon(SNAME("ZoomMore"), SNAME("EditorIcons"))); - [[fallthrough]]; - } - case NOTIFICATION_THEME_CHANGED: { split_sheet_scroll->add_theme_style_override("bg", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); } break; + case NOTIFICATION_READY: { add_theme_constant_override("autohide", 1); // Fixes the dragger always showing up. } break; diff --git a/editor/plugins/sprite_frames_editor_plugin.h b/editor/plugins/sprite_frames_editor_plugin.h index 461c8dd41a..872a88e262 100644 --- a/editor/plugins/sprite_frames_editor_plugin.h +++ b/editor/plugins/sprite_frames_editor_plugin.h @@ -143,6 +143,7 @@ class SpriteFramesEditor : public HSplitContainer { void _sheet_preview_input(const Ref<InputEvent> &p_event); void _sheet_scroll_input(const Ref<InputEvent> &p_event); void _sheet_add_frames(); + void _sheet_zoom_on_position(float p_zoom, const Vector2 &p_position); void _sheet_zoom_in(); void _sheet_zoom_out(); void _sheet_zoom_reset(); diff --git a/main/main.cpp b/main/main.cpp index 89457a0cce..f0e74c3bb7 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -273,7 +273,7 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print(" -h, --help Display this help message.\n"); OS::get_singleton()->print(" --version Display the version string.\n"); OS::get_singleton()->print(" -v, --verbose Use verbose stdout mode.\n"); - OS::get_singleton()->print(" --quiet Quiet mode, silences stdout messages. Errors are still displayed.\n"); + OS::get_singleton()->print(" -q, --quiet Quiet mode, silences stdout messages. Errors are still displayed.\n"); OS::get_singleton()->print("\n"); OS::get_singleton()->print("Run options:\n"); @@ -282,7 +282,7 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print(" -p, --project-manager Start the project manager, even if a project is auto-detected.\n"); OS::get_singleton()->print(" --debug-server <uri> Start the editor debug server (<protocol>://<host/IP>[:<port>], e.g. tcp://127.0.0.1:6007)\n"); #endif - OS::get_singleton()->print(" -q, --quit Quit after the first iteration.\n"); + OS::get_singleton()->print(" --quit Quit after the first iteration.\n"); OS::get_singleton()->print(" -l, --language <locale> Use a specific locale (<locale> being a two-letter code).\n"); OS::get_singleton()->print(" --path <directory> Path to a project (<directory> must contain a 'project.godot' file).\n"); OS::get_singleton()->print(" -u, --upwards Scan folders upwards for project.godot file.\n"); @@ -643,7 +643,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "-v" || I->get() == "--verbose") { // verbose output OS::get_singleton()->_verbose_stdout = true; - } else if (I->get() == "--quiet") { // quieter output + } else if (I->get() == "-q" || I->get() == "--quiet") { // quieter output quiet_stdout = true; @@ -977,7 +977,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } } else if (I->get() == "-u" || I->get() == "--upwards") { // scan folders upwards upwards = true; - } else if (I->get() == "-q" || I->get() == "--quit") { // Auto quit at the end of the first main loop iteration + } else if (I->get() == "--quit") { // Auto quit at the end of the first main loop iteration auto_quit = true; } else if (I->get().ends_with("project.godot")) { String path; diff --git a/misc/dist/shell/_godot.zsh-completion b/misc/dist/shell/_godot.zsh-completion index 031f9aab71..aaa5fe0a06 100644 --- a/misc/dist/shell/_godot.zsh-completion +++ b/misc/dist/shell/_godot.zsh-completion @@ -30,11 +30,11 @@ _arguments \ '(-h --help)'{-h,--help}'[display the full help message]' \ '--version[display the version string]' \ '(-v --verbose)'{-v,--verbose}'[use verbose stdout mode]' \ - '--quiet[quiet mode, silences stdout messages (errors are still displayed)]' \ + '(-q --quiet)'{-q,--quiet}'[quiet mode, silences stdout messages (errors are still displayed)]' \ '(-e --editor)'{-e,--editor}'[start the editor instead of running the scene]' \ '(-p --project-manager)'{-p,--project-manager}'[start the project manager, even if a project is auto-detected]' \ '--debug-server[start the editor debug server]:editor debugger listen address' \ - '(-q --quit)'{-q,--quit}'[quit after the first iteration]' \ + '--quit[quit after the first iteration]' \ '(-l --language)'{-l,--language}'[use a specific locale (<locale> being a two-letter code)]:two-letter locale code' \ "--path[path to a project (<directory> must contain a 'project.godot' file)]:path to directory with 'project.godot' file:_dirs" \ '(-u --upwards)'{-u,--upwards}'[scan folders upwards for project.godot file]' \ diff --git a/misc/dist/shell/godot.bash-completion b/misc/dist/shell/godot.bash-completion index bec77f8f6b..7927d26171 100644 --- a/misc/dist/shell/godot.bash-completion +++ b/misc/dist/shell/godot.bash-completion @@ -36,6 +36,7 @@ _complete_godot_options() { --quiet --editor --project-manager +--debug-server --quit --language --path diff --git a/misc/dist/shell/godot.fish b/misc/dist/shell/godot.fish index f756e4cd8a..c05aa74017 100644 --- a/misc/dist/shell/godot.fish +++ b/misc/dist/shell/godot.fish @@ -37,12 +37,13 @@ complete -c godot -e complete -c godot -s h -l help -d "Display the full help message" complete -c godot -l version -d "Display the version string" complete -c godot -s v -l verbose -d "Use verbose stdout mode" -complete -c godot -l quiet -d "Quiet mode, silences stdout messages (errors are still displayed)" +complete -c godot -s q -l quiet -d "Quiet mode, silences stdout messages (errors are still displayed)" # Run options: complete -c godot -s e -l editor -d "Start the editor instead of running the scene" complete -c godot -s p -l project-manager -d "Start the project manager, even if a project is auto-detected" -complete -c godot -s q -l quit -d "Quit after the first iteration" +complete -c godot -l debug-server -d "Start the editor debug server (<protocol>://<host/IP>[:<port>] address)" -x +complete -c godot -l quit -d "Quit after the first iteration" complete -c godot -s l -l language -d "Use a specific locale (<locale> being a two-letter code)" -x complete -c godot -l path -d "Path to a project (<directory> must contain a 'project.godot' file)" -r complete -c godot -s u -l upwards -d "Scan folders upwards for project.godot file" diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp index c422c3bd6b..7bfe849106 100644 --- a/modules/dds/texture_loader_dds.cpp +++ b/modules/dds/texture_loader_dds.cpp @@ -225,8 +225,8 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path, ERR_FAIL_COND_V(!(flags & DDSD_LINEARSIZE), RES()); for (uint32_t i = 1; i < mipmaps; i++) { - w = MAX(1, w >> 1); - h = MAX(1, h >> 1); + w = MAX(1u, w >> 1); + h = MAX(1u, h >> 1); uint32_t bsize = MAX(info.divisor, w) / info.divisor * MAX(info.divisor, h) / info.divisor * info.block_size; //printf("%i x %i - block: %i\n",w,h,bsize); size += bsize; diff --git a/modules/lightmapper_rd/lightmapper_rd.cpp b/modules/lightmapper_rd/lightmapper_rd.cpp index a4b3bfdbd0..68b3a41b9a 100644 --- a/modules/lightmapper_rd/lightmapper_rd.cpp +++ b/modules/lightmapper_rd/lightmapper_rd.cpp @@ -1244,7 +1244,7 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d } break; } - push_constant.ray_count = CLAMP(push_constant.ray_count, 16, 8192); + push_constant.ray_count = CLAMP(push_constant.ray_count, 16u, 8192u); int max_region_size = nearest_power_of_2_templated(int(GLOBAL_GET("rendering/lightmapping/bake_performance/region_size"))); int max_rays = GLOBAL_GET("rendering/lightmapping/bake_performance/max_rays_per_pass"); @@ -1375,7 +1375,7 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d } push_constant.atlas_size[0] = probe_positions.size(); - push_constant.ray_count = CLAMP(push_constant.ray_count, 16, 8192); + push_constant.ray_count = CLAMP(push_constant.ray_count, 16u, 8192u); int max_rays = GLOBAL_GET("rendering/lightmapping/bake_performance/max_rays_per_probe_pass"); int ray_iterations = (push_constant.ray_count - 1) / max_rays + 1; diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 390e6685b1..efde8d8a2b 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -79,6 +79,7 @@ void Camera2D::set_zoom(const Vector2 &p_zoom) { ERR_FAIL_COND_MSG(Math::is_zero_approx(p_zoom.x) || Math::is_zero_approx(p_zoom.y), "Zoom level must be different from 0 (can be negative)."); zoom = p_zoom; + zoom_scale = Vector2(1, 1) / zoom; Point2 old_smoothed_camera_pos = smoothed_camera_pos; _update_scroll(); smoothed_camera_pos = old_smoothed_camera_pos; @@ -103,8 +104,8 @@ Transform2D Camera2D::get_camera_transform() { if (!first) { if (anchor_mode == ANCHOR_MODE_DRAG_CENTER) { if (drag_horizontal_enabled && !Engine::get_singleton()->is_editor_hint() && !drag_horizontal_offset_changed) { - camera_pos.x = MIN(camera_pos.x, (new_camera_pos.x + screen_size.x * 0.5 * zoom.x * drag_margin[SIDE_LEFT])); - camera_pos.x = MAX(camera_pos.x, (new_camera_pos.x - screen_size.x * 0.5 * zoom.x * drag_margin[SIDE_RIGHT])); + camera_pos.x = MIN(camera_pos.x, (new_camera_pos.x + screen_size.x * 0.5 * zoom_scale.x * drag_margin[SIDE_LEFT])); + camera_pos.x = MAX(camera_pos.x, (new_camera_pos.x - screen_size.x * 0.5 * zoom_scale.x * drag_margin[SIDE_RIGHT])); } else { if (drag_horizontal_offset < 0) { camera_pos.x = new_camera_pos.x + screen_size.x * 0.5 * drag_margin[SIDE_RIGHT] * drag_horizontal_offset; @@ -116,8 +117,8 @@ Transform2D Camera2D::get_camera_transform() { } if (drag_vertical_enabled && !Engine::get_singleton()->is_editor_hint() && !drag_vertical_offset_changed) { - camera_pos.y = MIN(camera_pos.y, (new_camera_pos.y + screen_size.y * 0.5 * zoom.y * drag_margin[SIDE_TOP])); - camera_pos.y = MAX(camera_pos.y, (new_camera_pos.y - screen_size.y * 0.5 * zoom.y * drag_margin[SIDE_BOTTOM])); + camera_pos.y = MIN(camera_pos.y, (new_camera_pos.y + screen_size.y * 0.5 * zoom_scale.y * drag_margin[SIDE_TOP])); + camera_pos.y = MAX(camera_pos.y, (new_camera_pos.y - screen_size.y * 0.5 * zoom_scale.y * drag_margin[SIDE_BOTTOM])); } else { if (drag_vertical_offset < 0) { @@ -133,8 +134,8 @@ Transform2D Camera2D::get_camera_transform() { camera_pos = new_camera_pos; } - Point2 screen_offset = (anchor_mode == ANCHOR_MODE_DRAG_CENTER ? (screen_size * 0.5 * zoom) : Point2()); - Rect2 screen_rect(-screen_offset + camera_pos, screen_size * zoom); + Point2 screen_offset = (anchor_mode == ANCHOR_MODE_DRAG_CENTER ? (screen_size * 0.5 * zoom_scale) : Point2()); + Rect2 screen_rect(-screen_offset + camera_pos, screen_size * zoom_scale); if (limit_smoothing_enabled) { if (screen_rect.position.x < limit[SIDE_LEFT]) { @@ -168,14 +169,14 @@ Transform2D Camera2D::get_camera_transform() { first = false; } - Point2 screen_offset = (anchor_mode == ANCHOR_MODE_DRAG_CENTER ? (screen_size * 0.5 * zoom) : Point2()); + Point2 screen_offset = (anchor_mode == ANCHOR_MODE_DRAG_CENTER ? (screen_size * 0.5 * zoom_scale) : Point2()); real_t angle = get_global_rotation(); if (rotating) { screen_offset = screen_offset.rotated(angle); } - Rect2 screen_rect(-screen_offset + ret_camera_pos, screen_size * zoom); + Rect2 screen_rect(-screen_offset + ret_camera_pos, screen_size * zoom_scale); if (!smoothing_enabled || !limit_smoothing_enabled) { if (screen_rect.position.x < limit[SIDE_LEFT]) { @@ -202,7 +203,7 @@ Transform2D Camera2D::get_camera_transform() { camera_screen_center = screen_rect.get_center(); Transform2D xform; - xform.scale_basis(zoom); + xform.scale_basis(zoom_scale); if (rotating) { xform.set_rotation(angle); } diff --git a/scene/2d/camera_2d.h b/scene/2d/camera_2d.h index 662bee3612..294a6fcb80 100644 --- a/scene/2d/camera_2d.h +++ b/scene/2d/camera_2d.h @@ -61,6 +61,7 @@ protected: RID canvas; Vector2 offset; Vector2 zoom = Vector2(1, 1); + Vector2 zoom_scale = Vector2(1, 1); AnchorMode anchor_mode = ANCHOR_MODE_DRAG_CENTER; bool rotating = false; bool current = false; diff --git a/scene/3d/voxelizer.cpp b/scene/3d/voxelizer.cpp index f56e3caa4b..bda3868fbb 100644 --- a/scene/3d/voxelizer.cpp +++ b/scene/3d/voxelizer.cpp @@ -872,7 +872,7 @@ Vector<uint8_t> Voxelizer::get_sdf_3d_image() const { if (d == 0) { w[i] = 0; } else { - w[i] = MIN(d, 254) + 1; + w[i] = MIN(d, 254u) + 1; } } } diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index e580e64db6..ec33e5752e 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2033,6 +2033,17 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { } } +void Viewport::_gui_cleanup_internal_state(Ref<InputEvent> p_event) { + ERR_FAIL_COND(p_event.is_null()); + + Ref<InputEventMouseButton> mb = p_event; + if (mb.is_valid()) { + if (!mb->is_pressed()) { + gui.mouse_focus_mask &= ~mouse_button_to_mask(mb->get_button_index()); // Remove from mask. + } + } +} + List<Control *>::Element *Viewport::_gui_add_root_control(Control *p_control) { gui.roots_order_dirty = true; return gui.roots.push_back(p_control); @@ -2695,6 +2706,9 @@ void Viewport::push_input(const Ref<InputEvent> &p_event, bool p_local_coords) { if (!is_input_handled()) { _gui_input_event(ev); + } else { + // Cleanup internal GUI state after accepting event during _input(). + _gui_cleanup_internal_state(ev); } event_count++; @@ -2768,6 +2782,14 @@ Vector2 Viewport::get_camera_rect_size() const { } void Viewport::set_disable_input(bool p_disable) { + if (p_disable == disable_input) { + return; + } + if (p_disable) { + _drop_mouse_focus(); + _drop_mouse_over(); + _gui_cancel_tooltip(); + } disable_input = p_disable; } diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 1976b20502..e4912f31c5 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -388,6 +388,7 @@ private: Control *_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_global, const Transform2D &p_xform, Transform2D &r_inv_xform); void _gui_input_event(Ref<InputEvent> p_event); + void _gui_cleanup_internal_state(Ref<InputEvent> p_event); _FORCE_INLINE_ Transform2D _get_input_pre_xform() const; diff --git a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp index 38234cf0e7..e6fc50afbf 100644 --- a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp @@ -694,9 +694,9 @@ void RendererCanvasRenderRD::_render_item(RD::DrawListID p_draw_list, RID p_rend _bind_canvas_texture(p_draw_list, RID(), current_filter, current_repeat, last_texture, push_constant, texpixel_size); - RD::get_singleton()->draw_list_bind_index_array(p_draw_list, primitive_arrays.index_array[MIN(3, primitive->point_count) - 1]); + RD::get_singleton()->draw_list_bind_index_array(p_draw_list, primitive_arrays.index_array[MIN(3u, primitive->point_count) - 1]); - for (uint32_t j = 0; j < MIN(3, primitive->point_count); j++) { + for (uint32_t j = 0; j < MIN(3u, primitive->point_count); j++) { push_constant.points[j * 2 + 0] = primitive->points[j].x; push_constant.points[j * 2 + 1] = primitive->points[j].y; push_constant.uvs[j * 2 + 0] = primitive->uvs[j].x; diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp index 6296e10962..14207c6620 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp @@ -1666,8 +1666,8 @@ void RendererSceneRenderRD::_allocate_blur_textures(RenderBuffers *rb) { if (i == 1) { // next 2 are half size - tf.width = MAX(1, tf.width >> 1); - tf.height = MAX(1, tf.height >> 1); + tf.width = MAX(1u, tf.width >> 1); + tf.height = MAX(1u, tf.height >> 1); } } diff --git a/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp index e8d2ff9c8a..45fc37bd02 100644 --- a/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp @@ -362,8 +362,8 @@ void RendererSceneSkyRD::ReflectionData::update_reflection_data(RendererStorageR layer.views.write[j] = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), p_base_cube, p_base_layer + i * 6, j, 1, RD::TEXTURE_SLICE_CUBEMAP); - mmw = MAX(1, mmw >> 1); - mmh = MAX(1, mmh >> 1); + mmw = MAX(1u, mmw >> 1); + mmh = MAX(1u, mmh >> 1); } layers.push_back(layer); @@ -390,8 +390,8 @@ void RendererSceneSkyRD::ReflectionData::update_reflection_data(RendererStorageR layer.views.write[j] = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), p_base_cube, p_base_layer, j, 1, RD::TEXTURE_SLICE_CUBEMAP); - mmw = MAX(1, mmw >> 1); - mmh = MAX(1, mmh >> 1); + mmw = MAX(1u, mmw >> 1); + mmh = MAX(1u, mmh >> 1); } layers.push_back(layer); @@ -432,8 +432,8 @@ void RendererSceneSkyRD::ReflectionData::update_reflection_data(RendererStorageR } } - mmw = MAX(1, mmw >> 1); - mmh = MAX(1, mmh >> 1); + mmw = MAX(1u, mmw >> 1); + mmh = MAX(1u, mmh >> 1); } } } diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp index e4ddc1b41f..f00931cf47 100644 --- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp @@ -9510,8 +9510,7 @@ RendererStorageRD::RendererStorageRD() { static_assert(sizeof(GlobalVariables::Value) == 16); - global_variables.buffer_size = GLOBAL_GET("rendering/limits/global_shader_variables/buffer_size"); - global_variables.buffer_size = MAX(4096, global_variables.buffer_size); + global_variables.buffer_size = MAX(4096, (int)GLOBAL_GET("rendering/limits/global_shader_variables/buffer_size")); global_variables.buffer_values = memnew_arr(GlobalVariables::Value, global_variables.buffer_size); memset(global_variables.buffer_values, 0, sizeof(GlobalVariables::Value) * global_variables.buffer_size); global_variables.buffer_usage = memnew_arr(GlobalVariables::ValueUsage, global_variables.buffer_size); diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl index 1c9b08b6d3..bd1c2b5758 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl @@ -1,9 +1,9 @@ // Functions related to lighting float D_GGX(float cos_theta_m, float alpha) { - float alpha2 = alpha * alpha; - float d = 1.0 + (alpha2 - 1.0) * cos_theta_m * cos_theta_m; - return alpha2 / (M_PI * d * d); + float a = cos_theta_m * alpha; + float k = alpha / (1.0 - cos_theta_m * cos_theta_m + a * a); + return k * k * (1.0 / M_PI); } // From Earl Hammon, Jr. "PBR Diffuse Lighting for GGX+Smith Microsurfaces" https://www.gdcvault.com/play/1024478/PBR-Diffuse-Lighting-for-GGX |