Commit graph

3615 commits

Author SHA1 Message Date
Bartłomiej T. Listwon
8db39b82ea Include platform_config.h in thread.cpp and thread.h
(cherry picked from commit 6c6291b84f)
2022-03-17 13:03:52 +01:00
Haoyu Qiu
878cf8262a Add context support for editor translation 2022-03-16 15:44:30 +08:00
ConteZero
2ff0735329 Added primary clipboard for Linux 2022-03-14 15:28:36 +01:00
Aaron Franke
3040285b27 Add offset string from minutes conversion method to Time singleton
(cherry picked from commit 55aabb8b06)
2022-03-12 14:44:23 +01:00
Hugo Locurcio
cec7c908ca
Add get_screen_refresh_rate() to OS
This method can be used to get the refresh rate of a given screen.
It is supported on Windows, macOS, Linux, Android and iOS (but not
HTML5).
2022-03-10 22:10:48 +01:00
Rémi Verschelde
1639b3a6a9
Merge pull request #58674 from Calinou/smooth-trimesh-collision-always-setting-3.x 2022-03-10 21:11:44 +01:00
Rémi Verschelde
690020d385 Revert "Fix ProjectSettings has_setting() when used on a overriden setting with feature tags"
(cherry picked from commit 78bf9926f8)
2022-03-09 09:53:26 +01:00
Rémi Verschelde
85b4848ca8
Merge pull request #54188 from Rubonnek/increase_var_arg_max_3x 2022-03-08 13:10:48 +01:00
Wilson E. Alvarez
424dbf70af
Increase VARIANT_ARG_MAX to 8 2022-03-07 10:03:49 -05:00
Rémi Verschelde
445339e1b2
Merge pull request #58427 from lawnjelly/safe_vector2 2022-03-07 12:39:28 +01:00
lawnjelly
0bcda22d7c Protection for array operator for Vector2 / 3 in DEV builds
A previous PR had changed the array operator to give unbounded access. This could cause crashes where old code depended on this previous safe behaviour.

This PR adds DEV_ASSERT macros for out of bound access to DEV builds, allowing us to quickly identify bugs in calling code, without affecting performance in release or release_debug editor builds.
2022-03-07 10:34:40 +00:00
Rémi Verschelde
f622c60805
Merge pull request #58492 from lawnjelly/float_literals_3
[3.x] Float literals - fix math classes to allow 32 bit calculations
2022-03-06 10:14:10 +01:00
Hugo Locurcio
413689559c
Always register the Smooth Trimesh Collision project setting
This ensures the project setting never disappears from the editor,
even if the current physics engine is GodotPhysics.

This also adds documentation for the Smooth Trimesh Collision
project setting.
2022-03-02 18:50:21 +01:00
Haoyu Qiu
56fd92ca76 Fix UndoRedo::create_action() invalid memory usage
(cherry picked from commit b00b7f9b7c)
2022-03-02 12:02:37 +01:00
Hugo Locurcio
824eaabd7b Print every file exported with PCKPacker.flush()s verbose parameter
Previously, only one line per 100 files was printed.

This also refactors the print statement to use Godot methods and
make it more informative overall.

(cherry picked from commit 8e57e5dc6a)
2022-03-02 11:00:26 +01:00
lawnjelly
d24c715678 Float literals - fix math classes to allow 32 bit calculations
Converts float literals from double format (e.g. 0.0) to float format (e.g. 0.0f) where appropriate for 32 bit calculations, and cast to (real_t) or (float) as appropriate.

This ensures that appropriate calculations will be done at 32 bits when real_t is compiled as float, rather than promoted to 64 bits.
2022-02-24 16:46:02 +00:00
Rémi Verschelde
fe8ea0de5b
Merge pull request #58295 from Pineapple/ustring-optimizations
Optimize String concatenation and copy functions
2022-02-21 08:45:23 +01:00
Bartłomiej T. Listwon
66085e210e Optimize String::copy_from(const CharType &p_char) 2022-02-20 12:47:35 +01:00
Bartłomiej T. Listwon
3d35f29f27 Optimize String::copy_from_unchecked 2022-02-20 12:47:35 +01:00
Bartłomiej T. Listwon
069e8f32d8 Optimize String::operator+= and CharString::operator+= 2022-02-20 12:47:22 +01:00
Ricardo Subtil
60f9c0fb42 Fix decompression functions not returning errcodes
(cherry picked from commit 61790a03f5)
2022-02-19 15:50:38 +01:00
Yuri Sizov
df13466139 Add type variations to Theme 2022-02-17 15:24:10 +03:00
Rémi Verschelde
47e34dc4e2
Merge pull request #58157 from Calinou/os-add-get-processor-name-3.x 2022-02-17 12:34:16 +01:00
Haoyu Qiu
0f76143444
Make VMap::find_nearest return -1 when empty
(cherry picked from commit 3057b19daa)
2022-02-17 09:59:28 +01:00
Hugo Locurcio
7f9e974a8b
Add an OS.get_processor_name() method
This method can be used to get the CPU model name.
It can be used in conjunction with
`VisualServer.get_video_adapter_name()` and
`VisualServer.get_video_adapter_vendor()` for annotating benchmarks
and automatic graphics quality configuration.
2022-02-16 18:39:02 +01:00
lawnjelly
522bce1159 Fixed Timestep Interpolation (3D)
Adds fixed timestep interpolation to the visual server.
Switchable on and off with project setting.

This version does not add new API for set_transform etc, when nodes have the interpolated flag set they will always use interpolation.
2022-02-16 09:41:23 +00:00
Max
273abf5225
Fixed variant decoding Segmentation Fault
(cherry picked from commit 6aede992a9)
2022-02-15 12:30:40 +01:00
BimDav
b343660dac
has_setting now correctly returns true when the setting is present due to a feature tag
(cherry picked from commit d39e416c61)
2022-02-15 12:23:45 +01:00
Rémi Verschelde
7a16bb2ee4
Fix typos with codespell
Using codespell 2.2-dev from current git.

Added `misc/scripts/codespell.sh` to make it easier to run it once in a
while and update the skip and ignore lists.

(cherry picked from commit 1bdb82c64e)
2022-02-11 09:50:59 +01:00
Hayden
6d867b6d13
Make parser treat all exponent literals as float
(cherry picked from commit 1305ff92f7)
2022-02-11 09:50:58 +01:00
Hayden Leete
61cd26be28
Added hex and bin literal support to Expression parser
fixed formatting

(cherry picked from commit 018de19eba)
2022-02-11 09:50:58 +01:00
Rémi Verschelde
f50c7f7415
Core: Move generated VERSION_HASH to a .cpp file
This lets us have its definition in `core/version.h` and avoid
rebuilding a handful of files every time the commit hash changes.

(cherry picked from commit 90162851a7)
2022-02-10 13:06:56 +01:00
Rémi Verschelde
43dfafdfc9
Merge pull request #53296 from lawnjelly/project_settings_dirty_flag 2022-02-09 14:04:45 +01:00
lawnjelly
f0af29346b ProjectSettings add dirty flag and project_settings_changed signal
Most frames there will be no change in project settings, and it makes no sense to read settings every frame in case of changes, as a large number of string compares are involved.

This PR adds a signal to ProjectSettings that can be subscribed to in order to keep local settings up to date with ProjectSettings.

In addition a function `ProjectSettings::has_changes()` is provided for objects outside the signal system (e.g. Rasterizers).
2022-02-09 11:20:25 +00:00
Bartłomiej T. Listwon
134aac5725 Fix Vector2 and Vector2i coord access via operator[] 2022-02-09 09:18:05 +01:00
lawnjelly
ee979d321a Add fflush to error macros
CRASH_NOW and DEV_ASSERT macros would previously terminate before outputting any error messages.
This PR ensures calling fflush for stdout before terminating.
2022-02-05 12:38:57 +00:00
Haoyu Qiu
de47cb0c5b Fix PoolByteArray.decompress_dynamic return value and memleak 2022-02-05 15:14:23 +08:00
Rémi Verschelde
689f59dca0
Merge pull request #53463 from lawnjelly/vital_redraws
Add editor vital redraws only option
2022-02-04 21:42:49 +01:00
Rémi Verschelde
ae948d83b2
Merge pull request #57561 from lawnjelly/bvh_fix_leaf_leak 2022-02-03 09:57:01 +01:00
lawnjelly
90bea27e82 BVH - fix leaking leaves
In the BVH leaf nodes are a combination of two objects - a node object, and a leaf object. Testing revealed that in some situations node objects could be freed without also freeing the paired leaf object. This closes this bug.
2022-02-03 08:05:57 +00:00
Rémi Verschelde
98ed117613
Merge pull request #54174 from nathanfranke/3.x-fix-exact-match 2022-02-02 23:25:08 +01:00
lawnjelly
a0c6d16c90 Add editor vital redraws only option
When editor continuous redraws is switched off, the editor only redraws when a redraw_request was issued by an element in the scene. This works well in most situations, but when scenes have dynamic content they will continuously issue redraw_requests.

This can be fine on high power desktops but can be an annoyance on lower power machines.

This PR splits redraw requests into high and low priority requests, defaulting to high priority. Requests due to e.g. shaders using TIME are assigned low priority.

An extra editor setting is used to record the user preference and an extra option is added to the editor spinner menu, to allow the user to select between 3 modes:

* Continuous
* Update all changes
* Update vital changes
2022-02-02 11:26:45 +00:00
Rémi Verschelde
b6dbff7621
Merge pull request #57361 from lawnjelly/occ_poly_only 2022-02-01 14:04:24 +01:00
lawnjelly
8ea20f5fdd Add OccluderShapePolygon
Add OccluderShapePolygon, glue to Occluder and gizmos etc.
2022-02-01 11:31:06 +00:00
Fabio Alessandrelli
aa3ef20fcb
[Net] Simplify IP resolution code, fix caching.
First, we should not insert into cache if the hostname resolution has
failed (as it might be a temporary internet issue), second, the async
resolver should also properly insert into cache.

Took the chance to remove some duplicate code with critical section in
it at the cost of little performance when calling the blocking
resolve_hostname function.

(cherry picked from commit 49297d937c)
2022-01-31 22:54:25 +01:00
Rémi Verschelde
d3582685d2
Merge pull request #57159 from Pineapple/rid-set-data
[3.x] Use refval() instead of separate ref() and get() in RID_OwnerBase::_set_data()
2022-01-28 21:49:29 +01:00
Fabio Alessandrelli
822da984bb
[Net] Fix get_response_body_length for large files.
Parsing was fixed, but not the return value for the exposed getter.

(cherry picked from commit 01e5e98312)
2022-01-25 18:23:04 +01:00
cdemirer
dd57c321bf
Fix Array and Dictionary id() and dictionary test bug
(cherry picked from commit e2ed9d13eb)
2022-01-25 18:20:59 +01:00
Bartłomiej T. Listwon
7df2f31c27 Use refval() instead of separate ref() and get() 2022-01-24 21:36:25 +01:00
lawnjelly
dc14636e68 BVH templated mask checks and generic NUM_TREES
Refactors the BVH to make it more generic and customizable. Instead of hard coding the system of pairable_mask and pairable_type into the BVH, this information is no longer stored internally, and instead the BVH uses callbacks both for determining whether pairs of objects can pair with each other, and for filtering cull / intersection tests.

In addition, instead of hard coding the number of trees, the BVH now supports up to 32 trees, and each object can supply a tree collision mask to determine which trees it can collide against.

This enables the BVH to scale to either the two or 3 trees needed in physics, and the single tree used without pairing in Godot 4 render tree.
2022-01-21 10:08:29 +00:00