Commit Graph

285 Commits

Author SHA1 Message Date
25e57a4268 Added erf to Math. 2023-04-22 13:00:28 +02:00
e80dfcee2e Added a Math singleton exposing math functions directly to scripts. The idea is to make the disrepancies between scripts and engine side code smaller. 2023-04-22 12:47:56 +02:00
4ab9936fc8 Added log10 to the Math class. 2023-04-22 11:00:24 +02:00
06b2437b72 Ported: [3.x] Expose more compression formats in Image
- AThousandShips
2ca86ef449
2023-04-20 23:47:57 +02:00
1263101396 Ported: Batching - Add MultiRect command
Large groups of similar rects can be processed more efficiently using the MultiRect command. Processing common to the group can be done as a one off, instead of per rect.

Adds the new API to VisualServerCanvas, and uses the new functionality from Font, BitmapFont, DynamicFont and TileMap, via the VisualServerCanvasHelper class.

- lawnjelly

910ddd13c4
2023-04-20 23:09:37 +02:00
d6442bc57c Added Size and Point typedefs for Vector3i and Vector4i. 2023-04-16 16:16:56 +02:00
326bd9a1e9 Added HAS_TRIVIAL_CONSTRUCTOR, HAS_TRIVIAL_DESTRUCTOR, and HAS_TRIVIAL_COPY macros to typedefs to fix new clang deprecations. 2023-04-16 15:42:57 +02:00
31f61225a2 Ported: Make MessageQueue growable
* Uses simple vector resizing (po2)
* Uses pair of read and write buffers
- lawnjelly
5f1e7e6fbc
2023-04-15 12:06:16 +02:00
464b0b5e08 Ported: Add Color + alpha constructor for Color
- timothyqiu
3544cd1dad
2023-04-15 11:02:41 +02:00
8ab1998fcb Ported from godot 4: Optimize Node::add_child validation
Adding 10k nodes is almost twice as fast.
- reduz
223ce4fcb9
2023-04-10 18:10:22 +02:00
32e9927ac8 Ported from godot 4: Remove NOTIFICATION_MOVED_IN_PARENT
* This notification makes node children management very inefficient.
* Replaced by a NOTIFICATION_CHILDREN_CHANGED (and children_changed signal).
* Changed Canvas code (and similar) to use the above signal, to perform more efficiently.
This PR breaks compatibility (although this notification was very rarely used, even within the engine), but provides an alternate way to do the same.
It is required for the changes in #75627 to be entirely effective.
- reduz
Note that I removed NOTIFICATION_MOVED_IN_PARENT, as keeping it, but making it just not work is worse in my opinion.
104392ef4e
2023-04-10 15:55:34 +02:00
d357a57ab2 Updated the logic of a few getters in String. 2023-03-22 01:42:53 +01:00
4b23c9c5c9 Renamed utf8_length() to utf8_byte_length(), and utf16_length() to utf16_byte_length() in String, as this might help to better explain why these differ from normal length(). 2023-03-20 22:34:21 +01:00
a0d33b5fcd Added utf8_length(), and utf16_length() helper methods to String. 2023-03-20 22:12:17 +01:00
26f77bbe2b Use set_length, instead of resize in String's operator +=. 2023-03-20 21:26:59 +01:00
67ebd5e52b Ported: Fix Standard Gamepad Mapping triggers.
- j8r and  akien-mga
669749fa39
2023-03-12 19:12:39 +01:00
2db3148b23 Ported: Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@436c7e3
- akien-mga
bab7f1c0a6
2023-03-12 19:02:32 +01:00
9c28f6fb7f Ported: Add PS3 controller guide button
- j8r and akien-mga
2c18066231
2023-03-12 16:59:28 +01:00
9118798036 Fix include. 2023-03-12 16:05:58 +01:00
Rémi Verschelde
f3e1aab267 Math: Prevent division by zero in posmod
Fixes #43932.

Co-authored-by: David Hoppenbrouwers <david@salt-inc.org>
(cherry picked from commit f011d8ca9ca25232fb335eead1c8eeaf5c7f2c54)
2023-03-12 15:43:52 +01:00
lawnjelly
4684c72b92 BVH - fix lockguards for multithread mode
Due to a lack of variable name, the BVH lock guards lifetimes previously did not cover the whole function call.
2023-03-12 14:20:02 +01:00
c356806ebf Ported: Extract Syntax highlighting from TextEdit and add EditorSyntaxHighlighter
- Extacted all syntax highlighting code from text edit
- Removed enable syntax highlighting from text edit
- Added line_edited_from signal to text_edit
- Renamed get/set_syntax_highlighting to get/set_syntax_highlighter
- Added EditorSyntaxHighligher
- Paulb23
bc4cee4458
2023-02-21 01:30:59 +01:00
79842beb9a Ported: Expose OS.read_string_from_stdin() to the scripting API
This can be used in scripts to read user input in a blocking manner.
This also removes the unused `block` argument, which is always `true`.
- Calinou
badcfa2523
2023-02-07 01:07:31 +01:00
d999f63cbd Cleanups and codestyle for the godot4 containers that I added in unmodified yesterday. 2023-01-16 22:09:32 +01:00
5579d563bd Ported: Fix for PoolArray comparison - AThousandShips
f26069e94d
2023-01-16 14:35:23 +01:00
heppocogne
7d4baaed2b Fix get_path() is not working when files are opend with open_compressed
And also fixed `get_absolute_path()` in the same way

(cherry picked from commit ea11ffc88c22dea2b71d7863808cd65f64f9eded)
2023-01-16 14:18:57 +01:00
b6f4b647d6 Added the rest of the new container classes from godot4. They will likely not work as-is, this will be fixed later. 2023-01-16 00:40:55 +01:00
3c461a4660 Added more getters to the new HshMap, for more backwards compatibility. 2023-01-15 23:46:53 +01:00
fd7c2153a6 Replaced the HashMap's implementation with the one Godot4. Refactored it to work as a drop in replacement. Renamed the old one to OGHashMap. 2023-01-15 22:57:13 +01:00
2cd4e4d828 Renamed Set to RBSet. 2023-01-15 19:42:08 +01:00
1b0aac6028 Renamed Map to RBMap. 2023-01-15 19:12:50 +01:00
389052c51a Small cleanups for PooledList and PagedAllocator. 2023-01-15 18:00:34 +01:00
698c2e01f0 Backported the tight version of godot4's LocalVector as the new TightLocalVector class. 2023-01-15 17:30:08 +01:00
5972b6cc43 Removed the deprecated clamped() method from vector2. (The new method is limit_length().) 2023-01-15 14:05:45 +01:00
b240df7df6 Updated more copyright headers for 2023. 2022-12-31 21:07:05 +01:00
f70e207741 Added support for specifying a COPYRIGHT.txt file for modules. 2022-12-31 18:12:06 +01:00
3bf2b79d88 Added set_length helper method to String. 2022-12-22 21:10:04 +01:00
e756718326 Add _FORCE_INLINE_ to String's resize(). 2022-12-22 20:04:50 +01:00
4fb7856b5a Remove now superfluos check from String's operator[]. 2022-12-22 20:03:28 +01:00
91c50d4bea Never print an error message in Object::get_meta(). 2022-12-22 19:58:58 +01:00
213f393293 Fix typos with codespell. 2022-12-22 19:51:25 +01:00
b8009c85f4 Ported: Add vector value linking - KoBeWi and timothyqiu
9499ebecee
2022-12-22 18:50:17 +01:00
51ed526179 Ported: Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@adf7ec1
- akien-mga
84d2f884f8
2022-12-22 17:50:20 +01:00
91e598aa7b Ported: SCons: Cleanup DEBUG, _DEBUG and NDEBUG defines
- `_DEBUG` is MSVC specific so it didn't make much sense to define for
  Android and iOS builds.
- iOS was the only platform to define `DEBUG`. We don't use it anywhere
  outside thirdparty code, which we usually don't intend to debug, so it
  seems better to be consistent with other platforms.
- Consistently define `NDEBUG` to disable assert behavior in both `release`
  and `release_debug` targets. This used to be set for `release` for all
  platforms, and `release_debug` for Android and iOS only.
- Due to the above, I removed the only use we made of `assert()` in Godot
  code, which was only implemented for Unix anyway, should have been
  `DEV_ENABLED`, and is in PoolAllocator which we don't actually use.
- The denoise and recast modules keep defining `NDEBUG` even for the `debug`
  target as we don't want OIDN and Embree asserting all over the place.
- akien-mga
b0b759e6da
2022-12-22 17:42:54 +01:00
f42e413a51 Ported: [Web] Add PS3 gamepad mapping for FF+Linux. - Faless
41b880582e
2022-12-22 16:59:06 +01:00
Hugo Locurcio
fe010a1efe Silence Input.vibrate_handheld() warning as it's already documented
The warning causes messages to be spammed if you are calling this
method in a game that runs on both desktop and mobile platforms,
unless you guard all calls to `Input.vibrate_handheld()` with
`OS.has_feature("mobile") or OS.has_feature("web")`.

Since the limitation is already documented (and is obvious enough
given the method's name), the warning message is redundant.

(cherry picked from commit 4a991887bf3dd5fbb687fb379f06ac85aa4a6245)
2022-12-22 14:08:01 +01:00
lawnjelly
25c3232a77 VariantParser make readahead optional
It turns out some areas are independently moving / reading filepointers outside of the VariantParser, which can cause the readahead caching to get out of sync.

This PR makes the VariantParser readahead to be optional to allow for these use cases.
2022-12-22 13:52:51 +01:00
Emmanouil Papadeas
9524cb6a74 Fix InputEventAction's is_action method ignoring exact_match parameter
(cherry picked from commit 38b51942d6d346d19dd5d4cd1073389caf0152fc)
2022-12-12 12:12:30 +01:00
a7fb068ab4 Revert "Backported: RID: Change comparison operators to use RID_Data id instead of address. This should helps making sorting more deterministic in physics and rendering. The same change was done for 4.0 in 4f16397. - akien-mga - 797321fec4"
This reverts commit 185cfb3291.
2022-12-12 11:54:51 +01:00
lawnjelly
3d1640eb70 Add readahead to VariantParser
Adds a readahead buffer to VariantParser, to prevent large numbers of freads for single bytes, which is inefficient.
2022-12-11 19:17:15 +01:00