1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00
Commit Graph

772 Commits

Author SHA1 Message Date
Thaddeus Crews
dae32f8ec6 Merge pull request #92737 from AThousandShips/packed_erase
[Core] Expose `Packed*Array::erase`
2025-03-10 10:01:06 -05:00
Thaddeus Crews
a13067e61f Merge pull request #97553 from AThousandShips/semantic_equal
[Core] Add `is_same` to types that have float components
2025-03-10 10:01:05 -05:00
A Thousand Ships
331a43a9d8 Add String::remove_char(s) methods for performance and convenience 2025-03-10 13:19:28 +01:00
Thaddeus Crews
324512e11c Style: Replace header guards with #pragma once 2025-03-07 17:33:47 -06:00
Thaddeus Crews
3c43508ed7 Merge pull request #102427 from AThousandShips/fix_substr
Clean up some uses of `String::substr`
2025-03-07 15:12:33 -06:00
Thaddeus Crews
9c07d31fbb Merge pull request #101618 from aaronfranke/var-parser-neg-ident
VariantParser: Fix reading negated identifiers, replace `inf_neg` with `-inf`
2025-03-07 12:06:35 -06:00
A Thousand Ships
5113022dfe Clean up some uses of String::substr
Cases where the end position is either equvalent to the default or past
the end of the string.
2025-03-07 14:50:38 +01:00
Hotkey
7bc030172e Fix crash when calling get_argument_count() on invalid Callable
https://github.com/godotengine/godot/issues/103438
2025-03-04 13:32:34 +09:00
Pāvels Nadtočajevs
f9c7d348c3 Add bound checks to Array/Packed*Array variant call get and set methods. 2025-02-27 17:54:40 +02:00
Aaron Franke
4d75c92225 VariantParser: Fix reading negated identifiers, replace inf_neg with -inf 2025-02-12 02:40:38 -08:00
Thaddeus Crews
a0f10a28a6 Merge pull request #100933 from Synzorasize/fix_100889
Fix parsing Resource type as value type of a Dictionary
2025-02-11 09:13:18 -06:00
Pāvels Nadtočajevs
1bc86c2626 Fix PackedStringArray.to_byte_array() to return UTF-8 encoded data instead of pointers. 2025-02-07 10:19:32 +02:00
Pāvels Nadtočajevs
b50d9742c2 Fix is_valid_float, Variant parser, Expression parser, script highlighter, and TextServer not handing capital E in scientific notation. 2025-02-05 18:39:40 +02:00
A Thousand Ships
e825085978 [Core] Add is_same to types that have float components
Compares `NaN` as equal.

Added to:
* `AABB`
* `Basis`
* `Color`
* `Plane`
* `Projection`
* `Quaternion`
* `Rect2`
* `Transform2D`
* `Transform3D`
* `Vector2`
* `Vector3`
* `Vector4`

And added as a method in `Math`
2025-02-03 19:25:50 +01:00
A Thousand Ships
46b6acdabb [Core] Expose Packed*Array::erase 2025-02-03 19:25:09 +01:00
lawnjelly
5c6d7bfb98 Change VariantUtility to prevent undef print_verbose
Changes the `VariantUtility` function from `print_verbose` to `_print_verbose`, eliminating the need for undefining the `print_verbose` macro, which caused compilation problems.
2025-01-30 10:29:11 +00:00
David Snopek
696285f23a Use MethodInfo::get_compatibility_hash() to generate the hash for MethodBind::get_hash() and other GDExtension hash clean up 2025-01-11 15:57:42 -06:00
Rémi Verschelde
76c8e76560 Merge pull request #101284 from akx/tyops
A handful of typo fixes
2025-01-08 15:53:33 +01:00
Rémi Verschelde
b857c2f3e6 Merge pull request #101016 from kiroxas/AddVariantStaticAssert
Add static assert checks in `Variant` constructors
2025-01-08 15:53:23 +01:00
Aarni Koskela
f134769506 Fix various typos
* Add TODO notes for typos that should be fixed for 5.0

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-01-08 14:47:42 +02:00
Synzorasize
b0845da37d Fix parsing Resource type as value type of a Dictionary 2025-01-07 18:37:31 -06:00
Rémi Verschelde
91fda4ecaf Merge pull request #101055 from Ivorforce/variant-to-number-consolidate
Consolidate `Variant` int and float conversion functions to reduce duplicate logic.
2025-01-06 22:48:24 +01:00
Lukas Tenbrink
0e72967244 Consolidate Variant int and float conversion functions to reduce duplicate logic. 2025-01-03 20:16:43 +01:00
Rémi Verschelde
c049d07121 VariantParser: Ensure all parse errors have an explanation
Likewise in ResourceFormatText and JSON.
2025-01-03 17:17:37 +01:00
Rémi Verschelde
21e6671740 Merge pull request #100937 from Repiteo/style/clang-format-sync
Style: Enforce `AllowShortFunctionsOnASingleLine`
2025-01-03 00:49:44 +01:00
Rémi Verschelde
5ff616736a Merge pull request #100825 from KoBeWi/colored_eight
Add `Color.from_rgba8` and deprecate Color8
2025-01-03 00:49:18 +01:00
Thaddeus Crews
e06d83860d Style: Enforce AllowShortFunctionsOnASingleLine 2025-01-02 10:09:41 -06:00
Kiro
176e5f42b2 add Static assert checks 2025-01-02 09:02:43 +01:00
kobewi
4e48b19e1f Add Color.from_rgba8 and deprecate Color8 2024-12-27 11:26:59 +01:00
HP van Braam
46c23e1758 Don't set Variant::Type in destructor
When profiling Dome Keeper, I found that in physics_process a HashMap
gets cleared a lot, which ends up calling the Variant destructor.
Calling Variant::clear() dominates this operation.

By not uselessly setting the Type to NIL on destruction we save about
50% of time. This is likely because if there is a simple type in the
Variant that doesn't need destructing, but now we write when we should
just drop the Variant altogether.

Since the value of Variant::type should be unobservable after
destruction this doesn't change any outward behavior.
2024-12-25 23:40:19 +01:00
Yufeng Ying
73d85f46c9 Remove unused headers in scene.
Co-authored-by: Thaddeus Crews <repiteo@outlook.com>

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2024-12-24 00:40:09 +08:00
Thaddeus Crews
fb8d2ee044 Merge pull request #100582 from bruvzg/fix_in_ops
[GDScript] Fix `Packed*Array` `OP_IN` using low precision int and float as input.
2024-12-19 20:00:06 -06:00
Thaddeus Crews
bf9ef5f8a5 Merge pull request #100564 from YYF233333/iwyu
Remove unused headers in core
2024-12-19 19:59:55 -06:00
Pāvels Nadtočajevs
eaf2d7c5b0 [GDScript] Fix Packed*Array OP_IN using low precision int and float as input. 2024-12-18 23:41:27 +02:00
Yufeng Ying
be86ce3103 Apply iwyu suggestion in core. 2024-12-19 00:43:47 +08:00
Rémi Verschelde
851d8e49e8 Merge pull request #100386 from hpvb/core-ubsan
Core: Fix UBSAN reports
2024-12-18 17:23:32 +01:00
HP van Braam
240f510fa7 Core ubsan fixes
This fixes UBSAN errors reported by running our testsuite, importing the
TPS demo, and running the TPS demo. I have tried, wherever possible, to
fix issues related to reported issues but not directly reported by UBSAN
because thse code paths just happened to not have been exercised in
these cases.

These fixes apply only to errors reported, and caused by, core/

The following things have been changed:

* Make sure there are no implicit sign changing casts in core.
* Explicitly type enums that are part of a public API such that users of
  the API cannot pass in wrongly-sized values leading to potential stack
  corruption.
* Ensure that memcpy is never called with invalid or null pointers as
  this is undefined behavior, and when the engine is built with
  optimizations turned on leads to memory corruption and hard to debug
  crashes.
* Replace enum values only used as static values with constexpr static
  const values instead. This has no runtime overhead. This makes it so
  that the size of the enums is explicit.
* Make sure that nan and inf is handled consistently in String.
* Implement a _to_int template to ensure that all of the paths use the
  same algorhithm, and correct the negative integer case.
* Changed the way the json serializer precision work, and added tests to
  verify the new behavior. The behavior doesn't quite match master in
  particulary for negative doubles as the original code tried to cast -inf
  to an int. This then led to negative doubles losing all but one of
  their decimal points when serializing. Behavior in GDScript remains
  unchanged.
2024-12-18 14:31:12 +01:00
Lukas Tenbrink
34fa0bf3ec Add move assignment and move constructor to Variant.
Add `_to_variant` helper functions to `gdvirtual.gen.inc` to work around an MSVC bug.
2024-12-15 14:38:46 +01:00
Thaddeus Crews
9c290c4c56 Merge pull request #100033 from Daylily-Zeleen/daylily-zeleen/optimize_callable_to_string
Optimize callable's stringify text.
2024-12-12 16:13:23 -06:00
Rémi Verschelde
819db4daf5 Merge pull request #99559 from mayoff/OperatorEvaluatorModNZ-ptr_evaluate
Fix `Variant` modulo operation
2024-12-12 14:09:59 +01:00
Thaddeus Crews
8f16f864a6 Merge pull request #99765 from dalexeev/core-fix-json-from-to-native
Core: Fix `JSON.{from,to}_native()` issues
2024-12-10 14:15:53 -06:00
Lukas Tenbrink
b5c31ebb41 Add contains_char() for single-character 'contains' calls. 2024-12-06 20:23:35 +01:00
Daylily-Zeleen
614a51f293 Optimize callable's stringify text. 2024-12-05 14:24:39 +08:00
rune-scape
d58b2e879f Get rid of easily removable uses of const_cast 2024-12-01 17:50:13 -08:00
Pāvels Nadtočajevs
54945c4d28 Add std::initializer_list constructor for Dictionary. 2024-11-29 14:12:40 +02:00
Danil Alexeev
bd1a35ce9e Core: Fix JSON.{from,to}_native() issues 2024-11-29 12:43:06 +03:00
Rob Mayoff
daa665c4cb fix copy/paste error (fixes #99518)
Replace erroneous use of `/` with `%`.
2024-11-22 13:21:02 -06:00
Danil Alexeev
03b05cf9ac Core: Fix built-in enum constant bindings 2024-11-22 14:03:21 +03:00
Thaddeus Crews
cc6ee3e956 Merge pull request #98713 from dalexeev/core-fix-callable-get-bound-arguments
Core: Fix `Callable.get_bound_arguments{,_count}()` return incorrect data
2024-11-12 12:13:04 -06:00
Thaddeus Crews
f233d186ef Merge pull request #93885 from dalexeev/core-fix-freed-object-booleanization
Core: Fix `Freed Object` booleanization
2024-11-11 14:18:18 -06:00