Compare commits

...

2257 Commits

Author SHA1 Message Date
Rémi Verschelde
45eaa2daf1 Bump version to 3.4.2-stable 2021-12-21 12:57:28 +01:00
Rémi Verschelde
8ac75669c1 Add changelog for Godot 3.4.2 2021-12-21 12:56:18 +01:00
Rémi Verschelde
eb4816ee13 i18n: Sync classref translations with Weblate 2021-12-21 12:23:51 +01:00
Rémi Verschelde
dbfe36728e i18n: Remove line numbers from classref PO files
It's useful context for translators but it generates very spammy diffs whenever
a line is added or removed, changing the comments for hundreds or thousands of
msgids needlessly.

We still have the file names so it's relatively easy to search in file to find
the location of the source string.
2021-12-21 12:23:45 +01:00
Rémi Verschelde
0fe94ee6e5 i18n: Sync editor translations with Weblate 2021-12-21 12:23:20 +01:00
Marcel Admiraal
fbf32c1ea2 Revert "[3.x] Fixed event spam when using the Nintendo Switch controller"
(cherry picked from commit 9f250e8370)
2021-12-21 12:23:20 +01:00
Zae
d55deabae7 [3.x]Fix BaseButton's localization for tooltip text with shortcut
(cherry picked from commit 23aaf78391)
2021-12-21 12:23:20 +01:00
Fabio Alessandrelli
3dd3f2211b Bump mbedtls to 2.16.12
Remove upstreamed patches.
Re-apply padlock and uwp patches.

NOTE: We could replace our padloack patch with mbedtls 3452.
(cherry picked from commit 36d316876b)
2021-12-21 12:23:19 +01:00
Raul Santos
9520c6b953 Check a csproj exists before trying to edit it
When folders are moved/removed from the file system, the `.csproj`
may need to be edited to update the path of C# scripts or remove them.
If a C# solution has not been created, the `.csproj` file does not exist
and therefore there is no need to edit it.

(cherry picked from commit cf98ff248a)
2021-12-21 12:23:19 +01:00
Bastiaan Olij
b47fa3f348 Fix size issue for ARVR managed viewport
(cherry picked from commit 4e4de3430e)
2021-12-21 12:23:19 +01:00
Lucas Ângelo
29dcb7a0d2 Trunc shader function fixed
the 'trunc' function was comparing integers with floats using the '>' operator, which is not supported in Android. This issue is now gone.

(cherry picked from commit 9f68b4fea3)
2021-12-21 12:23:19 +01:00
Rémi Verschelde
786c2ed7fa Merge pull request #56122 from bruvzg/macos_gl_off_ctx34 2021-12-21 12:15:09 +01:00
bruvzg
8d83e58b37 [macOS] Fix OpenGL flickering.
Remove kCGLCEMPEngine, which is causing flicker.
Disable window redraw during resize, when rendering in the separate thread.
2021-12-21 11:23:00 +02:00
Rémi Verschelde
f28771b7a8 Bump version to 3.4.2-rc 2021-12-17 23:14:50 +01:00
Rémi Verschelde
0a87e218e3 Bump version to 3.4.1-stable 2021-12-17 11:09:41 +01:00
Rémi Verschelde
aa1b958894 Update AUTHORS and DONORS list
New contributors added to AUTHORS:
Gallilus, Listwon, zaevi

Thanks to all contributors and donors for making Godot possible!

(cherry picked from commit 58712e96ae)
2021-12-17 10:38:52 +01:00
Rémi Verschelde
7ca4270c1b Add changelog for Godot 3.4.1 2021-12-17 00:20:42 +01:00
Rémi Verschelde
60c0e8299d Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@265b43b789.

(cherry picked from commit ed395c6b99)
2021-12-17 00:15:03 +01:00
Sam Lantinga
31f5b20d0f Fixed detecting the Valve Streaming Gamepad
Fixed the GUID, and compare the contents of the GUID, not just the pointers

(cherry picked from commit 8df0baf6f5)
2021-12-17 00:05:21 +01:00
Rémi Verschelde
67f8c5c4e8 Merge pull request #56002 from akien-mga/3.4-cherrypicks 2021-12-16 23:52:47 +01:00
bruvzg
5f7b91136f [Windows] Detect new Windows Terminal and disable unsupported set_console_visible code.
(cherry picked from commit 9aef3a93dd)
2021-12-16 23:05:54 +01:00
Sam Lantinga
3c752893c5 Fixed event spam when using the Nintendo Switch controller
There is no filtering on the Nintendo Switch Pro controller thumbstick, so there will frequently be events with very slight change. These are turned into "not pressed" events, which cancel "pressed" events from keys and buttons.

This change filters out up to 5% jitter, but it might be worth revisiting whether "not pressed" events should cancel "pressed" events.

(cherry picked from commit e5b0f86260)
2021-12-16 23:01:39 +01:00
kobewi
563de4c6f4 Mention what happens if find_node() fails
(cherry picked from commit e7722a9a7b)
2021-12-16 23:00:28 +01:00
Haoyu Qiu
f8387aafd4 Fix incompatible addition in auto exposure shader
(cherry picked from commit e614a0e9fc)
2021-12-16 23:00:05 +01:00
Yuri Roubinsky
8d13ed44fc [3.x] Prevent writing incorrect shader hints
(cherry picked from commit 25e24f2d05)
2021-12-16 22:59:51 +01:00
Haoyu Qiu
9cdaf19735 Fix Color.v integer assignment
(cherry picked from commit a16b06e7a4)
2021-12-16 22:59:18 +01:00
Haoyu Qiu
e28860d003 Fix indentations in class reference XMLs
(cherry picked from commit b225fec1de)
2021-12-16 22:59:04 +01:00
Fabio Alessandrelli
1d9993936c [Net] Fix WebRTC returning packets from peers too early.
Due to the async nature of WebRTC implementations, the multiplayer peer
could end up having queued packets from a given connection before it is
able to emit the "peer_added" signal.
This commit ensures that packets from peers which are not notified yet
are skipped by `get_packet` and `get_available_packet_count`.

(cherry picked from commit 9b8db7c63a)
2021-12-16 22:58:48 +01:00
Hugo Locurcio
b8c1453f49 Improve the ReflectionProbe class documentation
(cherry picked from commit 2fbf880912)
2021-12-16 22:58:29 +01:00
Hugo Locurcio
ecdd46ff22 Document sampling a TextureArray with sRGB -> linear conversion
This is required when sampling an albedo map from a texture array
in 3D. Otherwise, colors will look washed out.

(cherry picked from commit 491acf346d)
2021-12-16 22:58:10 +01:00
Hugo Locurcio
e058748d06 Document physics simulation being limited to 8 ticks per rendered frame
(cherry picked from commit bfe77b8fab)
2021-12-16 22:57:53 +01:00
Max Hilbrunner
adc6ec0abb Websockets: Fix buffer size checks in put_packet()
(cherry picked from commit 6a92a2e92d)
2021-12-16 22:57:16 +01:00
Haoyu Qiu
b90bec546d Make --doctool locale aware
* Adds `indent(prefix)` to `String`
* Moves the loading of tool/doc translation into
  `editor/editor_translation.{h,cpp}`
* Makes use of doc translation when generating XML class references, and
  setup the translation locale based on `-l LOCALE` CLI parameter.

The XML class reference won't be translated if `-l LOCALE` parameter is
not given, or when it's `-l en`.

(cherry picked from commit c11b1850c4)
2021-12-16 17:06:52 +01:00
Rémi Verschelde
f8b4412b51 i18n: Sync classref translations with current docs 2021-12-16 17:05:08 +01:00
Rémi Verschelde
9f838dbece i18n: Sync classref translations with Weblate 2021-12-16 15:10:54 +01:00
Rémi Verschelde
8a30e04fd1 i18n: Sync editor translations with Weblate 2021-12-16 15:09:10 +01:00
Rémi Verschelde
69585b0516 SceneTree: Document font oversampling, remove warnings
(cherry picked from commit 35b79284cc)
2021-12-14 17:33:21 +01:00
bruvzg
cd5ba99f35 [Windows] Open a new console window for the editor instances.
(cherry picked from commit 38c1706a7d)
2021-12-14 17:31:13 +01:00
Ryan Roden-Corrent
6a230c0cd3 Document how to autoscroll ScrollContainer.
It is not uncommon to want to scroll to the most recently added child of
a ScrollContainer (e.g. a chat box or activity log). This is a little
tricky, since `ensure_control_visible` will not work on a node on the
same frame as you add it. Let's at least document that you need to wait
until the next frame.

Relates to https://github.com/godotengine/godot-proposals/issues/3629.

Backport of https://github.com/godotengine/godot/pull/55609.

Co-authored-by: Yuri Sizov <pycbouh@users.noreply.github.com>
(cherry picked from commit 22fb04bddf)
2021-12-14 17:31:00 +01:00
lawnjelly
9d44a88e0b Visibility Notifier / Enabler classref mention Portals
Fixes the classref to show that these do not take account of occlusion except when using Portals.

(cherry picked from commit b8d3d97b6a)
2021-12-14 17:30:50 +01:00
Zae
22d8216780 Fix ViewportPreview upside-down in 3.x.
(cherry picked from commit 1426df66a8)
2021-12-14 17:30:37 +01:00
Hugo Locurcio
4dcce2cf30 Document Viewports rendering upside-down by default
This was fixed in `master`, but the default behavior can't be changed
in `3.x` for compatibility reasons.

(cherry picked from commit 6b26012284)
2021-12-14 17:30:27 +01:00
lawnjelly
c4d44e3826 Fix lighting_dirty flag bug
In rare circumstances, changing the geometry data attached to an instance, there was the opporunity for the lighting_dirty flag to get out of sync, which could lead to access to a stale light RID, and warnings or worse.

This PR fixes the problem by ensuring the lighting is always updated on the instance when first adding GeometryData.

(cherry picked from commit 26e93dc5c6)
2021-12-14 17:30:16 +01:00
Aaron Franke
e147fc3428 [3.x] Misc build system fixes
(cherry picked from commit 7bf7bd70ac)
2021-12-14 17:29:59 +01:00
raphaelazev
37a8a615e5 Added check to get_all_locales to avoid adding duplicate locales to array
(cherry picked from commit 82527df55c)
2021-12-14 17:29:20 +01:00
Haoyu Qiu
1230169ad1 Fix broken links in Class Reference
(cherry picked from commit b1153f8829)
2021-12-10 17:30:31 +01:00
Rémi Verschelde
6fb47a271f i18n: Remove deleted translations from PO files
Since we bundle the whole files in the editor binary, they actual impact the
binary size needlessly.

Automate it via `make merge`.
2021-12-10 11:49:04 +01:00
Rémi Verschelde
f4b3c3ff09 i18n: Sync classref translations with Weblate 2021-12-10 11:46:57 +01:00
Rémi Verschelde
fd86272ca0 i18n: Sync editor translations with Weblate 2021-12-10 11:39:33 +01:00
Rémi Verschelde
2813713be7 Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@348cfa347f.

(cherry picked from commit 03e105f677)
2021-12-10 11:19:21 +01:00
ne0fhyk
522c0dd6b6 Add support for configuring the xr hand tracking frequency mode
(cherry picked from commit 9d22ad3c9b)
2021-12-09 23:05:20 +01:00
Fredia Huya-Kouadio
605502a0d2 Enable configuration of the android:excludeFromRecents activity attribute.
(cherry picked from commit cfa81ff32a)
2021-12-09 23:03:42 +01:00
Fredia Huya-Kouadio
0ed8be946f Add configs to specify the min and target sdk versions.
(cherry picked from commit 65cfa28cce)
2021-12-09 23:02:13 +01:00
Francois Belair
77746ebed5 Remove extraneous return to LSP
(cherry picked from commit ad01201f34)
2021-12-09 22:08:21 +01:00
Cory Petkovsek
686780e289 Clears RIDs wherever they are freed by VisualServer or PhysicsServer and possibly reused. Fixes #53374
(cherry picked from commit 3d20218dae)
2021-12-09 22:02:00 +01:00
lawnjelly
cd371c45b7 Fix leaking environment RIDs in GLES2
This PR adds the code necessary to correctly free environments in GLES2, which was previously missing causing them to leak.

(cherry picked from commit 7134ef90bb)
2021-12-09 12:08:42 +01:00
Hugo Locurcio
c089e687cf Document that RigidBody angular velocity is in degrees per second
This will be changed to radians per second in Godot 4.0, but it can't
be changed in 3.x to preserve compatibility with existing projects.

(cherry picked from commit 2fe15124de)
2021-12-09 12:08:10 +01:00
Luis Sanchez
57927ff097 Fix files_dropped in HTML5 export.
(Ignore trailing slash when creating the temporary directory)

(cherry picked from commit 40f26cb260)
2021-12-09 12:06:14 +01:00
Raul Santos
a10372fe9a Expose ScriptEditor::edit to scripting
Exposes a method in `EditorInterface` to open scripts on a specified
line and column. This method handles if the internal or the external
editor should be used.

(cherry picked from commit 9535831866)
2021-12-09 12:06:12 +01:00
Rémi Verschelde
6e1bcf9390 Revert "Print a warning with unknown SCons variables to ease troubleshooting"
This reverts commit 60d1200a26.
2021-12-08 12:13:20 +01:00
bruvzg
fa3f071e21 [macOS] Fix crash handler not printing function names on M1 Macs.
(cherry picked from commit c8037ef2e5)
2021-12-08 10:38:43 +01:00
Univeous
42e3187560 Fix UI navigation with joysticks
(cherry picked from commit cf788ae684)
2021-12-07 12:16:05 +01:00
Yuri Sizov
e77c6aaba7 Sort and group theme properties in docs, improve formatting for theme and enums
(cherry picked from commit ebd8101546)
2021-12-07 12:14:59 +01:00
Raffaele Picca
d5aa00c2cb Fix for double use of seed in random Particle shader variables.
(cherry picked from commit 20568b9768)
2021-12-07 12:01:52 +01:00
Rémi Verschelde
14f92f9944 Revert "Fix particles emitting at old location"
(cherry picked from commit ee1877e63e)
2021-12-07 10:56:45 +01:00
lawnjelly
1b5832494a Fix incorrect RID cleanup in Rasterizers
Proper cleanup for GLES3 RIDs (preventing leak reports), and added missing destructor for RasterizerSceneGLES2.

(cherry picked from commit 6f4c0b95fc)
2021-12-07 09:14:40 +01:00
Francois Belair
97958e2a38 Prevent LSP adding signal func to non GDScripts
(cherry picked from commit 66f1b4bf66)
2021-12-07 09:14:32 +01:00
Haoyu Qiu
8ba1b94187 Fix EditorPlugin.remove_inspector_plugin() instance cleanup
(cherry picked from commit da94b61d09)
2021-12-07 09:14:32 +01:00
Manolis Papadeas
8c59dbda33 Fix link to the supported image formats in the Image class
It previously linked to this page which doesn't exist. https://docs.godotengine.org/en/latest/getting_started/workflow/assets/importing_images.html#supported-image-formats

Now, it should link here: https://docs.godotengine.org/en/latest/tutorials/assets_pipeline/importing_images.html#supported-image-formats

(cherry picked from commit c01c4c687b)
2021-12-07 09:14:31 +01:00
Hugo Locurcio
6ff6c503d0 Document SceneTreeTimer being freed automatically when elapsed
The note was present in the SceneTree `create_timer()` class
documentation, but not in the SceneTreeTimer class documentation.

(cherry picked from commit 796ea60d11)
2021-12-07 09:14:31 +01:00
Raffaele Picca
47f9a316ce Fix Ring-Axis parameter being always visible
(cherry picked from commit 2f69caaff3)
2021-12-07 09:14:31 +01:00
Vincent
2c7f6832ae AudioStreamMP3: expose loop properties to the editor
(cherry picked from commit 8263646f68)
2021-12-07 09:14:31 +01:00
Marcel Admiraal
ca3ab75697 Allow any kind of Mesh to be added to an EditorSpatialGizmo
(cherry picked from commit e0729b9c79)
2021-12-07 09:14:31 +01:00
kleonc
d3b0436cfb Clarify Transform.xform_inv docs
(cherry picked from commit c20d097636)
2021-12-07 09:14:31 +01:00
Yuri Sizov
3d0676a588 Allow scrolling theme preview when the control picker is active
(cherry picked from commit eb98210be4)
2021-12-07 09:14:31 +01:00
Raul Santos
34bdca36de Skip script property in remote object property list
(cherry picked from commit ba3e1d6ced)
2021-12-07 09:14:30 +01:00
kobewi
03bfedc67c Improve store_string() description
(cherry picked from commit 09b1fc1956)
2021-12-07 09:14:27 +01:00
Rémi Verschelde
5a06859bd7 Merge pull request #55673 from lawnjelly/rids_34_rasterizersync 2021-12-07 09:14:07 +01:00
lawnjelly
bf785444ff [3.4] Cutdown version of RID fixes to sync with 3.5 RID handles
The RID Handles PR introduced a couple of bug fixes, they are added here without the RID handles functionality in order to keep 3.4 and 3.x roughly in sync, allowing further fixes to RID lifetimes to be backported.
2021-12-06 16:43:27 +00:00
Yuri Sizov
fce6e13034 Make default/project theme wait for modules before initializing
(cherry picked from commit 33fb44223f)
2021-12-02 17:32:36 +01:00
Hugo Locurcio
e463d3daca Only print message for get_modified_time() failure when in verbose mode
This error message was often displayed for no good reason when PCK
files were loaded in the editor.

Since file modification dates are secondary metadata, it's not
very important if it can't be retrieved successfully anyway.

(cherry picked from commit 5acb8a253e)
2021-12-02 17:32:17 +01:00
Rémi Verschelde
ba277a0aa0 Revert "Expose Variant operator= to GDNative"
(cherry picked from commit 796f875870)
2021-12-02 11:47:50 +01:00
BimDav
521af55301 expose Variant operator= to GDNative
(cherry picked from commit 084b21c4a8)
2021-12-01 17:09:04 +01:00
Vincent
72709bb821 Fix crash when loading an invalid mp3 file
(cherry picked from commit 2d0068d1cb)
2021-12-01 17:01:31 +01:00
Yuri Sizov
2b9a1e0d2c Fix a crash in editor's script parent class check
(cherry picked from commit 62c34a6be7)
2021-12-01 14:36:24 +01:00
Rémi Verschelde
49285b2639 Remove editor splash screen with sponsors logo
The Godot Project Leadership Committe has decided to update the sponsoring
tiers so that the Platinum Sponsorship no longer includes a logo on the
editor splash screen.

This lets us reclaim the editor splash screen space for community-related
content instead of sponsors (e.g. a different community-designed splash
screen for each stable branch?).

Also removes two Platinum Sponsors whose sponsorship has expired earlier this
year.

(cherry picked from commit c283fce698)
2021-12-01 14:36:03 +01:00
Rémi Verschelde
187530de7d doc: Fixup Tabs reference after cherry-pick
(cherry picked from commit 6cf77f80b5)
2021-11-30 14:47:22 +01:00
Fabio Alessandrelli
4ce01a35be [HTML5] Fix multi-touch input handling.
The code to populate the input data for WebAssembly was incorrectly
overriding values when multiple touches were present due to wrong
indexing.

(cherry picked from commit 470496d8d4)
2021-11-30 12:21:28 +01:00
zacryol
7a79ee014d Clarify usage of TabContainer
Makes it more clear that TabBar is separate from TabContainer, and that the container draws the tabs itself.

(cherry picked from commit 5c645d510f)
2021-11-30 11:00:05 +01:00
bruvzg
726fe83b84 [macOS] Fix driver crash when enabling per-pixel transparency on M1 macs.
(cherry picked from commit f72cc71ebe)
2021-11-30 10:59:49 +01:00
ator-dev
43d23c3926 Prevent hidden tab close buttons from intercepting input [3.x]
(cherry picked from commit a8977006fd)
2021-11-30 10:59:32 +01:00
Haoyu Qiu
8e441d7c8b Fix potential infinite loop when connecting HTTPClient
(cherry picked from commit de1cdc2102)
2021-11-30 10:59:18 +01:00
kobewi
b646852765 Don't show tooltips for paused controls
(cherry picked from commit fe28e823c5)
2021-11-29 17:01:51 +01:00
bruvzg
552feba40b Fix RTL min/max line width calculation.
(cherry picked from commit 33b26e5cdc)
2021-11-29 16:45:32 +01:00
kobewi
97404dc612 Fix right alignment in RichTextLabel
(cherry picked from commit 820f7c9d15)
2021-11-29 16:45:22 +01:00
Eric
2e1646e484 Fix condition on 'jump to limits' logic
This is a fix for: #54856

(cherry picked from commit 7257bb6ad0)
2021-11-29 16:44:53 +01:00
Yuri Sizov
93fe9ecb97 Add methods to get position from column and line in TextEdit
(cherry picked from commit ba747e2a26)
2021-11-29 16:44:34 +01:00
Wilson E. Alvarez
07767fc676 Fix 'Add Node...' menu entries in AnimationNodeBlendTreeEditor
(cherry picked from commit 1a2153eb0a)
2021-11-29 16:44:21 +01:00
Red Headphone
d5bd37a1d1 progress_offset now added to reference cross draw function
(cherry picked from commit 8a6c6d5329)
2021-11-29 16:43:57 +01:00
Fabio Alessandrelli
35b7e86e6e [HTML5] Use compatibility function for glGetBufferSubData.
The "webgl/webgl2.h" include provides that function, but it's not
available in emscripten versions < 2.0.17 .

Since we need to support emscripten 1.39.9 (mono builds), this commit
adds a JS function in library_godot_display.js as a compatibility layer
for it, and implement glGetBufferSubData by funneling the call to that
function (so we don't have name collisions JS-side with recent emcc).

All those hacks are now moved to the platform directory instead of being
ifdefs inside the drivers implementations.

(cherry picked from commit bbfe054175)
2021-11-29 16:42:26 +01:00
Fabio Alessandrelli
8fb897ecfa [HTML5] Use absolute path for JS lib/pre/externs.
Ensure better compatibility when emcc which may run some tools from
different paths (e.g. closure compiler).

This fixes externs include issues with modern emcc using the closure
compiler.

(cherry picked from commit eaedc92c61)
2021-11-29 16:41:44 +01:00
zacryol
afa8844679 Fix description of Viewport find_world_2d() method.
The doc now states that the method searches for a World2D among ancestor Viewports as well, differentiating it from the get_world_2d() getter.

and also find_world_3d()

(cherry picked from commit 81c1d5197e)
2021-11-29 16:40:48 +01:00
Fabio Alessandrelli
8f0208af65 [HTML5] Fix focus (again) in Firefox's iframes.
This actually makes sense(?), when running inside an iframe the active
element might be our canvas, while the iframe itself is not active in
the parent window. Since we consume the event, the iframe does not get
focused in Firefox (but does in Chromium-based browsers), so we must
always call focus to handle such occasions.

(cherry picked from commit 63e2db2499)
2021-11-26 10:43:32 +01:00
Rémi Verschelde
7b0801c7fb Merge pull request #55326 from akien-mga/3.4-cherrypicks 2021-11-26 00:12:36 +01:00
kobewi
e203910804 Correct the doc about ease()
(cherry picked from commit 44e6655924)
2021-11-25 23:13:16 +01:00
kobewi
f5ea27e587 Mention that replace_by doesn't free the node
(cherry picked from commit 58a3ea5453)
2021-11-25 23:13:16 +01:00
bruvzg
b8f888a43b Add Input.is_physical_key_pressed method.
(cherry picked from commit 9877d91c4a)
2021-11-25 23:13:15 +01:00
Hugo Locurcio
5555a69b5e Document the engine's use of internal groups in Node
(cherry picked from commit f8d9e4afdb)
2021-11-25 23:13:15 +01:00
Gergely Kis
f2ef3e67a1 Fix debug build for iphone
printf() does not have a version that accepts std::string
as format string parameter.

(cherry picked from commit a1a3e79ea5)
2021-11-25 23:13:15 +01:00
kobewi
b8bda1fb67 Clarify get_indexed in relation to Nodes
(cherry picked from commit 4ea6709558)
2021-11-25 23:13:15 +01:00
kobewi
4876686cf7 Improved some editor checkboxes
(cherry picked from commit 5dc7346ab4)
2021-11-25 23:13:15 +01:00
Hugo Locurcio
60d1200a26 Print a warning with unknown SCons variables to ease troubleshooting
When disabling specific modules, misspellings can occur. Additionally,
when switching between the `3.x` and `master` branches frequently,
it's possible to forget about renamed modules such as `lightmapper_cpu`
versus `lightmapper_rd`.

(cherry picked from commit 69b2d3f791)
2021-11-25 23:13:15 +01:00
Haoyu Qiu
6516f26948 Fix crash when executing PackedDataContainer._iter_init
(cherry picked from commit 8253a45a1a)
2021-11-25 23:13:15 +01:00
Haoyu Qiu
c6927a9790 Fix Theme Editor crash when clicking the element picker
(cherry picked from commit abd41dedb0)
2021-11-25 23:13:15 +01:00
kleonc
ac56f95685 TileSetEditor Fix selecting next/previous subtile
(cherry picked from commit 97e9165de4)
2021-11-25 23:13:14 +01:00
jitspoe
b9d6d54746 Fix crash when exporting gltf mesh that has no skin.
(cherry picked from commit 734b4a46bc)
2021-11-25 23:13:14 +01:00
lawnjelly
07e5022cce BVH - add option for expanded AABBs in leaves
This PR adds a define BVH_EXPAND_LEAF_AABBS which is set, which stores expanded AABBs in the tree instead of exact AABBs.

This makes the logic less error prone when considering reciprocal collisions in the pairing, as all collision detect is now taking place between expanded AABB against expanded AABB, rather than expanded AABB against exact AABB.

The flip side of this is that the intersection tests will now be less exact when expanded margins are set.

All margins are now user customizable via project settings, and take account of collision pairing density to adjust the margin dynamically.

(cherry picked from commit 211dc8cd2d)
2021-11-25 23:13:14 +01:00
kobewi
f667afc8b2 Show tooltips even when paused or time_scale is 0
(cherry picked from commit 5b55599211)
2021-11-25 23:13:14 +01:00
Haoyu Qiu
58dc743a2c Allow toggle TextEdit bookmark gutter
(cherry picked from commit eb6f74855f)
2021-11-25 23:13:14 +01:00
Marcel Admiraal
fab0c48c80 Fix Android get_screen_orientation() not returning valid values
(cherry picked from commit 05744ee0e2)
2021-11-25 23:13:14 +01:00
Fredia Huya-Kouadio
2a12784498 Add support for OpenXR export configurations.
(cherry picked from commit 9c50bcabed)
2021-11-25 23:13:14 +01:00
clayjohn
5e95d317e6 Update CanvasItem when MultiMesh instance transform changes
(cherry picked from commit b54d4a93be)
2021-11-25 23:13:13 +01:00
Rémi Verschelde
1b3c02eba6 libvorbis: Sync with upstream 1.3.7
Fixes various bugs, including several ones with security relevance.

Changes: https://github.com/xiph/vorbis/releases/tag/v1.3.7
(cherry picked from commit 28ad2e8c72)
2021-11-25 23:13:13 +01:00
Rémi Verschelde
fee4142425 libogg: Update to upstream 1.3.5
Mostly a cosmetic update, we were already on a commit close to what
ended up being tagged as 1.3.5. Adds an extra buffer overflow fix.

(cherry picked from commit 77efd406bf)
2021-11-25 23:13:13 +01:00
Rémi Verschelde
9d6e01a5a3 certs: Sync with Mozilla bundle as of Nov 1, 2021
edd798d35a
(cherry picked from commit 07f8996b1c)
2021-11-25 23:13:13 +01:00
Fabio Alessandrelli
2a4efa3bcd [HTML5] Add checks to Gamepad API events.
In some conditions the events might be generated even when the `gamepad`
object is not accessible due to Security Context requirements.
This commit adds a check to avoid firing the handler in those cases.

(cherry picked from commit 91dbc288cc)
2021-11-25 23:13:13 +01:00
Fabio Alessandrelli
d70461b27e [HTML5] Fix input not focusing canvas.
mousedown and touchstart should focus the canvas to ensure correct
application lifecycle.

(cherry picked from commit f13c7fc83e)
2021-11-25 23:13:13 +01:00
lawnjelly
1698dbe30e BVH - detect shrinkage within expanded bounds
Although the expanded bounds were working in normal use, for moving and growing objects, there was one case which was not dealt with properly - significant shrinkage of exact bounds within an expanded bound.

This PR detects significant shrinkage and forces a new expanded bound to be created.

(cherry picked from commit ed47570266)
2021-11-25 23:13:12 +01:00
David Sichma
5eb644fab5 Fixed pre-commit-black file extensions
Now hook can find .py files.

(cherry picked from commit 3fe10c7e9d)
2021-11-25 23:13:12 +01:00
Giwayume
fd558de972 Fix edge case where 1px cut off from right of image
Backward loop should remain -1

(cherry picked from commit 88c1411051)
2021-11-25 23:13:12 +01:00
Giwayume
27f0a9547f Fix texture atlas generation when source sprite is larger than generated atlas
(cherry picked from commit 0093bda767)
2021-11-25 23:13:12 +01:00
lawnjelly
100c6d8ccd BVH - fix typename compiler warning
Some versions of microsoft compiler flag a warning that they want a typename keyword in templates in more places than clang / gcc.

(cherry picked from commit 9315b4fb51)
2021-11-25 23:13:12 +01:00
Will Jordan
e2cf151560 Fix crash on macOS (AS) when dualshock4 is removed
(cherry picked from commit 283e31a3e2)
2021-11-25 23:13:07 +01:00
kobewi
0a519fed25 Fix TileSet editor workspace breaking
(cherry picked from commit f3d5ef6f7b)
2021-11-25 21:04:14 +01:00
kobewi
cce91ce6e0 Mention how to add margins to Button's icon
(cherry picked from commit 2341c7bbd9)
2021-11-25 21:03:42 +01:00
Rémi Verschelde
f737ed4da0 i18n: Sync classref translations with Weblate 2021-11-19 09:54:07 +01:00
Rémi Verschelde
7ca1be5f37 i18n: Sync editor translations with Weblate 2021-11-19 09:48:42 +01:00
PouleyKetchoupp
e6b48769de Fix physics BVH pairing for teleported or fast moving objects
Updating the broadphase to find new collision pairs was done after
checking for collision islands, so it was working in most cases due to
the pairing margin used in the BVH, but in case of teleported objects
the narrowphase collision could be skipped.

Now it's done before checking for collision islands, so we can ensure
that broadphase pairing has been done at the same time as objects are
marked as moved so their collision can be checked properly.

This issue didn't happen in the Octree/HashGrid because they do nothing
on update and trigger pairs directly when objects move instead.

(cherry picked from commit e9fdf3e61f)
2021-11-16 21:23:39 +01:00
Rémi Verschelde
387876b592 Merge pull request #55012 from akien-mga/3.4 2021-11-16 09:18:17 +01:00
Lenny Critchley
0ce0af221a Add error condition for Control EXIT_TREE notif
(cherry picked from commit 3d1249a520)
2021-11-15 23:36:23 +01:00
robfram
2a3925136e Only visible TileMaps should add light occluders
(cherry picked from commit cf9220b7d5)
2021-11-15 23:33:26 +01:00
robfram
6247687be8 Fix particles emitting at old location
(cherry picked from commit 91b7c80d28)
2021-11-15 23:32:24 +01:00
Hugo Locurcio
a49e3bb449 Document low performance when using SurfaceTool.append_from() in thread
(cherry picked from commit f39375d315)
2021-11-15 22:47:24 +01:00
lawnjelly
7de023e192 Portals - Allow user to set roaming expansion margin
Previously a crude metric was used to decide on the roaming expansion margin, but it created unexpected results in some scenarios. Instead this setting is exposed to the user via the RoomManager, allowing them to tailor it to the world size, room sizes, roaming objects sizes and the speeds of movement.

(cherry picked from commit 788f075b44)
2021-11-15 22:45:57 +01:00
Hugo Locurcio
fc749f7f8b Improve the GIProbe and BakedLightmap class documentation
This adds information about performance and procedural generation.

(cherry picked from commit 194d45f11d)
2021-11-15 22:37:51 +01:00
Fabio Alessandrelli
fd8ae8ce39 [HTML5] Call glGetBufferSubData directly from C++.
Remove leftover EM_ASM causing problems with gdnative builds.

(cherry picked from commit 340ecb93be)
2021-11-15 22:37:36 +01:00
Hugo Locurcio
0b66d80b61 Fix outdated SCons macOS build message
The message incorrectly stated that the minimum supported version
is 10.9, when it is in fact 10.12.

(cherry picked from commit fde50db399)
2021-11-15 22:37:18 +01:00
Rémi Verschelde
63b5d5de64 Modules: Make sure to include modules_enabled.gen.h where needed
Fixes #51677.

Co-authored-by: Arkadiusz Marcin Kołek <aksoftware91@gmail.com>
(cherry picked from commit 6f4858f184)
2021-11-15 22:36:02 +01:00
Benjamin Armstrong
4f2993b124 Clarify how 'audio/driver/output_latency' project setting works
(cherry picked from commit 1e485a7da8)
2021-11-15 22:35:33 +01:00
Rémi Verschelde
9868850a9f Rect2: Clarify docs for has_point excluding bottom and right borders
Improve tests, as well as documentation for `expand`.

(cherry picked from commit 36c4451a7b)
2021-11-15 22:35:01 +01:00
boruok
0a2dadb639 fixed typo in NavigationPolygon doc
(cherry picked from commit 30d22305e1)
2021-11-15 22:34:11 +01:00
Hugo Locurcio
89cefee947 Swap rest pose actions in the Skeleton2D editor
The texts were changed before, but the actions weren't swapped around.
This led to unexpected behavior.

(cherry picked from commit 4ff1431993)
2021-11-15 22:33:49 +01:00
PouleyKetchoupp
f9710ecb5e Fix test_move reporting collision when touching another body
Reporting rest collision information is needed for move_and_collide and
move_and_slide so floor detection can be done properly, but in the case
of just testing the motion for collision, it makes sense to return false
if the body is able to move all along the path without being stopped.

Updated the logic in test_move and clarified the documentation for
test_move and move_and_collide.

(cherry picked from commit 1560c8b5aa)
2021-11-15 22:33:16 +01:00
PouleyKetchoupp
7344beafdd Fix errors in KinematicBody when floor is destroyed or removed
In all physics servers, body_get_direct_state() now silently returns
nullptr when the body has been already freed or is removed from space,
so the client code can detect this state and invalidate the body rid.

In 2D, there is no change in behavior (just no more errors).

In 3D, the Bullet server returned a valid direct body state when the
body was removed from the physics space, but in this case it didn't
make sense to use the information from the body state.

(cherry picked from commit b93aeec4a2)
2021-11-15 22:32:53 +01:00
Mark Riedesel
619c1e506e Fix glTF cubic spline track interpolation incorrectly reporting times/values size mismatch (3.4 specific)
(cherry picked from commit 999bba6916)
2021-11-15 22:32:26 +01:00
Hugo Locurcio
1f35876fd5 Remove hash symbol in front of opcode error messages in GDScript
The hash symbol creates spurious issue references on GitHub if
the message is posted outside a code block, which means some issues
have a lot more references than originally intended.

(cherry picked from commit 63d214f04b)
2021-11-15 22:31:32 +01:00
Hugo Locurcio
96b32740d3 Print the number of PulseAudio input channels when in verbose mode
This is useful information to have for troubleshooting, and it's
said to sidestep a possible race condition issue that breaks
microphone recording on Linux.

(cherry picked from commit de912a8bd9)
2021-11-15 22:30:57 +01:00
Ryan Roden-Corrent
a9a3702d69 Clamp rotation for up/down orbiting shortcuts.
This prevents the viewport from going upside-down.

This was suggested at:
https://github.com/godotengine/godot/pull/51984#issuecomment-948614191:

> For 3.4, I think we can just clamp the angle value when using the
> camera orbiting shortcuts. We can investigate what to do with panning
> and freelook in 3.5 and 4.0.

(cherry picked from commit 3bd7c4f2a9)
2021-11-15 22:30:27 +01:00
Omar El Sheikh
20e7a4095e Fix Vertex Attribute Specification Octahedral
For octahedral compressed normals/tangents, we use vec4 in the shader
regardless of whether a normal/tangent does/doesn't exist

For the case where we only have a normal vector, we need to specify that
there are only two components being used when calling glVertexAttrib

Before we would always specify that there were 4 components, and used
offsets to determine where in the vertex buffer to read data from but
this doesn't work on all platforms

(cherry picked from commit 8a43b222c7)
2021-11-15 22:28:23 +01:00
Ignacio Roldán Etcheverry
b63f1fc603 C#: Don't use ActivityThread to determine Android nativeLibraryDir
(cherry picked from commit 690bf12c4c)
2021-11-15 22:27:38 +01:00
kobewi
0f422ad35b Fix editor saving blank scenes (for real)
(cherry picked from commit 8144ac79cf)
2021-11-15 22:26:45 +01:00
bruvzg
4574b3ebeb [iOS export] Capture and display xcodebuild output.
(cherry picked from commit 2e74bacf17)
2021-11-15 22:25:35 +01:00
Brian Semrau
1cbc17247c Prevent obj importer from printing misleading error
(cherry picked from commit bd0d15c5be)
2021-11-15 22:24:45 +01:00
Josh Jones
a19040d2de Fix request headers being included in response.
(cherry picked from commit 7df8bd6b85)
2021-11-15 22:24:22 +01:00
bruvzg
a4b736606f [Export] Read and ZIP project files in 16K chunks instead of reading the whole file at once.
(cherry picked from commit c8f3dd776b)
2021-11-15 22:23:59 +01:00
Julian Adamse
5145c1d783 Fix the volume calculation for cylinders
(cherry picked from commit 03903fdeec)
2021-11-15 22:23:17 +01:00
Kongfa Waroros
5f27fd458c Fix little typos in 3.x doc
(cherry picked from commit 0d852bf5a6)
2021-11-15 22:22:45 +01:00
PouleyKetchoupp
c2a108fe7d Expose intersect_point in 3D physics server
Also cleaned a few things in the documentation for 2D.

(cherry picked from commit fc2bd63ca0)
2021-11-15 22:22:31 +01:00
bruvzg
71eeecfaf0 [macOS] Enable multithreaded OpenGL engine flag when using multithreaded VisualServer.
(cherry picked from commit 28d7b585c9)
2021-11-15 22:22:06 +01:00
Ibrahn Sahir
1c22bfdb37 AudioDriverPulseAudio: move Vector Cow access outside tight loop.
Replaced some in-loop uses of Vector.write with an out of loop ptrw,
to avoid a lot of superfluous reads on the CowData ref count.

(cherry picked from commit 47496a55bc)
2021-11-15 22:21:36 +01:00
Rémi Verschelde
e5d6954505 GDScript: Support multiline indexing with []
Fixes #35417.

(cherry picked from commit 92664f03a9)
2021-11-15 22:21:16 +01:00
Bartłomiej T. Listwon
bdf7a0294b Don't ignore the type mismatch in setter function
(cherry picked from commit 5a7bd296af)
2021-11-15 22:20:46 +01:00
Rémi Verschelde
489b49c6b8 doc: Remove obsolete files 2021-11-05 16:11:18 +01:00
Rémi Verschelde
cae697e189 CI: Change BASE_BRANCH to 3.4 2021-11-05 15:01:27 +01:00
Rémi Verschelde
8634985347 Bump version to 3.4.1-rc 2021-11-05 15:00:23 +01:00
Rémi Verschelde
206ba70f4b Bump version to 3.4-stable \o/
After the decision to continue feature development for the `3.x` branch
alongside the `master` branch for Godot 4.0, we released 3.3-stable in
April 2021.

6 months and 2000 commits later, Godot 3.4 is another feature-packed milestone
for Godot 3, with a ton of improvements and fixes to make it a great option
for use in production while we wait for Godot 4.0!

A big thankyou to all contributors who work tirelessly on our two parallel
development branches and made this stable 3.4 release possible.
2021-11-05 01:06:19 +01:00
Rémi Verschelde
e6613ca9d4 Add some more changelog entries for 3.4
Selected from the 3.3.x changelogs.
2021-11-05 00:52:27 +01:00
Hugo Locurcio
231883bdcc Improve description for BitMap.grow_mask()
(cherry picked from commit e3d23d444c)
2021-11-04 19:55:56 +01:00
Gustavo Beltrão Braga
27ec7e6ed5 Change description of relative field in input drag event.
(cherry picked from commit 76c50928a1)
2021-11-04 16:35:20 +01:00
Rémi Verschelde
f734a2c915 Merge pull request #54582 from m4gr3d/add_manifest_min_and_target_sdk_version_3x 2021-11-04 13:52:51 +01:00
Rémi Verschelde
2169d65799 Merge pull request #54576 from akien-mga/3.x-changelog-3.4
Add changelog for Godot 3.4
2021-11-04 09:49:00 +01:00
Fredia Huya-Kouadio
724ef83971 Add default minSdkVersion and targetSdkVersion in the AndroidManifest.xml file 2021-11-03 21:49:22 -07:00
Rémi Verschelde
d155f0a8a0 Add changelog for Godot 3.4 2021-11-04 00:28:44 +01:00
Rémi Verschelde
7afb784269 Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@322aac4bb7.

Also improve parser errors to allow identifying the problematic mappings.

(cherry picked from commit 4b247e7ffa)
2021-11-03 21:32:53 +01:00
Jake Young
feecd894d8 Update my name on author file
(cherry picked from commit 0b734bce4c)
2021-11-03 21:31:11 +01:00
PouleyKetchoupp
ec0dc93083 Fix errors with invalid bone node path in Polygon2D
NodePath properties are designed to be relative to the given node, so
validity checks are failing in the editor for Polygon2D nodes, which are
relative to the Skeleton2D node rather than the Polygon2D node.

Fixed by saving bone paths as String properties instead of NodePath.

Shouldn't cause a difference for performance since NodePath properties
are technically saved as String anyway.

(cherry picked from commit 8d9619ad46)
2021-11-03 17:31:10 +01:00
Rémi Verschelde
fb8834bb91 Update AUTHORS and DONORS list
New contributors added to AUTHORS:
@briansemrau, @Duroxxigar, @williamd67

Thanks to all contributors and donors for making Godot possible!

(cherry picked from commit 300286ea08)
2021-11-03 16:16:10 +01:00
Rémi Verschelde
0b694eb8e7 i18n: Sync classref translations with Weblate
German (de) is now above the threshold for inclusion.
2021-11-03 15:00:52 +01:00
Rémi Verschelde
74bcf37f90 i18n: Sync editor translations with Weblate
Latvian (lv) is now above the threshold for inclusion.
2021-11-03 14:56:44 +01:00
Rémi Verschelde
d04368a41b CI: Update black to 21.10b0
No formatting changes on our code compared to 20.8b1.

(cherry picked from commit 5116f32db4)
2021-11-03 14:53:05 +01:00
Rémi Verschelde
a05aefb74b Merge pull request #54512 from pycbouh/meshtool-fix-bones-crash-3.x 2021-11-02 15:20:12 +01:00
Yuri Sizov
ec15227be8 Prevent MeshDataTool from crashing due to invalid bones/weights arrays 2021-11-02 16:52:36 +03:00
Rémi Verschelde
4b7d1aed66 Merge pull request #54510 from pycbouh/lightmapper-respect-maximum-size-3.x 2021-11-02 14:18:22 +01:00
Yuri Sizov
d764e1fae7 Fix maximum allowed size atlas in CPU lightmapper 2021-11-02 15:50:50 +03:00
Rémi Verschelde
1a1a450616 Merge pull request #54507 from pycbouh/editor-resource-picker-edit-3.x 2021-11-02 13:31:55 +01:00
Yuri Sizov
5ff11a2c5c Add a flag to EditorResourcePicker to differentiate selection contexts 2021-11-02 14:15:14 +03:00
Chained Lupine
44a532e99e Fix crash in ResourceImporterTexture::_save_stex if webp disabled
Fixes #51535.

(cherry picked from commit 79d4edfca7)
2021-11-02 09:28:46 +01:00
Rémi Verschelde
e4996887ca Merge pull request #48625 from The-O-King/compression_options 2021-11-02 08:58:22 +01:00
Rémi Verschelde
2c47e33905 Merge pull request #54313 from nekomatata/x11-fix-input-delay-3.x 2021-11-02 08:53:06 +01:00
Rémi Verschelde
b8a70794de Merge pull request #54503 from lyuma/fix_override_materials_3.x
[3.x] glTF: Fix override materials and non-empty arrays
2021-11-02 07:56:29 +01:00
Lyuma
e575b27b15 3.x backport glTF: Fix override materials and non-empty arrays
Keep track of MeshInstance and GeometryInstance override materials in the GLTFMesh object.
Ensure all arrays are non-empty to conform with "minItems":1 in glTF spec.
2021-11-01 23:40:12 -07:00
Rémi Verschelde
bf59549f68 Merge pull request #54394 from robfram/freebsd-llvm-no-atomic-lib 2021-11-01 22:30:13 +01:00
Omar El Sheikh
203295f17d Added Mesh Compression Import Options
Fleshed out the "Optimize Mesh" options found in the mesh import UI
Gave a checkbox to every vertex attribute that can be compressed

Surfaced option to enable/disable Octahedral compression for
normal/tangent vectors

Also surfaces the vertex position compression option which previously
inaccessible because the defaults did not compress vertex positions

Supports all current importers (obj, fbx, collada, gltf)
2021-11-01 12:54:28 -04:00
Rémi Verschelde
8580cfb122 EditorSpinSlider: Add arg name for _value_input_gui_input binding 2021-11-01 15:02:44 +01:00
Rémi Verschelde
18c185bd42 Merge pull request #54474 from bruvzg/monterey_exec_hack 2021-11-01 14:12:54 +01:00
bruvzg
ed25a160ea [macOS] Always execute editor instances using NSWorkspace to ensure app window is registered and activated correctly. 2021-11-01 11:33:30 +02:00
Michael Alexsander
d5adb9e4b4 Fix uninteractable singular tab in TabBar
(cherry picked from commit 96fdb030ec)
2021-10-31 23:10:47 +01:00
Rémi Verschelde
92aede4e33 Merge pull request #54424 from raulsntos/csharp-exports-ii-3.x
[3.x] Ensure C# script properties are added to the end
2021-10-31 09:10:56 +01:00
Raul Santos
21f68e7bdb Ensure C# script properties are added to the end
Ensures that the `get_property_list` and `get_script_property_list`
methods push the script properties to the end of the given list, this
prevents the script property from appearing after the script variables.
2021-10-30 16:55:21 +02:00
robfram
2c8014e565 Exclude atomic lib under FreeBSD using LLVM 2021-10-29 18:24:57 +02:00
Rémi Verschelde
ecedc7df0b Merge pull request #54197 from clayjohn/GLES3-irradiance-map
Fudge irradiance map lookup to avoid precision issues
2021-10-29 14:11:53 +02:00
Rémi Verschelde
f0223ea8d3 CI: Update to clang-format 13 using LLVM repo
(cherry picked from commit f42ef8d5f9)
2021-10-28 17:30:52 +02:00
Rémi Verschelde
14ef65e49b Merge pull request #54348 from akien-mga/3.x-clang-format-dont-align-operands 2021-10-28 15:43:15 +02:00
Rémi Verschelde
87c80f529f clang-format: Enable BreakBeforeTernaryOperators
clang-format keeps breaking the way it handles break *after* ternary operators,
so I give up and go with the only style they seem to actually test.
2021-10-28 14:50:33 +02:00
Rémi Verschelde
1b65550ec7 clang-format: Various fixes to comments alignment from clang-format 13
All reviewed manually and occasionally rewritten to avoid bad auto formatting.
2021-10-28 14:50:32 +02:00
Rémi Verschelde
42d385b312 clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 13:23:38 +02:00
Aaron Franke
8723df767b Merge pull request #54319 from aaronfranke/3.x-riscv-server
[3.x] Add RISC-V to "server" platform
2021-10-27 15:48:58 -04:00
Aaron Franke
18b1de1983 [3.x] Add RISC-V to "server" platform 2021-10-27 13:57:37 -05:00
Rémi Verschelde
187f293189 Merge pull request #54154 from bjauny/fix_areanotification 2021-10-27 20:38:55 +02:00
Bastien JAUNY
a6ca61797c Checking validity of world reference before using it. Fix #54094. 2021-10-27 19:32:44 +02:00
PouleyKetchoupp
874c9ae89a Fix input events random delay on X11
The new system based on a thread gathering events from the X11 server
was causing delays in some scenarios where some events have just been
missed at the time of processing and we're waiting for a whole frame to
check them again.

Solved by flushing again and checking for pending events at the
beginning of the process loop, in addition to events already gathered
on the event thread.
2021-10-27 10:19:16 -07:00
Rémi Verschelde
23955fc282 Merge pull request #54262 from raulsntos/csproj-globbing-3.x 2021-10-26 21:56:58 +02:00
Rémi Verschelde
5d0ec1779d Merge pull request #54272 from pycbouh/gdscript-ignore-groups-completion-3.x 2021-10-26 20:02:01 +02:00
Yuri Sizov
b3fc278dcf Ignore property groups and categories in GDScript code completion 2021-10-26 20:01:49 +03:00
Rémi Verschelde
8c04e10298 Merge pull request #54271 from nekomatata/fix-bvh-recheck-pairs-crash 2021-10-26 18:49:31 +02:00
Rémi Verschelde
c7f4e1d5dd Android: Properly validate godot_project_name_string for Android special chars
Fixes #52659.

(cherry picked from commit 9204a3a50e)
2021-10-26 18:23:47 +02:00
Max Hilbrunner
e29126914d Save all 64 bits of get_ticks_msec() in more cases
(cherry picked from commit 5dc02eb8b0)
2021-10-26 18:23:31 +02:00
Raul Santos
ced4f3519d Avoid modifying csproj globbing includes
Check if the found globbing include already matches the new path on
moving scripts to avoid modifying users' csproj files.
2021-10-26 18:21:19 +02:00
PouleyKetchoupp
ba424a22d3 Fix crash due to recheck pair process in BVH broadphase
The pair user data wasn't correctly updated in the BVH from the check
pair callback.

This could lead to crashes when the check caused logical unpairing in
physics, then actual unpairing from the broadphase occured and the
physics server tried to delete an already deleted pointer.
2021-10-26 09:17:36 -07:00
Rémi Verschelde
fa3fc6ff0d Merge pull request #54264 from pycbouh/controls-button-font-focus-3.x 2021-10-26 17:34:19 +02:00
Yuri Sizov
7fe0dab69b Add focus font color to Button and derivatives 2021-10-26 17:40:51 +03:00
skyace65
c1709e8177 Improve area method descriptions
(cherry picked from commit 4dd8ab745a)
2021-10-26 13:34:36 +02:00
Aaron Franke
69e90daae3 Rename "makerst.py" to "make_rst.py"
(cherry picked from commits 8f05e26198
and cce7797a75)
2021-10-26 13:34:36 +02:00
kobewi
cef504b955 Fix multiple definitions of Listener2D
(cherry picked from commit 6b68445e4d)
2021-10-26 13:34:33 +02:00
Rémi Verschelde
b6e3d73337 Merge pull request #54258 from BastiaanOlij/fix_arvr_resize_issue 2021-10-26 13:34:26 +02:00
Bastiaan Olij
3bd6088663 Only update render target directly if ARVR mode is off 2021-10-26 21:40:25 +11:00
Rémi Verschelde
656894d596 Merge pull request #54250 from lyuma/gltf_padding_fix_3.x 2021-10-26 08:32:23 +02:00
Lyuma
e49f8c5823 3.x: Fix validation errors due to chunk padding and empty skins.
GLB chunk padding length calculation was backwards and missing for the BIN chunk.
Fixed error caused by "skins":[] when no skins were present.
Finally, encode animations before textures to avoid accessor misalignment due to texture byteLength.
2021-10-25 21:17:13 -07:00
Rémi Verschelde
221beb8152 Merge pull request #54241 from akien-mga/3.x-control-rename-input-group 2021-10-25 22:24:15 +02:00
Rémi Verschelde
8ff437822a Control: Rename Input group that confuses GDScript completion
Fixes #47926.
2021-10-25 22:07:20 +02:00
Rémi Verschelde
72427737ae mbedtls: Backport PR 4819 to fix certs parsing speed
Fixes engine startup time regression described here:
https://github.com/godotengine/godot/issues/43351#issuecomment-847466783

(cherry picked from commit 52a535c030)
2021-10-25 21:16:04 +02:00
Rémi Verschelde
6e141e8688 Merge pull request #54229 from akien-mga/3.x-ios-disable-high-float 2021-10-25 20:57:48 +02:00
Rémi Verschelde
828898867f Merge pull request #54230 from Calinou/doc-image-format-r8-gles2 2021-10-25 17:05:49 +02:00
Hugo Locurcio
059ba23f72 Document Image.FORMAT_R8 stores in alpha channel instead in GLES2 2021-10-25 16:52:58 +02:00
Rémi Verschelde
bc0d18d8d5 GLES2: Disable half float on iOS via platform override
This can be changed back by setting
`rendering/gles2/compatibility/disable_half_float.iOS` to false.

Fixes #31907.
2021-10-25 16:25:56 +02:00
Zae
a1b282cc16 Fix unexpected crashes in notification
(cherry picked from commit 924c2078da)
2021-10-25 11:16:59 +02:00
Rémi Verschelde
d09b33dab2 clang-format: Enable --Wno-error=unknown for compat with older versions
This prevents errors when encountering options which have been defined in newer
versions of clang-format, and are invalid in the YAML for the old version.

Bump minimum supported clang-format version to 12 (where `--Wno-error=unknown`
was added).

Use clang-format 12 on CI (13 is not available yet on the Ubuntu 20.04 images).

(cherry picked from commit 55d05565d0)
2021-10-25 11:16:13 +02:00
Rémi Verschelde
fe0cbe6e53 Merge pull request #54170 from miraz12/fix-color-picker-notification33-crash 2021-10-25 11:15:52 +02:00
Anton Christoffersson
35eeafdb0c Fixes crash in caused by calling ColorPickerButton.propagate_notification(33) 2021-10-25 08:47:44 +02:00
Rémi Verschelde
c3bdcb4516 Merge pull request #53706 from Calinou/action-editor-list-physical-key-first 2021-10-24 23:33:44 +02:00
Rémi Verschelde
63d5f9316b Merge pull request #54199 from raulsntos/csharp-exports-3.x 2021-10-24 22:27:09 +02:00
Raul Santos
da419bbeed Keep order for C# exported members 2021-10-24 21:14:20 +02:00
clayjohn
3f03b60718 Fudge irradiance map lookup to avoid precision issues 2021-10-24 12:03:54 -07:00
Marcel Admiraal
4febf69f2a Fix Gradle builds not excluding excluded tasks
(cherry picked from commit f80cb4dffa)
2021-10-24 01:43:44 +02:00
Rémi Verschelde
62f56af694 Merge pull request #54146 from akien-mga/3.x-cherrypicks 2021-10-23 18:34:23 +02:00
Rémi Verschelde
5a48cba649 Merge pull request #54152 from bjauny/fix_treenotification 2021-10-23 18:33:32 +02:00
Bastien JAUNY
e74db1de23 #54143 Fix potential null pointer dereference 2021-10-23 14:47:02 +02:00
Rémi Verschelde
4010bb9af0 i18n: Sync editor translations with Weblate 2021-10-23 12:28:40 +02:00
Robin Arys
0bbdfd420a Fix newly created files not sorted correctly
(cherry picked from commit e69d40cad9)
2021-10-23 12:12:36 +02:00
Robin Arys
5bc44b53f6 Fix support for multiple base types in the quick load dialog
(cherry picked from commit bb7888debb)
2021-10-23 12:09:23 +02:00
bruvzg
ea844046c3 [macOS] Add entitlements required by OIDN JIT for the editor build.
(cherry picked from commit 53cb556841)
2021-10-23 12:04:35 +02:00
Rémi Verschelde
f5e6a2624c JS: Bump ansi-regex version for linter
Silences warning about a moderate security vulnerability (which doesn't affect us).

(cherry picked from commit 5f7bbc2b57)
2021-10-23 12:04:17 +02:00
Rémi Verschelde
093919196a clang-format: Sync config with LLVM 13
Disable minimum amount of spaces in comment prefix for now, as it otherwise
modifies the whole codebase. That's something we probably want to use as it
matches our convention, but we should look into fully converting these
comments to our style guide at the same time.

(cherry picked from commit 63544c3a9d)
2021-10-23 12:03:51 +02:00
Pedro J. Estébanez
beb99fe54b Expose Input::flush_buffered_events()
(cherry picked from commit 6dc3fae201)
2021-10-23 12:02:48 +02:00
Pawel Lampe
cc0479a17e Fix exit code for --script --check-only, fixes #54087
this commit makes godot executable to return zero exit code
once a valid script is passed via --script during --check-only

(cherry picked from commit 75ae3164a4)
2021-10-23 12:00:28 +02:00
Sean Kim
378ca68dc1 Fix potential nullptr dereference in CanvasLayer
* Changed another instance of ERR_FAIL_COND in the same file to
  ERR_FAIL_NULL_MSG instead.
* Checked for potential access of the viewport pointer elsewhere in same
  file.

Fixes #54098

(cherry picked from commit 497b00a937)
2021-10-23 11:57:52 +02:00
Kemikal1
fa2feb9bec Change the unreacheable return value of shape_find_owner()
(cherry picked from commit 563d3dbf94)
2021-10-23 11:57:10 +02:00
kobewi
f0dabe4ac5 Fix MeshInstance2D rect
(cherry picked from commit 1a347e9cf3)
2021-10-23 11:54:55 +02:00
Robin Arys
0dcf1e3a45 Fix Tabs crash where it still tries to detect the clicked tab even if there are none
(cherry picked from commit 2203670ccc)
2021-10-23 11:53:58 +02:00
Haoyu Qiu
bd39b8649e Update view name after processing orbit view shortcuts
(cherry picked from commit 392d529247)
2021-10-23 11:52:20 +02:00
Rémi Verschelde
18aaa883f5 Merge pull request #53509 from aaronfranke/3.x-riscv 2021-10-22 21:27:51 +02:00
Aaron Franke
5659120af3 [3.x] Add support for the RISC-V architecture
Supports RV64GC (RISC-V 64-bit with general-purpose and compressed-instruction extensions)
2021-10-22 12:51:23 -05:00
Rémi Verschelde
72fb4d7b09 Merge pull request #54114 from timothyqiu/rich-text-label-fill-pointer 2021-10-22 12:26:20 +02:00
Rémi Verschelde
e81c3fb034 Merge pull request #54108 from nekomatata/fix-bvh-update-collision-layer-3.x 2021-10-22 12:04:30 +02:00
Haoyu Qiu
5366743454 Fix RichTextLabel meta link detection when used inside a fill tag 2021-10-22 16:20:56 +08:00
PouleyKetchoupp
48144ed40e Fix physics BVH broadphase update when changing collision layer/mask
The BVH implementation is not checking collision layers on existing
pairs on move like other physics broadphases do.

This is solved by adding a new call to trigger pair callbacks again so
the physics engine can check layers again (specific to the BVH version,
other broadphase implementations just trigger a move like before).
2021-10-21 16:53:41 -07:00
Rémi Verschelde
2c548d5005 Merge pull request #54049 from rxlecky/baked-lightmap-add-no-root-error-53774 2021-10-21 13:51:30 +02:00
SeleckyErik
98c0ffb749 Add BAKE_ERROR_NO_ROOT to BakedLightmap
Add new error type to BakeError to signalise that there is no root node to
start baking from.
Document the new error type, as well as BAKE_ERROR_NO_LIGHTMAPPER.
2021-10-21 13:32:03 +02:00
Rémi Verschelde
b7ded89fe9 Merge pull request #54057 from skimmedsquare/procedural-sky-thread-done-crash-53621 2021-10-21 12:00:07 +02:00
Rémi Verschelde
1e44d792a0 Merge pull request #54054 from timothyqiu/rich-text-label-shadow 2021-10-21 11:47:26 +02:00
Rémi Verschelde
7648dd2da9 Merge pull request #53162 from Duroxxigar/3.x-copy-group-name 2021-10-21 11:22:38 +02:00
Duroxxigar
bf2449ca92 Backport ability to copy group name 2021-10-21 03:54:44 -04:00
Sean Kim
8de5b78a97 Fix crash on null image ref in ProceduralSky 2021-10-20 22:55:08 -07:00
Haoyu Qiu
7e6e6c871b Make RichTextLabel honor content margin when drawing font shadow 2021-10-21 11:30:45 +08:00
Rémi Verschelde
d65f06652e Merge pull request #54031 from timothyqiu/rich-text-label-space-cache 2021-10-20 18:32:03 +02:00
Haoyu Qiu
37ef6036d0 Add missing cache clear in RichTextLabel::_process_line 2021-10-20 23:46:57 +08:00
Rémi Verschelde
2a970c336b Merge pull request #54020 from akien-mga/3.x-editor-i18n-thresholds 2021-10-20 16:05:33 +02:00
Rémi Verschelde
8425c58991 i18n: Only include editor translations above a threshold
This reduces the size of the editor binaries significantly, as we otherwise
embed all WIP translations, including ones with very low completion ratios,
and end up paying for the size of all `msgid`s for each locale.

Cf. https://github.com/godotengine/godot-proposals/issues/3421 for details.

The thresholds used are:
- 30% for the editor interface (should already include most common strings
  while more obscure ones like UndoRedo action names might be untranslated).
- 10% for the class reference: this is a HUGE resource and 10% is already
  a lot of useful content, especially if focused on the most used APIs.

For 3.x, we also exclude languages that require complex text layout support
to be displayed properly.

This currently reduces the size of the editor binary by 17% on Linux.

The list will be synced manually every now and then.
2021-10-20 14:39:21 +02:00
Rémi Verschelde
485d9c3054 Merge pull request #54004 from bruvzg/fix_multi_phy_key_map_3 2021-10-20 10:56:33 +02:00
Rémi Verschelde
ae5cdf3b86 Merge pull request #53991 from Faless/js/3.x_gles3_editor 2021-10-20 10:40:46 +02:00
bruvzg
b97ca39360 Fix handling multiple "physical key" events in the single input map action. 2021-10-19 22:19:13 +03:00
Fabio Alessandrelli
3a61d0990e [HTML5] Editor video driver option. Replace canvas on exit.
Default is "Auto", but can be forced to a specific WebGL version if the
automatic detection fails.

The game and editor canvas are now replaced with a new one in the exit
hooks. This helps the browser do some context cleanup, and allow us to
create a new context of a different type (WebGL/WebGL2).

Enable GLES3/WebGL2 in the Web Editor.
2021-10-19 15:52:02 +02:00
Rémi Verschelde
da5c843bd1 Merge pull request #53986 from madmiraal/remove-unused-variables-3.x 2021-10-19 12:18:21 +02:00
Rémi Verschelde
90f8cd89a7 Merge pull request #50560 from noidexe/patch-1 2021-10-18 23:01:52 +02:00
Rémi Verschelde
c743649c0b Merge pull request #53742 from DmitriySalnikov/exposed_sensor_setters 2021-10-18 23:01:07 +02:00
Rémi Verschelde
0fb135d598 Merge pull request #53779 from m4gr3d/restrict_project_data_dir_config_3x 2021-10-18 22:58:51 +02:00
Rémi Verschelde
12797510cb Merge pull request #53966 from The-O-King/csg_fix 2021-10-18 22:56:46 +02:00
Marcel Admiraal
fe9fd5c5ce Remove unused variables 2021-10-18 18:51:05 +01:00
Omar El Sheikh
b679594eac Fix CSGPolygon Buffer Overflow
Immediate meshes do not have geometry of type Surface so we check
to see the mesh isn't immediate before trying to cast to surface
to check for octahedral compression
2021-10-18 11:39:54 -04:00
Fabio Alessandrelli
11d1b0387e [HTML5] Bump initial memory for Web editor
More memory is needed because the editor became bigger with the addition
of class reference translations.

(cherry picked from commit 1446cfd13d)
2021-10-18 16:09:04 +02:00
Rémi Verschelde
89076410de WebM: Disable SIMD optimization with YASM on Windows
It triggers a crash when playing V9 videos.

Could likely be fixed if anyone wants to work on it, but so far nobody seems to
want to and WebM support is dropped in 4.0, so this workaround should help for
now.

Fixes #50862.
2021-10-18 15:48:45 +02:00
Rémi Verschelde
443bf1f70a Bump version to 3.4-rc 2021-10-18 12:06:53 +02:00
Rémi Verschelde
c17f051ee9 i18n: Sync classref translations with Weblate 2021-10-18 11:58:55 +02:00
Rémi Verschelde
2a7e1d0aac i18n: Sync editor translations with Weblate 2021-10-18 11:58:51 +02:00
Hugo Locurcio
dc3b614a6a Tweak AudioStreamPlayer3D property hints for usability
This also improves the documentation for the `max_distance` property.

(cherry picked from commit b383181851)
2021-10-18 11:24:42 +02:00
Anutrix
d238b15c15 Remove unused imports in .py, SCsub and SConstruct files
(cherry picked from commit a4b736658e)
2021-10-18 11:24:42 +02:00
Ryan Roden-Corrent
76255d89af Implement camera orbiting shortcuts.
Fixes godotengine/godot-proposals#2051.
Relates to godotengine/godot-proposals#1215.

Implements shortucts for adjusting the camera rotation in 15-degree
increments, similar to Blender.

I did not add corresponding menu entries for these, as I didn't feel
like they would be too useful from a menu, and didn't want to make the
menu too long.

(cherry picked from commit cb15ec20bb)
2021-10-18 11:24:37 +02:00
Rémi Verschelde
fbcf442260 Merge pull request #53651 from pycbouh/docs-warn-about-internal-nodes-3.x 2021-10-18 11:24:08 +02:00
Rémi Verschelde
ae92a6b024 Merge pull request #53932 from neikeq/issue-51045 2021-10-18 10:45:46 +02:00
Rémi Verschelde
75a05fc3a9 Merge pull request #53938 from clayjohn/GLES3-directional-lights
Only add emission on base pass in GLES3
2021-10-18 07:53:54 +02:00
clayjohn
a4e8ba8cfd Only add emission on base pass in GLES3 2021-10-17 15:58:57 -07:00
Ignacio Roldán Etchevery
24fb09614d iOS: Don't embed project static frameworks/libs
Previously, files added via `add_ios_project_static_libs` where
being added as embedded frameworks. This commit fixes that.

Static frameworks/libs should never be embedded into IPAs.
2021-10-17 22:30:09 +02:00
Rémi Verschelde
fddbbf445b SCons: Fix missing mono .gen.cpp sources after #53860
(cherry picked from commit d6aab5c1bf)
2021-10-16 16:47:08 +02:00
Rémi Verschelde
a5093d64ac SCons: List .gen.cpp sources explicitly to avoid globbing errors
Whenever we change the name (or remove) generated cpp files with the `.gen.cpp`
extension, users run into build issues when switching between branches (i.e.
switching before and after the name change/removal). This is because we glob
`*.cpp` so if a now-obsolete file from a previous build is present, we'll
include it too, potentially leading to bugs or compilation failure (due to
missing headers or invalid code).

So globbing patterns in `add_source_files` will now skip files ending with
`.gen.cpp`, which should instead be passed explicitly where they're used.

(cherry picked from commit c133480531)
2021-10-16 10:59:14 +02:00
Rémi Verschelde
f28199f403 Merge pull request #53638 from raulsntos/fix-enum-array-hint-3.x 2021-10-15 20:23:03 +02:00
Rémi Verschelde
22219e2e35 Merge pull request #53850 from Calinou/gles2-remove-unused-shaders 2021-10-15 19:13:51 +02:00
Raul Santos
977898709f Fix hint_string for C# enum arrays 2021-10-15 19:07:31 +02:00
Rémi Verschelde
f6784e18d1 Merge pull request #53848 from MaxLap/backport_doc_shape_signals 2021-10-15 18:54:43 +02:00
Hugo Locurcio
cc823bc5b3 Remove unused built-in GLES2 shaders
These shaders were never compiled in the Godot binary, so the binary
size remains identical.
2021-10-15 17:41:31 +02:00
Rémi Verschelde
c15143e316 Merge pull request #53834 from akien-mga/3.x-cherrypicks 2021-10-15 17:36:28 +02:00
Rémi Verschelde
f04a1bec63 Merge pull request #53628 from raulsntos/fix-list-marshal-3.x 2021-10-15 17:36:00 +02:00
Rémi Verschelde
b8761569f6 Merge pull request #53582 from raulsntos/mono-marshal-generics-3.x 2021-10-15 17:35:32 +02:00
Rémi Verschelde
5ff8d0e8a7 Merge pull request #53577 from raulsntos/fix-mono-to-variant-array-3.x 2021-10-15 17:35:09 +02:00
Maxime Lapointe
f3002c62b7 Improve area/body_shape_entered/exited signals parameter names and doc
Fix some typoed names from the doc
Add _index to "index" parameters of *_shape_* signals, this is both in doc and in the template. This makes the code, signature and doc easier to understand
Add method to get Node from the _index params of those signals. This was not as easy to find as one would expect. Putting this information where it is needed will help.
2021-10-15 11:28:17 -04:00
Rémi Verschelde
9657559b66 SCons: Set DEBUG_ENABLED and DEV_ENABLED in SConstruct
They're the same for all platforms so they don't need to be repeated in all
platform definitions.

(cherry picked from commit cd21cc683a)
2021-10-15 12:54:16 +02:00
Rémi Verschelde
8c6e341876 SCons: Remove MD5-timestamp and implicit cache optimizations
They haven't really helped save much time on incremental rebuilds, and they do
cause potential issues with build correctness (and possibly even one of the cause
for overly eager incremental rebuilds).

(cherry picked from commit 0433d0f54d)
2021-10-15 12:51:43 +02:00
Marcel Admiraal
fd942cd465 Upgrade Android Gradle to version 7.2
(cherry picked from commit 95b1275197)
2021-10-15 12:51:43 +02:00
Rémi Verschelde
5bcba2b825 mbedtls: Backport "Fix x86_64 assembly for bignum multiplication"
Backports PR https://github.com/ARMmbed/mbedtls/pull/4948 to fix a regression
with our macOS builds using Clang 12.

Fixes #53297.

(cherry picked from commit 4cf3056ca6)
2021-10-15 12:51:42 +02:00
Hugo Locurcio
52b16f0984 Increase object snapping distances in the 3D editor
- Increase drag-and-drop snapping to 50 units
  (from 10 units).
- Increase Snap Object to Floor maximum height to 500 units
  (from 20 units).
- Increase Snap Object to Floor negative margin to 1 unit
  (from 0.2 units).

(cherry picked from commit 7a3d0b79b4)
2021-10-15 12:51:42 +02:00
floppyhammer
0b5724514d Fix bilinear TextureProgressBar with nine patch enabled
(cherry picked from commit a238816f0b)
2021-10-15 12:51:42 +02:00
Xeadriel
78b247c91e Add that elapsed_time in CharFXTransform resets when RichTextLabels text is changed
Update doc/classes/CharFXTransform.xml Grammar fix

Co-authored-by: Aaron Record <50304111+LightningAA@users.noreply.github.com>
(cherry picked from commit bf5f5e159e)
2021-10-15 12:51:42 +02:00
Nathan Franke
4df2951b5c Fix character encoding of Engine::get_copyright_info
(cherry picked from commit 28c163a432)
2021-10-15 12:51:42 +02:00
Red Headphone
066f214654 no limit of negative value for engine_force (VehicleBody class)
(cherry picked from commit fff70a6427)
2021-10-15 12:51:42 +02:00
Matthew Newall
3149eabdc0 Fixed editor attempting to save a blank scene with save all scenes
(cherry picked from commit e10d0d76bc)
2021-10-15 12:51:38 +02:00
Rémi Verschelde
3ca8003199 Merge pull request #53830 from zaevi/fix_EditorSpinSlider_freeze 2021-10-15 12:41:47 +02:00
Zae
ee4c533ca6 [3.x] Fix EditorSpinSlider freezes editor when tabbing focus rapidly. 2021-10-15 16:52:45 +08:00
Rémi Verschelde
ff132ca278 Merge pull request #53800 from Faless/net/3.x_revert_gzip 2021-10-14 14:26:26 +02:00
Fabio Alessandrelli
6c4bb3fc4a Revert HTTPRequest gzip compression support.
Partial revert of commit c1135cf006.
2021-10-14 12:51:37 +02:00
Fredia Huya-Kouadio
2b6678c851 Restrict the project data directory configuration. 2021-10-13 13:56:01 -07:00
Raul Santos
059750cd0d Support marshaling generic Godot.Object
Allows using generic C# types in signals as long as they inherit
from `Godot.Object`.
2021-10-13 18:22:06 +02:00
Rémi Verschelde
2b5d89e635 Merge pull request #53763 from Ev1lbl0w/bugfix-visual_script_crash 2021-10-13 14:53:02 +02:00
Ev1lbl0w
e57f8fd083 Fix VisualScript crash with null object 2021-10-13 12:19:29 +01:00
Rémi Verschelde
8bdeee04f0 Merge pull request #53655 from pycbouh/core-print-bytearray-contents-3.x 2021-10-13 12:50:32 +02:00
Rémi Verschelde
6fb7f18e35 Merge pull request #53740 from clktmr/gles2-multiple-refprobes 2021-10-13 12:42:23 +02:00
Timur Celik
e230bc6caa Fix flipped interior option for second refprobe
This patch fixes rendering of multiple reflection probes for a single
mesh in the GLES2 renderer.  If there were two reflection probes, one of
them would always have the `interior` option flipped, resulting in
broken blending between probes and flickering of ambient reflection.

Also make note of GLES2 reflection probe limit
2021-10-13 10:04:48 +02:00
Rémi Verschelde
4186c5e757 Merge pull request #53490 from briansemrau/thread-is-alive-3.x
[3.x] [core_bind] Add `Thread::is_alive`
2021-10-12 22:35:26 +02:00
Rémi Verschelde
8a332a2456 Merge pull request #53695 from CakHuri/fix-typo-csg-3.x
[3.x] Fix a typo in csg module
2021-10-12 22:31:58 +02:00
Rémi Verschelde
c44f24ebf7 Merge pull request #53739 from Calinou/gles3-fix-light-flickering-2
Fix lights flickering in GLES3 when new light attenuation is disabled
2021-10-12 22:11:41 +02:00
Дмитрий Сальников
5cf898b897 Exposed setters for sensor values in Input class 2021-10-12 23:09:30 +03:00
Hugo Locurcio
2826bec5d4 Fix lights flickering in GLES3 when new light attenuation is disabled
Co-authored-by: Clay John <claynjohn@gmail.com>
2021-10-12 21:59:23 +02:00
Yuri Sizov
c2106725ae Unify Pool*Array printing output
Co-authored-by: mashumafi <mashumafi@gmail.com>
2021-10-12 22:31:18 +03:00
Rémi Verschelde
779a5e5621 Change editor FPS limit for unfocused mode back to 20 FPS
This was changed in 7991d0fb22 but seems to cause issues
for some projects when using the profiler.

Fixes #51222.
2021-10-12 16:56:09 +02:00
Hugo Locurcio
f769e9a864 List Physical Key before Key in the action map input editor
Physical Key should be used for most game inputs as it allows
keys to work on non-QWERTY layouts out of the box.
This is especially important for WASD movement layouts.

In contrast, remapped (non-physical) keys are mainly useful in
non-game applications, where shortcuts are expected to match a
precise letter rather than a location on the keyboard.
2021-10-12 11:57:08 +02:00
Rémi Verschelde
f7fd5e3aeb Merge pull request #52556 from m4gr3d/customize_metadata_dir_3x
[3.x] Make the project data directory customizable
2021-10-12 08:28:01 +02:00
M. Huri
37ccfb18ff Fixed a typo in csg module 2021-10-12 11:13:29 +07:00
Fredia Huya-Kouadio
d1808f0a7f Make the project data directory customizable. 2021-10-11 14:42:40 -07:00
ne0fhyk
754db65a1f Pass the correct export_format argument to locate the assets directory when exporting.
(cherry picked from commit 431ccdb057)
2021-10-11 18:04:16 +02:00
zacryol
df1eebd8d8 Mention remove_node() side effect of potentially setting owner to null
(cherry picked from commit 6941ab9ae5)
2021-10-11 12:50:04 +02:00
Marcel Admiraal
f3b69e3cf4 Update Android CI to use JDK 11.
(cherry picked from commit fe0b673bb3)
2021-10-11 12:49:38 +02:00
Rémi Verschelde
2f2e2cab01 Update AUTHORS and DONORS list
New contributors added to AUTHORS:
@raulsntos, @TokageItLab

Thanks to all contributors and donors for making Godot possible!

(cherry picked from commit cd3c1f2594)
2021-10-11 12:00:05 +02:00
Rémi Verschelde
4b4cbdd2c1 Merge pull request #53657 from pycbouh/gdscript-exports-redundant-string-op-3.x 2021-10-11 09:18:38 +02:00
Yuri Sizov
b6b65e08d1 Remove redundant String operation from GDScript enum exports 2021-10-11 02:12:30 +03:00
Rémi Verschelde
de319bec4f Merge pull request #53652 from pycbouh/docs-make-defaults-stable-3.x 2021-10-11 00:14:34 +02:00
Yuri Sizov
b02c61ddb1 Ignore OS specific values (constants, project settings, properties)
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2021-10-10 23:40:32 +03:00
Yuri Sizov
2401f1cf65 Add warnings to methods that give access to internal nodes 2021-10-10 23:10:07 +03:00
Zae
5e92619a64 Fix EditorFileSystem not checking .gdignore in existed directory
(cherry picked from commit 70cf3cbd60)
2021-10-10 12:27:51 +02:00
Omar Polo
04c08d1f8c use .get_file() instead of basename(3)
On OpenBSD the compiler complains that calling basename(3) would lose
const qualifier.  basename(3) is defined as

	char *basename(char *);

and can, accorgindly to the POSIX.1, modify the passed string.

This uses the .get_file() method.  The check is necessary because
file_name could be a directory, in which case .get_file() would return
an empty string.  The .get_base_dir().get_file() idiom is already used.

The usage of get_file() and the check were suggested by theraot, thanks!

(cherry picked from commit a3384b7461)
2021-10-10 12:27:51 +02:00
Michael Alexsander
eeb6652436 Fix invisible tabs not being ignored in Tabs
(cherry picked from commit 3c5103ac1d)
2021-10-10 12:27:51 +02:00
mujpao
64d70d28d4 Fix right clicking sub nodes after renaming parent
(cherry picked from commit f25a698f80)
2021-10-10 12:27:51 +02:00
Haoyu Qiu
e7b67fe8ee Fix make sub-resource crash in AnimationTreeEditor
(cherry picked from commit 274ed82283)
2021-10-10 12:27:51 +02:00
Haoyu Qiu
52ebe5993e Use loop instead of recursion when clearing proximity groups
(cherry picked from commit 6072f38bb1)
2021-10-10 12:27:51 +02:00
Infinixius
0f328bcbdc Fix small typos regarding WebSocketPeer
(cherry picked from commit 547ed239c0)
2021-10-10 12:27:47 +02:00
Raul Santos
fd160b642e Fix C# List<T> marshalling 2021-10-10 11:41:37 +02:00
Rémi Verschelde
be768e524d Merge pull request #53616 from Calinou/editor-import-dock-add-dirty-marker-3.x
Add a "dirty" marker to the editor import dock for unsaved changes (3.x)
2021-10-10 10:51:52 +02:00
Hugo Locurcio
35d76733b0 Add a "dirty" marker to the editor import dock for unsaved changes 2021-10-10 01:06:05 +02:00
Lisandro Lorea
56f66aa8fc Clarify that resize doesn't initialize memory
Some users might expect resize() to initialize added elements to zero. This clarifies that it is not the case.
2021-10-09 13:46:04 -03:00
Rémi Verschelde
512211b61c Merge pull request #53591 from Calinou/timer-low-wait-time-add-warning-3.x 2021-10-09 13:41:01 +02:00
Hugo Locurcio
7dcefa7c1b Add a warning for Timer nodes with very low wait times
Very low wait times behave in unpredictable ways depending on the
rendered frame rate. This is because the timeout signal is only emitted
once per rendered frame (or physics frame, depending on the timer's
process mode).
2021-10-09 11:36:03 +02:00
Rémi Verschelde
7843c871d0 Fix missing argument names in FileSystemDock bindings 2021-10-09 00:31:22 +02:00
Rémi Verschelde
302ad4e600 Merge pull request #52918 from Calinou/add-new-light-attenuation-3.x 2021-10-08 23:08:49 +02:00
Hugo Locurcio
85e080fcc0 Backport new 3D point light attenuation as an option
This provides more realistic lighting with a very small performance cost.
The option is available in both GLES3 and GLES2, and can be enabled in
the Project Settings. This goes well with the ACES Fitted tonemapping mode
that was recently added.

When enabled, this also makes upgrading Godot 3.x projects to Godot 4.0 easier,
since lighting in 3.x will better match how it'll look in Godot 4.0.
2021-10-08 22:15:22 +02:00
Raul Santos
ec2f86ec9a Support arrays of StringName, NodePath and RID in mono 2021-10-08 18:52:40 +02:00
Rémi Verschelde
c00848ae03 Merge pull request #53572 from kleonc/scene-tree-free-objects-queued-during-destruction-3x 2021-10-08 18:10:45 +02:00
kleonc
ae96da28d8 Delete objects enqueued for deletion during SceneTree destruction 2021-10-08 16:38:38 +02:00
Rémi Verschelde
07094f5253 Merge pull request #53507 from qarmin/fast_as_snail 2021-10-08 14:58:01 +02:00
Rémi Verschelde
b280da0132 Merge pull request #53557 from Pineapple/faster-string-int-dictionary-3x 2021-10-08 14:27:05 +02:00
Bartłomiej T. Listwon
5b4e3624f4 Faster hash_compare for integer and string keys in dictionaries 2021-10-08 10:13:43 +02:00
Rémi Verschelde
06fc2378de Merge pull request #51491 from Calinou/glow-add-high-quality-mode-3.x
Add high quality glow mode (3.x)
2021-10-08 07:47:07 +02:00
Rémi Verschelde
6051be3eb1 Merge pull request #53542 from Calinou/doc-call-group-null-3.x 2021-10-07 22:35:22 +02:00
Hugo Locurcio
761047076c Document null argument limitation with SceneTree.call_group() 2021-10-07 18:55:44 +02:00
Rémi Verschelde
7a145ff8c7 Merge pull request #53518 from akien-mga/3.x-i18n-classref-sync-weblate 2021-10-07 15:06:11 +02:00
Rémi Verschelde
0b7c957ce8 i18n: Sync classref template with current 3.x docs
Merge the PO translations with the new template.
This adds the following changes:

- 8000 strings are still valid as is (80%)
- 2000 strings are marked fuzzy and need reviewing (20%)
- 1000 strings are new and need translation
2021-10-07 14:05:46 +02:00
Rémi Verschelde
831e85f4d9 i18n: Sync classref translations with Weblate
These are based on the `master` API from mid-2020 so they're somewhat outdated.
Some strings will be marked as fuzzy (needs review) and new strings will be
added in the next commit.
2021-10-07 14:04:08 +02:00
Rémi Verschelde
df07d69aaa Merge pull request #53511 from akien-mga/3.x-i18n-classref 2021-10-07 14:03:56 +02:00
bruvzg
583c6d303c Change in-editor documentation style to be closer to online docs.
(cherry picked from commit 1e3c02d590)
2021-10-07 12:48:23 +02:00
Rémi Verschelde
81da3b8ba4 Use translated docs in PropertySelector
And do the dedent and stripping for both translated and
non-translated strings for consistency, and so that we
don't need to do it at the call site.

(cherry picked from commit a16031beb6)
2021-10-07 12:48:23 +02:00
Thakee Nathees
46df39d5e5 i18n: Fix parsing of multiple escapes before quotes
See https://github.com/godotengine/godot/pull/37114#issuecomment-601463765

(cherry picked from commit 8c3ad2af93)
2021-10-07 12:48:23 +02:00
Rémi Verschelde
9729432ec0 i18n: Add support for translating the class reference
- Parse `.po` files from `doc/translations/*.po` like already done
  with `editor/translations/*.po`.
- Add logic to register a doc translation mapping in `TranslationServer`
  and `EditorSettings`.
- Add `DTR()` to lookup the doc translation mapping (similar to `TTR()`).
  Strings are automatically dedented and stripped of whitespace to ensure
  that they would match the translation catalog.
- Use `DTR()` to translate relevant strings in `EditorHelp`,
  `EditorInspector`, `CreateDialog`, `ConnectionsDialog`.
- Small simplification to `TranslationLoaderPO`, the path argument was
  not really meaningful.

(cherry picked from commit 4857648a16)
2021-10-07 12:48:23 +02:00
Rémi Verschelde
ab80f9d9b2 i18n: Add Makefile to extract classref strings
Change extract script `path` argument to support specifying multiple
paths, like `makerst.py`. This prevents parsing invalid XML files while
scanning the whole repository.

(cherry picked from commit 87d23bf85a)
2021-10-07 12:48:22 +02:00
Rémi Verschelde
01707c28c9 i18n: Add header strings to translation catalog
(cherry picked from commit aca1971a12)
2021-10-07 12:48:21 +02:00
Thakee Nathees
eac1752b68 Add script to generate translation catalog for the class reference
Fixes #37109.

(cherry picked from commit e817792c0a)
2021-10-07 12:11:40 +02:00
Rémi Verschelde
26aefbb454 Merge pull request #53498 from nekomatata/body-test-motion-thread-safe-3.x
[3.x] Make body_test_motion thread safe for multi-threaded physics
2021-10-07 08:13:06 +02:00
Rafał Mikrut
1558f4a599 Speedup parsing big GDScript files 2021-10-07 07:39:56 +02:00
PouleyKetchoupp
11aeaaa2cf Make body_test_motion thread safe for multi-threaded physics
Needs proper synchro with the command buffer for thread safety, in case
physics is not running on the main thread.
2021-10-06 16:06:03 -07:00
Camille Mohr-Daurat
e1de198e95 Merge pull request #53481 from timothyqiu/soft-body-ready-3.x
[3.x] Re-prepare VisualServer if SoftBody mesh changed
2021-10-06 14:58:10 -07:00
Brian Semrau
d734bcc289 [core_bind] Add Thread::is_alive 2021-10-06 13:18:40 -04:00
Haoyu Qiu
ff27b994cd Re-prepare VisualServer if SoftBody mesh changed 2021-10-06 23:25:14 +08:00
Rémi Verschelde
3e2bb415a9 Merge pull request #53461 from timothyqiu/tooltip-request-func-3.x 2021-10-06 10:13:29 +02:00
Rémi Verschelde
3f05c388a1 Merge pull request #52521 from kdiduk/52499-preload-parsing-error-when-newline-encountered 2021-10-06 10:13:19 +02:00
Kirill Diduk
835143b7bd #52499 Fix parsing 'preload': increase/decrease parenthesis count 2021-10-06 09:35:21 +02:00
Haoyu Qiu
52a840b9c9 Fix crash when tooltip_request_func object is freed 2021-10-06 15:33:31 +08:00
Rémi Verschelde
322387b694 makerst: Make external links anonymous
Otherwise we get errors if we use the same title for different links in a given class.

(cherry picked from commit 1e36f5f524)
2021-10-06 09:29:32 +02:00
Rémi Verschelde
c7eb3d25e7 doc: Fix style inconsistencies for [b]Note:[/b] paragraphs
(cherry picked from commit 788b3aa27a)
2021-10-06 09:29:32 +02:00
Maxime Lapointe
487ca87e94 Improve error message when instantiating virtual class
(cherry picked from commit 29dc8de88b)
2021-10-06 09:29:31 +02:00
PouleyKetchoupp
00d4a30b05 Fix editable children errors when packing scene tree at runtime
When packing a scene node which is not the root, errors where caused
by internal checks in is_editable_instance method.

This check can be safely made outside instead.

(cherry picked from commit 2f6cf3b8a8)
2021-10-06 09:29:31 +02:00
Rémi Verschelde
732dfddc20 Merge pull request #53459 from timothyqiu/camera-viewport-3.x 2021-10-06 08:47:49 +02:00
Rémi Verschelde
abb1413e0f Merge pull request #53453 from nekomatata/fix-rayshape-snap-3.x 2021-10-06 08:37:57 +02:00
Rémi Verschelde
a735ff5c2c Merge pull request #53451 from nekomatata/kinematic-body-recovery-depth-3.x 2021-10-06 08:36:30 +02:00
Rémi Verschelde
0a1cd0c316 Merge pull request #53448 from lyuma/backport_gltf_skin_export 2021-10-06 08:26:18 +02:00
Rémi Verschelde
e6cc245bf0 Merge pull request #53454 from stebulba/path_simplify_angle-fix-error-from-merge 2021-10-06 08:24:56 +02:00
Rémi Verschelde
55ae863a63 Merge pull request #53458 from akien-mga/3.x-bullet-fix-uwp 2021-10-06 08:17:58 +02:00
Rémi Verschelde
cbe0cff53d bullet: Fix UWP build by disabling TaskScheduler dynamic loading
Cf. https://github.com/bulletphysics/bullet3/pull/3991
2021-10-06 07:44:30 +02:00
Haoyu Qiu
0f18f225ee Fix crash when deleting Camera2D and Viewport assigned to it 2021-10-06 13:41:21 +08:00
PouleyKetchoupp
255febefb2 Fix Rayshape recovery in test_body_ray_separation
These changes improve Rayshape behavior for Godot Physics 2D and 3D
when using move_and_slide with and without snapping.

Kinematic margin is now applied to ray shapes when handling snapping
collision tests and separation raycasts to help getting consistent
results in slopes and flat surfaces.

Recovery is calculated without the margin and a depth of 0 is still
considered a collision to stabilize results when on flat surface.

Recovery depth takes into account the current recovery vector (just like
test_body_motion) to fix jittering issues with multiple ray shapes due
to applying too much recovery.
2021-10-05 18:24:30 -07:00
Stéphane Fortin
58a4035017 Fix merging error path_simplify_angle CSGPolygon
[3.x] Quick fix on path_simplify_angle introduce here https://github.com/godotengine/godot/pull/52509#issuecomment-933331579
after merging #52509
2021-10-05 21:19:23 -04:00
PouleyKetchoupp
9bc1b4b90e Improved logic for KinematicBody collision recovery depth
Allows more flexible collision detection with different safe margin values.

Kinematic body motion changes in 2D and 3D:
-Recovery only for depth > min contact depth to help with collision
detection consistency (rest info could be lost if recovery was too much)
-Adaptive min contact depth (based on margin) instead of space parameter
2021-10-05 17:00:55 -07:00
Lyuma
3cdaaffb54 Backport to 3.x "gltf export: Fix export of skeletons, skins and blend shapes."
Create GLTFSkeleton at the same time we create GLTFNode objects.
Create GLTFSkin at the same time we export MeshInstance3D
Fixes export of blend shape arrays for meshes with multiple surfaces.
Fixes array indexing issues in export of glTF morph target animations.

Converts BoneAttachment3D nodes during normal node creation: this avoids
special cases during mesh export, and especially exporting skeletons or meshes
which are children of BoneAttachment3D.

Co-authored-by: K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
2021-10-05 14:14:28 -07:00
Rémi Verschelde
df69945f1f Merge pull request #52714 from m4gr3d/provide_getter_for_project_data_dir_3x 2021-10-05 21:02:41 +02:00
Rémi Verschelde
c637588214 Merge pull request #47500 from briansemrau/nan-inf-tscn-parsing-bug-3.x 2021-10-05 20:00:05 +02:00
Thakee Nathees
91be2b4407 NaN, INF read/write bug fixed
Fix: #40589
2021-10-05 13:28:39 -04:00
Rémi Verschelde
5fb9a2a54d Merge pull request #52652 from boruok/optional-crop-for-texture-atlas-importer 2021-10-05 19:21:49 +02:00
Rémi Verschelde
393166793c Merge pull request #52952 from Calinou/cpu-lightmapper-num-threads-editor-setting 2021-10-05 19:20:29 +02:00
Rémi Verschelde
77f52bdf99 Merge pull request #52137 from Ansraer/3.x-2d-scale-factor 2021-10-05 19:12:19 +02:00
Rémi Verschelde
d35fccb651 Merge pull request #52365 from jitspoe/3.x.viewport_error_fix
[3.x] Fix ViewportTexture error when viewport is used from a child scene
2021-10-05 18:51:51 +02:00
Hugo Locurcio
0e943939e2 Add an editor setting to configure number of threads for lightmap baking
This can be used to free some CPU cores when baking lightmaps.
When using fewer CPU cores, lightmap baking is slower but background
tasks aren't slowed down as much.
2021-10-05 17:35:20 +02:00
Rémi Verschelde
e848da3a5d Merge pull request #52812 from Faless/js/3.x_our_input 2021-10-05 15:27:35 +02:00
Rémi Verschelde
bd7bea2087 Merge pull request #53233 from metinc/fix-animated-sprite-precision-error 2021-10-05 15:23:51 +02:00
Fabio Alessandrelli
adef4ed958 [HTML5] Remove "maximize" support.
I don't think anyone is actively using it, and it's a lot of convoluted
code.
2021-10-05 15:13:41 +02:00
Fabio Alessandrelli
d61fc468a2 [HTML5] Refactor JS library listeners to OS. 2021-10-05 15:13:41 +02:00
Fabio Alessandrelli
5e2e54a4b4 [HTML5] Refactor display/input JS library code. 2021-10-05 15:13:41 +02:00
Fabio Alessandrelli
c54f5b90e6 [HTML5] Implement Pointer Lock API in JS library.
Removes more emscripten HTML5 library dependencies.
2021-10-05 15:13:41 +02:00
Fabio Alessandrelli
89c6aaa96d [HTML5] Implement window blur in JS library.
Removes more emscripten HTML5 library dependencies.
2021-10-05 15:13:41 +02:00
Fabio Alessandrelli
ac78e7f940 [HTML5] Implement fullscreenchange in JS library.
Removes more emscripten HTML5 library dependencies.
2021-10-05 15:13:41 +02:00
Fabio Alessandrelli
b7ac3c1aeb [HTML5] Implement mouse/touch/key events in JS library.
This makes us more independent from emscripten libraries, giving us more
control on the application lifecycle.
2021-10-05 15:13:41 +02:00
Ansraer
d44aa61735 implement better ui scaling 2021-10-05 14:30:38 +02:00
Rémi Verschelde
4e85135c37 Merge pull request #53429 from KoBeWi/listener3.x 2021-10-05 13:57:28 +02:00
Rémi Verschelde
d4b2db5c3a Merge pull request #51438 from timothyqiu/selection-box-sep-3x 2021-10-05 13:55:36 +02:00
Rémi Verschelde
f9e3bc2652 Merge pull request #51728 from lawnjelly/proj_settings_misc 2021-10-05 13:36:43 +02:00
kobewi
f9720a9bf2 Add Listener2D 2021-10-05 13:29:59 +02:00
lawnjelly
192ec963ae Create 'rendering/misc' project settings section
To prevent the project settings `rendering` section getting out of hand, this PR moves some of the smaller new settings into a `misc` category.
2021-10-05 11:47:03 +01:00
Rémi Verschelde
e31a10da98 Merge pull request #52274 from aaronfranke/3.x-gltf-noregex 2021-10-05 12:40:12 +02:00
jitspoe
d2637ca950 Fix ViewportTexture error when viewport is used from a child scene
Fix invalid errors when a separate child scene file contains a viewport and
that viewport is used for a texture in the current scene.

Fixes #27790.
2021-10-05 12:17:42 +02:00
Rémi Verschelde
db0370cab5 Merge pull request #51086 from aaronfranke/3.x-warn-dectime 2021-10-05 12:06:03 +02:00
Rémi Verschelde
d01c660954 Merge pull request #52964 from Pineapple/WIN32_LEAN_AND_MEAN 2021-10-05 12:03:52 +02:00
Rémi Verschelde
69437eb746 Merge pull request #53012 from lawnjelly/portals_unload_reason 2021-10-05 12:00:43 +02:00
Rémi Verschelde
7f58b6322e Merge pull request #53067 from Calinou/add-script-nav-extra-mouse-button-3.x 2021-10-05 11:57:51 +02:00
Rémi Verschelde
86ee82c6e2 Merge pull request #53090 from Razoric480/key_up_down_spin_slider_32 2021-10-05 11:30:47 +02:00
Rémi Verschelde
d82c75adca Merge pull request #53393 from lawnjelly/dev_asserts 2021-10-05 11:25:24 +02:00
Rémi Verschelde
58fe0bd2cb Merge pull request #53052 from kleonc/animated-sprites-centered-rendering-3x 2021-10-05 11:22:26 +02:00
Rémi Verschelde
5f1b659d35 Merge pull request #53226 from aaronfranke/3.x-c-locale 2021-10-05 11:20:20 +02:00
Rémi Verschelde
59930dca00 Merge pull request #53263 from Calinou/editor-inspector-warning-yellow-3.x 2021-10-05 11:12:44 +02:00
Rémi Verschelde
74727be0aa Merge pull request #50718 from LightningAA/drag-multiple-resources-onto-array-export-3.x 2021-10-05 11:11:30 +02:00
Rémi Verschelde
d16d35e260 Merge pull request #53410 from pycbouh/editor-theme-guard-bitmap-fonts-3.x 2021-10-05 11:09:07 +02:00
Rémi Verschelde
9ffaa6c090 Merge pull request #53347 from migeran/fix_gdnative_get_current_library_path 2021-10-05 11:08:16 +02:00
Jordan Schidlowsky
db44406082 revert 0d7409a so additional error information prints in release builds
(cherry picked from commit b78d399f91)
2021-10-05 10:56:53 +02:00
Michael Alexsander
a5214f437f Fix Tabs offset overreaching when scrolling fast
(cherry picked from commit 0dd65fff3b)
2021-10-05 10:53:06 +02:00
Yuri Sizov
8fe6fceb02 Safeguard against BitMap fonts in the CanvasItem editor
Co-authored-by: ArrowInAKnee <gatexxl@gmail.com>
2021-10-04 22:54:04 +03:00
Rémi Verschelde
72a922eb4e Merge pull request #53300 from Calinou/viewport-tweak-configuration-warning-3.x 2021-10-04 20:31:05 +02:00
Rémi Verschelde
55c9cc21e9 Merge pull request #53397 from pycbouh/theme-improve-change-propagation-3.x
[3.x] Make `Theme` report property list changes less often, and other backports
2021-10-04 18:05:16 +02:00
Rémi Verschelde
37847eb94d Merge pull request #53369 from RandomShaper/fix_shader_state_3.x
[3.x] Reset scene conditionals assumed to be false
2021-10-04 17:31:25 +02:00
Yuri Sizov
457d48a1f1 Make Theme report property list changes less often 2021-10-04 18:05:23 +03:00
Yuri Sizov
98cf645258 Expose API to retrieve Theme's default font 2021-10-04 17:44:53 +03:00
Rémi Verschelde
cd2c2f8da4 Merge pull request #53387 from akien-mga/3.x-cherrypicks 2021-10-04 16:16:16 +02:00
Yuri Sizov
cd45a70f2d Reorganize Theme resource code for better maintainability 2021-10-04 17:09:32 +03:00
lawnjelly
c835f1f3c5 Add DEV_ASSERT and DEV_CHECK macros
Change the existing DEV_ASSERT function to be switched on and off by the DEV_ENABLED define. DEV_ASSERT breaks into the debugger as soon as hit.
Add error macros DEV_CHECK and DEV_CHECK_ONCE to add an alternative check that ERR_PRINT when a condition fails, again only enabled in DEV_ENABLED builds.
2021-10-04 14:57:54 +01:00
Kongfa Waroros
77d5ead241 Check if the line pointer goes away from the image buffer's EOF in the BMP importer
(cherry picked from commit ac5d7abe13)
2021-10-04 15:22:16 +02:00
Florian Kothmeier
5185cd4f80 Fix AnimationNodeStateMachinePlayback start() on nonexistent node
(cherry picked from commit b6e7df56cb)
2021-10-04 15:22:16 +02:00
Robbie Cooper
761c915070 Fix file panel renaming unable to change the case of dirs on Windows
Tested on Windows 10.

(cherry picked from commit 85e99460b4)
2021-10-04 15:22:03 +02:00
Shatur95
8ebefc8cf4 Fix CONNECT_REFERENCE_COUNTED
(cherry picked from commit e5a086fde6)
2021-10-04 15:15:27 +02:00
Hugo Locurcio
d71ed9d287 Document SurfaceTool must generate tangents for proper normal display
(cherry picked from commit d339388942)
2021-10-04 15:15:27 +02:00
Hugo Locurcio
48e0212497 Add an example on iterating an array backwards
This closes https://github.com/godotengine/godot-docs/issues/3472.

(cherry picked from commit 810d8f06b7)
2021-10-04 15:15:27 +02:00
PouleyKetchoupp
54424b57b3 Fix buffer overflow in 2D BVH
Some areas of code were missed and assumed Vector3.

(cherry picked from commit d3c6395dcd)
2021-10-04 15:15:23 +02:00
Hugo Locurcio
7e3016ebfd Document how to set up UPnP in a non-blocking manner
(cherry picked from commit f4bebc272c)
2021-10-04 14:37:43 +02:00
Lucy
1d3f1c8c0a Fix Platform Thread Override
(cherry picked from commit 5fe1857496)
2021-10-04 14:37:27 +02:00
zacryol
3e4e87fb90 Fix typo with example variable name in Dictionary docs, and fix error in C# example
(cherry picked from commit 9359bee75c)
2021-10-04 14:36:59 +02:00
Hugo Locurcio
7c624b6b2b Use a Big Sur-style macOS icon for the Godot editor
This provides a more coherent visual look with the rest of macOS.

Co-authored-by: Hazar <36481442+hazarek@users.noreply.github.com>
(cherry picked from commit 4589790348)
2021-10-04 14:33:46 +02:00
Rémi Verschelde
87feb57a1f Merge pull request #52509 from jitspoe/3.x.csg_fixes_and_simplification 2021-10-04 13:15:48 +02:00
Rémi Verschelde
555e937815 Merge pull request #53383 from akien-mga/3.x-DEV_ENABLED 2021-10-04 13:05:10 +02:00
jitspoe
d7af7a9b3b CSGPolygon fixes and features: Added angle simplification, UV tiling distance option, and interval type, which allows distance-based intervals (old) and subdivision-based intervals (new to 3.4). 2021-10-04 12:14:44 +02:00
Rémi Verschelde
b301514708 Merge pull request #53380 from timothyqiu/soft-body-3.x 2021-10-04 11:36:48 +02:00
Rémi Verschelde
e292d79fb3 SCons: Add DEV_ENABLED defines for target=debug builds
This will allow adding developer checks which will be fully compiled out in
user builds, unlike `DEBUG_ENABLED` which is included in debug tempates and
the editor builds.

This define is not used yet, but we'll soon add code that uses it, and change
some existing `DEBUG_ENABLED` checks to be performed only in dev builds.

Related to https://github.com/godotengine/godot-proposals/issues/3371.
2021-10-04 11:25:02 +02:00
Haoyu Qiu
ed5a98c3c6 Fix crash when pinned SoftBody point is out of range 2021-10-04 15:47:12 +08:00
Rémi Verschelde
2b642d68c1 Merge pull request #52752 from Pineapple/fix-richtextlabel-character-offsets 2021-10-04 08:52:26 +02:00
Pedro J. Estébanez
6a4c2c1c13 Reset scene conditionals assumed to be false 2021-10-04 00:13:59 +02:00
Rémi Verschelde
a5159f3527 Merge pull request #53060 from timothyqiu/thread-obj-3.x 2021-10-03 22:10:53 +02:00
kleonc
e2e149f4df Fix rendering centered odd-size texture in AnimatedSprite/AnimatedSprite3D 2021-10-03 14:15:21 +02:00
Rémi Verschelde
33a42160a0 Merge pull request #42365 from madmiraal/fix-39887-3.2 2021-10-03 13:41:38 +02:00
Rémi Verschelde
06e0260699 Merge pull request #53349 from LATRio/53331_1 2021-10-03 12:16:45 +02:00
Rémi Verschelde
e92818b85a Merge pull request #53335 from LATRio/53331_2 2021-10-03 10:17:49 +02:00
Haoyu Qiu
7be67ee1b7 Fix crash when creating thread 2021-10-03 16:03:41 +08:00
LATRio
56aa9f71b6 Prevent out of bound access through 'm_nodes' in SoftBodyBullet 2021-10-03 16:36:01 +09:00
Gergely Kis
1583c89a45 Fix GDNativeLibrary::get_current_library_path()
Return a const String reference to make sure that when its address
is used as a handle in NativeScriptLanguage::init_library(),
it refers to the heap instead of a temporary object on the stack.
2021-10-03 08:24:49 +02:00
LATRio
be69d26403 Fix crash at SoftBodyBullet::reset_all_node_positions when bt_soft_body isn't initialized
Update soft_body_bullet.cpp
2021-10-02 22:03:54 +09:00
Rémi Verschelde
90a7342114 Merge pull request #53307 from Calinou/doc-spatialmaterial-normal-tangents 2021-10-01 21:43:54 +02:00
Francois Belair
6be31e559d Fix empty line hover; fix open non-res:// script
(cherry picked from commit 572979d011)
2021-10-01 21:30:39 +02:00
Rémi Verschelde
003c282e10 Merge pull request #53309 from Razoric480/fix-lsp-token-issues-3x 2021-10-01 21:27:15 +02:00
EricEzaM
6628fe0469 Fixed drag and drop not respecting type on exported arrays. 2021-10-01 13:26:15 -06:00
Eric M
a4b6ba2c2f Added properties and methods to allow for dragging and dropping multiple files onto exported arrays. 2021-10-01 13:24:41 -06:00
Hugo Locurcio
ebdbace62a Document that tangents are required for normal mapping in SpatialMaterial 2021-10-01 19:05:58 +02:00
Francois Belair
3754759e26 Fix extends parsing breaking if it has the cursor 2021-10-01 11:31:05 -04:00
Hugo Locurcio
c6617e956c Tweak the Viewport configuration warning to mention 2×2 size requirement 2021-10-01 16:43:33 +02:00
Hugo Locurcio
fe2f24c47c Improve the documentation for ease() and smoothstep()
This adds a cheatsheet for `ease()` and a comparison graph for
`smoothstep()`, among other things.

(cherry picked from commit 567b6436c9)
2021-10-01 08:04:20 +02:00
Hugo Locurcio
deeeabc2ba Clarify what the Node.filename property contains
(cherry picked from commit f23b917007)
2021-10-01 08:01:47 +02:00
Haoyu Qiu
44ea7e7c4f Fix doc for Dictionary.erase
(cherry picked from commit 1e0fe9f817)
2021-10-01 08:00:59 +02:00
Hugo Locurcio
26671e7407 Use a yellow color for editable children properties instead of red
This matches the usual "Changes may be lost!" warning color.
2021-09-30 18:41:46 +02:00
Rémi Verschelde
8d0b2edfc2 Merge pull request #53258 from boruok/3.x-fix-atlas-texture-get_data-crash 2021-09-30 18:31:44 +02:00
Rémi Verschelde
23f21ac45e Merge pull request #53261 from Razoric480/lsp_crash_vim_ale 2021-09-30 17:59:01 +02:00
Francois Belair
679ce6fd0b Fix LSP crash parsing scripts of temp size 0 2021-09-30 11:11:56 -04:00
boruok
85dd970b81 [3.x] Fix AtlasTexture get_data crash 2021-09-30 22:22:10 +09:00
Rémi Verschelde
7c9e06f936 Merge pull request #48686 from bruvzg/bundle_icon_3 2021-09-30 14:55:41 +02:00
Rémi Verschelde
0a7c6c0f1d Merge pull request #53220 from KoBeWi/dark_editor 2021-09-29 22:57:08 +02:00
Rémi Verschelde
fba9fb2439 Merge pull request #53183 from m4nu3lf/threadsafe_bullet_3.x 2021-09-29 21:34:56 +02:00
Rémi Verschelde
585a9c2979 Merge pull request #48300 from akien-mga/3.x-bullet-3.09 2021-09-29 21:25:58 +02:00
Aaron Franke
c1734dacf6 Add locale rename for the "C" locale 2021-09-29 13:57:24 -05:00
Francois Belair
d43a485e51 Add up/down keys to inc/dec val in spin slider
Back ported to 3.2.
2021-09-29 14:09:27 -04:00
Metin Celik
edcb7b8129 Add half frame to floor() 2021-09-29 20:03:07 +02:00
kobewi
0fa8d3431a Fix editor stuck dimmed because of unsaved script 2021-09-29 17:06:12 +02:00
Rémi Verschelde
b7901c773c bullet: Sync with upstream 3.17
Stop include Bullet headers using `-isystem` for GCC/Clang as it misleads
SCons into not properly rebuilding all files when headers change.

This means we also need to make sure Bullet builds without warning, and
current version fares fairly well, there were just a couple to fix (patch
included).

Increase minimum version for distro packages to 2.90 (this was never released
as the "next" version after 2.89 was 3.05... but that covers it too).
2021-09-29 16:30:34 +02:00
Rémi Verschelde
69b2f1dcc6 Merge pull request #53094 from Razoric480/fix-func-doc-_init 2021-09-29 15:47:37 +02:00
Rémi Verschelde
9b4e62d78f Merge pull request #53213 from akien-mga/3.x-fix-gcc-11-Wextra 2021-09-29 15:42:19 +02:00
Rémi Verschelde
6bdd84b8d5 Fix -Wextra warnings from GCC 11 2021-09-29 15:23:12 +02:00
Francois Belair
ae3aec1dbc Makes LSP report new() as _init; fixes docstrings 2021-09-29 08:43:32 -04:00
Rémi Verschelde
01ae4888e9 Merge pull request #53207 from o01eg/virtual-translation-3.x 2021-09-29 14:09:15 +02:00
Fabio Alessandrelli
acb748e66f Merge pull request #52973 from selgesel/patch2
[3.x] Release pressed events when the window is blurred on HTML5 platform
2021-09-29 13:11:56 +02:00
O01eg
cddabf2a8b Implement override of get_message 2021-09-29 14:06:57 +03:00
kleonc
047108a4ca SceneTreeDock Ensure to deactivate multi edit when selection changes to a single node
(cherry picked from commit 5d25115e80)
2021-09-29 11:05:05 +02:00
Matthew Newall
8f66e6148d Corrected Save Scene and Save All Scenes not working when the scene's dir no longer exists
(cherry picked from commit ed2280528f)
2021-09-29 11:04:49 +02:00
Duarte David
a4fecbb0da Fixes the normals of SphereMesh when the sphere/hemisphere is oblong
(cherry picked from commits f4ac08a182
and 7d53755ca7)
2021-09-29 10:55:51 +02:00
Rémi Verschelde
bf65c0e479 HTML5: Fix minification error with Emscripten 1.39.9
It used an old vendored version of acorn.js which seems to choke on this
trailing comma. This is not a problem for more recent Emscripten versions.

We disable the `comma-dangle` check in ESLint to prevent this issue.

(cherry picked from commit 23b51a1708)
2021-09-29 10:54:01 +02:00
Rémi Verschelde
60bcc91dd5 Merge pull request #53190 from nekomatata/software-skinning-aabb-optimization 2021-09-29 10:34:55 +02:00
Rémi Verschelde
bb60c97d10 Merge pull request #53063 from stebulba/3_x_undo_closecurve 2021-09-29 10:18:37 +02:00
Rémi Verschelde
2ad1c85831 Merge pull request #52947 from zmanuel/negative-delta-fix-3x 2021-09-29 09:10:07 +02:00
Rémi Verschelde
b22d3df89d Merge pull request #53065 from godotengine/template_manager_mirror_icon_3 2021-09-29 08:12:26 +02:00
Rémi Verschelde
37a484ebbb Merge pull request #53202 from timothyqiu/line-edit-undo 2021-09-29 08:10:12 +02:00
Haoyu Qiu
eab1e228c8 Fix LineEdit undo crash
Make sure all related member variables are initialized before creating
the first undo state.
2021-09-29 13:52:40 +08:00
PouleyKetchoupp
304102f66f Optimize AABB calculation in software skinning
Using min/max instead of regular AABB for optimal processing.
2021-09-28 10:11:04 -07:00
Rémi Verschelde
1dfddae05f Merge pull request #53113 from danger-dan/wake_on_force 2021-09-28 18:57:48 +02:00
Rémi Verschelde
72950684c8 Merge pull request #53157 from boruok/fix-atlas-texture-return-null 2021-09-28 18:53:53 +02:00
Manuele Finocchiaro
6f81c213a6 Compile bullet with threasafe switch on 2021-09-28 17:21:26 +01:00
Rémi Verschelde
9147a6a401 Merge pull request #53168 from LATRio/53120 2021-09-28 14:04:10 +02:00
LATRio
4fb7b1ebb0 fix crash in Variant::get_method_default_arguments when wrong type is passed 2021-09-28 19:57:45 +09:00
Rémi Verschelde
462b8dfe96 Merge pull request #53041 from pycbouh/docs-color-picker-and-button-3.x 2021-09-28 12:14:00 +02:00
boruok
768cff7c02 fix atlas texture return null 2021-09-28 16:34:00 +09:00
Rémi Verschelde
dbe0e4613a Merge pull request #53140 from V-Sekai/gltf_naming_fix 2021-09-28 08:40:54 +02:00
Daniel
57b3b5108a Added wakeup() call to velocity, force and impulse functions. 2021-09-28 19:00:10 +13:00
Rémi Verschelde
508a616455 Merge pull request #53142 from RandomShaper/fix_cast_freed_check_3.x 2021-09-28 07:42:40 +02:00
Rémi Verschelde
d4d4603827 Merge pull request #53144 from nekomatata/software-skinning-aabb
Update mesh AABB when software skinning is used
2021-09-28 07:27:23 +02:00
Rémi Verschelde
5807586188 Merge pull request #53143 from naeu/fix_folder_icon_3.x
[3.x] Set directory dialog folder icon color
2021-09-27 23:47:43 +02:00
PouleyKetchoupp
941cff4157 Update mesh AABB when software skinning is used
Not updating the mesh properly can cause rendering issues in some cases,
like shadows not updating properly.
2021-09-27 11:56:58 -07:00
naeu
9fb7efdf16 Set dialog folder icon color 2021-09-27 19:10:20 +01:00
Pedro J. Estébanez
6697e380d9 Fix check for freed object during cast 2021-09-27 19:46:49 +02:00
Rémi Verschelde
65ab9130e1 Merge pull request #53136 from akien-mga/3.x-cherrypicks 2021-09-27 19:35:43 +02:00
SaracenOne
c6387e58e9 Fixes naming conflict in GLTF importer 2021-09-27 18:07:50 +01:00
Rémi Verschelde
abe0535fc0 Revert "Load assets before enabling editor plugins"
This reverts commit 55f9ae3d21.

It caused regressions #52968 and #52995.
2021-09-27 18:28:01 +02:00
Rémi Verschelde
ac01b1cb1c Revert "Fixes the normals of SphereMesh when the sphere/hemisphere is oblong"
This reverts commit c4d0074aae.

It caused regression #52965.
2021-09-27 18:27:55 +02:00
BimDav
9de9994444 Reload kinematic shapes when changing PhysicsBody mode to Kinematic
Prevents a crash when calling test_body_motion. Call reload_kinematic_shapes
from init_kinematic_utilities as they are always called together.

(cherry picked from commits 112985c5bc
and 3540e716f9)
2021-09-27 18:10:30 +02:00
Matthew Newall
e01d609c02 Updated Tabs to not update excessively
(cherry picked from commit 082f924566)
2021-09-27 18:09:47 +02:00
David Socha
b05f70fe6e export "Keep" import option when multiple files are selected
Co-Authored-By: Rémi Verschelde <rverschelde@gmail.com>
(cherry picked from commit ec9f9f72e2)
2021-09-27 18:06:55 +02:00
Michael Alexsander
b4d6afb7ad Expose TabContainer's tab hidding for scripts
(cherry picked from commit 7ce02b642e)
2021-09-27 18:06:36 +02:00
kobewi
e0f46c2b38 Add a special case for 0-time interpolations
(cherry picked from commit 5c1195e456)
2021-09-27 18:06:08 +02:00
Rémi Verschelde
e2b2319ee5 CI: Build test binaries with debug symbols, then strip
This allows having good stacktraces when the tests crash.

(cherry picked from commit c4fa301b6b)
2021-09-27 18:03:39 +02:00
Rémi Verschelde
4f734c15a4 nanosvg: Sync with upstream ccdb199
Includes fixes for a memory corruption bug (CVE-2019-1000032)
and possible division by zero.

(cherry picked from commit 05b28b66ea)
2021-09-27 17:59:04 +02:00
skyace65
370fa82b2c Add note that for _gui_input(event) event position is relative to the control origin
(cherry picked from commit 824259aca0)
2021-09-27 17:57:50 +02:00
Rémi Verschelde
29b1d39c51 Merge pull request #53105 from aaronfranke/3.x-fix-gltf-light 2021-09-27 16:18:43 +02:00
Aaron Franke
674cb947ea [3.x] Fix GLTF light import 2021-09-26 21:57:03 -05:00
Rémi Verschelde
8fb06b45d1 Merge pull request #53015 from timothyqiu/cast-crash 2021-09-26 12:05:38 +02:00
Haoyu Qiu
8a47fe9eb0 Fix crash when casting from null 2021-09-26 10:08:14 +08:00
Rémi Verschelde
7893dd26df Merge pull request #53068 from Razoric480/apply-new-signal 2021-09-25 22:13:08 +02:00
Francois Belair
885d905b0d Make LSP send applyEdit to connect editor signals 2021-09-25 15:22:28 -04:00
Hugo Locurcio
1ff98bfa1b Add history navigation in the script editor using extra mouse buttons
This feature is enabled by default, but it can be disabled in the editor
settings in case it interferes with other uses of the extra buttons
(such as push-to-talk in a VoIP program).
2021-09-25 20:33:57 +02:00
Michael Alexsander
da265c6ceb Make mirror button in Template Manager use the lighter version of its icon 2021-09-25 15:15:58 -03:00
Stéphane Fortin
6cf54d06be add missing undo on CloseCurve 2021-09-25 13:22:10 -04:00
Rémi Verschelde
f8b8ef656c Merge pull request #53039 from pycbouh/tree-fix-folding-arrow-with-margin-3.x
[3.x] Correctly calculate position of the folding arrow in `Tree`
2021-09-25 09:13:51 +02:00
Yuri Sizov
dd2a01cbbe Add usability notes to ColorPicker and ColorPickerButton descriptions
Co-authored-by: follower <follower@rancidbacon.com>
2021-09-25 02:21:39 +03:00
Yuri Sizov
020807dc0f Correctly calculate position of the folding arrow in Tree 2021-09-25 02:01:35 +03:00
Rémi Verschelde
94f658a8d2 Merge pull request #52984 from pycbouh/disable-freaky-subinspectors-3.x 2021-09-25 00:08:42 +02:00
Rémi Verschelde
792f95a264 Merge pull request #53022 from Schweini07/ve2d-signal-fix 2021-09-24 23:15:45 +02:00
Rémi Verschelde
86944daafd Merge pull request #53026 from kleonc/texture-preview-updating-3x 2021-09-24 23:15:12 +02:00
Rémi Verschelde
5d34480dab Merge pull request #53010 from Calinou/editor-debugger-color-error-warning-lines-3.x 2021-09-24 21:42:05 +02:00
Laurenz Reinthaler
aad01cd0c6 Fix VisibilityEnabler2D throwing a signal error when process_parent or physics_process_parent are enabled 2021-09-24 19:03:10 +02:00
kleonc
4eb59e8492 TexturePreview Update text when texture is being changed 2021-09-24 18:55:58 +02:00
Hugo Locurcio
1e4967968f Color error and warning lines in the editor debugger's Errors panel
This improves readability when some errors/warnings are unfolded,
as their stack traces will keep their original colors.
2021-09-24 15:53:41 +02:00
lawnjelly
279e6f65cd Portals - add reason string to unload message
To help users identify conditions that are causing room system invalidation, a reason message is passed to the unload function and logged.
2021-09-24 14:00:24 +01:00
Rémi Verschelde
c26547414d Update AUTHORS and DONORS list
New contributors added to AUTHORS:
@AnilBK, @Jummit

Thanks to all contributors and donors for making Godot possible!

(cherry picked from commit 252ae43737)
2021-09-24 12:28:18 +02:00
Yuri Roubinsky
1622827a7e Merge pull request #52966 from Chaosus/blend_tree_connection_improvement_3.x
[3.x] Draggin in/out from ports to create nodes in Animation Blend Tree
2021-09-24 10:00:47 +03:00
Rémi Verschelde
6e39566344 Merge pull request #52883 from Germanrc/script_reload_fix
C# scripts reload in editor fixed
2021-09-24 08:33:49 +02:00
Yuri Sizov
d3d7c29b8c Disable sub-inspectors for properties with their own editors 2021-09-24 00:36:28 +03:00
Selgesel
c918b4d246 [3.x] Release pressed events when the window is blurred on HTML5 platform 2021-09-23 16:44:03 +03:00
Rémi Verschelde
044cafc31a Merge pull request #52894 from laws65/3d-skeleton-bone-fix 2021-09-23 12:10:26 +02:00
Yuri Roubinsky
5c06685609 [3.x] Draggin in/out from ports to create nodes in Animation Blend Tree 2021-09-23 12:09:19 +03:00
Bartłomiej T. Listwon
f463e612a1 Add missing WIN32_LEAN_AND_MEAN 2021-09-23 10:36:31 +02:00
Rémi Verschelde
08887fd391 Merge pull request #52955 from nekomatata/fix-kinematic-collision-reference-3.x 2021-09-23 10:26:17 +02:00
PouleyKetchoupp
8b562543df Don't override KinematicCollision reference when still in use in script
In case the reference is stored in script, create a new instance to
avoid overriding the previous values.
Otherwise, re-use the reference as before to avoid extra allocations.
2021-09-22 18:15:03 -07:00
Manuel Moos
f8e62424c5 Fix negative delta arguments
Three attack points, all after the regular calculations:
1. Prevent negative physics timestep counts. They could occur if
   physics_jtter_fix is changed at runtime.
2. idle_step is not allowed to go below 1/8th of the input step.
   That could happen on physics_jitter_fix changes or heavily
   fluctuating performance.
3. Prevent that the idle_step modification breaks the promise
   that Engine.get_physics_interpolation_fraction() is between
   0 and 1 by doing more physics steps than the base system wants.

Fixes #26887

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
Cherry-Pick from 6be702bace.
2021-09-22 21:09:38 +02:00
Rémi Verschelde
23bb5883cb Merge pull request #52925 from timothyqiu/follow-property-null 2021-09-22 08:42:27 +02:00
Rémi Verschelde
644b054e12 Merge pull request #52922 from timothyqiu/view-name-typo-3.x 2021-09-22 08:29:33 +02:00
Haoyu Qiu
45b4304f10 Fix crash in Tween.follow_property
Check `p_object` for null before using it.
2021-09-22 13:38:21 +08:00
Haoyu Qiu
4b611c4518 Fix 3D view name typo 2021-09-22 10:31:48 +08:00
Germanrc
84a218d346 C# script reload fixed
Co-authored-by: Michael Bickel <mib@developium.net>
2021-09-21 23:03:45 +02:00
Rémi Verschelde
dd0ee48728 Merge pull request #52900 from akien-mga/3.x-cherrypicks 2021-09-21 21:40:47 +02:00
kobewi
d0a8e6d563 Improve call_group documentation
(cherry picked from commit 31ef94f2ec)
2021-09-21 20:33:12 +02:00
Rémi Verschelde
882e04ed0d i18n: Sync translations with Weblate 2021-09-21 20:33:12 +02:00
kleonc
67b27ea4c9 AStar Add error messages
(cherry picked from commit 71255bc2a9)
2021-09-21 20:33:12 +02:00
Rémi Verschelde
b4fc24b73f Implement OS::get_locale_language() helper method
This method extracts the 2 or 3-letter language code from `OS::get_locale()`,
making it easier for users to identify the "main" language code for users
that might have different OS locales due to different OS or region, but
should be matched to the same translation (e.g. "generic" Spanish).

Fixes #40703.

(cherry picked from commit def99c7baf)
2021-09-21 20:33:12 +02:00
bruvzg
131f913747 Improve OS::get_locale() on macOS and Windows, replace "-" with "_" and use system macros instead of bitwise AND. Add locale format info to the documentation.
(cherry picked from commit f797e1c078)
2021-09-21 20:33:11 +02:00
Ricardo Subtil
5167a0281a Fix shell_open not returning errors on Windows
(cherry picked from commit c4787a8e6d)
2021-09-21 20:33:11 +02:00
Hugo Locurcio
6702e37a88 Document how to delay code execution in a non-blocking manner
(cherry picked from commit 1529bf7c10)
2021-09-21 20:33:11 +02:00
John Wigg
d484e30247 Fix y billboard shear when rotating camera
Fixes shear effect with `BILLBOARD_FIXED_Y` when the camera is rotated around the z-axis by rotating the mesh correctly into view space.

Also removes shearing effects that occur when rotating the mesh by excluding the model rotation and scale from the billboard matrix.

(cherry picked from commit d3850a0954)
2021-09-21 20:33:11 +02:00
kobewi
168292fa00 Don't stop closing on unsaved script
(cherry picked from commit 8fe664fb4b)
2021-09-21 20:33:11 +02:00
Ryan Roden-Corrent
ae38c672f1 Add QuickLoad option to resource picker.
When clicking on a resource field in the inspector dock, you now have
the "Quick Load" option in addition to "Load". This opens a QuickOpen
dialog allowing the user to type in a phrase to quickly locate the
desired resource (similar to "Quick Open Scene").

In my experience, this is much faster than clicking through the File
Dialog.

Relates to godotengine/godot-proposals#346.

(cherry picked from commit 470b94fe22)
2021-09-21 20:33:11 +02:00
mechPenSketch
68b8cf75ea Add Graph Illustrations to Doc
(cherry picked from commit 9ea619c486)
2021-09-21 20:33:11 +02:00
kleonc
891681a5a3 SpriteFramesEditor Fix preview grid in "Select Frames" dialog
(cherry picked from commit ad7a6102ae)
2021-09-21 20:33:07 +02:00
Rémi Verschelde
5b841c182a Merge pull request #52902 from nekomatata/fix-ray-shape-platform-3.x 2021-09-21 20:25:44 +02:00
PouleyKetchoupp
ad5e70cde4 Fix moving platforms with ray shapes
In the case of ray shapes, the body RID used to apply platform velocity
wasn't properly set.
2021-09-21 09:00:23 -07:00
Hugo Locurcio
da68feb0ca Print a warning if a 3D editor gizmo has no name defined
Unnamed gizmos should be avoided, so this should help editor plugin
authors resolve issues with gizmo naming if they forgot to override
the function.

(cherry picked from commit e5406ba952)
2021-09-21 17:15:01 +02:00
Nick Huelin
e902ee06ef Add note to SceneTree about pausing
This pull request adds a small amendment to `SceneTree` describing the behavior `_physics_process()` when pausing the scene.

`_physics_process` will completely stop processing collisions and signals whenever the scene is paused, however, the function will still receive calls.

This addresses: #47326

(cherry picked from commit d62175e009)
2021-09-21 17:15:01 +02:00
Nick Huelin
03af0f3e94 Add note to RichTextLabel
(cherry picked from commit 4a0cadd4ed)
2021-09-21 17:15:01 +02:00
Lucy
83bbb527ad Allow for platform Thread implementation override
(cherry picked from commit e9723efd34)
2021-09-21 17:15:00 +02:00
Jummit
d29095027b clarify what duplicate does and its limitations
(cherry picked from commit a6108f8a3d)
2021-09-21 17:15:00 +02:00
Manuel Dun
dbf2d7b76c Conversion now includes "Local to scene" flag and name
(cherry picked from commit 3e8b54bfc3)
2021-09-21 17:15:00 +02:00
Hugo Locurcio
b1b936cba8 Tweak the script editor's line/column indicator for readability
- Use a colon instead of parentheses and a comma to reduce visual
  clutter.
- Pad the line number with 4 spaces to account for scripts longer
  than 999 lines.

(cherry picked from commit 1e8976fcb5)
2021-09-21 17:15:00 +02:00
Marcus Brummer
c75aa69774 Documented that mutexes are implemented recursively
(cherry picked from commit 46bbeb2b60)
2021-09-21 17:15:00 +02:00
georgespatton
de009a29c8 doc: Clarify need to save ConfigFile to apply changes to file
See #52645 for context.

(cherry picked from commit fd8bdddd5d)
2021-09-21 17:15:00 +02:00
Hugo Locurcio
df0210a508 Document caveats with StyleBoxFlat antialiasing and beveled corners
(cherry picked from commit f7f8ae6372)
2021-09-21 17:15:00 +02:00
TechnoPorg
55f9ae3d21 Load assets before enabling editor plugins
Moves the code for enabling plugins from NOTIFICATION_READY to after the first scan has been completed.

(cherry picked from commit 1963c63b91)
2021-09-21 17:15:00 +02:00
Espeute Clement
a259112d6e Fixed Animation Playback Track not seeking properly
Fixes #38093.

(cherry picked from commit aa72af4f46)
2021-09-21 17:15:00 +02:00
Yuri Roubinsky
8519c803e4 Prevent error generates if Delete Line used on last line in CodeEditor
(cherry picked from commit 7ccbf49bda)
2021-09-21 17:14:59 +02:00
Haoyu Qiu
acd15e4cd2 Don't update CSG Shape when not inside tree
(cherry picked from commit 07042b4044)
2021-09-21 17:14:59 +02:00
David Cambré
d6f131904b Update VisualScriptCustomNode.xml
(cherry picked from commit 080125660a)
2021-09-21 17:14:59 +02:00
Hugo Locurcio
c1d13df0ef Enable Pixel Snap by default in the 2D editor
Since this avoids accidentally placing 2D nodes at subpixel positions,
this results in more crisp visuals by default, even when pixel snapping
is disabled in the project settings.

(cherry picked from commit c03e7c2dde)
2021-09-21 17:14:59 +02:00
kleonc
8816838247 MultiNodeEdit Fix setting NodePath
(cherry picked from commit 5260fd8f3e)
2021-09-21 17:14:59 +02:00
skysphr
f53294f874 Added increment_pressed and decrement_pressed icons to scrollbars
(cherry picked from commit e27ab2708f)
2021-09-21 17:14:59 +02:00
Hugo Locurcio
8a6bc045ea Add logo attribution for Android, HTML5 and Linux platform icons
- Tweak the Android platform logo to remove the Android wordmark,
  as it can't be used without explicit permission.

(cherry picked from commit 1513aa9b26)
2021-09-21 17:14:59 +02:00
kobewi
44a56c9742 Add offset for TextureProgress progress texture
(cherry picked from commit e78ee616f7)
2021-09-21 17:14:59 +02:00
jmb462
e7dac5da41 Adding InputMap action error suggestion for Input singleton
(cherry picked from commit a3b9842616)
2021-09-21 17:14:58 +02:00
Hugo Locurcio
415b7a7bfc Improve documentation for String.get_extension()
(cherry picked from commit 09eb98c530)
2021-09-21 17:14:58 +02:00
Rémi Verschelde
c906afe045 HTML5: Handle GODOT_VERSION_STATUS env var in @GODOT_VERSION@
Follow-up to #51002.

(cherry picked from commit 16f49d4b29)
2021-09-21 17:14:58 +02:00
gyroninja
9f0d7b70fd Fail at instantiating if the root node is instantiated
(cherry picked from commit f400c9239e)
2021-09-21 17:14:58 +02:00
Hugo Locurcio
3872986f1f Document Object.get_class()/is_class() ignores class_name declaration
(cherry picked from commit a15847e5ca)
2021-09-21 17:14:58 +02:00
Hugo Locurcio
348152b3c9 Document that ConfigFiles can use any file extension
The file extension given to a ConfigFile has no impact on its
formatting or behavior.

(cherry picked from commit 9c6ae95cb2)
2021-09-21 17:14:58 +02:00
dankan1890
6f6102f22c Fixed TextureAtlas import wrong images size.
Fix #42057

(cherry picked from commit 395ab3441d)
2021-09-21 17:14:58 +02:00
Hugo Locurcio
b63016c571 Display an alert when attempting to run a project with no main scene
This gives visual feedback when not starting Godot from a terminal.
This could lead to confusion when placing a Godot binary within a
project folder that has no main scene defined.

(cherry picked from commit 87fb9297e3)
2021-09-21 17:14:58 +02:00
Lorenzo Cerqua
9d6c827081 Add an outlined version of logo.png and icon.png and put it in README.md
(cherry picked from commit d68abd95fc)
2021-09-21 17:14:58 +02:00
Silc 'Tokage' Renew
fa45aa22cb Fixed seeking behavior of property track with discrete interpolation
(cherry picked from commit 6613d9cf67)
2021-09-21 17:14:57 +02:00
Aaron Franke
a5543bc35e [3.x] Warn when using the dectime method
dectime has been removed in the master branch (what will be Godot 4.0)
2021-09-21 10:03:42 -05:00
Rémi Verschelde
ed3742c4a7 Merge pull request #52897 from aaronfranke/3.x-regex
[3.x] Allow disabling the RegEx module in the editor
2021-09-21 16:26:39 +02:00
Aaron Franke
6c4928fe69 [3.x] Allow disabling the RegEx module in the editor 2021-09-21 08:49:17 -05:00
laws65
d1bacb53fd Prevent being able to set bone's parent as itself 2021-09-21 22:06:03 +09:30
Rémi Verschelde
be6b7b4f9f Merge pull request #52475 from tcoxon/fix_43733_3.x
Prevent shaders from generating code before the constructor finishes. [3.x]
2021-09-21 13:53:17 +02:00
Tom Coxon
9e9bac1549 Prevent shaders from generating code before the constructor finishes.
Fixes #43733: "creating SpatialMaterial in a separate thread creates invalid
shaders (temporarily)."

The bug occurred because various setters called in materials' constructors add
materials to queues that are processed on the main thread. This means that
when the materials are created in another thread, they can be processed on the
main thread before the constructor has finished.

The fix adds a flag to affected materials that prevents them from being added
to the queue until their constructors have finished initialising all the
members.
2021-09-21 11:47:51 +01:00
Rémi Verschelde
22aab6be1c Merge pull request #51796 from RandomShaper/dangling_obj_release_3.x
[3.x] Promote object validity checks to release builds
2021-09-21 11:48:11 +02:00
Rémi Verschelde
8ea1ad6725 Merge pull request #52772 from Calinou/editor-default-enable-doppler-3.x 2021-09-21 11:30:03 +02:00
Rémi Verschelde
8a48be6980 Merge pull request #52650 from Faless/js/3.x_audioworklet_nothreads_pr
[3.x] [HTML5] Refactor audio drivers. Implement AudioWorklet w/o threads.
2021-09-21 10:44:14 +02:00
Pedro J. Estébanez
26edc6cd41 Promote object validity checks to release builds
Extra:
- Optimized the debug-only check about why the object is null to determine if it's because it has been deleted (the RC is enough; no need to check the ObjectDB).
- Because of the previous point. the debugger being attached is not required anymore for giving the "Object was deleted" error; from now, it only matters that it's a debug build.
- `is_instance_valid()` is now trustworthy. It will return `true` if, and only if, the last object assigned to a `Variant` is still alive (and not if a new object happened to be created at the same memory address of the old one).
- Replacements of `instance_validate()` are used where possible `Variant::is_invalid_object()` is introduced to help with that. (GDScript's `is_instance_valid()` is good.)
2021-09-21 10:39:04 +02:00
Rémi Verschelde
b37776fa2f Merge pull request #52591 from timothyqiu/error-macros
[3.x] Remove do{ } while(0) wrapper around error macros
2021-09-21 10:38:34 +02:00
Rémi Verschelde
75161d247b Merge pull request #52885 from David1Socha/3.x_fix_connection_comparison
Update connection comparison operator to compare connection sources based on instance ID instead of by pointer
2021-09-21 10:12:41 +02:00
David Socha
ede023d4fa Update connection comparison operator to compare connection sources based on instance ID instead of by pointer 2021-09-21 01:38:11 -05:00
Rémi Verschelde
1ceba6e1b0 Merge pull request #52585 from Calinou/screen-texture-improve-no-sampling-error 2021-09-20 16:25:16 +02:00
Rémi Verschelde
91d0e985cd Merge pull request #52572 from timothyqiu/expose-enum-3x
[3.x] Expose enum related methods in ClassDB
2021-09-20 16:12:16 +02:00
Rémi Verschelde
7d852bd98a Merge pull request #52377 from Calinou/tweak-3d-inertia-3.x
Tweak the 3D editor inertia defaults for better responsiveness (3.x)
2021-09-20 15:41:43 +02:00
Fabio Alessandrelli
2024200182 [HTML5] Refactor audio drivers. Implement AudioWorklet w/o threads.
Performances are not great in general, bad on Firefox, on Chrome, well,
it's an improvement compared to the way they broke ScriptProcessorNode.

I'm actually surprised this works, it involves so many allocations, but
there's no way around it when SharedArrayBuffer is not available :(.
2021-09-20 14:53:27 +02:00
Rémi Verschelde
da8cd3d7a7 Merge pull request #52841 from akien-mga/3.x-cherrypicks 2021-09-20 14:26:40 +02:00
John J. Donna II
91482a00bb LSP: Add support for custom host setting
You can now configure host in the `language_server` settings in the editor
settings.

(cherry picked from commit be6da39b8a)
2021-09-20 13:55:28 +02:00
Silc 'Tokage' Renew
a95b015968 fixed AnimationNodeTransition when xfade time is zero
(cherry picked from commit 02d8166427)
2021-09-20 13:19:41 +02:00
lawnjelly
0316d50ece Improve Basis::get_quaternion error message
The previous error message incorrectly suggested that any Basis could be fixed by calling get_rotation_quation() or orthonormalize(). This PR points out that only a valid rotation Basis can be fixed in this way.

(cherry picked from commit d3a3b3aff3)
2021-09-20 13:05:26 +02:00
kobewi
0da326c8b3 Save branch as scene by dropping to filesystem
(cherry picked from commit d4f4cfbb40)
2021-09-20 13:03:29 +02:00
Ricardo Subtil
723ad5ef61 Fix path with multiple slashes not being corrected on templates
(cherry picked from commit eef0327d1e)
2021-09-20 13:01:13 +02:00
Zak
fb17ac885a Improve docs for Thread
An attempt to improve the documentation for Thread
- Adds documentation on how and when the `wait_to_finish` should be used
- Adds a note on what to be careful about when using `wait_to_finish`

(cherry picked from commit 9e2882a989)
2021-09-20 12:49:13 +02:00
Kyle
cc04b4ceba Wrote JNISinglton docs
I added a few descriptions and links to the empty JNISingleton class doc.

(cherry picked from commit 4eff57d39b)
2021-09-20 12:47:43 +02:00
Austin Tasato
af76e5fddc Add "Physics intro" docs link for State classes
(cherry picked from commit ce8eb09a25)
2021-09-20 12:42:17 +02:00
Hugo Locurcio
e1330418ab Document that node groups don't have a guaranteed order
(cherry picked from commit 0adf1a6683)
2021-09-20 12:31:56 +02:00
Marcel Admiraal
cce7e6c9d6 Use current androidx Fragment library instead of legacy libraries
(cherry picked from commit 23311a6ed3)
2021-09-19 11:37:19 +02:00
Hugo Locurcio
520b2d822a Display the node name in scene tree dock tooltips
This makes long node names previewable without having to rename them.

(cherry picked from commit c673aea124)
2021-09-19 11:32:52 +02:00
bruvzg
92377f4b20 [macOS] Request camera permission before session init.
(cherry picked from commit e6801a098e)
2021-09-19 11:31:14 +02:00
kobewi
fe745e2fff Close built-in script from any scene
(cherry picked from commit 1a60509699)
2021-09-19 11:30:29 +02:00
Hugo Locurcio
59eafe4cd3 Remove #ifdefs for handling compilation with Visual Studio < 2015
Godot 3.3 and later require Visual Studio 2017 to be compiled.

(cherry picked from commit fc0bfbb33b)
2021-09-19 11:30:22 +02:00
Arthur Paulino
e1be41b2c6 improving note on HTTPRequest class under the request method documentation
(cherry picked from commit 1ed3d9a0b0)
2021-09-19 11:30:21 +02:00
Daniel Kariv
ca2372164b fix fullscreen issue on macOS
adds a call for resize event.

(cherry picked from commit 52b114bc78)
2021-09-19 11:30:21 +02:00
Hugo Locurcio
2cd626185c Capitalize properties in the remote inspector
This makes property casing consistent with the editor.

If property capitalization is disabled in the Editor Settings,
the remote inspector will also disable capitalization.

(cherry picked from commit 854f328517)
2021-09-19 11:30:21 +02:00
PouleyKetchoupp
1454d6c670 Add support for adding plugin views behind the main view on Android
Doesn't change the default behavior, but allows plugins to add their
view behind the main view, which gives more control over what happens
with inputs and can be useful along with transparent rendering.

(cherry picked from commit 0b681d5834)
2021-09-19 11:30:21 +02:00
Hugo Locurcio
de3f454c27 Tweak skeleton editor texts "Make Rest Pose" and "Set Bones to Rest Pose"
The new terms are more descriptive of each button's actual function.

(cherry picked from commit 16cfb97ca2)
2021-09-19 11:30:21 +02:00
Hugo Locurcio
210ab11643 Write node groups one a single line when saving a .tscn file
This makes `.tscn` files more readable by ensuring sections are always
written on a single line.

(cherry picked from commit d33a7367b6)
2021-09-19 11:30:21 +02:00
Fabio Alessandrelli
b7f466012c [HTML5] Fix bug in AudioWorklet when reading output buffer.
Would attempt an out of bounds read, causing an exception.

(cherry picked from commit ba08f39e47)
2021-09-19 11:30:21 +02:00
Hugo Locurcio
f2ab6bd01c Improve messages when compiling for Linux/*BSD
- Don't display messages when enabling PulseAudio/ALSA/D-Bus/udev
  as these become noisy in incremental builds.
- Improve warning and error messages to be more descriptive
  and consistent.

(cherry picked from commit 4c5deea83e)
2021-09-19 11:30:20 +02:00
Rémi Verschelde
673612f1b7 Merge pull request #52830 from aaronfranke/3.x-cs-format-mini
[3.x] Some more C# formatting and style fixes
2021-09-18 23:02:11 +02:00
Aaron Franke
298e29c772 [3.x] Some more C# formatting and style fixes 2021-09-18 12:11:03 -05:00
Rémi Verschelde
bb2772d2f2 Merge pull request #52762 from magian1127/3.xTemp1 2021-09-18 14:51:07 +02:00
Magian
0263a87c8b C#, replace the current Xform method with a * operator. 2021-09-18 20:40:08 +08:00
Rémi Verschelde
316b5dad2d Merge pull request #52390 from raulsntos/csharp-docs-3.x
[3.x] Add documentation to GodotSharp
2021-09-18 01:00:03 +02:00
Rémi Verschelde
1a30a285a9 Merge pull request #52454 from skyace65/ExpRange34 2021-09-17 23:12:36 +02:00
Rémi Verschelde
d92405de74 Merge pull request #52728 from jmb462/ninepatchrect_node_warning 2021-09-17 20:22:10 +02:00
Hugo Locurcio
4914b57222 Enable Doppler preview in the 3D editor by default
This makes setting up AudioStreamPlayer3D nodes for Doppler playback
a bit easier.

- Move AudioStreamPlayer3D's Doppler Tracking property outside a group
  since the group only had 1 property, which resulted in unnecessary
  folding in the inspector.
- Put the AudioStreamPlayer3D Playing and Autoplay properties higher up
  in the inspector since these are likely to be modified often.
2021-09-17 18:51:09 +02:00
Rémi Verschelde
a72724023c Merge pull request #52438 from tommyZZM/main-loop-type-class-3.x 2021-09-17 16:20:41 +02:00
Camille Mohr-Daurat
bb885c5704 Merge pull request #52369 from bengtsts/3.x
Expose soft body pin methods to GDScript
2021-09-17 06:19:54 -07:00
Rémi Verschelde
4b50cd9b56 Merge pull request #52763 from magian1127/3.xtemp2 2021-09-17 12:26:36 +02:00
Rémi Verschelde
6ba5d36853 Merge pull request #52758 from Calinou/add-listener-gizmo-icon-3.x 2021-09-17 12:07:58 +02:00
Rémi Verschelde
16ca2757f8 Merge pull request #52737 from EIRTeam/action_erase_fix 2021-09-17 11:52:42 +02:00
Bengt Söderström
2117584690 Documented soft body pinning methods 2021-09-17 11:25:53 +02:00
Bengt Söderström
73b9b84995 Expose soft body pin methods to GDScript 2021-09-17 11:25:31 +02:00
Rémi Verschelde
48b2a026c9 Merge pull request #52753 from SilverCreekEntertainment/fix-cursor-disappearing-in-windows-fullscreen-3.x 2021-09-17 11:16:23 +02:00
Magian
58e742e2c0 C# Array<String> Export Support Enum(String) 2021-09-17 14:03:27 +08:00
jmb462
a9d0baa4f4 Add a node warning using NinePatchRect's Tile or Tile Fit modes in GLES2 2021-09-17 06:29:10 +02:00
Álex Román Núñez
43bc8830f1 Fix InputMap.action_erase_event() failing to erase events correctly.
Fixes #52733

(3.x backport of 7104229a85)
2021-09-17 03:08:21 +02:00
Hugo Locurcio
7922c262f6 Display a editor gizmo icon for Listener
The icon was present in `editor/icons/`, but it was never implemented
in the editor gizmos code.

This also removes some unused gizmo drawing code (overridden methods
that are no longer called anywhere).
2021-09-16 23:37:12 +02:00
Bartłomiej T. Listwon
903765f94d Fix RichTextLabel character horizontal offset calculation 2021-09-16 21:44:17 +02:00
Dan
5a8fe36891 Fix Windows cursor with trails disappearing in fullscreen
Fixed by turning off mouse trails when going into fullscreen, then restoring trails when exiting fullscreen or game
2021-09-16 12:34:46 -07:00
Rémi Verschelde
76a3c72a1d Merge pull request #47690 from nekomatata/textedit-fix-cursor-update-3.x
[3.x] Fix TextEdit cursor update when adding or deleting text
2021-09-16 18:28:12 +02:00
PouleyKetchoupp
ab55c33c20 Fix TextEdit cursor update when adding or deleting text
Updating the viewport while setting the line index before the column is
set could wrongly cause the text to be scrolled down.
2021-09-16 09:14:22 -07:00
Rémi Verschelde
c33ff6bf6b Merge pull request #47235 from opl-/fix/25046-3.x 2021-09-16 15:24:09 +02:00
Rémi Verschelde
627577d615 Merge pull request #47346 from nekomatata/heightmap-draw-triangles-3.x 2021-09-16 15:23:06 +02:00
Rémi Verschelde
ae58f94323 Merge pull request #52445 from nekomatata/fix-mono-nodepath-default-arg-3.x 2021-09-16 15:20:17 +02:00
Rémi Verschelde
4850e7eaca Merge pull request #52744 from theraot/3.x
[3.x] Fix get_base_dir windows top level directory logic
2021-09-16 14:12:57 +02:00
Theraot
d03f7c0598 [3.x] Fix get_base_dir windows top level directory logic
This is a fix for https://github.com/godotengine/godot/issues/52048
2021-09-16 06:38:29 -05:00
Rémi Verschelde
1bbc7c9c3a Merge pull request #52713 from Calinou/x11-opengl-driver-reboot
Mention that rebooting is required after updating graphics driver on X11
2021-09-16 10:26:27 +02:00
Rémi Verschelde
e4c4e7c2e0 Merge pull request #52721 from Faless/js/3.x_fix_wheel
[3.x] [HTML5] Fix wheel/touch callback modifying event after parse.
2021-09-16 09:41:53 +02:00
Max Hilbrunner
f8e3840913 Merge pull request #49039 from madmiraal/fix-docs-3407-3.x
[3.x] Clarify documentation of Camera.get_camera_transform()
2021-09-16 00:22:06 +02:00
Max Hilbrunner
1d07feca54 Merge pull request #49042 from madmiraal/fix-docs-4085-3.x
[3.x] Clarify that eof_reached() cannot be used to check if more data is available
2021-09-16 00:20:12 +02:00
Rémi Verschelde
25cbb858bc Merge pull request #51935 from nekomatata/android-transparency-3.x
[3.x] Window transparency support on Android
2021-09-15 22:34:12 +02:00
Fredia Huya-Kouadio
c8b022c165 Provide a getter for the project data directory. 2021-09-15 13:00:25 -07:00
Fabio Alessandrelli
97a8b7c68e Merge pull request #52723 from Faless/js/3.x_mix_rate
[3.x] [HTML5] Use browser mix rate by default on the Web.
2021-09-15 21:49:26 +02:00
Fabio Alessandrelli
b800438efb [HTML5] Use browser mix rate by default on the Web.
Browsers doesn't really like forcing the mix rate, e.g. Firefox does not
allow input (microphone) if the mix rate is not the default one, Chrom*
will exhibit worse performances, etc.
2021-09-15 20:36:19 +02:00
PouleyKetchoupp
52fdb4ece9 Window transparency support on Android
Implements per-pixel transparency feature on Android.
Allows plugins to do specific rendering and render godot UI on top
(useful for camera support with drawing on top).
2021-09-15 10:41:08 -07:00
Rémi Verschelde
6138c69cf5 Merge pull request #52717 from Calinou/doc-unicode-emoji-windows-3.x 2021-09-15 19:39:43 +02:00
Hugo Locurcio
622f0b7d38 Document that most emoji won't display correctly on Windows 2021-09-15 18:52:21 +02:00
Hugo Locurcio
a5d027e542 Mention that rebooting is required after updating graphics driver on X11 2021-09-15 18:25:49 +02:00
Fabio Alessandrelli
7dfbc4e57c [HTML5] Fix wheel/touch callback modifying event after parse.
The events should be duplicated or reinstantiated without
assuming that parse_input will consume them immediately.
2021-09-15 17:28:44 +02:00
Aaron Franke
85eb6b6352 [3.x] Make the GLTF module not depend on the RegEx module 2021-09-15 09:19:06 -05:00
Rémi Verschelde
1cbb1f2796 Merge pull request #52526 from m4gr3d/add_pad_support_3x 2021-09-15 15:14:44 +02:00
ne0fhyk
35a98d305b Add support for Play Asset Delivery.
This only adds support for a subset of Play Asset Delivery: this causes a single install-time asset pack to always be present, but doesn't add support for dynamically downloaded asset packs.
2021-09-15 06:02:53 -07:00
Rémi Verschelde
815c16ae17 Merge pull request #52515 from m4gr3d/android_export_refactoring
[3.x] Refactor Android platform export structure
2021-09-15 14:03:53 +02:00
Rémi Verschelde
29eefc466e Merge pull request #52665 from lentsius-bark/fix-3d-scale-sensitivity
[3.x] Fix scale sensitivity for 3D objects.
2021-09-15 09:31:36 +02:00
Rémi Verschelde
2b61a4fa1a Merge pull request #52686 from eswartz/line-edit-move-cursor-on-unselect-3.x 2021-09-15 08:44:56 +02:00
Krystof Klestil
5e2450cae6 Fix issues with scaling 3D Objects
When scaling 3D objects the distance form them is not considered. Allowing for finer contorl. Overscaled objects no longer break the gizmo.
2021-09-15 08:40:41 +02:00
Ed Swartz
c79898a7b8 Use left/right arrow to move cursor when unselecting in LineEdit
-- useful for rename dialog (the filename portion is selected by
default, and usually, want to change the end of the name, not the
beginning)
2021-09-14 20:26:10 -05:00
Rémi Verschelde
20f14e0a16 Merge pull request #52586 from JFonS/lm_bake_end
Fix editor getting stuck after baking lightmaps from a script
2021-09-14 22:40:48 +02:00
Rémi Verschelde
187b1ec61e Merge pull request #51095 from RandomShaper/error_cast_freed_object_3.x
[3.x] Complain if casting a freed object in a debug session
2021-09-14 22:40:17 +02:00
Rémi Verschelde
07d7754ac6 Merge pull request #52664 from butkeim/3.x
[3.x] Fix 3D Onion skinning missing
2021-09-14 22:27:55 +02:00
Pedro J. Estébanez
123d3ef935 Complain if casting a freed object in a debug session
The idea is to give the user a chance to realize a mistake that will cause a crash in a release build (or with no debugger attached).
2021-09-14 21:05:47 +02:00
Fabio Alessandrelli
82ca712dd4 Merge pull request #52670 from Faless/ci/3.x_actions
[3.x] [CI] Refactor CI actions, use sub-actions, matrices.
2021-09-14 21:02:20 +02:00
Fabio Alessandrelli
8773b83773 [CI] Refactor CI actions, use sub-actions, matrices. 2021-09-14 19:19:13 +02:00
Rémi Verschelde
154cca3d5d Merge pull request #52595 from lewiji/mono-build-solution-shortcut
[3.x] Add editor keyboard shortcut for Mono Build solution button
2021-09-14 16:00:10 +02:00
Rémi Verschelde
47d56ace79 Merge pull request #52638 from akien-mga/3.x-cherrypicks 2021-09-14 15:56:16 +02:00
Lewis James
48a6264a87 Add editor keyboard shortcut for Mono Build solution button
Update GodotSharpEditor.cs & csharp_script.cpp with better casing and localisation for HintTooltip on Build button

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-09-14 13:24:03 +01:00
Alexandr Xenofontov
9913af974f added optional cropping for texture atlas importer 2021-09-14 21:23:59 +09:00
Rémi Verschelde
8a211219c7 Merge pull request #52243 from Pineapple/fix-light-internal
Fix Light2D UBO initialization
2021-09-14 14:21:22 +02:00
Haoyu Qiu
25bd0c3f72 Try other resolved IPs if one fails to connect
(cherry picked from commit fd52e18d19)
2021-09-14 14:18:18 +02:00
Rémi Verschelde
555108d378 Merge pull request #52661 from lawnjelly/portals_sphere_improvements
Sphere occluders - self occlusion and improvements
2021-09-14 13:55:05 +02:00
Haoyu Qiu
018f28bead Make sure IK target is inside tree before using its transform
(cherry picked from commit 88e3ba83f0)
2021-09-14 13:41:30 +02:00
Haoyu Qiu
e46d54ebec Quote and escape ConfigFile keys when necessary
(cherry picked from commit 597d489a20)
2021-09-14 13:41:27 +02:00
PouleyKetchoupp
389e67aa98 Fix loading packed scene with editable children at runtime
At runtime, packed scenes with nodes marked as editable instance where
saved with node type tags, which prevented the scene to be then loaded
as an instance, causing duplicated nodes in the tree.

This change ensures nodes marked as editable instances and their owned
children are properly set as instances.

That doesn't make a difference in the editor, since such nodes where
already set as instances based on their instance state, but it helps
at runtime where instance states are disabled.

Co-authored-by: latorril <latorril@gmail.com>
(cherry picked from commit fab88a810c)
2021-09-14 13:41:27 +02:00
Yuri Roubinsky
b36b81cbdd Better port handling connection for GraphEdit
(cherry picked from commit 61904d56ea)
2021-09-14 13:41:27 +02:00
Lewis Pollard
4e68f089e0 Fix is_playing() method in AnimatedSprite3D
(cherry picked from commit 2450173495)
2021-09-14 13:41:26 +02:00
Gilles Roudière
b0cb253a51 Fix LocalVector crash on insert.
(cherry picked from commit de0765b94a)
2021-09-14 13:41:26 +02:00
Raul Santos
6a7ca43297 Expose String.SimplifyPath in C#
(cherry picked from commit 126b1ea149)
2021-09-14 13:41:26 +02:00
Hugo Locurcio
9aee1a3992 Document Image.generate_mipmaps() always running on the main thread
(cherry picked from commit 30a88f464b)
2021-09-14 13:41:26 +02:00
Hugo Locurcio
4d94aba0ed Improve crash handler message display
- State the Godot version and full hash in the backtrace.
- Add decoration around the crash backtrace, both to make it stand out
  from other messages and help the user figure out what they should copy.

(cherry picked from commit 8556dd1bef)
2021-09-14 13:41:26 +02:00
Paul Joannon
e2b71de38b Improve C# method listing
- implement CSharpInstance::get_method_list
- loop through parent classes in CSharpInstance::get_method_list and CSharpScript::get_script_method_list (#46408)

(cherry picked from commit 19f25b6847)
2021-09-14 13:41:26 +02:00
Hugo Locurcio
d1a4cb2bea Print colored diffs when there are formatting failures in CI
This makes diffs more readable in CI logs.

(cherry picked from commit 38424714b1)
2021-09-14 13:41:26 +02:00
Duarte David
c4d0074aae Fixes the normals of SphereMesh when the sphere/hemisphere is oblong
(cherry picked from commit f4ac08a182)
2021-09-14 13:41:26 +02:00
Haoyu Qiu
930a1ea746 Make RichTextLabel honour default cursor shape property
(cherry picked from commit d12cceadd2)
2021-09-14 13:41:26 +02:00
LoipesMas
7f0094ca9f Add note about batching to Line2D's anti-aliasing
(cherry picked from commit b047430702)
2021-09-14 13:41:25 +02:00
Marcus Brummer
128208d1d0 Check if vibration duration is > 0 on Android
(cherry picked from commit 47f338fc12)
2021-09-14 13:41:25 +02:00
Vincent
ea13ff860d implement individual mesh transform for meshlibrary items
(cherry picked from commit 70108fd850)
2021-09-14 13:41:22 +02:00
Kerrad Yanis
77b00d16e2 Fix 3D Onion skinning missing 2021-09-14 13:37:23 +02:00
Rémi Verschelde
73345e1514 Merge pull request #52217 from ChronicallySerious/fix-vcs-script-attachment
Fix VCS script attachment when using GDScript VCS plugins
2021-09-14 13:13:07 +02:00
Rémi Verschelde
bd7394a105 Merge pull request #52219 from Gallilus/Fix-VisualScriptPropertySet-value-property-hint-3x
[3.x] Fix VisualScriptPropertySet value hint
2021-09-14 12:49:43 +02:00
lawnjelly
d878fe7b90 Sphere occluders - self occlusion and improvements
Sphere occluders are now tested for self occlusion. Spheres that are behind another sphere in the current view are superfluous so can be removed, cutting down on the runtime calculations.

AABBs are now maintained for Occluders as well as individual spheres, meaning a bunch of occluder spheres can be frustum rejected as a block.
2021-09-14 11:31:14 +01:00
Fabio Alessandrelli
a33635200a Merge pull request #52603 from Faless/js/3.x_fix_input_buffered
[3.x] [HTML5] Fix input not working when buffered.
2021-09-14 11:48:01 +02:00
Rémi Verschelde
f85ad007c0 Merge pull request #52338 from lawnjelly/portals_fix_portal_import
Portals - fix import of portal normal + small bug fixes
2021-09-14 10:21:44 +02:00
Rémi Verschelde
37fab65e00 Merge pull request #52477 from Lauson1ex/3.x
Add a new high quality tonemapper: ACES Fitted (3.x)
2021-09-13 17:37:22 +02:00
Juan Linietsky
42927e8069 Merge pull request #52493 from KoBeWi/this_is_order
Compare connections by object id
2021-09-13 09:02:27 -03:00
Rémi Verschelde
600f2a8d5d Merge pull request #51927 from 20kdc/issue-51897-sp1
Fix issue #51897 (horizon occlusion causing black blob), fix ver. SP1
2021-09-13 11:44:55 +02:00
Max Hilbrunner
13884099e7 Merge pull request #52616 from Calinou/doc-idle-physics-frames-3.x
Improve documentation for `Engine.get_idle_frames/get_physics_frames()` (3.x)
2021-09-13 02:38:10 +02:00
Hugo Locurcio
31c07bcca7 Improve documentation for Engine.get_idle_frames/get_physics_frames() 2021-09-12 23:10:06 +02:00
Fabio Alessandrelli
98b42ca958 [HTML5] Fix input not working when buffered.
After input buffering was reworked, input accumulation is now handled
outside of OS, and the JavaScript plaform never implemented that.
Additionally, the JavaScript platform is quite obnoxious about calling
specific APIs outside specific user triggered events.

This commit adds event flushing during the main iteration, and forces it
during keydown/keyup/mousedown/mouseup/touchstart/touchend/touchcanel
events (effectively only accumulating only "move" events).
2021-09-12 18:42:43 +02:00
Haoyu Qiu
70853fd669 Remove do{ } while(0) wrapper around error macros 2021-09-12 15:04:53 +08:00
JFonS
14eb739418 Fix editor getting stuck after baking lightmaps from a script 2021-09-12 01:01:29 +02:00
Hugo Locurcio
1c63e335b3 Improve the error message about SCREEN_TEXTURE being unavailable
This also tweaks the Viewport `usage` property hint to match the
project setting used for the root viewport.
2021-09-11 23:17:07 +02:00
opl-
a8a52f576e Fix DynamicFont breaking mouse grab in inspector spinners
This was caused by DynamicFont not specifying which property was edited, resulting in the whole inspector property tree being recreated.
2021-09-11 20:12:44 +02:00
Haoyu Qiu
468a2a2a65 Expose enum related methods in ClassDB 2021-09-11 20:33:29 +08:00
Hugo Locurcio
543c14336d Tweak the 3D editor inertia defaults for better responsiveness
The default orbit sensitivity was decreased to account for this change.
Rotational inertia (orbit + freelook) was disabled by default due to
known issues.

This also removes the need for separate manipulation inertia settings,
as the default settings are more responsive.
2021-09-10 22:17:04 +02:00
Max Hilbrunner
95162ca393 Merge pull request #52540 from kyoz/3.x
Fix (iOS): Clipboard get/set missing implement
2021-09-10 18:25:56 +02:00
Kyoz
6db3e074c5 fix(ios): Clipboard get/set missing implement 2021-09-10 21:46:54 +07:00
ne0fhyk
0cfbe354d7 Refactor Android platform export structure. 2021-09-09 10:48:29 -07:00
Endri Lauson
077083938e Add a new high quality tonemapper: ACES Fitted 2021-09-08 19:12:09 -03:00
kobewi
02535e7f17 Compare connections by object id 2021-09-08 14:00:29 +02:00
Max Hilbrunner
76693aa364 Merge pull request #52182 from lawnjelly/portals_pvs_enum
Portals - Fix RoomManager PVS enum
2021-09-07 21:23:48 +02:00
Gilles Roudière
cf48297ea2 Merge pull request #52047 from nobuyukinyuu/bind-get-tab-idx-at-point
[3.x] Bind TabContainer::get_tab_idx_at_point() to ClassDB
2021-09-07 11:10:27 +02:00
skyace65
b926059f78 Fix EXP range property hint description 2021-09-06 21:29:39 -04:00
Camille Mohr-Daurat
26e6a802c6 Merge pull request #48709 from nekomatata/heightmap-raycast-acceleration-3.x
[3.x] Optimize raycast with large Heightmap shape data
2021-09-06 16:16:06 -07:00
PouleyKetchoupp
bb6760a09f Optimize raycast with large Heightmap shape data
Port raycast accelerator from Bullet's btHeightfieldTerrainShape.
2021-09-06 15:59:47 -07:00
PouleyKetchoupp
781b979292 Fix NodePath default argument in mono bindings
Backport from master, mono was generating "" as default argument
instead of (NodePath)"".
2021-09-06 10:46:33 -07:00
Camille Mohr-Daurat
095dea7b71 Merge pull request #48551 from nekomatata/concave-shape-optimization-3.x
[3.x] Optimize area detection and intersect_shape queries with concave shapes
2021-09-06 09:36:27 -07:00
Camille Mohr-Daurat
8608ece42f Merge pull request #50405 from nekomatata/clean-convex-hull-decomposition-3.x
[3.x] Clean convex hull decomposition code
2021-09-06 09:34:50 -07:00
tommyZZM
f2a3af47e4 [3.x] Backport Accept global classes for MainLoop type in project settings
https://github.com/godotengine/godot/pull/41190
2021-09-06 23:18:06 +08:00
Gilles Roudière
ac89f9d7d7 Merge pull request #52361 from Calinou/minimap-add-hover-pressed-feedback-3.x
Add visual feedback when hovering or dragging the code minimap grabber (3.x)
2021-09-06 17:02:46 +02:00
Fabio Alessandrelli
f09ea4f0c8 Merge pull request #52416 from mbrlabs/fix-warning-spam
Initialize n_warnings_dropped to 0 in ScriptDebuggerRemote
2021-09-05 16:35:21 +02:00
Marcus Brummer
d3866d78f2 Initialize n_warnings_dropped to 0 in ScriptDebuggerRemote 2021-09-05 12:20:49 +02:00
Raul Santos
cacf3e28fd Add documentation to GodotSharp
- Adds documentation to almost every class and member in `GodotSharp`
- Fixes some old documentation to more closely follow the XML comments convention
2021-09-04 20:15:53 +02:00
Hugo Locurcio
85ebe8e3f6 Add visual feedback when hovering or dragging the code minimap grabber
This makes it more obvious that the minimap grabber can be dragged
to scroll.
2021-09-04 02:25:44 +02:00
Raul Santos
d76562ceb9 Fix constant tag documentation in C# bindings generator 2021-09-03 23:02:14 +02:00
Hugo Locurcio
ef1c509372 Merge pull request #52241 from Rubonnek/fix-simplify-path-ret
[3.x] Fix `String::simplify_path` return type
2021-09-03 15:49:53 +02:00
Fabio Alessandrelli
d136ac7f79 Merge pull request #52343 from Faless/enet/3.x_no_close_error
[3.x] [Net] Silence ENetMultiplayerPeer close_connection.
2021-09-03 10:39:53 +02:00
Fabio Alessandrelli
25f33999af [Net] Silence ENetMultiplayerPeer close_connection.
Used to print an error when it was not active, now it just returns
immediately as per the documentation.
2021-09-02 15:26:23 +02:00
lawnjelly
116e2ce799 Portals - fix import of portal normal + small bug fixes
When converting portal meshes during import, indices were not being taken into account, which could lead to incorrect estimation of the portal direction. This PR now copes with either indexed or non-indexed portal meshes.

Added a bug fix to cope with portals pointing almost directly straight up or down, which could cause problems with the lookat transform.

Added the ability for named portals to link to short room names (in addition to postfix room names).
2021-09-02 10:39:47 +01:00
Fredia Huya-Kouadio
98e1b730c8 Merge pull request #52160 from m4gr3d/update_oculus_vr_configs_3x
[3.x] Update Oculus vr configs
2021-09-01 21:11:29 -07:00
Gilles Roudière
e7ad636ef5 Merge pull request #52299 from kleonc/tab_container_drawing_disabled_current_tab_3x
[3.x] TabContainer Fix drawing current tab when it's disabled
2021-09-01 09:15:17 +02:00
kleonc
8004678d57 TabContainer Fix drawing current tab when it's disabled 2021-09-01 04:01:07 +02:00
Bartłomiej T. Listwon
350573a4df Fix buffer creation in light_internal_create() 2021-08-31 08:33:43 +02:00
Camille Mohr-Daurat
e44379612d Merge pull request #45176 from aaronfranke/3.2-kine-dup-lock
[3.x] Fix KinematicBody axis lock
2021-08-30 09:11:44 -07:00
Aaron Franke
ee69b57434 [3.x] Fix KinematicBody axis lock 2021-08-29 20:38:09 -05:00
Wilson E. Alvarez
f5409e7c3f Fixed String::simplify_path Variant return type 2021-08-29 20:25:00 -04:00
nobuyuki_nyuu
522af5c614 Bind TabContainer::get_tab_idx_at_point() to ClassDB 2021-08-29 09:11:41 -05:00
David Cambré
0c9947cb2f Fix VisualScriptPropertySet value hint 2021-08-29 15:42:04 +02:00
Twarit Waikar
25cb3edbc4 Fix #52195 VCS script attachment failing for GDScript instances 2021-08-29 18:27:17 +05:30
lawnjelly
7ea35da462 Portals - Fix RoomManager PVS enum
The PVS mode enum had been declared using scope operator, which does not seem to work correctly from GDScript with the BIND_ENUM_CONSTANT macro.

This PR removes the scope operator in the declaration.
2021-08-28 07:27:50 +01:00
Max Hilbrunner
17e61fa0af Merge pull request #52095 from kleonc/tree-item-drag-drop-drawing-3x
[3.x] Tree Fix line rendering when drag and dropping TreeItem
2021-08-27 20:55:58 +02:00
Fredia Huya-Kouadio
5b8d7752b5 Update Oculus vr configs and add support for accessing Oculus OpenXR runtime 2021-08-27 11:16:20 -07:00
Gilles Roudière
a09124aaa5 Merge pull request #52143 from Calinou/add-array-pop-method-3.x
Add an `Array.pop_at()` method to pop an element at an arbitrary index (3.x)
2021-08-27 09:37:55 +02:00
Hugo Locurcio
d717eb537b Add an Array.pop_at() method to pop an element at an arbitrary index
Negative indices are supported to pop an element relative from the end.
2021-08-27 01:27:07 +02:00
Michael Alexsander
ac33441b94 Merge pull request #52138 from LeaoLuciano/linkbutton-translation
LinkButton's text now is automatically translated in 3.x
2021-08-26 22:26:13 +00:00
LeaoLuciano
9cecabb186 LinkButton's text now is automatically translated 2021-08-26 17:56:34 -03:00
Camille Mohr-Daurat
7f1543256d Merge pull request #52116 from timothyqiu/new-kinematic-methods
[3.x] Backport new methods for `KinematicBody` and `KinematicCollision`
2021-08-26 11:02:37 -07:00
Haoyu Qiu
5183c473f7 Backport new methods for KinematicBody and KinematicCollision
For both 2D and 3D, three methods are added:

- `get_floor_angle` on `KinematicBody` to get the floor angle.
- `get_angle` on `KinematicCollision` to get the collision angle.
- `get_last_slide_collision` to quickly get the latest collision of `move_and_slide`.
2021-08-26 12:16:40 +08:00
Clay John
46ad2560a1 Merge pull request #51780 from BastiaanOlij/output_linear_gles2
Convert output of GLES2 to linear color space
2021-08-25 22:22:05 -03:00
kleonc
92ea0f7dd9 Tree Fix line rendering when drag and dropping TreeItem 2021-08-25 12:03:05 +02:00
Hugo Locurcio
f5e83e7305 Merge pull request #52052 from Calinou/dynamicfont-allow-woff
Allow using WOFF fonts in DynamicFont
2021-08-25 10:37:15 +02:00
Hugo Locurcio
1ab3ddf94a Allow using WOFF fonts in DynamicFont
This is already supported by FreeType, but it wasn't exposed.

Adding support for WOFF2 would require linking a Brotli decompression
library in Godot, so only WOFF1 is exposed here.
2021-08-25 08:09:23 +02:00
Camille Mohr-Daurat
52b7be5c41 Merge pull request #52059 from mortarroad/3.x-fix-convex-hull-double-edges
[3.x] Fix emitting duplicate edges for convex hulls
2021-08-24 15:41:11 -07:00
Morris Tabor
647ab948c0 Fix emitting duplicate edges for convex hulls
Fixes https://github.com/godotengine/godot/issues/51909
2021-08-24 19:26:33 +02:00
Camille Mohr-Daurat
5ce734c073 Merge pull request #52056 from jmb462/fix-raycast3D-color-update
[3.x] Fix Raycast3D color update when not colliding anymore (Fix #52051)
2021-08-24 08:11:05 -07:00
Max Hilbrunner
0b0002e7b4 Merge pull request #52042 from Rubonnek/expose-simplify-path-3
[3.x] Expose `String.simplify_path`
2021-08-24 17:06:58 +02:00
Camille Mohr-Daurat
9c893d3c78 Merge pull request #52057 from fabriceci/fix-transmission-velocity-on-wall
[3.x] Remove the transmission of the velocity when a body is on_wall Fix #51960
2021-08-24 08:02:29 -07:00
fabriceci
13d5fa2c43 Remove the transmission of velocity when a body is on_wall 2021-08-24 11:29:40 +02:00
jmb462
5de6376a22 Fix Raycast3D color update when not colliding anymore 2021-08-24 11:24:02 +02:00
Wilson E. Alvarez
fb5417a17b [3.x] Expose String.simplify_path 2021-08-24 00:48:20 -04:00
Hugo Locurcio
3bd682cc7b Merge pull request #52018 from Calinou/doc-networkedmultiplayerenet-compression-mode
Document that ENet compression mode must match between client and server
2021-08-23 18:57:28 +02:00
Hugo Locurcio
c2945365d8 Document that ENet compression mode must match between client and server 2021-08-23 17:35:42 +02:00
Max Hilbrunner
27bcd0601e Merge pull request #51938 from clayjohn/GLES3-reflection-probe
Properly clear cubemap filter state when texture array environment disabled
2021-08-23 16:02:55 +02:00
Max Hilbrunner
8c98320f93 Merge pull request #51967 from Calinou/spatialmaterial-gles2-allow-more-features
Allow clearcoat, anisotropy and refraction in SpatialMaterial in GLES2
2021-08-23 16:01:55 +02:00
Bastiaan Olij
73722f3c65 Convert output of GLES2 to linear color space if keep_3d_linear is enabled 2021-08-23 15:59:56 +10:00
Hugo Locurcio
2370fe5c26 Merge pull request #51973 from Calinou/define-minimum-window-size-3.x
Define a default minimum window size to workaround rendering issues (3.x)
2021-08-23 04:10:55 +02:00
Hugo Locurcio
59f24d8867 Define a default minimum window size to workaround rendering issues
The minimum window size can still be set to `Vector2(0, 0)` in a script
if needed.
2021-08-23 04:10:24 +02:00
Michael Alexsander
2ea2f30d33 Merge pull request #51993 from Calinou/basebutton-remove-enabled-focus-mode-warning
Remove deprecation warning for `BaseButton.enabled_focus_mode`
2021-08-23 01:06:55 +00:00
Hugo Locurcio
43da1790c8 Remove deprecation warning for BaseButton.enabled_focus_mode
There were too many instances of false positives that are difficult
to fix. The note in the class reference has been clarified instead.
2021-08-22 21:47:53 +02:00
Michael Alexsander
a989eb9335 Merge pull request #51972 from Calinou/improve-editor-window-title-3.x
Improve the editor window title for better usability (3.x)
2021-08-22 19:11:29 +00:00
Michael Alexsander
c62399557a Merge pull request #51974 from anazr9/godot-3.x-fixes
Fixed Crash with RichTextLabel [fill] tag #51968
2021-08-22 13:40:51 +00:00
Anas Saifi
4874270592 Removed unused variable 2021-08-22 15:58:45 +05:30
Anas Saifi
9b06355488 Update scene/gui/rich_text_label.cpp
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2021-08-22 15:18:52 +05:30
anazr9
b8bf2ec3cd fixed crash with RichTextLabel [fill] tag #51968 by using 3.3 as reference 2021-08-22 14:17:01 +05:30
Hugo Locurcio
27e38b0f26 Improve the editor window title for better usability
- Display the scene name, then the project name, then "Godot Engine".
- Display the "modified" mark before anytihng else.

Both of these changes ensure important, project-specific elements
can always be seen in the task bar which may truncate strings due to
its low per-item width.

- Use "Unnamed Project" if the project has no name (similar to the
  Project Manager).
2021-08-22 08:59:42 +02:00
Hugo Locurcio
33d23281cb Allow clearcoat, anisotropy and refraction in SpatialMaterial in GLES2
These SpatialMaterial features work just fine in GLES2,
but they were not exposed in the inspector when GLES2 was used.
2021-08-22 02:18:36 +02:00
clayjohn
987aef4e0d Properly clear cubemap filter state when texture array environment disabled 2021-08-20 19:12:38 -07:00
20kdc
324c487c63 Fix issue #51897 (horizon occlusion causing black blob), fix ver. SP1
No, not service pack 1. Removes comments from the original fix commit.
2021-08-20 19:04:27 +01:00
Camille Mohr-Daurat
16642e2838 Merge pull request #51921 from mortarroad/3.x-fix-convex-hull-winding
[3.x] Fix winding of new convex hull implementation.
2021-08-20 08:20:52 -07:00
K. S. Ernest (iFire) Lee
ffe39ee393 Merge pull request #51922 from Gallilus/Revert-sequence-port-VisualScriptPropertySet-basic-type
Revert sequence port VisualScriptPropertySet basic type
2021-08-20 08:05:14 -07:00
David Cambré
be7718c96c Revert sequence port VisualScriptPropertySet basic type
Revert a part of #50709.
Adding a sequence port to basic type set breaks backwards compatibility
2021-08-20 15:43:47 +02:00
Morris Tabor
82279538a3 Fix winding of new convex hull implementation. 2021-08-20 15:19:39 +02:00
Rémi Verschelde
0452832a16 Merge pull request #51875 from V-Sekai/gltf_accessor_min
Assign the min values in gltf accessors [3.x]
2021-08-19 11:54:42 +02:00
Rémi Verschelde
9b3d3ee6fc Merge pull request #48571 from SaracenOne/collada_semantic_fix_3_x
Fix to parsing some Collada files with extra vertex semantics  [3.x]
2021-08-19 11:09:18 +02:00
Lyuma
79b016adad Assign the min values in gltf accessors 2021-08-19 09:30:05 +01:00
Saracen
6482ba8807 Fix to parsing some Collada with extra vertex semantics referenced only in the vertices section. 2021-08-19 08:45:52 +01:00
Rémi Verschelde
6a058cbf39 Merge pull request #51746 from Calinou/add-shader-comment-3.x
Add a comment at the top of generated shaders (3.x)
2021-08-19 00:16:29 +02:00
Rémi Verschelde
364e281c75 Merge pull request #51834 from KoBeWi/🔓🔓🔓
[3.x] Include locked nodes on selection list
2021-08-19 00:15:15 +02:00
Fredia Huya-Kouadio
3baf5563e8 Delegate handling and implementation of the restart functionality to the Godot host.
(cherry picked from commit f4222733ca)
2021-08-18 23:21:13 +02:00
Fabio Alessandrelli
b7b9b902e5 Update Godot Javascript FS library to manually depend on ERRNO_CODES.
Fixes compatibility with Emscripten 2.0.26+.

(cherry picked from commit 71fb2429a0)
2021-08-18 23:20:34 +02:00
kobewi
6eb52b0768 Fix renaming directories
(cherry picked from commit 0dde3e5b59)
2021-08-18 23:19:44 +02:00
Hugo Locurcio
da757c25e1 Improve the animation bezier editor
- Allow snapping bezier handles to the timeline.
- Allow precise snapping when holding Shift for keyframes and handles.
  - Previously, it was only allowed for seeking the timeline.
  - This change also impacts the animation track editor,
    not just the bezier editor.
- Invert the Ctrl + mouse wheel behavior to match the zoom direction
  in the animation track editor.
- Increase the line spacing between the "Time:" and "Value:" texts
  to improve readability.
- Tweak box selection styling to match the animation track editor.
- Adjust line widths for hiDPI displays.

(cherry picked from commit 4a4d977bea)
2021-08-18 23:11:46 +02:00
Gordon MacPherson
0a1cf70037 Fix github actions cache server being down failing builds
(cherry picked from commit 27da2e364e)
2021-08-18 23:08:21 +02:00
Rémi Verschelde
8605d4ec26 SCons: Fix potential error when pruning cache on CI
This could cause spurious errors on CI when trying to prune the cache,
as for some reason it tries to remove files/paths which do not exist.

That points at a bug in the `cache_progress` logic but at least this
workaround should prevent CI failures.

(cherry picked from commit 825b245f0d)
2021-08-18 23:05:58 +02:00
Rémi Verschelde
85e13a4e02 Merge pull request #51858 from nekomatata/bullet-test-body-motion-depth-3.x
[3.x] Add collision depth and safe/unsafe fraction to Bullet body_test_motion
2021-08-18 22:45:54 +02:00
Rémi Verschelde
64a4c2378d Merge pull request #51857 from nekomatata/bullet-test-body-motion-crash-3.x
[3.x] Fix crash in body_test_motion when used with RigidBody3D in Bullet
2021-08-18 22:45:16 +02:00
PouleyKetchoupp
02adb0e361 Add collision depth and safe/unsafe fraction to Bullet body_test_motion
It was only implemented for godot physics before.
2021-08-18 13:09:27 -07:00
PouleyKetchoupp
db47b670f6 Fix crash in body_test_motion when used with RigidBody3D in Bullet
Kinematic utilities are now initialized for a rigid body if needed for a
call to body_test_motion.
2021-08-18 13:07:21 -07:00
Rémi Verschelde
3daf5361cc Merge pull request #51849 from aaronfranke/3.x-float-doc
[3.x] Improve the docs for the float type
2021-08-18 21:46:58 +02:00
Aaron Franke
02a94ee977 [3.x] Improve the docs for the float type 2021-08-18 13:27:43 -05:00
Rémi Verschelde
a67eaa67b0 Merge pull request #51732 from codecat/fix-caret-selection-3.x
Move cursor to edge of selection when moving caret left/right
2021-08-18 20:12:19 +02:00
Rémi Verschelde
f87c6a38b8 Merge pull request #51839 from pycbouh/particles-adjust-material-bit-size-3.x
[3.x] Adjust the material key bit size for `ParticlesMaterial`
2021-08-18 17:28:35 +02:00
Rémi Verschelde
42b7f1fbc4 Merge pull request #51841 from Calinou/cas-fix-tonemap-exposure
Fix tonemap exposure not being taken into account by sharpening
2021-08-18 17:13:00 +02:00
Yuri Sizov
29f0a0eebf Adjust the material key bit size for ParticlesMaterial 2021-08-18 17:53:24 +03:00
Hugo Locurcio
663af7ff03 Fix tonemap exposure not being taken into account by sharpening
The same fix as FXAA was applied to the CAS filter.
2021-08-18 16:44:41 +02:00
Melissa Geels
6bf6d18ee1 Move cursor to edge of selection when moving caret left/right
This is to mimic the behavior of many third party text editors.
The reasons it's not doing it when moving by word is due to that
behavior being mostly the same on other editors.

This was backported to 3.x from pull request #51502.
2021-08-18 14:28:57 +02:00
kobewi
6611d24e74 Include locked nodes on selection list 2021-08-18 13:27:33 +02:00
Rémi Verschelde
ddfaf20f62 Merge pull request #50483 from akien-mga/3.x-ci-emscripten-2.0.25 2021-08-18 11:56:39 +02:00
Rémi Verschelde
1de8f31448 CI: Upgrade Emscripten to 2.0.25
That's the version used by current containers for Godot 3.4.

Fixes a couple stray warnings that new Emscripten/LLVM catches.
2021-08-18 11:13:34 +02:00
Rémi Verschelde
19301d4ad2 Merge pull request #51828 from yjh0502/ext-reload
Auto-reload scripts with external editor
2021-08-18 10:37:09 +02:00
Rémi Verschelde
216f5f8006 Merge pull request #51824 from timothyqiu/text-editor-ttr 2021-08-18 10:06:25 +02:00
Jihyun Yu
5c66891048 Auto-reload scripts with external editor 2021-08-18 16:52:14 +09:00
Rémi Verschelde
2875cd1651 Merge pull request #51826 from Calinou/port-visual-shader-icons-3.x
Port visual shader node icons from Godot 2.1.x (3.x)
2021-08-18 08:58:29 +02:00
Rémi Verschelde
111e489f78 Merge pull request #51822 from Calinou/editor-icons-add-expression-3.x
Add editor icons for VisualScript and VisualShader expression resources (3.x)
2021-08-18 08:03:24 +02:00
Rémi Verschelde
92a7ae022d Merge pull request #51769 from The-O-King/oct_split_stream_fix
Fix Octahedral/Split Stream Options
2021-08-18 08:01:56 +02:00
Hugo Locurcio
d782353afc Port visual shader node icons from Godot 2.1.x
This also adds an icon for VisualScriptComment.
2021-08-18 05:27:19 +02:00
Haoyu Qiu
a66339a549 Fix TextEditor not checking Standard highlighter in non-English UI
When using non-English UI, there were `Index p_idx = -1 is out of bounds (items.size() = 2).`
errors on on startup if any text file is open in the script editor. And clicking the Standard
highlighter option does not check that menu item.

This is caused by `TextEditor` searching for that menu item with unlocalized text. As already
did in `ScriptTextEditor`, this PR stores and searches for menu item with `TTR`ed text.
2021-08-18 10:42:12 +08:00
Hugo Locurcio
4ef661c1e8 Add editor icons for VisualScript and VisualShader expression resources 2021-08-18 03:36:04 +02:00
Omar El Sheikh
a63028e172 Fix Octahedral/Split Stream Options
Update mesh_surface_get_format_stride and
mesh_surface_make_offsets_from_format to return an array of offsets and
an array of strides in order to support vertex stream splitting

Update _get_array_from_surface to also support vertex stream splitting

Add a condition on split stream usage to ensure it does not get used on
dynamic meshes

Handle case when Tangent is compressed but Normal is not compressed

Make stream splitting option require a restart in the settings

Update SoftBody and Sprite3D to support and use strides and offsets
returned by updated visual_server functions

Update Sprite3D to use the dynamic mesh flag
2021-08-17 16:11:47 -04:00
Rémi Verschelde
622ecf4f06 Merge pull request #51776 from timothyqiu/disable-undo-redo-3x
[3.x] Improve Undo/Redo menu items
2021-08-17 19:27:53 +02:00
Haoyu Qiu
5f316aa216 Improve Undo/Redo menu items
* Make Undo/Redo menu items disabled when clicking it does nothing.
    * Context menu of `TextEdit`
    * Context menu of `LineEdit`
    * Editor's Scene menu
    * Script editor's Edit menu and context menu  (for Script and Text)
* Make editor undo/redo log messages translatable.
* Mark `UndoRedo`'s `has_{un,re}do()` methods as `const`.
* Expose `TextEdit`'s `has_{un,re}do()` to scripts since `{un,re}do()` are already available.
2021-08-18 00:46:51 +08:00
Rémi Verschelde
c0fc475078 Merge pull request #51521 from lawnjelly/portals_occluders
Sphere occluders (portals and general use)
2021-08-17 13:55:34 +02:00
Rémi Verschelde
2ab45474fd Merge pull request #51783 from m4gr3d/address_external_dir_access
Fix possible null pointer exception.
2021-08-17 13:32:33 +02:00
Rémi Verschelde
53cc7a9be9 Merge pull request #51648 from pycbouh/editor-merge-custom-theme-3.x
[3.x] Add support for partial custom editor themes
2021-08-17 13:12:49 +02:00
Rémi Verschelde
8073b4f86a Merge pull request #51646 from pycbouh/editor-dont-use-invalid-styleboxes-3.x
[3.x] Make sure stylebox is valid in `EditorSpinSlider` before using it
2021-08-17 13:12:09 +02:00
Rémi Verschelde
97ca300acc Merge pull request #51745 from ModProg/android-right-click-3.x
[3.x] [android] Fixed wrong button mask for right click
2021-08-17 12:50:09 +02:00
Rémi Verschelde
e321b5c12f Merge pull request #51489 from nekomatata/fix-moving-platform-3d-snap-3.x
[3.x] Fix 2D/3D character snap on moving platforms
2021-08-17 11:40:17 +02:00
lawnjelly
115f4dce55 Sphere occluders (portals and general use)
Add framework for supporting geometrical occluders within rooms, and add support for sphere occluders.
Includes gizmos for editing.

They also work outside the portal system.
2021-08-17 09:02:06 +01:00
ne0fhyk
e2bcdad43b Fix possible null pointer exception. 2021-08-16 23:14:10 -07:00
Rémi Verschelde
2bc1d82098 Merge pull request #51782 from clayjohn/GLES3-octahedral-normalize
Normalize the results of octahedral decompression
2021-08-17 08:11:27 +02:00
Rémi Verschelde
daa5da0d2a Merge pull request #51757 from RevoluPowered/fix-sprite3d-using-invalid-normals-tangents
Fix octahedral compression with Sprite3D
2021-08-17 07:43:04 +02:00
clayjohn
8ac85e6a9e Normalize the results of octahedral decompression 2021-08-16 22:17:38 -07:00
Gordon MacPherson
f038c6a926 Fix octahedral compression with Sprite3D
Needs a default which is not zero
2021-08-16 22:25:44 +01:00
Rémi Verschelde
4032d26dd5 Merge pull request #51268 from RevoluPowered/fix-nan-data-from-compression
Prevent division by zero and warn about invalid normal/tangent information
2021-08-16 22:54:50 +02:00
Gordon MacPherson
6883d55da8 Octahedral compression fix division by zero and warn
This was reported by UBSAN.

Many methods were discussed, in the end this has the least evils and will use a 0,0,1 default on decompress.

Please see the PR for more info https://github.com/godotengine/godot/pull/51268
2021-08-16 21:18:57 +01:00
Rémi Verschelde
7a657b9b1c Merge pull request #51749 from LoipesMas/3.x
[3.x] Epsilon check for angular velocity in BodySW
2021-08-16 20:41:43 +02:00
PouleyKetchoupp
be13538b71 Fix 3D character snap on moving platforms
Applying the platform velocity when leaving the platform floor should be
done after snapping to keep things consistent.

Now it's done in both 2D and 3D, as it's already done in 2D on master.
2021-08-16 11:30:28 -07:00
Rémi Verschelde
dc1b18e832 Merge pull request #51743 from fabriceci/3x-avoid-useless-snap
[3.x] Avoid useless call to move and collide during snapping
2021-08-16 20:19:39 +02:00
LoipesMas
32965aa0ab Epsilon check for angular velocity in BodySW 2021-08-16 20:11:46 +02:00
Rémi Verschelde
51dd4d0c6c Merge pull request #49509 from Chaosus/shader_time_3.x 2021-08-16 19:42:55 +02:00
Hugo Locurcio
8dae2f9f00 Add a comment at the top of generated shaders
This comment is useful to determine the origin of ShaderMaterials
converted from built-in material types (such as CanvasItemMaterial
or SpatialMaterial).

The Godot version is also included in case the shader needs to be
regenerated with a newer engine version.
2021-08-16 18:46:55 +02:00
ModProg
1d63a94d19 [android] Fixed wrong button mask for right click 2021-08-16 18:41:20 +02:00
Rémi Verschelde
fb0dcdf808 Merge pull request #51734 from timothyqiu/resource-menu-item-3x
[3.x] Disable "Edit Resource from Clipboard" when nothing in clipboard
2021-08-16 18:32:34 +02:00
fabriceci
2cb364bab1 Avoid to snap when the body is already on the floor. 2021-08-16 18:09:44 +02:00
Rémi Verschelde
5ac3a85af3 Merge pull request #51117 from Calinou/macos-fix-xbox-bluetooth-controllers-3.x
Fix Xbox controllers in Bluetooth mode on macOS (3.x)
2021-08-16 17:50:17 +02:00
Hugo Locurcio
f95035b80b Fix Xbox controllers in Bluetooth mode on macOS
This prevents the D-pad up arrow from being registered as pressed
when it isn't, and pressing any direction from activating the next
arrow clockwise of it.

Co-authored-by: Scott Wadden <scott.wadden@gmail.com>
2021-08-16 17:06:31 +02:00
Haoyu Qiu
1a9604f605 Disable "Edit Resource from Clipboard" menu item when nothing in clipboard
To be consistent with other menu items.
2021-08-16 22:36:49 +08:00
Rémi Verschelde
76c891c257 Merge pull request #51706 from maiself/fix-input-methods-returning-zero-strength
Fix input methods returning zero strength when pressed status not requested
2021-08-16 13:02:36 +02:00
Rémi Verschelde
293d01ef33 Merge pull request #51721 from akien-mga/android-ndk-19
Android: Increase default armv7 NDK platform to 19
2021-08-16 10:48:40 +02:00
Rémi Verschelde
032559936f Merge pull request #51031 from kleonc/sprite_frames-preserve-src-atlas_texture-margins-3x
[3.x] SpriteFramesEditor: preserve source texture margins when creating frames from AtlasTexture
2021-08-16 10:37:57 +02:00
Rémi Verschelde
7722eea613 Merge pull request #51252 from kleonc/tab_container-fix-disconnecting-errors-3x
[3.x] TabContainer: Fix error on removing top-level Control child, Remove _get_tab method
2021-08-16 10:35:45 +02:00
Rémi Verschelde
daf922fa8a Android: Increase default armv7 NDK platform to 19
Following #50359 this is the new minSdk that we target.
Users can still override it in custom builds if they want to support SDK 18.
2021-08-16 10:14:03 +02:00
Rémi Verschelde
028a2a7205 Merge pull request #50359 from m4gr3d/address_external_dir_access
[3.x] Add support for Android scoped storage
2021-08-16 09:48:34 +02:00
Rémi Verschelde
33c9dd8845 Merge pull request #51363 from parulina/gles2-blendshapes-perf 2021-08-16 08:42:14 +02:00
Rémi Verschelde
237adfac9d Merge pull request #51714 from clayjohn/GLES3-normal-blend
Define normal_attrib when not using octahedral compression in GLES3
2021-08-16 08:26:06 +02:00
paru
ab21a3b8fb Performance improvements for GLES2 CPU blendshapes 2021-08-16 08:22:45 +02:00
clayjohn
81dc6a7688 Define normal_attrib when not using octahedral compression in GLES3 2021-08-15 22:27:46 -07:00
Mai Lavelle
d418443992 Fix input methods returning zero strength when pressed status not requested
Fixes behavior of these methods:

`InputMap::event_get_action_status`
`InputEvent*::action_match`

Previously when `p_pressed` was `nullptr`, `p_strength` would be set to
`0.0f` regardless of event strength. This affected `InputEventAction` events
processed by `Input.parse_input_event` for example.

Regression found in afa89c9eea
2021-08-15 20:00:31 -04:00
Rémi Verschelde
66497e2ecb Merge pull request #51693 from dalexeev/fix-name-casing-setting
[3.x] Fix "Property not found: editor/node_naming/name_casing"
2021-08-15 16:29:05 +02:00
Danil Alexeev
1372ba681b [3.x] Fix "Property not found: editor/node_naming/name_casing" 2021-08-15 16:54:19 +03:00
Rémi Verschelde
450f7fdc39 Merge pull request #51690 from QbieShay/rotate-y-fix
fixed rotate y flag causing the position to reset
2021-08-15 12:18:54 +02:00
Rémi Verschelde
a002e92c2e Merge pull request #51689 from lawnjelly/portals_fix_roaming
Portals - Fix cull roaming through multiple portals
2021-08-15 12:11:08 +02:00
QbieShay
32c287e01b fixed rotate y flag causing the position to reset 2021-08-15 11:35:22 +02:00
lawnjelly
546e207d8f Portals - Fix cull roaming through multiple portals
Small bug in the logic, the roaming objects only should be set to done when they have been marked as visible, rather than the first time they are examined. This is because they can be seen in a room through multiple portals, and each needs to be tested until there is either a visible result or all the portals in are visited.
2021-08-15 10:22:27 +01:00
Rémi Verschelde
f285b88dae Merge pull request #51658 from timothyqiu/view-name-3x
[3.x] Fix i18n of 3D view name
2021-08-14 18:02:40 +02:00
Haoyu Qiu
afea754e97 Fix i18n of 3D view name
Make the full view name translatable as a whole instead of combining
from sub-strings.
2021-08-14 15:23:59 +08:00
Yuri Sizov
ab25266213 Add support for partial custom editor themes 2021-08-14 02:11:54 +03:00
Yuri Sizov
be491e248a Make sure stylebox is valid in EditorSpinSlider before using it 2021-08-14 00:20:29 +03:00
Rémi Verschelde
632844e464 Merge pull request #51320 from pycbouh/docs-extract-theme-items-3.x
[3.x] Add theme item descriptions to the online documentation
2021-08-13 22:39:09 +02:00
Rémi Verschelde
67b906f2f6 Merge pull request #51629 from timothyqiu/drag-property-path-3x 2021-08-13 21:14:19 +02:00
ne0fhyk
c88d1608ab Add partial support for Android scoped storage.
This is done by providing API access to app specific directories which don't have any limitations and allows us to bump the target sdk version to 30.
In addition, we're also bumping the min sdk version to 19 as version 18 is no longer supported by Google Play Services and only account of 0.3% of Android devices.
2021-08-13 11:04:17 -07:00
Haoyu Qiu
ad425b7e9f Allow dropping property path into script editor 2021-08-13 23:01:45 +08:00
Rémi Verschelde
263a5328b8 Update AUTHORS and DONORS list
New contributors added to AUTHORS:
angad-k, Bhu1-V, Blackiris, ellenhp, fabriceci, follower,
foxydevloper, Geometror, hilfazer, hoontee, Janglee123,
Razoric480, SirQuartz, theoway.

Thanks to all contributors and donors for making Godot possible!

(cherry picked from commit d8a8d32f2e)
2021-08-13 11:45:47 +02:00
kobewi
b730ea9ad3 Don't save project on startup in headless or no-window mode
(cherry picked from commit ea2489ce93)
2021-08-13 10:20:01 +02:00
Hugo Locurcio
f77b228b2c Fix incorrect descriptions for EditorFileSystem's get_file_type()
(cherry picked from commit 1942e0c117)
2021-08-13 09:55:18 +02:00
Yuri Roubinsky
17bbdba80e Merge pull request #51610 from Chaosus/shader_fix_varying_error_3.x
[3.x] Fix shader crash when using local var with the same name as varying
2021-08-13 10:38:08 +03:00
Rémi Verschelde
b484956fba Merge pull request #51601 from RandomShaper/android_step_acq_rel
Use SafeNumeric for Android JNI step
2021-08-13 09:33:20 +02:00
Rémi Verschelde
54d14a912a Merge pull request #51402 from tinmanjuggernaut/texture_array_anisotropic
[3.x] Add Anisotropic Filter option for TextureArrays
2021-08-13 08:46:22 +02:00
Rémi Verschelde
f976cec536 Merge pull request #51584 from m4gr3d/investigate_godot_resume_stalls_3_x
[3.x] Resolve issue where the Godot app remains stuck when resuming.
2021-08-13 08:44:33 +02:00
Rémi Verschelde
537077fffa Merge pull request #51605 from m4gr3d/expose_fragile_user_data_config_3_x
[3.x] Add support for prompting the user to retain app data on uninstall.
2021-08-13 08:41:46 +02:00
Yuri Roubinsky
8a1c986455 [3.x] Fix shader crash when using local var with the same name as varying 2021-08-13 09:30:35 +03:00
Fredia Huya-Kouadio
336c630f51 Add support for prompting the user to retain app data on uninstall.
Supported on Android 10 and higher.
2021-08-12 22:06:13 -07:00
Fredia Huya-Kouadio
874aa1708f Resolve issue where the Godot app remains stuck when resuming.
This was caused by the fact that a new instance of Godot was created at resume while a previous instance already existed.
The previous instance would then go through its cleanup lifecycle, and would thus attempt to close the entire app, leading to the system to restart the app, thus starting the cycle anew.
The fix involves reusing the previous instance of Godot if one is available instead of creating a new one, as well as giving control to the host activity for how the process should be terminated.
2021-08-12 20:58:00 -07:00
Pedro J. Estébanez
78d945e7fb Use SafeNumeric for Android JNI step
Aside from the cosmetic improvement of using the Godot-style type, this switches to acquire-release semantics, which may improve performance by not forcing a full barrier to be issued if the CPU architecture can use a cheaper one.
2021-08-13 02:48:58 +02:00
Rémi Verschelde
f75d8d5c04 Merge pull request #51589 from Geometror/improve-stylebox-aa-3.x
StyleBox fake AA improvements (make anti aliasing size a float property) [3.x]
2021-08-13 01:33:01 +02:00
Rémi Verschelde
4b514bfdff Merge pull request #51577 from m4gr3d/update_external_texture_config
Update external texture flag configuration.
2021-08-12 22:55:15 +02:00
Rémi Verschelde
ffc372b002 Merge pull request #42220 from RandomShaper/agile_input_3.2
[3.x] Improve responsiveness on underpowered Android devices
2021-08-12 22:46:17 +02:00
Hendrik Brucker
6d05ef9ccb StyleBox fake AA improvements (aa_size float property) 2021-08-12 22:21:34 +02:00
Rémi Verschelde
e2e34812fe Merge pull request #51556 from fabriceci/fix-move-and-slide-regression-multiple-collision-3x
[3.x] Fix move and slide regression by allowing multiple collision direction
2021-08-12 20:37:48 +02:00
Rémi Verschelde
dc1fc97836 Merge pull request #50397 from JestemStefan/41756_issue_fix
[3.x] Skip rendering of `Light2D` with zero size texture
2021-08-12 20:30:52 +02:00
Rémi Verschelde
b2cc3e1976 Merge pull request #51574 from akien-mga/3.x-cherrypicks
Cherry-picks for the 3.x branch (future 3.4) - 15th batch
2021-08-12 20:30:30 +02:00
Fredia Huya-Kouadio
2cc1cdc27b Update external texture flag configuration. 2021-08-12 10:46:09 -07:00
Cory Petkovsek
fb609b22e4 Add Anisotropic Filtering option for TextureArrays 2021-08-12 23:56:03 +08:00
JestemStefan
9bf47923a5 Skip rendering of lights with zero size 2021-08-12 17:25:58 +02:00
Rémi Verschelde
f0b37b1519 doc: Point URLs to 3.4 version of the online docs 2021-08-12 17:08:10 +02:00
Rémi Verschelde
f3441fcff0 i18n: Sync translations with Weblate
And sync template with current 3.x codebase.
2021-08-12 17:08:10 +02:00
Anilforextra
081bc20d66 Remove unused swap template.
(cherry picked from commit e3872a244d)
2021-08-12 16:46:02 +02:00
Rémi Verschelde
ba8551451f Resource: Remove unused _use_builtin_script() virtual method
And another piece of dead code found while searching for "use_builtin".

(cherry picked from commit 6e9439198c)
2021-08-12 16:45:48 +02:00
Iced Quinn
c5f01173a4 doc: Add documentation for JSONRPC class
(cherry picked from commit 3fc5646b98)
2021-08-12 16:43:45 +02:00
Lightning_A
63581fccc3 Focus the scene tree dock after hitting one of the "Create Root Node:" buttons
(cherry picked from commit 285024e806)
2021-08-12 16:43:23 +02:00
Haoyu Qiu
cdaae2abfb Fixes crash when AnimationPlayer reset on save
(cherry picked from commit 96f077a18d)
2021-08-12 16:43:23 +02:00
Melissa Geels
ac40f5bb75 Triple click in text editor now uses last mouse position for validity
Previously, you would be able to double click a word, followed by
single-clicking another word on the same line, which would select the
entire line. Now, it will only select the whole line if the mouse
position has remained the same after the double click. This mimicks the
behavior in most third party text editors.

Fixes #51312.

(cherry picked from commit 408401a642)
2021-08-12 16:43:22 +02:00
Max Hilbrunner
8190746066 Update bundled Mozilla X.509 CA root certificates
Updated to latest upstream changes (2021-07-05 21:36:52 GMT), taken from 8b263a18fc

(cherry picked from commit d9005912c1)
2021-08-12 16:42:17 +02:00
Max Hilbrunner
235fec4316 Docs: Add warnings about no SSL/(D)TLS revocation
(cherry picked from commit 4eb427afb8)
2021-08-12 16:42:17 +02:00
Yuri Roubinsky
34f7ceefe0 Allow using more assignment operators on matrixes in shaders
(cherry picked from commit 0f42a29864)
2021-08-12 16:42:17 +02:00
Yuri Roubinsky
144e0856a4 Fix shader crash when using varying array in fragment->light context
(cherry picked from commit fead1595f9)
2021-08-12 16:42:17 +02:00
Yuri Roubinsky
9c9559654b Fix incorrect position of the created VisualShader nodes on zoomed graph
(cherry picked from commit 8249ae8085)
2021-08-12 16:42:17 +02:00
Rémi Verschelde
d2a70532e8 FileAccessWindows: Add missing share.h include
Follow-up to #51430.

(cherry picked from commit cb52f2c9c0)
2021-08-12 16:42:17 +02:00
Max Hilbrunner
8dcc764e5a Fix Windows platform file access
This restores Windows platform file handling back to open files non-exlusively by default, as was the case before October 2018. (See b902a2f2a7)
Back then, while fixing warnings for MSVC, the function used for opening files was changed from _wfopen() to _wfopen_s() as suggsted by the warning C4996. ("This function may be unsafe, consider using _wfopen_s instead.")

This new function
1. did parameter validation and thus avoided some possible security issues due to nil pointers or wrongly terminated strings
2. it also changed the default file sharing for opened files from _SH_DENYNO (which was the implicit default for the previous _wfopen()) to _SH_SECURE.

_SH_DENYNO means every opened file could be opened by other calls (like is the default on other operating systems).
_SH_SECURE means if the file is opened with READ access, others can still read the same file, but if it is opened with WRITE access, others can't open it at all, not even to read.

This led to rarely occuring bugs on Windows, i.e. due to random access by Antivirus processes, or Godot/Windows not closing a file handle fast enough while trying to open it again elsewhere (i.e. project.godot, instead showing the Project manager, or saving shaders/debugging the game).

What this PR does it change the file access to a third method, _wfsopen(). This is still secure, doing parameter validation and thus avoids the warning, but it allows us to actually SET the file sharing parameter. And we set it to _SH_DENYNO, as it was implicitely before the change. (And as it currently is on all non-Windows platforms, where file sharing restrictions don't exist by default.)

Warning C4996 should really have been pointing this out. It should've been _wfsopen() all along. Let's hope this banishes those annoying, rare errors for all eternity.

Fixes #28036.

(cherry picked from commit b48cbb5da9)
2021-08-12 16:42:17 +02:00
Omar Polo
abe5760a2d automatically detect BSDs as platform=linuxbsd
(cherry picked from commit 78cd0ffdba)
2021-08-12 16:42:16 +02:00
Michael Alexsander
832833e6a3 Make property description in the animation editor actually show it
(cherry picked from commit bea868f750)
2021-08-12 16:42:16 +02:00
K. S. Ernest (iFire) Lee
beb3a6859d Continue when glTF2 lights fail to parse.
(cherry picked from commit 0c79a8fa22)
2021-08-12 16:42:16 +02:00
Pedro J. Estébanez
9aafb22d99 Fix logic to allow default null thread argument
(cherry picked from commit a6303b70a5)
2021-08-12 16:42:16 +02:00
follower
abc18e9a4f Fix Unicode URL link tags to render correctly.
Change incorrect `[/code]` closing tags to `[/url]` tags.

The `url` tags for the links to the Unicode code points information use `[/code]` rather than `[/url]` to close them.

This results in the links being rendered incorrectly in the IDE--the entire rest of the documentation for each method gets turned into a giant underlined link.

This issue was introduced in a2271ba3bd.

(cherry picked from commit b85688ac7d)
2021-08-12 16:42:16 +02:00
Paulb23
ea0456679a Redraw on item list custom bg/fg colour change
(cherry picked from commit 738b0fdae5)
2021-08-12 16:42:16 +02:00
Hugo Locurcio
a2a4935166 Allow using the mouse wheel to navigate scene tabs
This works in a way similar to tabs in KDE or some patched
Chromium builds.

(cherry picked from commit d2dec8d614)
2021-08-12 16:42:15 +02:00
Georg Wacker
8add8f4e58 Fix vertical scroll/zoom for precision touchpad
Adds factor data for vertical mousewheel event, in line with horizontal mousewheel event

(cherry picked from commit 63ba15a518)
2021-08-12 16:37:38 +02:00
Rémi Verschelde
0142a378c6 HTML5: Fix a couple warnings
Add a missing call to disable warnings on a forked env for freetype's
`sfnt.c`.

(cherry picked from commit c44ebb020d)
2021-08-12 16:37:38 +02:00
Rémi Verschelde
e7f7d5f330 SCons: Add method to detect Emscripten and use it for warnings config
Emscripten is LLVM-based so we want to follow the same logic. But we can't just
put it as a match in `methods.using_clang()` as that would mess with the
compiler version detection logic used to restrict old GCC and Clang releases.

(cherry picked from commit 34421683eb)
2021-08-12 16:37:38 +02:00
Rémi Verschelde
4c79dcc3e7 SCons: Disable Clang -Wordered-compare-function-pointers warning
It's raised for us on many comparators implemented to be able to store a struct
in `Set` or `Map` (who rely on `operator<` internally). In the cases I reviewed
we don't actually care about the ordering and we use the struct's function
pointers as that's the only distinctive data available.

(cherry picked from commit 802810c371)
2021-08-12 16:37:38 +02:00
Jason Knight
955f2ba75e Removed the alteration of status.hovering during Focus Enter and Focus Exit events.
This is incorrect and not fully implemented, and results in inconsistency in the UI and in the hovering variable.

(cherry-picked from commit edcbe88389)
2021-08-12 16:37:35 +02:00
Rémi Verschelde
1cd10461ca Merge pull request #50351 from JestemStefan/node_2D_zero_scale_det_bug
[3.x] Limit scale of `Node2D` to EPSILON (0.00001) to prevent det==0 error
2021-08-12 15:41:04 +02:00
Rémi Verschelde
02541db309 Merge pull request #51565 from mortarroad/3.x-fix-cpu-particles-spread
[3.x] Fix CPU Particles spread
2021-08-12 14:23:22 +02:00
Morris Tabor
a517ed7c6d Fix CPU Particles spread
Fixes https://github.com/godotengine/godot/issues/51162
This is the same change as for the GPU Particles in https://github.com/godotengine/godot/pull/47310, including the recent fix for zero direction vectors.
2021-08-12 14:00:02 +02:00
Rémi Verschelde
07c70efcbb Merge pull request #51555 from mortarroad/3.x-fix-mipmap-loading
[3.x] Fix loading mipmaps, if the mipmap levels have different formats.
2021-08-12 13:17:10 +02:00
Rémi Verschelde
9532dc56a2 Merge pull request #51553 from mortarroad/3.x-fix-particle-spread-regressions
[3.x] Fix regressions caused by recent particle spread refactor
2021-08-12 12:49:04 +02:00
fabriceci
1d5a01d12d Fix regression by allowing multiple collision direction 2021-08-12 12:23:17 +02:00
Morris Tabor
0e26f1747b Fix loading mipmaps, if the mipmap levels have different formats.
Fixes https://github.com/godotengine/godot/issues/50647
2021-08-12 12:18:13 +02:00
Rémi Verschelde
bf383a31cb Merge pull request #49314 from madmiraal/fix-48408-3.x
[3.x] Fix multiple issues with CSGPolygon
2021-08-12 11:49:43 +02:00
Morris Tabor
fb9685daaa Fix regressions caused by recent particle spread refactor
Caused by https://github.com/godotengine/godot/pull/47310
Fixes https://github.com/godotengine/godot/issues/51043
Fixes https://github.com/godotengine/godot/issues/51424
2021-08-12 11:47:05 +02:00
Marcel Admiraal
2449b581dd Fix multiple issues with CSGPolygon 2021-08-12 09:55:18 +01:00
Rémi Verschelde
9e3e7b03e4 Merge pull request #51376 from The-O-King/vertex_buffer_alignment
Align Vertex Buffer to 4 Bytes
2021-08-12 07:13:45 +02:00
Fabio Alessandrelli
dd30944ff3 Merge pull request #51525 from Calinou/hlm-default-enable-compression-3.x
Enable range coder compression by default in NetworkedMultiplayerENet
2021-08-12 01:44:45 +02:00
Hugo Locurcio
d0508e5155 Enable range coder compression by default in NetworkedMultiplayerENet
From empirical testing, this seems to provide the best compression
compared to other compression algorithms when used in the
Multiplayer Bomber demo.

Other algorithms may provide better compression ratios for more
complex games, but some compression is probably better than
no compression.

Zstandard was also not very efficient in my testing, so I added
a note in the documentation.
2021-08-11 21:05:37 +02:00
Hugo Locurcio
0e0af7fa83 Add high quality glow mode
This backports the high quality glow mode from the `master` branch.

Previously, during downsample, every second row was ignored.
Now, when high-quality is used, we sample two rows at once to ensure
that no pixel is missed. It is slower, but looks much better and has
a much high stability while moving.

High quality also takes an additional horizontal sample the width of the
horizontal blur matches the height of the vertical blur.
2021-08-11 17:00:41 +02:00
Rémi Verschelde
91cb296a90 Merge pull request #51499 from timothyqiu/navmesh-doc-3x
[3.x] Improve NavigationMesh typing, parameter validation and documentation
2021-08-11 14:13:45 +02:00
Rémi Verschelde
35096325b8 Merge pull request #51495 from lawnjelly/fix_delta_overflow
Delta smoothing - fix overflow for long frames
2021-08-11 12:23:32 +02:00
Haoyu Qiu
f4a6737eed Improve NavigationMesh typing, parameter validation and documentation 2021-08-11 18:18:27 +08:00
lawnjelly
3025b6d299 Delta smoothing - fix overflow for long frames
Extremely long frames caused by suspending and resuming the machine could result in an overflow in the delta smoothing because it uses 32 bit math on delta values measured in nanoseconds.

This PR puts a cap of a second as the maximum frame delta that will be processed by the smoothing, otherwise it returns the frame delta 64 bit value unaltered. It also converts internal math to explicitly use 64 bit integers.
2021-08-11 09:47:23 +01:00
Rémi Verschelde
03c41fa34c Merge pull request #51458 from nekomatata/moving-platforms-3d-3.x
[3.x] Fix 3D moving platform logic
2021-08-10 14:12:47 +02:00
Rémi Verschelde
48faf66228 Merge pull request #51469 from lawnjelly/quickhull_hide_warning 2021-08-10 13:18:28 +02:00
lawnjelly
fc60eaccb8 Quickhull - reduce warning spam and make hideable
Added one more warning to the hideable warnings. These seem to be benign warnings and are hidden during use in rooms and portals. When used from other areas, only one warning is displayed per run, instead of for every occurrence.
2021-08-10 12:06:46 +01:00
Rémi Verschelde
a9b585dd1a Fixup doc formatting after #47416 2021-08-10 12:11:30 +02:00
Rémi Verschelde
7c6bdea33c Merge pull request #47416 from Calinou/add-contrast-adaptive-sharpening-3.x
Add support for contrast-adaptive sharpening in 3D (GLES3 only)
2021-08-10 10:08:24 +02:00
Rémi Verschelde
5116855637 Merge pull request #51439 from Calinou/tonemap-clamp-negative-colors-3.x
Clamp negative colors regardless of the tonemapper to avoid artifacts
2021-08-10 09:56:18 +02:00
Rémi Verschelde
dad5d09d1b Merge pull request #51416 from clayjohn/GLES-horizon-occlusion
[3.x] Add horizon specular occlusion
2021-08-10 09:55:46 +02:00
Rémi Verschelde
6518a61bd4 Merge pull request #51410 from clayjohn/GLES-blinn-phong 2021-08-10 09:52:28 +02:00
Rémi Verschelde
ef0dff3f23 Merge pull request #51462 from clayjohn/GLES-Sprite3D-modulate
Allow unclamped colors in Sprite3D
2021-08-10 07:57:19 +02:00
clayjohn
f7dbcf95e1 Allow unclamped colors in Sprite3D 2021-08-09 21:44:21 -07:00
clayjohn
f92a600d5c Make blinn and phong specular use full pbr 2021-08-09 20:45:14 -07:00
PouleyKetchoupp
da159cd258 Fix 3D moving platform logic
Same thing that was already done in 2D, applies moving platform motion
by using a call to move_and_collide that excludes the platform itself,
instead of making it part of the body motion.

Helps with handling walls and slopes correctly when the character walks
on the moving platform.

Also made some minor adjustments to the 2D version and documentation.

Co-authored-by: fabriceci <fabricecipolla@gmail.com>
2021-08-09 18:55:49 -07:00
Rémi Verschelde
0403cb8ad5 Merge pull request #51447 from nekomatata/fix-moving-platform-rotation-3.x
[3.x] Fix applied rotation from moving platforms in move_and_slide
2021-08-09 23:20:35 +02:00
PouleyKetchoupp
f101349225 Fix applied rotation from moving platforms in move_and_slide
When synchronizing KinematicBody motion with moving the platform using
direct body state, only the linear velocity was taken into account.

This change exposes velocity at local point in direct body state and
uses it in move_and_slide to get the proper velocity that includes
rotations.
2021-08-09 12:04:57 -07:00
Hugo Locurcio
313527b3fa Clamp negative colors regardless of the tonemapper to avoid artifacts
Color artifacts could be visible when using negative lights with the
Filmic and ACES tonemapping operators, as these did not clamp negative
colors.
2021-08-09 17:16:27 +02:00
Fabio Alessandrelli
feebeb0345 Merge pull request #51434 from Faless/enet/3.x_dtls_hostname
[Net] Add "dtls_hostname" property to ENet.
2021-08-09 17:02:58 +02:00
Haoyu Qiu
9d9043e1a9 Make 3D selection box independent of object size 2021-08-09 22:51:26 +08:00
Fabio Alessandrelli
ef43d95897 [Net] Add "dtls_hostname" property to ENet.
Used to specify the expected "CN" in the server certificate if different
from the server address.
2021-08-09 15:50:52 +02:00
Rémi Verschelde
a418d09617 Merge pull request #51166 from RandomShaper/fix_can_reset_3.x 2021-08-09 09:19:25 +02:00
Rémi Verschelde
d3fc2a4d32 Merge pull request #51401 from Chaosus/shader_fix_specular_mode_3.x
[3.x] Fix a default shader specular render mode to `SCHLICK_GGX`
2021-08-09 08:14:06 +02:00
clayjohn
1065f8dc86 Add horizon specular occlusion 2021-08-08 19:29:02 -07:00
Rémi Verschelde
89313b9ed1 Merge pull request #51403 from lawnjelly/portals_move_settings
Portals - fix PVS generation and move settings
2021-08-09 00:17:13 +02:00
lawnjelly
f3e6547a99 Portals - fix PVS generation and move settings
Fixed a bug in the complex PVS generation which was causing recursive loop.
Move some of the settings out of RoomManager into Project Settings.
Allow PVS generation method to be selected from Project Settings, and control PVS logging.
2021-08-08 19:57:27 +01:00
Rémi Verschelde
0b461cbb01 Merge pull request #51218 from timothyqiu/more-i18n-3x
[3.x] Fix various i18n failures
2021-08-08 19:24:45 +02:00
Yuri Roubinsky
0f817e127d [3.x] Fix a default shader specular render mode to (SCHLICK_GGX) 2021-08-08 19:26:00 +03:00
Rémi Verschelde
be22d7b013 Merge pull request #51396 from lawnjelly/portals_sprite3d
Portals - add support for Sprite3D
2021-08-08 17:47:32 +02:00
Rémi Verschelde
6149304c3a Merge pull request #51394 from lawnjelly/portals_fix_log_crash
Portals - fix crash when logging link room names
2021-08-08 17:47:05 +02:00
Rémi Verschelde
52b3891b59 Merge pull request #51392 from lawnjelly/portals_autolink_internal
Portals - fix autolinking to internal rooms
2021-08-08 17:46:37 +02:00
Rémi Verschelde
7b718dc36b Merge pull request #51388 from lawnjelly/portals_fix_secondary_pvs
Portals - Fix secondary PVS bug
2021-08-08 17:46:15 +02:00
lawnjelly
fc3c01db0f Portals - add support for Sprite3D
Add support for Sprite3D and animated Sprite3D.
2021-08-08 15:43:24 +01:00
lawnjelly
ef894c0966 Portals - fix crash when logging link room names
The checking for link room IDs was checking for less than size(), but was not correctly checking for -1,
and therefore reading outside the array range. This PR fixes this.
2021-08-08 15:00:39 +01:00
lawnjelly
a339f6fc49 Portals - fix autolinking to internal rooms
Portal autolinking was previously agnostic to room priorities, which meant that portals would link to the first room they found (often outside rooms). This PR fixes this by making the autolinking priority aware, and will preferentially link to internal rooms.
2021-08-08 14:37:04 +01:00
lawnjelly
cfe806a929 Portals - Fix secondary PVS bug
Fixes a bug whereby it read from the primary PVS in the gameplay monitor, using the size from the secondary PVS. This would read out of bounds and crash.

Removed debug code to update the gameplay monitor from the preview camera - this is no longer required.

Temporarily revert to the simple PVS generation method, because I've noticed a bug in the complex version, and the simple version is safer while I fix this.
2021-08-08 14:02:38 +01:00
Pedro J. Estébanez
45c2a7159e Switch to input buffering on Android
Key, touch and joystick events will be passed directly from the UI thread to Godot, so they can benefit from agile input flushing.

As another consequence of this new way of passing events, less Java object are created at runtime (`Runnable`), which is good since the garbage collector needs to run less.

`AndroidInputHandler` is introduced to have a smaller cross-thread surface. `main_loop_request_go_back()` is removed in favor just inline calling `notification()` on the `MainLoop` at the most caller's convenience.

Lastly, `get_mouse_position()` and `get_mouse_button_state()` now just call through `InputDefault` to avoid the need of sync of mouse data tracked on the UI thread.
2021-08-08 13:41:27 +02:00
Pedro J. Estébanez
31a0ca2cac Add project setting for agile input event flushing
If enabled, key/touch/joystick events will be flushed just before every idle and physics frame.

Enabling this can greatly improve the responsiveness to input, specially in devices that need to run multiple physics frames per each idle frame, because of not being powerful enough to run at the target frame rate.

This will only work for platforms using input buffering (regardless event accumulation). Currenly, only Android does so, but could be implemented for iOS in an upcoming PR.
2021-08-08 12:37:55 +02:00
Pedro J. Estébanez
7be9c26e20 Add input buffering framework
Input buffering is implicitly used by event accumulation, but this commit makes it more generic so it can be enabled for other uses.

For desktop OSs it's currently not feasible given main and UI threads are the same).
2021-08-08 12:37:55 +02:00
Pedro J. Estébanez
58a54f534e Improve input event accumulation
- API has been simplified: all events now go through `parse_input_event()`. Whether they are accumulated or not depends on the `use_accumulated_input` flag.
- Event accumulation is now thread-safe (it was not needed so far, but it prepares the ground for the following changes).
- Touch drag events now support accumulation.
2021-08-08 12:37:55 +02:00
Rémi Verschelde
42e40a7d3c Merge pull request #51370 from lawnjelly/portals_better_pvs
Portals - improve PVS tracing
2021-08-07 23:48:06 +02:00
Omar El Sheikh
f0de7ec2b6 Align Vertex Buffer to 4 Bytes
With the octahedral compression, we had attributes of a size of 2 bytes
which potentially caused performance regressions on iOS/Mac

Now add padding to the normal/tangent buffer

For octahedral, normal will always be oct32 encoded
UNLESS tangent exists and is also compressed
then both will be oct16 encoded and packed into a vec4<GL_BYTE>
attribute
2021-08-07 15:42:03 -04:00
lawnjelly
69cc759b65 Portals - improve PVS tracing
The existing tracing routine for building the PVS was rather simple compared to the main portal tracing, and could not correctly cope with paths that went through multiple portals from room A to B, and as a result would sometimes miss room entries in the PVS resulting in too many culled rooms in these circumstances.

This PR adds an improved function that can cope with entering a room multiple times during a trace. As a result it has to take care of portal directions (to prevent going back on itself) in a similar, but not identical way to the main portal tracing routine, and internal rooms, to prevent recursive loops.
2021-08-07 17:57:30 +01:00
Rémi Verschelde
41cf7f2760 Merge pull request #51358 from raulsntos/fix-51342-3.x
[3.x] Fix Path3D initial forward calculation
2021-08-07 13:30:11 +02:00
Rémi Verschelde
b44f2126f6 Merge pull request #51334 from pycbouh/classref-get-theme-items-3.x
[3.x] Improve `Control`'s theme item methods documentation
2021-08-07 12:41:54 +02:00
Rémi Verschelde
b4a8717260 Merge pull request #51324 from LightningAA/show_view_rotation_dir-3.x
[3.x] Minor visual improvements to the viewport rotation gizmo (again)
2021-08-07 12:41:30 +02:00
Raul Santos
102ec1042b Fix Path3D initial forward calculation 2021-08-07 12:40:14 +02:00
Rémi Verschelde
92fa4e137d Merge pull request #51329 from pycbouh/docs-inspector-plugins-classref-3.x
[3.x] Improve the inspector plugin documentation and remove a confusing statement
2021-08-07 12:37:13 +02:00
Rémi Verschelde
92d5614711 Merge pull request #51327 from kleonc/tile_map-ensure-tile-is-in_tile_set
[3.x] TileMap Fix trying to get data for tile not existing in attached TileSet
2021-08-07 12:35:36 +02:00
Rémi Verschelde
030bdc5a41 Merge pull request #51325 from raulsntos/fix-msbuild-exception-3.x
[3.x] Ensure MSBuildPanel buttons are instantiated
2021-08-07 12:19:43 +02:00
Rémi Verschelde
3585c4f3d0 Merge pull request #50637 from lawnjelly/fix_plane_xform_new
Fix Transform::xform(Plane) functions, add Transform unit tests
2021-08-07 09:39:43 +02:00
lawnjelly
37f20e1d78 Fix Transform::xform(Plane) functions, add Transform unit tests
The Transform::xform and xform_inv are made safe for Planes when using non-uniform scaling.

Basic unit tests for Transform.

Optimization of calling sites to prevent loss of performance from the changes to xform(Plane).
2021-08-07 08:05:39 +01:00
Rémi Verschelde
a0810f313f Merge pull request #51333 from Razoric480/3x-sceneless-fix
[3.x] Fix LSP completion crashing on scene-less scripts
2021-08-07 00:02:15 +02:00
Rémi Verschelde
afe7b3fc58 Merge pull request #51336 from naithar/fix/ios-plugin-initialization
[3.x] [iOS] Use platform generated api to initialize iOS plugins
2021-08-06 23:59:06 +02:00
Lightning_A
9613725732 Minor visual improvements to the viewport rotation gizmo (again) 2021-08-06 14:38:31 -06:00
Raul Santos
dd9c07ee46 Ensure MSBuildPanel buttons are instantiated 2021-08-06 22:32:54 +02:00
Sergey Minakov
d48d7cc94f [iOS] Use platform generated api to initialize iOS plugins 2021-08-06 23:29:09 +03:00
Yuri Sizov
71ec6dba67 Improve Control's theme item methods documentation 2021-08-06 22:31:58 +03:00
Francois Belair
6db17a523e Fix LSP completion crashing on sceneless scripts 2021-08-06 15:31:04 -04:00
Yuri Sizov
974e76a082 Improve the inspector plugin documentation and remove a confusing statement 2021-08-06 21:01:48 +03:00
kleonc
2eeed26d67 TileMap Fix trying to get data for tile not existing in attached TileSet 2021-08-06 18:52:04 +02:00
Yuri Sizov
fcbe5a3fde Add theme item descriptions to the online documentation 2021-08-06 18:20:51 +03:00
Rémi Verschelde
8db0bd4424 OS: Fix used resource debug prints
These methods were broken by 22419082d9
5 years ago and nobody complained, so maybe they're not so useful...
But at least this should restore them to a working state.

(cherry picked from commit 8c3a6b10a9)
2021-08-06 13:24:02 +02:00
31
659b89c615 Fix 'script_class' null access when reloading a deleted C# script
(cherry picked from commit 6fd2edddc0)
2021-08-06 13:03:03 +02:00
Rémi Verschelde
70784f983b Mono: Remove diagnostics incompatible with 3.x codebase 2021-08-06 12:59:17 +02:00
Ellen Poe
999159c12c Fix Godot's cubic resampling algorithm
(cherry picked from commit 2d450c6f61)
2021-08-06 11:45:08 +02:00
Ellen Poe
840c0e57fb Revert "Implement a new resampling algorithm in AudioStreamPlaybackResampled"
This reverts commit b2264cb48b.

(cherry picked from commit 57ccfab5fb)
2021-08-06 11:45:08 +02:00
Francois Belair
1f0fa16a15 Fix LSP parsing get_node only from the scene root
(cherry picked from commit 03f8fa9f62)
2021-08-06 11:45:08 +02:00
Rémi Verschelde
b3c555504f Improve documentation and simplifies code for File::get_csv_line()
Also forbids using double quotes as a delimiter.

(cherry picked from commit b8c08ba5ad)
2021-08-06 11:13:43 +02:00
Hugo Locurcio
5497405cf7 Change the editor update spinner color when updating continuously
Updating continuously should only be enabled for troubleshooting
purposes, as it uses a lot of CPU/GPU power.

The update spinner is now displayed in red when the Update Continuously
editor setting is enabled.

(cherry picked from commit a97c5b50db)
2021-08-06 11:10:48 +02:00
Raul Santos
332e31260e Reduce C# Dictionary internal calls
- Implements new `KeyValuePairs` and `KeyValuePairAt` internal calls
to get the `key` and the `value` in one call.
- Caches the `DictionaryEntry` to reuse properties without repeating
internal calls.

(cherry picked from commit 2deefd938f)
2021-08-06 11:10:04 +02:00
Raul Santos
ca32c18458 Add documentation to Dictionary in C#
Adds documentation to `Godot.Collections.Dictionary` in C#.

(cherry picked from commit 0669ffcd15)
2021-08-06 11:09:56 +02:00
Rémi Verschelde
320579b9fd Merge pull request #51246 from lawnjelly/portals_hull_editor
Portals - add gizmo handles for editing portals and rooms
2021-08-06 09:04:52 +02:00
lawnjelly
770d9f8220 Portals - add gizmo handles for editing portals and rooms
Gizmo handles are added for much more user friendly editing of portals and room bounds.
2021-08-06 07:53:22 +01:00
Rémi Verschelde
93ff6e790b Merge pull request #51287 from Calinou/x11-software-opengl
Point at software OpenGL when OpenGL fails to initialize on X11
2021-08-05 19:38:25 +02:00
Hugo Locurcio
8fbdcb6fea Point at software OpenGL when OpenGL fails to initialize on X11 2021-08-05 18:24:42 +02:00
Rémi Verschelde
d835b46e09 Merge pull request #51281 from BastiaanOlij/revert_50723
Revert "Combined the DOF far and DOF near passes"
2021-08-05 16:39:39 +02:00
Rémi Verschelde
28b5f07355 Merge pull request #51277 from lawnjelly/portals_debug_collision_shapes 2021-08-05 16:39:03 +02:00
Rémi Verschelde
c409e8268c Merge pull request #51276 from lawnjelly/portals_set_active_editor_check
Portals - rooms_set_active needs Editor check
2021-08-05 16:38:55 +02:00
Rémi Verschelde
91dfb803c5 SCons: Fix info message when defining GODOT_VERSION_STATUS
(cherry picked from commit e92ba89dc7)
2021-08-05 16:36:20 +02:00
Raul Santos
5c206c38f9 Simplify C# print methods
- Extracts the parameters logic to a single method
- Simplify the handling of null parameters

(cherry picked from commit ad460cde79)
2021-08-05 16:35:55 +02:00
Rémi Verschelde
a96519fa69 Merge pull request #51274 from lawnjelly/portals_recursive_loop
Portals - fix recursive loop looking out from internal rooms
2021-08-05 15:45:47 +02:00
Bastiaan Olij
cc1f7f2edc Revert "Combined the DOF far and DOF near passes"
This reverts commit 39658b4e07.
2021-08-05 23:22:31 +10:00
Rémi Verschelde
9bbb8cd40d Merge pull request #51251 from LightningAA/show_view_rotation_dir-3.x
[3.x] Minor visual improvements to the view rotation gizmo
2021-08-05 15:00:02 +02:00
lawnjelly
258831c12e Portals - fix showing debug collision shapes
Set the portal_mode to GLOBAL on creation.
2021-08-05 13:28:11 +01:00
lawnjelly
f4c5092027 Portals - rooms_set_active needs Editor check
Calling rooms_set_active with TOOLS_ENABLED from a running project resulted in a crash because the Spatial Editor is not available. Wrapped it in an is_editor_hint.
2021-08-05 13:14:00 +01:00
lawnjelly
2c88517a7b Portals - fix recursive loop looking out from internal rooms
In some situations looking out from an internal room it was possible to look back into the portal into the internal room.

This PR fixes this by keeping a single item 'stack' record of the last external room, and preventing recursing into this room. This also makes tracing significantly more efficient out of internal rooms, as there is no need to trace the external room multiple times.
2021-08-05 12:37:05 +01:00
Rémi Verschelde
856097d7bc Merge pull request #51258 from The-O-King/normal_compression_fix
Fix Bugs w/ Octahedral Compression Implementation
2021-08-05 09:14:38 +02:00
Omar El Sheikh
6c643af6a7 Fix Bugs w/ Octahedral Compression Implementation
Initial octahedral compression incorrectly wrote tangent to the buffer
using an offset of 3 rather than 4, losing the sign of the tangent
vector needed for things like tangent space for texturing mapping

GLES3 renderer used remove_custom_define rather than set_conditional to
change back to the default conditional state the scene shader should be
in
2021-08-04 21:48:56 -04:00
kleonc
063d1a5d53 TabContainer: Fix error on removing top-level Control child, Remove _get_tab method 2021-08-04 22:10:06 +02:00
Lightning_A
6280c66f04 Minor improvements to the view rotation gizmo 2021-08-04 13:15:44 -06:00
Rémi Verschelde
63047093c9 Merge pull request #48616 from Razoric480/lsp-3x-rename
Implement LSP didSave notify and rename request [3.x]
2021-08-04 20:28:16 +02:00
Rémi Verschelde
d5a0b2e8bf Merge pull request #47266 from nekomatata/solver-kinematic-bug-fix-3.4
[3.4] Fix GodotPhysics solver with kinematic body set to report contacts
2021-08-04 19:59:19 +02:00
PouleyKetchoupp
6fdffacb4e Fix GodotPhysics solver with kinematic body set to report contacts
In 3D, collision is disabled between kinematic/static bodies when
contacts are generated only to report them.

In 2D, this case was already fixed but the code is cleaned to make
it easier to follow.
2021-08-04 10:41:58 -07:00
Rémi Verschelde
2269c2ebe2 Merge pull request #51243 from pycbouh/editor-theme-instructions-3.x
[3.x] Improve user communications in the theme editor
2021-08-04 18:35:03 +02:00
Yuri Sizov
3b6e7d61a5 Improve user communications in the theme editor 2021-08-04 18:36:06 +03:00
Rémi Verschelde
b8ac2e0cff Merge pull request #51240 from pycbouh/control-theme-override-rename-3.x
[3.x] Make theme item overrides more obvious in the Inspector
2021-08-04 17:29:09 +02:00
Yuri Sizov
e7bd53b690 Make theme item overrides more obvious in the Inspector 2021-08-04 17:02:00 +03:00
Rémi Verschelde
c96377399c Merge pull request #51229 from timothyqiu/inspector-update-3x
[3.x] Disable save button when Inspector is not editing anything
2021-08-04 09:29:01 +02:00
Haoyu Qiu
063b7be937 Disable save button when Inspector is not editing anything 2021-08-04 15:03:54 +08:00
Rémi Verschelde
d9a07d1528 Merge pull request #51221 from pycbouh/editor-mono-build-log-3.x
[3.x] Fix the editor theme application for the Mono build log
2021-08-03 21:45:39 +02:00
Yuri Sizov
3857fd5ceb Fix the editor theme application for the Mono build log 2021-08-03 22:11:33 +03:00
Haoyu Qiu
87e49183bc Fix various i18n failures 2021-08-03 23:36:43 +08:00
Rémi Verschelde
cae29b5267 Merge pull request #51211 from pycbouh/editor-resource-picker-cache-3.x
[3.x] Cache `EditorResourcePicker`'s allowed types
2021-08-03 15:52:20 +02:00
Yuri Sizov
cb66cf80f5 Cache EditorResourcePicker's allowed types 2021-08-03 16:21:05 +03:00
kobewi
5692bc8dd0 Improve ConfigFile example
(cherry picked from commit 1721f0143e)
2021-08-03 14:56:51 +02:00
Fabio Alessandrelli
811ea6ad64 [Net] Fix IP address resolution incorrectly locking the main thread.
This seems to be a pretty old bug, older then originally reported (at
least under certain circumstances).

The IP singleton uses a resolve queue so developers can queue hostnames
for resolution in a separate while keeping the main thread unlocked
(address-resolution OS functions are blocking, and could block for a long
time in case of network disruption).

In most places though, the address resolution function was called with
the mutex locked, causing other functions (querying status, queueing
another hostname, ecc) to block until that resolution ended.

This commit ensures that all calls to OS address resolution are done
with the mutex unlocked.

(cherry picked from commit aca5540e13)
2021-08-03 14:33:42 +02:00
Rémi Verschelde
d38180b20f Merge pull request #51208 from Chaosus/vs_cleanup_warnings_3.x
[3.x] Prevents some warnings from appearing in visual scripts
2021-08-03 11:08:00 +02:00
Rémi Verschelde
92bafdcafb i18n: Sync template with current 3.x codebase
Weblate will now track the state of `3.x` to prepare for the 3.4 release.
2021-08-03 11:04:02 +02:00
Rémi Verschelde
cefc806b34 i18n: Sync translations with Weblate
Last POT sync with the `3.3` branch, we'll now switch Weblate to track
`3.x` to prepare for the 3.4 release.

(cherry picked from commit dec840452d)
2021-08-03 11:04:01 +02:00
Rémi Verschelde
ba886a7295 Merge pull request #51207 from akien-mga/3.x-cherrypicks 2021-08-03 11:03:53 +02:00
Yuri Roubinsky
96f957f93b [3.x] Prevents some warnings from appearing in visual scripts 2021-08-03 11:27:45 +03:00
merumelu
ffec0799cb makerst: use link titles for external tutorials
(cherry picked from commit b8752d91dc)
2021-08-03 10:20:19 +02:00
Rémi Verschelde
f5836b40d4 doc: Use self-closing tags for return and argument
For the time being we don't support writing a description for those, preferring
having all details in the method's description.

Using self-closing tags saves half the lines, and prevents contributors from
thinking that they should write the argument or return documentation there.

(cherry picked from commit 7adf4cc9b5)
2021-08-03 10:20:19 +02:00
Rémi Verschelde
a43365bd58 Allow overriding VERSION_STATUS with GODOT_VERSION_STATUS in env
`VERSION_STATUS` is part of what constitutes the reference version for a given
Godot build, and is part of the version check for compatible export templates.

For dev snapshots (alpha, beta, RCs), we usually set the `VERSION_STATUS` to
a specific build number (e.g. `beta2`), but this change doesn't end up
committed to the Git repository as we don't want to keep changing `version.py`
for testing builds.

So this new environment override will be what can be used in official builds
and by users making custom builds for specific snapshots.

(cherry picked from commit 948dcb63ca)
2021-08-03 10:20:19 +02:00
Rémi Verschelde
91d29ddcfb Add script to make source tarball with .git/HEAD
This allows to generate the `VERSION_HASH` constant with the Git commit hash
even when building from a source tarball which is not a Git repository (and
without dependency on Git itself).

(cherry picked from commit 9a71038e34)
2021-08-03 10:20:18 +02:00
kleonc
8274d18244 TabContainer Fix moving dropped tab at incorrect child index
(cherry picked from commit a5a4532378)
2021-08-03 10:20:18 +02:00
Nicholas Huelin
0b94db5f4c Make the "View" menu in 3D view toolbar stay open when selecting a checkbox
This pull request fixes an issue where the "View" menu in the 3D view toolbar would close when you selected either the "View Origin" or "View Grid" checkboxes. This was inconvenient and wasted time by making you have to reopen the menu in order to get to other settings anytime you changed this.

(cherry picked from commit 3ffd75107d)
2021-08-03 10:20:18 +02:00
Hugo Locurcio
21a68d1c44 Print a warning when the engine is started as root/superuser
This is a security risk (especially when hosting a game server)
and can make audio non-functional on Linux.

(cherry picked from commit 9c34db6cb4)
2021-08-03 10:20:18 +02:00
foxydevloper
f807c7e569 Name nodes added from drag & drop by name_casing
(cherry picked from commit 07a8f0fe38)
2021-08-03 10:18:04 +02:00
Raul Santos
d46d66020e Fix forward calculation in PathFollow3D for the position at the end of the curve
(cherry picked from commit e23f6a5bba)
2021-08-03 10:18:04 +02:00
Kevin Sanders
88ad05c5dc Grammar fix.
(cherry picked from commit 6db57b9da2)
2021-08-03 09:33:25 +02:00
Haoyu Qiu
812076baf6 Validates VisualScript.add_node input node
(cherry picked from commit 0ca38ffe76)
2021-08-03 09:33:25 +02:00
Rémi Verschelde
ea0116b01f Dependency editor: Edit message about move to trash
Fixes #47106.

(cherry picked from commit 41ed695ba2)
2021-08-03 09:33:25 +02:00
Yuri Roubinsky
4fef6b9cbc Prevent warning spam to console when dragging a CanvasItem in container
(cherry picked from commit bb5729fd35)
2021-08-03 09:33:25 +02:00
Yuri Roubinsky
37c985e189 Fix crash on doc dragging in script list panel
(cherry picked from commit c86aa2a705)
2021-08-03 09:33:25 +02:00
Pedro J. Estébanez
e0f8efcb01 Fix thread start with no user data when target has no default argument
(cherry picked from commit 7ca8051645)
2021-08-03 09:33:25 +02:00
Rémi Verschelde
69c194736d VariantParser: Fix uninitialized ResourceParser funcs
They could cause a segfault when parsing values with ID "Resource"
as apparently we never set a valid `func` for it.

Fixes crash part of #42115.

(cherry picked from commit f3aaa713d9)
2021-08-03 09:33:25 +02:00
Nicholas Huelin
61d153a1fa Make "Find in Files" searches ignore directories with .gdignore files in them
This pull request fixes an issue where searches using the "Find in Files" function would include folders with `.gdignore` files in them. The editor is supposed to ignore directories with these files in them altogether.

(cherry picked from commit 658b152bd8)
2021-08-03 09:33:25 +02:00
Haoyu Qiu
f4208ad1e8 Do nothing when dragging CSGBox handle perpendicular to the camera
(cherry picked from commit 0f1e107ede)
2021-08-03 09:33:24 +02:00
Fabio Alessandrelli
ccbd810934 [Net] Fix Marshalls infinite recursion crash.
Variants like dictionaries and arrays can have cyclic references, which
caused `encode_variant` to run an infinite recursion.
Instead of keeping a stack and looking for cyclic references which would
make serialization slower, this commit adds a `MAX_RECURSION_DEPTH`
constant to Variant, and have `encode_variant` keep track of the current
recursion depth, bailing when it's too high since this likely means a
cyclic reference has been encountered.

(cherry picked from commit 324636473a)
2021-08-03 09:33:24 +02:00
K. S. Ernest (iFire) Lee
8f592d50c3 glTF2 fallback load PNG and JPG
(cherry picked from commit ddff1c10c3)
2021-08-03 09:15:34 +02:00
K. S. Ernest (iFire) Lee
6ba37005d1 In glTF2 animations, log spam less when running.
(cherry picked from commit 882f7d9bdf)
2021-08-03 09:15:34 +02:00
K. S. Ernest (iFire) Lee
42ad091738 Make curve interpolate crash less.
(cherry picked from commit d67c5afa95)
2021-08-03 09:15:33 +02:00
Michael Alexsander
e74ee7294e Properly tag project files as a subclass of plain text in the MIME info
(cherry picked from commit a47e48987d)
2021-08-03 09:15:33 +02:00
Michael Alexsander
e71640af2f Make some small tweaks to the MIME info
(cherry picked from commit 0218616747)
2021-08-03 09:15:33 +02:00
Haoyu Qiu
a0d47033f7 Remove colon from column titles
(cherry picked from commit f9aad98d36)
2021-08-03 09:15:33 +02:00
Raul Santos
ecb973ab02 Use allowEmpty parameter in Split
(cherry picked from commit b7a66a820b)
2021-08-03 09:15:33 +02:00
Haoyu Qiu
1da4e9e608 Hide open doc button when not inspecting anything
(cherry picked from commit 80e4c8626d)
2021-08-03 09:15:33 +02:00
vitika9
bea67d7763 Fixed Camera2D's reset_smoothing() does not work as described
(cherry picked from commit 22eaec6895)
2021-08-03 09:15:33 +02:00
Hugo Locurcio
bcd3c9a285 Improve the 2D editor ruler display
- Use the ° symbol instead of "deg" to reduce clutter.
- Round the displayed lengths to only one decimal instead of two
  to further reduce clutter.
- Don't make the `px` suffix localizable, as it isn't localizable
  anywhere else in the editor.

(cherry picked from commit 026aea681d)
2021-08-03 09:15:33 +02:00
kleonc
507fcf2a82 Astar::get_available_point_id Start from 0
(cherry picked from commit 17324db4ca)
2021-08-03 08:45:27 +02:00
Rémi Verschelde
38d47c051a Merge pull request #51200 from timothyqiu/enet-memleak
[3.x] Fix `NetworkedMultiplayerENet` client memory leak
2021-08-03 08:10:26 +02:00
Rémi Verschelde
08b67aabb8 Merge pull request #51193 from timothyqiu/atp-remove
memdelete the node in AnimationTreePlayer.remove_node
2021-08-03 08:08:22 +02:00
Haoyu Qiu
ac04032e95 Fix NetworkedMultiplayerENet client memory leak
The host is not destroyed in some error conditions.
2021-08-03 10:14:14 +08:00
Rémi Verschelde
7b97243521 Merge pull request #51040 from nekomatata/layer-grid-32-3.x
[3.x] Refactor layer property editor grid
2021-08-02 21:14:43 +02:00
Rémi Verschelde
5054596533 Merge pull request #51120 from Calinou/doc-randomnumbergenerator-tutorials-3.x
Link to the Random number generation tutorial in RandomNumberGenerator
2021-08-02 18:17:01 +02:00
Haoyu Qiu
859922a5f0 Delete the node in AnimationTreePlayer.remove_node 2021-08-03 00:12:04 +08:00
Pedro J. Estébanez
c4811747cc Rationalize property reversion 2021-08-02 17:58:04 +02:00
Pedro J. Estébanez
d272464e6e Implement inherits_script() for NativeScript and PluginScript
(cherry picked from commit 2dcd064056)
2021-08-02 17:58:04 +02:00
Rémi Verschelde
7a7de3ce12 Merge pull request #51191 from neikeq/mono-ios-aot-cache
C#+iOS: Cache AOT compilater output
2021-08-02 17:57:37 +02:00
Ignacio Roldán Etchevery
e72fdc4b95 C#+iOS: Cache AOT compilater output
Implemented some basic caching to avoid unnecessary AOT compilation
of unchanged assemblies that were already compiled previously.
This reduces iOS export times considerably for subsequent builds
since many dependencies never change, such as framework assemblies
and the Godot bindings.

The AOT compiler asm output and object files are now placed in
`res://.mono/temp/obj/<CONFIG>/godot-aot-cache/` instead of a
temporary directory.
2021-08-02 17:27:47 +02:00
Rémi Verschelde
8f3ec04811 Merge pull request #51186 from lawnjelly/portals_fix_ui_default 2021-08-02 17:20:52 +02:00
lawnjelly
9e9abe2137 Portals - Fix UI default
I had forgotten to add a call to update_portal_tools() at the end of the SpatialEditor constructors. This ensures that the portal UI is off by default in normal use without portals.
2021-08-02 16:10:34 +01:00
Ignacio Etcheverry
417a69c643 Implement CSharpScript::inherits_script()
(cherry picked from commit 840255a04b)
2021-08-02 15:30:13 +02:00
Pedro J. Estébanez
7426b3fa91 Add Script::inherits_script()
Partial cherry-pick of 5d4dc2d45c.

Co-authored-by: Juan Linietsky <reduzio@gmail.com>
2021-08-02 15:18:30 +02:00
Rémi Verschelde
73c6ab0215 Merge pull request #51152 from lawnjelly/portals_improve_ui 2021-08-02 14:40:18 +02:00
Rémi Verschelde
76e202c07b Merge pull request #51171 from timothyqiu/spin-slider-osx-3x
[3.x] Use Command+Drag in EditSpinSlider on macOS
2021-08-02 14:36:35 +02:00
Rémi Verschelde
b42ca985bd Merge pull request #51062 from lawnjelly/portals_no_names 2021-08-02 13:28:01 +02:00
Haoyu Qiu
a4dee07966 Use Command+Drag in EditSpinSlider on macOS 2021-08-02 19:09:04 +08:00
Rémi Verschelde
e8f1cc693a Merge pull request #50432 from goostengine/ctrl-enter-commit-3.x
[3.x] VCS: Allow to stage and commit all files with Ctrl + Enter
2021-08-02 12:20:35 +02:00
lawnjelly
2eae35693e Portals - change import naming convention to postfix
In response to user demand, the naming convention for importing levels from blender etc is changed from prefixes `Room_` and `Portal_` to postfixes `-room`, `-roomgroup`, `-portal`.
2021-08-02 11:04:02 +01:00
lawnjelly
8c4c6a93b0 Portals - Remove node naming restrictions
The use of special prefixes is only actually required during the import phase - the first conversion of rooms, roomgroups, and portals from Spatials and MeshInstances (based on the workflow of importing from blender).

Once converted to the native Godot nodes there is no longer a need for the naming requirements.

This PR removes the requirements except for the import. Manual portal linking after the initial conversion is now done exclusively using the `linked_room` nodepath property of the Portal.
2021-08-01 20:04:58 +01:00
lawnjelly
776623d56b Portals - Improve UI and add shortcuts
This PR makes the 'convert rooms' button permanently on the toolbar and accessible whichever node is selected, so you can convert rooms without having to select the RoomManager first.

It also adds a togglable item 'view portal culling' to the 'View' menu which is a simple way of setting the RoomManager 'active' setting without the RoomManager being the selected node.

Both of these have keyboard shortcuts, which should make it much faster to reconvert rooms and edit.

In addition there the string in the 'Perspective' Listbox is modified to show [portals active] when portal culling is operational, for visual feedback. This is updated when you change modes, and when the rooms are invalidated.
2021-08-01 19:54:16 +01:00
Rémi Verschelde
4542e3382b Merge pull request #51131 from timothyqiu/i18n-android-export-3x
[3.x] Make progress and errors translatable when exporting to Android
2021-08-01 12:10:52 +02:00
Rémi Verschelde
74f28ca404 Merge pull request #51138 from lawnjelly/fix_profiler_delta
[3.4] Profiling - fix frame_time measurement
2021-08-01 12:10:38 +02:00
Haoyu Qiu
55b52341d1 Make progress and errors translatable when exporting to Android 2021-08-01 17:15:56 +08:00
Rémi Verschelde
02967a9c5e Merge pull request #51037 from winterpixelgames/ws-fix
3.x WebsocketPeer outbound buffer fixes and buffer size query
2021-08-01 11:14:03 +02:00
lawnjelly
98a39aade9 Profiling - fix frame_time measurement
When the `sync_after_draw` feature was on it was possible for the profiler's frame_time measurement to be incorrect. This fixes this problem by storing the raw measured time for use by the profiler.
2021-08-01 10:05:43 +01:00
Rémi Verschelde
59c050ddc3 Windows: Fix build with SCons 4.2.0
(cherry picked from commit c191cfbddf)
2021-08-01 11:05:40 +02:00
Jordan Schidlowsky
023548c0a5 Websocket peer outbound buffer fixes. Expose outbound buffered amount. 2021-07-31 19:50:05 -06:00
Hugo Locurcio
93f4f9e076 Link to the Random number generation tutorial in RandomNumberGenerator
This was done in `master` already, but not in `3.x`.
2021-07-31 22:54:30 +02:00
Rémi Verschelde
a17228c788 Merge pull request #51111 from pycbouh/editor-put-the-colon-back-in-3.x
[3.x] Put multiple colons back into translated strings
2021-07-31 22:05:04 +02:00
Rémi Verschelde
2d2e247a7a Merge pull request #51106 from timothyqiu/i18n-action-names-3x
[3.x] Make action names translatable
2021-07-31 21:13:46 +02:00
Rémi Verschelde
858c6f7b28 Merge pull request #51113 from pycbouh/editor-fix-audio-bus-colors-3.x
[3.x] Fix theming in the audio bus editor
2021-07-31 21:05:53 +02:00
Yuri Sizov
ade21ed69c Fix theming in the audio bus editor 2021-07-31 21:43:14 +03:00
Yuri Sizov
9b228f0f5d Put multiple colons back into translated strings 2021-07-31 20:18:24 +03:00
Haoyu Qiu
a3b221e99f Make action names translatable 2021-07-31 22:19:47 +08:00
Rémi Verschelde
7c1ee0488e Merge pull request #51087 from Calinou/editor-viewport-highlight-context-menus-3.x
Highlight context menu items at the top of the 2D/3D viewports (3.x)
2021-07-31 11:48:29 +02:00
Rémi Verschelde
3875cdaec4 Merge pull request #51092 from lawnjelly/portals_preview_globals
Portals - disable frustum culling gizmos with preview camera
2021-07-31 10:53:45 +02:00
Rémi Verschelde
4ef834637e Merge pull request #41470 from madmiraal/fix-41397-3.2
[3.x] Ensure node's area tree signals are disconnected when clearing monitoring, even if nodes are no longer in the tree.
2021-07-31 10:37:56 +02:00
lawnjelly
93c78af488 Portals - disable frustum culling gizmos with preview camera
When using the preview camera feature it turns out as well as culling the game objects, this also culls the editor gizmos from the preview camera, which makes the editor hard to use in this mode.

To get around this problem we simply disable frustum culling for GLOBAL portal_mode objects when in preview camera mode. This could be a bit slower in an editor scene with lots of gizmos but is the simplest way of solving the problem.
2021-07-31 07:58:47 +01:00
Marcel Admiraal
e2d0dfe3c7 Ensure node's area tree signals are disconnected when clearing monitoring,
even if nodes are no longer in the tree.
2021-07-31 07:14:03 +01:00
Hugo Locurcio
1ed24ca548 Highlight context menu items at the top of the 2D/3D viewports
This makes it easier to notice that some menu items only appear when
specific nodes are selected.

This change applies to both 2D and 3D editors, including both plugin-based
menus and the hardcoded 2D layout/animation contextual menus.
2021-07-31 01:50:50 +02:00
Rémi Verschelde
504f47eaec Merge pull request #47222 from dreamsComeTrue/anim-track-improv
[3.x] Make Animation's SceneTreeDialog filter nodes properly
2021-07-30 23:42:55 +02:00
PouleyKetchoupp
e0e9f575ae Refactor layer property editor grid
- Now able to display up to 32 layers in physics (still 20 for render)
- Adjustable grid size to fit available space in dock
- Expansion icon to display more layers vertically
- Layer numbers in cells to help with selection
2021-07-30 11:43:04 -07:00
Rémi Verschelde
9735f2803c Merge pull request #46800 from The-O-King/normal_compression
[3.x] Implement Octahedral Map Normal/Tangent Attribute Compression
2021-07-30 17:34:47 +02:00
Rémi Verschelde
18f09492b4 Merge pull request #50874 from raulsntos/backport-44355 2021-07-30 16:43:03 +02:00
Omar El Sheikh
d274284069 Octahedral Normal/Tangent Compression
Implement Octahedral Compression for normal/tangent vectors
*Oct32 for uncompressed vectors
*Oct16 for compressed vectors

Reduces vertex size for each attribute by
*Uncompressed: 12 bytes, vec4<float32> -> vec2<unorm16>
*Compressed: 2 bytes, vec4<unorm8> -> vec2<unorm8>

Binormal sign is encoded in the y coordinate of the encoded tangent

Added conversion functions to go from octahedral mapping to cartesian
for normal and tangent vectors

sprite_3d and soft_body meshes write to their vertex buffer memory
directly and need to convert their normals and tangents to the new oct
format before writing

Created a new mesh flag to specify whether a mesh is using octahedral
compression or not
Updated documentation to discuss new flag/defaults

Created shader flags to specify whether octahedral or cartesian vectors
are being used

Updated importers to use octahedral representation as the default format
for importing meshes

Updated ShaderGLES2 to support 64 bit version codes as we hit the limit
of the 32-bit integer that was previously used as a bitset to store
enabled/disabled flags
2021-07-30 10:29:09 -04:00
EricEzaM
0e5c6e0d55 Allow checking for exact matches with Action events.
Added additional param to action related methods to test for exactness.
If "p_exact_match" is true, then the action will only be "matched" if the provided input event *exactly* matches with the action event.

Before:
* Action Event = KEY_S
* Input Event = KEY_CONTROL + KEY_S
* Is Action Pressed = True

Now:
You can still do the above, however you can optionally check that the input is exactly what the action event is:
* Action Event = KEY_S
* Input Event = KEY_CONTROL + KEY_S
* p_exact_match = True
* Is Action Pressed = False
* If the Input Event was only KEY_S, then the result would be true.

Usage:

```gdscript
Input.is_action_pressed(action_name: String, exact_match: bool)
Input.is_action_pressed("my_action", true)

InputMap.event_is_action(p_event, "my_action", true)

func _input(event: InputEvent):
  event.is_action_pressed("my_action", false, true) # false = "allow_echo", true = "exact_match"
  event.is_action("my_action", true)
```

Co-authored-by: Eric M <itsjusteza@gmail.com>
2021-07-30 15:35:39 +02:00
Rémi Verschelde
7f4eafa6f2 Merge pull request #50983 from Calinou/editor-use-bullet-points-3.x
Use bullet points in the editor instead of dashes where relevant
2021-07-30 13:42:27 +02:00
Rémi Verschelde
7075bb6129 Merge pull request #51046 from aaronfranke/3.x-freetype
[3.x] Fix building with the FreeType module disabled
2021-07-30 09:07:35 +02:00
Rémi Verschelde
896e7a4458 Merge pull request #50985 from raulsntos/fix-50788
[3.x] Set p_raw_strength in action_match methods
2021-07-30 08:58:29 +02:00
Aaron Franke
e47018ffa4 [3.x] Fix building with the FreeType module disabled 2021-07-29 21:47:40 -05:00
Rémi Verschelde
78d9a4ae7e Merge pull request #51029 from lawnjelly/portals_gizmo_margins
Portals - fix gizmo margin scaling
2021-07-29 22:13:45 +02:00
kleonc
3bb950b8e8 SpriteFramesEditor: preserve source texture margins when creating frames from AtlasTexture 2021-07-29 20:23:06 +02:00
lawnjelly
d578ea99b9 Portals - fix gizmo margin scaling
If the user changed the portal Z scale in the editor the portal margin display could become incorrectly sized.

This is because the portal margin is measured in world space units, and has to be back calculated into model space using the inverse global transform of the portal node. The model space size of the margin is thus tied to the current scale of the node.

This PR forces updating the gizmo each time the transform is changed. This isn't super efficient, but as this is an editor only feature it should be okay, and it is unlikely to be a performance problem.
2021-07-29 18:58:19 +01:00
Rémi Verschelde
bab9c02f47 Merge pull request #51014 from pycbouh/core-texture-webp-crash-3.x
[3.x] Fix a crash when trying to load a WebP `StreamTexture`
2021-07-29 16:00:30 +02:00
Rémi Verschelde
7a35eec705 Merge pull request #50979 from lawnjelly/portals_autoplace_priority_setting 2021-07-29 15:46:01 +02:00
Yuri Sizov
62f7eb7b2f Fix a crash when trying to load a WebP StreamTexture 2021-07-29 16:00:04 +03:00
Rémi Verschelde
6ce12088c7 Merge pull request #51010 from lawnjelly/portals_fix_csg_update 2021-07-29 14:55:45 +02:00
lawnjelly
e06cd3042f Portals - Fix CSG updates on room conversion
Due to a quirk in CSG Shapes, updating is usually deferred to the next frame. This is problematic as we need to read back the geometry on the first frame when converting levels.

This PR adds a function to CSGShape to force immediate updating (if dirty), and calls it during room conversion.
2021-07-29 12:41:23 +01:00
lawnjelly
8287d9e9bc Portals - Fix sending portal margins to VisualServer
Portal margins were not being correctly sent to the PortalRenderer from the SceneTree, so all margins were being used as default (1.0). This PR fixes this.
2021-07-29 11:57:32 +01:00
Raul Santos
daa07219cb Set p_raw_strength in action_match methods 2021-07-28 20:42:21 +02:00
Hugo Locurcio
10ef55ce23 Use bullet points in the editor instead of dashes where relevant 2021-07-28 19:47:11 +02:00
lawnjelly
d0ba355520 Portals - add autoplace priority setting to CullInstance
The default autoplace algorithm places instances in the highest priority Room. It became apparent that there are some situations in which users will want to override this and force placement in a Room from a particular RoomGroup, especially an "outside" RoomGroup.

This setting allows the user to specify a preference for Room priority. When set to 0, the setting is ignored and the highest priority Room is chosen.
2021-07-28 17:23:20 +01:00
Rémi Verschelde
5d4352fad4 Merge pull request #50977 from lawnjelly/portals_fix_autolink_internal 2021-07-28 18:20:06 +02:00
lawnjelly
d7d7abf057 Portals - fix autolink portals to detect internal
Although explicit portals did a check to detect internal portals, this check was missing from autolinked portals. This meant they were incorrectly clipping the room bounds of the enclosing outer room.

This PR adds a check for internal rooms during the autolinking and sets the internal flag where needed.
2021-07-28 15:54:45 +01:00
Hugo Locurcio
8f891535d0 Improve MeshInstance3D UV preview in the editor
- Use background and line colors that match better with the
  rest of the editor.
- Use translucent lines to make overlapping lines visible.
- Tweak the error message to mention the UV layer in question
  when there is no UV for a defined layer.

(cherry picked from commit 8cdfd2e706)
2021-07-28 15:37:40 +02:00
Hugo Locurcio
7e3c0a0c1f Document Image.save_exr() only being available in editor builds
(cherry picked from commit a1784c64b4)
2021-07-28 15:35:52 +02:00
Hugo Locurcio
8fc99ef680 Improve the 3D editor manipulation gizmo
- Allow some tolerance when clicking the plane move/scale,
  even if the click is actually slightly outside the plane
  (similar to Blender).
- Make the rotate manipulation circles visually thinner to be
  less distracting.
- Make the hovered color less saturated to be more distinguishable
  from the non-hovered state.
  - Don't set brightness above 1.0 to prevent the gizmo from glowing
    when hovered.

(cherry picked from commit 6cfcbbbb93)
2021-07-28 15:35:35 +02:00
Aaron Franke
48308a5e0a Fix CSGSphere3D mesh creation
(cherry picked from commit b2156b22ea)
2021-07-28 15:34:00 +02:00
Rémi Verschelde
ab30437529 Merge pull request #50963 from Chaosus/shader_fix_varying
Fix varying usage in custom functions [3.x]
2021-07-28 08:24:05 +02:00
Yuri Roubinsky
8b6d9ab956 Fix varying usage in custom functions [3.x] 2021-07-28 08:11:35 +03:00
Rémi Verschelde
fa9f387367 Merge pull request #50945 from m4gr3d/fix_custom_build_export_3x
[3.x] Fix custom build export
2021-07-27 21:38:31 +02:00
Fredia Huya-Kouadio
df1ebbb0aa Fix custom build export 2021-07-27 12:24:44 -07:00
Rémi Verschelde
56d7de2208 Merge pull request #50909 from fabriceci/fix-multiple-direction-collision-3x
[3.x] Allow multiple collision direction at the same time
2021-07-27 19:10:52 +02:00
Rémi Verschelde
fddc370b2b Merge pull request #50837 from Calinou/3d-editor-camera-preview-add-shortcut-3.x
Add shortcut to toggle the 3D editor's camera preview (3.x)
2021-07-27 13:34:35 +02:00
Rémi Verschelde
b358a71a38 Merge pull request #50817 from KoBeWi/gg_ez_rects
[3.x] Allow for easier editing of rect CollisionShape2D
2021-07-27 13:34:29 +02:00
Rémi Verschelde
bcc5250cde Merge pull request #50914 from Razoric480/3x-lsp-symbolkind-fix
[3.x] Fix LSP reporting wrong types
2021-07-27 13:32:46 +02:00
Rémi Verschelde
717ba8f9d8 Merge pull request #50932 from lawnjelly/portals_fix_margin_loading
Portals - Fix default portal margin loading
2021-07-27 13:09:01 +02:00
Rémi Verschelde
7d425d2c77 Merge pull request #50911 from lawnjelly/portals_editor_colors
Portals - Gizmo colors added to editor settings
2021-07-27 13:08:03 +02:00
Rémi Verschelde
940ca74ccf Merge pull request #50889 from Chaosus/shader_const_array_3.x
[3.x] Implemented global const array to shaders
2021-07-27 13:05:32 +02:00
lawnjelly
d012a26e6a Portals - Fix default portal margin loading
The default portal margin is stored in the RoomManager. Previously this was propagated to Portals when the value was changed, and Portals each stored this default value.

This caused a bug during loading, if the RoomManager was loaded before Portals, the value was never propagated.

This PR makes the default margin a static value stored in the RoomManager, and the Portals now read directly from the static value when required, and do not store locally. This gets around the problem.
2021-07-27 11:48:34 +01:00
vitika9
843c2a3dd8 Removed Redundant assignement of name inside configure_joypad function
(cherry picked from commit 1add8b3172)
2021-07-27 12:17:14 +02:00
Haoyu Qiu
eb31a39e82 Add check to internal methods to prevent crash
(cherry picked from commit 448295cd51)
2021-07-27 12:17:14 +02:00
Raul Santos
9fd201c7a4 Ignore paths with invalid chars in PathWhich
(cherry picked from commit d636ebbfe9)
2021-07-27 12:17:14 +02:00
Raul Santos
2d60a64260 Use Array.Empty instead of allocating a every time
Use `System.Array.Empty<T>` to get an empty array instead of allocating
a new one every time. Since arrays are immutable there is no need to
allocate them every time.

(cherry picked from commit accd05f4ad)
2021-07-27 12:17:09 +02:00
SaracenOne
462231e297 Removing bounding box calculations from 3D scene drag and drop and collide against physics rather than visual geometry.
(cherry picked from commit fbda490d0f)
2021-07-27 11:58:36 +02:00
Rémi Verschelde
6a6b6fa5cb Merge pull request #50827 from Calinou/bakedlightmap-add-bounce-indirect-energy 2021-07-27 10:44:41 +02:00
Rémi Verschelde
5e279516bf Merge pull request #50924 from timothyqiu/popup-menu-check
[3.x] Fix crash when executing PopupMenu.new()._submenu_timeout()
2021-07-27 10:00:50 +02:00
Haoyu Qiu
fb15adfad0 Fix crash when executing PopupMenu.new()._submenu_timeout() 2021-07-27 12:11:28 +08:00
lawnjelly
cb39b3d77c Portals - Gizmo colors added to editor settings
Make the portal and room gizmo colors user definable.
2021-07-26 20:09:22 +01:00
fabriceci
aaf09f864a Allow multiple collision direction at the same time 2021-07-26 20:11:22 +02:00
Rémi Verschelde
a71169c0e0 Merge pull request #50788 from aaronfranke/3.x-input-get-axis 2021-07-26 16:30:44 +02:00
Rémi Verschelde
52df2940bc i18n: Sync translations with Weblate
(cherry picked from commit c406c8512f)
2021-07-26 16:23:20 +02:00
Rémi Verschelde
2ae4748816 Revert "Fix Illegible text in audio bus editor 3.x"
This reverts commit d2cbf331ce.

Fixes #50890.
2021-07-26 16:14:17 +02:00
Rémi Verschelde
95326f283a Merge pull request #50887 from Chaosus/varying_fixes_3.x
Backport latest varying fixes to 3.x (2)
2021-07-26 16:14:04 +02:00
Rémi Verschelde
c376aa669e Merge pull request #50886 from timothyqiu/tileset-atlas
[3.x] Fix selection of spaced atlas tile when using priority
2021-07-26 15:39:00 +02:00
Yuri Roubinsky
1e191847c7 [3.x] Implemented global const array to shaders 2021-07-26 16:29:39 +03:00
Yuri Roubinsky
0a99613e53 Backport latest varying fixes to 3.x (2) 2021-07-26 15:40:42 +03:00
Rémi Verschelde
cc194f68e4 Merge pull request #50882 from akien-mga/3.x-cherrypicks 2021-07-26 14:31:17 +02:00
Haoyu Qiu
2131b3c61c Fix selection of spaced atlas tile when using priority 2021-07-26 20:05:59 +08:00
bruvzg
d86eae09d9 [macOS] Add "debugging" (get-task-allow) to the export options, to allow using native debugger.
(cherry picked from commit 2dd6c3eb09)
2021-07-26 13:37:26 +02:00
Hugo Locurcio
94f79fa474 Document caveats with Control's mouse_entered/mouse_exited signals
(cherry picked from commit 37c1cbdcb2)
2021-07-26 13:36:37 +02:00
luz paz
b684d72af0 Remove unnecessary 'pass' statement
ref: https://lgtm.com/projects/g/godotengine/godot/?mode=tree&ruleFocus=910088
(cherry picked from commit 2e0044c93d)
2021-07-26 13:36:25 +02:00
Gallilus
9342457bcd Change "Add Preload Node" action to "Add Node(s)"
The action might also drop Custom Nodes

(cherry picked from commit 70a6ff0a71)
2021-07-26 13:36:07 +02:00
Aaron Franke
1180256090 Add documentation to Array in C#
(cherry picked from commit 080f44a3b7)
2021-07-26 13:35:52 +02:00
Raul Santos
6ea8334012 Fix documentation in StringExtensions
(cherry picked from commit ba99387bf3)
2021-07-26 13:35:12 +02:00
Raul Santos
f20ace5cd2 Fix typo in CollisionObject documentation
(cherry picked from commit f8374b021e)
2021-07-26 13:31:19 +02:00
foxydevloper
f2cdacd3a6 Improve select tool's tooltip
- Makes tips clearer and more consistent.
- Removes outdated "shift+v" that doesn't work
- Adds Ctrl+RMB for adding nodes at position
- Removes tip for non-existent Alt+Drag in 3D select tool

(cherry picked from commit 6b90e2df6c)
2021-07-26 13:30:56 +02:00
Hugo Locurcio
3462aa4aba Add a tooltip for Inclusive and Self in the editor profiler
This also changes the display mode tooltips to reflect the fact that
times are now displayed in milliseconds instead of seconds.

(cherry picked from commit e837e04ef8)
2021-07-26 13:29:11 +02:00
Hugo Locurcio
af3f83407f Expose an ImportOrder enum in ResourceImporter
This avoids using magic numbers in code.

(cherry picked from commit 7f83977f37)
2021-07-26 13:26:58 +02:00
Rémi Verschelde
8ecb5d2047 Merge pull request #48621 from Calinou/editor-3d-hide-selection-box-no-gizmos-3.x
Hide the 3D editor selection box when View Gizmos is disabled (3.x)
2021-07-26 12:45:00 +02:00
Hugo Locurcio
ba91c37efe Add shortcut to toggle the 3D editor's camera preview
A Camera node still has to be selected to initially enable camera
preview, but another node can then be selected and the preview can
be disabled by pressing the shortcut key again.
2021-07-25 12:50:51 +02:00
Hugo Locurcio
974d3aa9cd Add a property to control the bounce indirect energy in BakedLightmap
Higher values will make indirect lighting brighter.
A value of 1.0 represents physically accurate behavior, but higher values
can be used to make indirect lighting propagate more visibly when using
a low number of bounces.

This can be used to speed up bake times by lowering the number of bounces
then increasing the bounce indirect energy. Unlike BakedLightmapData's
energy property, this property does not affect direct lighting
emitted by light nodes or emissive materials.
2021-07-25 03:04:40 +02:00
Rémi Verschelde
d22f487dfe Merge pull request #50819 from aaronfranke/3.x-simple-cs-editorconfig
[3.x] Add a simple C# .editorconfig
2021-07-24 23:20:33 +02:00
Rémi Verschelde
fd74ac2f3d Merge pull request #50818 from Calinou/bakedlightmap-message-only-if-nonzero-bake-time
Only print message about lightmap baking if it took at least 1 second
2021-07-24 23:08:10 +02:00
Aaron Franke
17551fe29e [3.x] Add a simple C# .editorconfig 2021-07-24 16:27:57 -04:00
Francois Belair
02bc1bf355 Fix LSP SymbolKind reporting wrong types
Classes were properties, functions interfaces, etc.
2021-07-24 16:25:47 -04:00
Hugo Locurcio
db04860653 Only print message about lightmap baking if it took at least 1 second 2021-07-24 22:06:46 +02:00
kobewi
10652cd342 Allow for easier editing of rect CollisionShape2D 2021-07-24 21:31:32 +02:00
Aaron Franke
69fb14256b [3.x] Allow getting Input axis/vector values from multiple actions
For get_vector, use raw values and handle deadzones appropriately
2021-07-23 19:17:55 -04:00
Aaron Franke
afa89c9eea [3.x] Add raw strength value for internal use 2021-07-23 19:09:53 -04:00
Nicholas Huelin
6d58ea6ce7 Fix doc typos
This pull request fixes an assortment of typos and improves conciseness in `Animation`, `Area2D`,  `Array`, `ArrayMesh`, `Control`, `Directory`, `EditorPlugin`, `Engine`, and `OS`.

(cherry picked from commit 9a72b0d3d0)
2021-07-24 01:06:38 +02:00
Hugo Locurcio
ce78e605b1 Clarify the purpose of the default asset library URLs in the editor
`localhost` was removed as it won't work out of the box. It can be added
by the user if they're working on the asset library itself.

This won't affect existing installations due to how the editor settings
are stored, but existing installations will keep working fine.

(cherry picked from commit eac8ba6ce8)
2021-07-24 01:01:14 +02:00
Nicholas Huelin
bd8747f7f1 Fix miscellaneous doc typos and inconsistencies
This pull request fixes an assortment of typos, improves conciseness, and enhances clarity.

(cherry picked from commit 9787e631aa)
2021-07-24 01:00:37 +02:00
Distrikt64
1e49b6299a Fix msec documentation description typo
(cherry picked from commit 44eb041d60)
2021-07-24 00:59:57 +02:00
Hugo Locurcio
069281d58f Improve documentation for GDScript constants
(cherry picked from commit 8ff8c1e5f8)
2021-07-24 00:59:35 +02:00
Joseph Davies
b98a06b259 Fix grammar in MultiMesh documentation.
(cherry picked from commit 136567ebcf)
2021-07-24 00:58:30 +02:00
Hugo Locurcio
244425998f Document the RootMotionView class
(cherry picked from commit 6880829a9a)
2021-07-24 00:58:11 +02:00
foxydevloper
c7062f3bb8 Fix hidden seperators when horizontal frames is 1
(cherry picked from commit 429382b7e5)
2021-07-24 00:52:49 +02:00
kobewi
d2034fc269 Fix Change Node Type after Add Node Here
(cherry picked from commit 31a81562a8)
2021-07-24 00:52:32 +02:00
Haoyu Qiu
329df4e404 Fix UndoRedo crash when clearing history
(cherry picked from commit c3baf83e28)
2021-07-24 00:51:42 +02:00
kobewi
49f323410b Don't set metadata_label font if it doesn't exist
(cherry picked from commit 2846dbf239)
2021-07-24 00:51:08 +02:00
Rémi Verschelde
7968208b0a Merge pull request #47201 from LightningAA/delete-from-project-manager-3.x
[3.x] Add the ability to remove project contents from the remove project dialog
2021-07-23 22:17:55 +02:00
Rémi Verschelde
322252e89f Merge pull request #50766 from lawnjelly/portals_warn_room_planes
Portals - Config warning for Rooms with too many planes
2021-07-23 14:24:53 +02:00
Rémi Verschelde
48d80b31b1 Merge pull request #50709 from DavidCambre/Improve-and-stramline-VisualScriptFuncNodes-Call-Set-Get
[3.x] Improve and streamline VisualScriptFuncNodes Call Set Get
2021-07-23 13:00:24 +02:00
Rémi Verschelde
d8cb3c193f Merge pull request #50763 from godotengine/revert-50561-fix-scene-tree-duplicate-selection-3.x
Revert "Fix duplicate selection in SceneTree (3.x)"
2021-07-23 12:20:08 +02:00
lawnjelly
5e59f7ce3a Portals - Config warning for Rooms with too many planes
Just a small addition, a config warning if the user creates a Room with a large number of bounding planes, letting them know to simplify it.
2021-07-23 10:19:09 +01:00
Rémi Verschelde
4ecd9af616 Revert "Fix duplicate selection in SceneTree (3.x)" 2021-07-23 10:56:03 +02:00
Rémi Verschelde
b856841b99 Merge pull request #50745 from LightningAA/fix-texture-preview-crash-3.x
[3.x] Fix `TexturePreview` crashing
2021-07-22 23:33:18 +02:00
Rémi Verschelde
b0132e59c4 Merge pull request #50749 from lawnjelly/portals_fix_adding_twice
Portals - fix adding statics twice
2021-07-22 21:44:40 +02:00
Lightning_A
8e90c7e829 Fix TexturePreview crashing 2021-07-22 13:42:22 -06:00
lawnjelly
c2dd51a85e Portals - fix adding statics twice
Due to an oversight in the autoplace recursive search for static objects, static objects were getting added twice to the portal renderer, which meant they were being rendered twice, lowering performance.

This PR corrects this horrendous error.
2021-07-22 20:23:57 +01:00
David Cambré
af1ea1800d Improve and streamline VisualScriptFuncNodes Call Set Get
This PR improves and streamlines the workflow for VisualScriptFunctionNodes Call Set Get
Uniform design.
Drag in set-get from tree is now working.
port 'pass' not backported to 3.x to keep script backwards compatibility
2021-07-22 21:13:37 +02:00
Rémi Verschelde
883bb2f4f6 Merge pull request #50561 from Calinou/fix-scene-tree-duplicate-selection-3.x
Fix duplicate selection in SceneTree (3.x)
2021-07-22 16:41:59 +02:00
Rémi Verschelde
86054e00bf Merge pull request #50446 from AnilBK/graphnode-improv-3.x
[3.x]Add missing graphnode setters.
2021-07-22 16:41:20 +02:00
Rémi Verschelde
0b4080ba4d Merge pull request #48555 from lawnjelly/delta_sync
Add option to sync frame delta after draw
2021-07-22 13:33:57 +02:00
Rémi Verschelde
2ac292a5ad Merge pull request #50646 from SirQuartz/3.x
Fix Illegible text in audio bus editor 3.x
2021-07-22 13:20:35 +02:00
Rémi Verschelde
214106d6e3 Merge pull request #50723 from BastiaanOlij/combine_far_near_dof
Combined the DOF far and DOF near passes
2021-07-22 13:19:39 +02:00
lawnjelly
93557927e4 Add option to sync frame delta after draw
Investigations have showed that a lot of the random variation in frame deltas causing glitches may be due to sampling the time at the wrong place in the game loop.

Although sampling at the start of Main::Iteration makes logical sense, the most consistent deltas may be better measured after the location likely to block at vsync - either the OpenGL draw commands or the SwapBuffers.

Here we add an experimental setting to allow syncing after the OpenGL draw section of Main::Iteration.
2021-07-22 12:04:22 +01:00
Rémi Verschelde
ca8e4889eb Merge pull request #50706 from dsnopek/webrtc-gdnative-version-3.x
Update GDNative API version for changes from #50659 (Godot 3.x)
2021-07-22 12:47:24 +02:00
Rémi Verschelde
d3f500cf33 Merge pull request #48390 from lawnjelly/delta_smooth
Add frame delta smoothing option
2021-07-22 12:43:39 +02:00
Rémi Verschelde
b4282c8435 Merge pull request #50700 from KoBeWi/3.drop
[3.x] Assign value to property by dropping to scene tree
2021-07-22 12:42:13 +02:00
Rémi Verschelde
5ca46ee1fd Merge pull request #50696 from DavidCambre/Allow-dropping-custom-node-scripts-in-VisualScript-editor
[3.x] Allow dropping custom node scripts in VisualScript editor
2021-07-22 12:42:06 +02:00
Rémi Verschelde
801205b2c1 Merge pull request #48892 from lawnjelly/bvh_robust
BVH - thread safety option
2021-07-22 12:41:42 +02:00
Rémi Verschelde
8341c09912 Merge pull request #50705 from DavidCambre/Expose-visual-script-custom-node-type-hints 2021-07-22 12:39:05 +02:00
Rémi Verschelde
e3c545668b Merge pull request #50112 from lawnjelly/camera_2d_current
Most recently added current Camera2D takes precedence
2021-07-22 12:16:44 +02:00
Rémi Verschelde
54ad72d08d Merge pull request #50320 from nekomatata/optimize-node-path-check-3.x
[3.x] Optimize NodePath update when renaming or deleting nodes in the editor
2021-07-22 12:13:26 +02:00
Rémi Verschelde
8cb25a581d Merge pull request #50724 from Chaosus/varying_fixes_3.x
Backport latest varying fixes to 3.x
2021-07-22 09:29:43 +02:00
Rémi Verschelde
8ca2deeccf Merge pull request #50699 from Calinou/rootmotionview-add-icon-3.x
Backport RootMotionView icon from the `master` branch
2021-07-22 09:28:57 +02:00
Rémi Verschelde
0c1d52f897 Merge pull request #50721 from tinmanjuggernaut/fix-alpha-ordering
[3.x] Fixes depth sorting of meshes with transparent textures
2021-07-22 08:53:30 +02:00
Yuri Roubinsky
1e128c80c6 Backport latest varying fixes to 3.x 2021-07-22 08:43:12 +03:00
Hugo Locurcio
a528931c5e Backport RootMotionView icon from the master branch
This makes RootMotionView display with a proper icon in the editor.
2021-07-22 07:36:08 +02:00
Bastiaan Olij
39658b4e07 Combined the DOF far and DOF near passes 2021-07-22 13:45:57 +10:00
Cory Petkovsek
096417905b Calculate instance depth after shadow calculation in VisualServer 2021-07-22 08:06:02 +08:00
Rémi Verschelde
9178e24d30 Expose visual script custom node type hints 2021-07-21 19:33:10 +02:00
David Snopek
a27f4de2ef Update GDNative API version for changes from #50659 2021-07-21 10:30:31 -05:00
kobewi
559b3a59bb Assign value to property by dropping to scene tree 2021-07-21 15:40:19 +02:00
David Cambré
968dd73141 Allow dropping custom node scripts in VisualScript editor 2021-07-21 15:01:07 +02:00
Rémi Verschelde
40b57319e2 Merge pull request #50664 from m4gr3d/disable_release_build_shrinking
[3.x] Disable resource optimizations for release builds
2021-07-21 09:03:22 +02:00
Fabio Alessandrelli
7c4cc4297a Merge pull request #50659 from dsnopek/webrtc-get-buffered-amount-3.x
Add get_buffered_amount() to WebRTCDataChannel (Godot 3.x)
2021-07-21 06:29:31 +02:00
ne0fhyk
d1fdb60ee2 Disable resource optimizations for release builds as it breaks the legacy build system. 2021-07-20 16:36:00 -07:00
Rémi Verschelde
6efdba4dab Merge pull request #50668 from Calinou/editor-create-dialog-display-class-name-3.x
Display the class name in the description
2021-07-21 00:15:56 +02:00
David Snopek
5b2dcc5f6b Add get_buffered_amount() to WebRTCDataChannel 2021-07-20 16:52:33 -05:00
Hugo Locurcio
130a467839 Display the class name in the description
- Display a placeholder if no description is available.
- Display a message if the search didn't return any results.
2021-07-20 23:28:23 +02:00
Rémi Verschelde
843ab4e375 Merge pull request #50482 from lawnjelly/portals_autoplace 2021-07-20 21:26:36 +02:00
Rémi Verschelde
8153175b42 Merge pull request #50656 from LightningAA/inspector-reorder-array-3.x
[3.x] Fix array reorder methods not being bound
2021-07-20 20:48:55 +02:00
Lightning_A
04fbe18c06 Fix array reorder methods not being bound 2021-07-20 12:22:47 -06:00
lawnjelly
83f1377a8f Portals - lift roomlist restrictions and fix link bug
Allows users to have the RoomManager as the roomlist.

Fixes a couple of bugs dealing with situations where users attempt to link Portals to Rooms outside the roomlist.

Adds a PortalEditorPlugin allowing you to flip individual portals.
2021-07-20 19:05:16 +01:00
Rémi Verschelde
af2c675a37 Merge pull request #50651 from LightningAA/inspector-reorder-array-3.x
[3.x] Add the ability to reorder array elements from the inspector
2021-07-20 19:50:13 +02:00
Lightning_A
5ca145ba5d Add the ability to reorder arrays from the inspector 2021-07-20 11:30:21 -06:00
Nick Huelin
d2cbf331ce Fix Illegible text in audio bus editor 3.x
This pull request fixes an issue where the text within the audio bus editor would be illegible. This version is tailored for 3.x.
2021-07-20 08:43:30 -04:00
lawnjelly
06d66488c2 Portals - Add the ability to autoplace static objects
In order to make level building easier, the system can now support STATIC and DYNAMIC objects in the roomlist that are not placed in rooms. The system will automatically place them in the appropriate room.
2021-07-20 13:24:30 +01:00
Rémi Verschelde
51f8247871 Merge pull request #50642 from akien-mga/3.x-cherrypicks 2021-07-20 13:53:03 +02:00
Rémi Verschelde
028bf846a8 Merge pull request #50640 from goostengine/add-engine-print-error-property-3.x
[3.x] Add `Engine.print_error_messages` property to disable printing errors
2021-07-20 13:31:04 +02:00
Rémi Verschelde
fde7c2c5b8 Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@241fed0a44.

(cherry picked from commit a98677181b)
2021-07-20 13:20:40 +02:00
Rémi Verschelde
96f5ffdcc1 mbedtls: Update to upstream version 2.16.11
(cherry picked from commit cd7b25588b)
2021-07-20 13:05:28 +02:00
Tomasz Chabora
d966f00954 Calculate __focus_rect when TreeItem is focused
(cherry picked from commit 2035992a07)
2021-07-20 13:05:14 +02:00
Haoyu Qiu
49c521021a Fix missing locale names
(cherry picked from commit 7eec8334d4)
2021-07-20 13:05:13 +02:00
Rémi Verschelde
3c8faed9e9 SCons: Avoid using Python f-string to preserve Python 3.5 compat
Fixes #50629.

(cherry picked from commit d1b39f0a14)
2021-07-20 13:05:13 +02:00
Kyle
f218e9e929 MultiplayerAPI is_network_server Fails Silently
Removes the error message when the network peer is not valid and returns false instead.

This makes it simpler to make games that are both on/offline by replacing server checks of

'''
if is_instance_valid(get_tree().network_peer) and get_tree().is_network_server():
		# Do server things
'''

with

'''
if get_tree().is_network_server():
		# Do server things
'''

Requires no changes to the docs because both the MultiplayerAPI and SceneTree docs don't mention the error.

(cherry picked from commit 74379b15ff)
2021-07-20 13:05:13 +02:00
Atlinx
6026de80e7 Add scaling to the curve editor's handles
This fixes issue #50617

(cherry picked from commit ac5f3a6733)
2021-07-20 13:05:12 +02:00
Haoyu Qiu
890dda4cb4 Minor enhancements for the resource options button
(cherry picked from commit 8c4cb53d21)
2021-07-20 13:05:12 +02:00
Hugo Locurcio
79d3a6c8df Improve tooltips in the editor profiler to mention the script name
Co-authored-by: CrispyPin <crispin@tasa.se>
(cherry picked from commit 0098e9243c)
2021-07-20 13:05:11 +02:00
David Snopek
1899a3b1ea Fix "IDHandler.get_prop is not a function" error when calling some methods on WebRTCDataChannel
(cherry picked from commit 756ed308ee)
2021-07-20 13:05:11 +02:00
Fabio Alessandrelli
6d546692fe [HTML5] Add 2 controllers to the godot database.
Sony PlayStation DualShock 4 (054c:05c4 first gen).
Unofficial Switch controller.

(cherry picked from commit 5717118bcc)
2021-07-20 13:05:10 +02:00
reduz
ca223d71d8 Addes ability to load build sources from file.
* If not present, the dialog asks to load build sources from a file.
* The export templates check now also verifies that build sources are installed and skips the template check.

This makes Android development easier.

(cherry picked from commit 6639cc9853)
2021-07-20 13:05:10 +02:00
Eric M
7b6b402a0c Added Node name to print() when printing Nodes.
(cherry picked from commit 3ca25ffe8a)
2021-07-20 13:05:09 +02:00
Nathan Franke
970a66a0fd Do not update scene tree dock when node edited outside of it
(cherry picked from commit 022a061571)
2021-07-20 13:05:09 +02:00
Rémi Verschelde
f8264abb46 Mono: Remove info dialog discouraging use in production
While there are still various bugs to solve and features to implement, the C#
support as of Godot 3.4 is fairly mature and already used by a number of users
in production. Now that we default to dotnet CLI as build tool, it also seems
to be more reliable than MSBuild.

The documentation can (and does for the most part) point out some caveats that
users should be aware of, but this info dialog has outlived its intended
purpose.

(cherry picked from commit 671467b888)
2021-07-20 13:05:04 +02:00
Andrii Doroshenko (Xrayez)
726111f38f Add Engine.print_error_messages property to disable printing errors
Backports #48359 to 3.x.

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2021-07-20 13:58:07 +03:00
Rémi Verschelde
d12243370d Merge pull request #50632 from timothyqiu/add-item-type-3.x
[3.x] Improve add item type UI in theme editor
2021-07-20 12:15:11 +02:00
Rémi Verschelde
559d02a216 Merge pull request #50095 from LightningAA/add-viewport-spy-3.x
[3.x] Add the ability to preview viewports from the inspector
2021-07-20 11:19:34 +02:00
Rémi Verschelde
78d6dc4d24 Merge pull request #50502 from Calinou/animation-track-editor-improve-scrolling-3.x
Improve scrolling actions in the animation track editor
2021-07-20 11:16:25 +02:00
Rémi Verschelde
2ee38416a4 Merge pull request #50507 from Calinou/light-tweak-property-hints
Tweak Light property hints for greater flexibility
2021-07-20 11:13:16 +02:00
Rémi Verschelde
7fe45cb25b Merge pull request #50531 from pycbouh/editor-improve-template-downloader-3.x
[3.x] Improve the UI/UX of the Export Template Manager dialog
2021-07-20 11:00:45 +02:00
Haoyu Qiu
48af497e8c Improve add item type UI in theme editor 2021-07-20 16:55:54 +08:00
Rémi Verschelde
f131a77f46 Merge pull request #46574 from The-O-King/split_stream_3.2
[3.4] Split Vertex Buffer Stream in Positions and Attributes
2021-07-20 10:48:37 +02:00
Rémi Verschelde
7d5c7e02c4 Merge pull request #50565 from foxydevloper/3.x-add-sort-button
Backport filesystem dock sorting to 3.x
2021-07-20 10:46:17 +02:00
Rémi Verschelde
f9707e1a28 Merge pull request #50499 from LightningAA/zoom-out-alt-3.x
[3.x] Add shift + [1-5] keyboard shortcuts to zoom out
2021-07-20 09:17:52 +02:00
Rémi Verschelde
89097fa8d9 Merge pull request #49983 from aaronfranke/3.x-gdshader
[3.x] Allow reading shaders from `.gdshader` files
2021-07-20 08:08:48 +02:00
Rémi Verschelde
087f23fd15 Merge pull request #50536 from Calinou/improve-shader-error-output-3.x
Improve the shader error console output
2021-07-20 07:22:06 +02:00
Aaron Franke
7dc2edc430 [3.x] Allow reading shaders from .gdshader files 2021-07-19 23:34:23 -04:00
Rémi Verschelde
a5c62edc14 Merge pull request #50586 from pycbouh/editor-theme-type-clear
Clear the theme type filter/name on each dialog popup
2021-07-19 22:55:44 +02:00
Rémi Verschelde
235a331e36 Merge pull request #50613 from DarkMessiah/reload-current-project-shortcut-3.x
Implemented the ability to add shortcut for Reload Current Project (3.x)
2021-07-19 22:46:56 +02:00
Omar El Sheikh
7f8487a900 Split Vertex Position and Attribute Streams
Implemented splitting of vertex positions and attributes in the vertex
buffer

Positions are sequential at the start of the buffer, followed by the
additional attributes which are interleaved

Made a project setting which enables/disabled the buffer formatting
throughout the project

Implemented in both GLES2 and GLES3

This improves performance particularly on tile-based GPUs as well as
cache performance for something like shadow mapping which only needs
position data

Updated Docs and Project Setting
2021-07-19 13:23:46 -07:00
Rémi Verschelde
526447b86f Merge pull request #50495 from nekomatata/move-and-slide-fixes-3.x
[3.x] Backport KinematicBody move_and_slide and move_and_collide fixes
2021-07-19 20:11:51 +02:00
Stanislav Labzyuk
10252d81a3 Implemented the ability to add shortcut for Project -> Reload Current Project. 2021-07-20 00:12:50 +07:00
foxydevloper
6926363efb Backport filesystem dock sorting to 3.x
Co-authored-by: Gilles Roudiere <gilles.roudiere@gmail.com>
2021-07-19 12:31:28 -04:00
PouleyKetchoupp
beeebb4c2f More accurate unsafe motion calculation
* Safe and unsafe motion are calculated by dichotomy with a limited
number of steps. It's good for performance, but on long motions that
either collide near the beginning or near the end, the result can be
very imprecise.
* Now a factor 0.25 or 0.75 is used to converge faster when this case
happens, which allows longer motions to get more accurate collision
detection.
* Makes snap collision more precise, and helps with cases where diagonal collision on the border of a platform can lead to the character being stuck.

Additional improvements to move_and_slide:
* Handle slide canceling in move_and_collide with 0 velocity instead of
not applying it.
* Better handling of snap with custom logic to cancel sliding.
* Remove small jittering when using stop on slope, by canceling the
motion completely when the resulting motion is less than margin instead
of always projecting to the up direction (in both body motion and snap).

Co-authored-by: fabriceci <fabricecipolla@gmail.com>
2021-07-19 08:09:17 -07:00
PouleyKetchoupp
2fbb6fff4e Fix move_and_collide causing sliding on slopes
Make sure the direction of the motion is preserved, unless the depth is
higher than the margin, which means the body needs depenetration in any
direction.

Also changed move_and_slide to avoid sliding on the first motion, in
order to avoid issues with unstable position on ground when jumping.

Co-authored-by: fabriceci <fabricecipolla@gmail.com>
2021-07-19 08:09:16 -07:00
Lightning_A
cf8de3b316 Add viewport preview plugin and refactor TextureEditorPlugin 2021-07-18 14:49:45 -06:00
Yuri Sizov
9c2ff29c4d Clear the theme type filter/name on each dialog popup 2021-07-18 20:37:30 +03:00
Hugo Locurcio
8f448b5830 Fix duplicate selection in SceneTree
* It seems both cell_selected and multi_selected were being triggered,
* This caused inspector updating twice.
* cell_selected connection and callback were removed.

Co-authored-by: Juan Linietsky <reduzio@gmail.com>
2021-07-17 21:26:24 +02:00
Rémi Verschelde
9636deac55 Merge pull request #50508 from Calinou/add-drag-threshold-select-mode-3.x
Prevent accidental drags by adding drag distance threshold
2021-07-17 19:36:16 +02:00
Francois Belair
802bb9c01f Implement LSP didSave notify and rename request 2021-07-17 11:50:17 -04:00
Andrii Doroshenko (Xrayez)
7bedb68632 VCS: Allow to stage and commit all files with Ctrl + Enter 2021-07-17 13:00:27 +03:00
Rémi Verschelde
d7f49c7709 Merge pull request #50519 from pycbouh/editor-theme-fixup-3.x
[3.x] Fix control picker in the Theme editor
2021-07-17 09:30:35 +02:00
Rémi Verschelde
522df33334 Merge pull request #50528 from pycbouh/editor-subresource-selector-3.x
[3.x] Make several actions in the Inspector dock more obvious
2021-07-17 09:29:01 +02:00
Rémi Verschelde
c391c2210f Merge pull request #50526 from pycbouh/graphedit-adjust-zoom-levels-3.x
[3.x] Make zoom limits and step adjustable in GraphEdit
2021-07-17 08:50:31 +02:00
Hugo Locurcio
43d7b62cb0 Improve the shader error console output
This makes the line gutter look more like an actual line gutter,
which makes it less confusing.
2021-07-17 03:00:46 +02:00
Yuri Sizov
266c726dad Improve the UI/UX of the Export Template Manager dialog 2021-07-17 00:46:30 +03:00
Yuri Sizov
47592f96bc Make several actions in the Inspector dock more obvious 2021-07-16 23:27:00 +03:00
Yuri Sizov
e05eb8a6ad Make zoom limits and step adjustable in GraphEdit 2021-07-16 22:43:28 +03:00
Yuri Sizov
b11178b21e Fix control picker in the Theme editor 2021-07-16 21:36:54 +03:00
Lightning_A
c4ff3ef891 Add shift + [1-5] keyboard shortcuts to zoom out 2021-07-16 12:15:44 -06:00
Rémi Verschelde
4d3c11e85e Merge pull request #49446 from nekomatata/sync-to-physics-3d-3.x
[3.x] Support for 3D sync to physics
2021-07-16 07:15:17 +02:00
Hugo Locurcio
44b01751e6 Prevent accidental drags by adding drag distance threshold
Co-authored-by: fox <12120644+foxydevloper@users.noreply.github.com>
2021-07-16 06:04:25 +02:00
Hugo Locurcio
0fe771dfe5 Tweak Light property hints for greater flexibility
- Specular can now be set above 1.0.
- Some properties now allow more precise values.
- The Bake Mode property hint was changed to be more descriptive.
- The maximum shadow bias values were adjusted to follow the property
  hints in `master`.
2021-07-16 04:12:10 +02:00
Hugo Locurcio
a623eb5083 Improve scrolling actions in the animation track editor
- Implement timeline scrobbling using Alt + Mouse wheel anywhere in the
  animation track editor.
  - Snap settings are followed, and precise snapping can be obtained by also
    holding down Shift.
  - This modifier wasn't used by anything in the animation editor.
- Allow zooming by using Ctrl + Mouse wheel on the timeline itself.
  - Previously, this was only possible on the track area, not the timeline.
2021-07-15 22:29:36 +02:00
Rémi Verschelde
08d517243c Merge pull request #50490 from Calinou/improve-2d-editor-zoom-3.x
Improve 2D editor zoom logic (3.x)
2021-07-15 19:04:38 +02:00
Rémi Verschelde
ba57247448 Merge pull request #50492 from KoBeWi/🌳🌳🌳.x
[3.x] Update Tree when modified
2021-07-15 19:03:54 +02:00
Rémi Verschelde
317b5c7141 Merge pull request #50494 from Calinou/asset-search-autofocus-3.x
Automatically focus the Search field when displaying asset library
2021-07-15 19:03:30 +02:00
Hugo Locurcio
9cc65e1b9b Automatically focus the Search field when displaying asset library
- Focus the project search box when switching from the Templates tab
  back to the Projects tab in the project manager.
- Add a context-specific placeholder for the asset library search box.
- Rename "Search" project filter box placeholder to the more
  descriptive "Filter projects". When performing a search on an
  existing selection, "Filter" is more accurate than "Search".
2021-07-15 18:47:38 +02:00
kobewi
557a1f6232 [3.x] Update Tree when modified 2021-07-15 18:19:29 +02:00
Hugo Locurcio
477dfc5174 Improve 2D editor zoom logic
- Add 1-5 shortcuts to zoom between 100% and 1600% quickly
  (similar to GIMP).
- When holding down Alt, go through integer zoom values if above 100%
  or fractional zoom values with integer denominators if below 100%
  (50%, ~33.3%, 25%, …).
2021-07-15 17:15:02 +02:00
Rémi Verschelde
26d0c90370 Merge pull request #50477 from lawnjelly/portals_autolink_order
Portals - fix autolink sprawling, refine logs
2021-07-15 15:22:53 +02:00
Rémi Verschelde
50790a5893 Merge pull request #50478 from KoBeWi/xalign
[3.x] Fix valign with stylebox borders
2021-07-15 15:22:13 +02:00
lawnjelly
44f9a0f961 Portals - fix autolink sprawling, refine logs
It turned out the new autolinking feature was linking portals AFTER the static meshes had been added to rooms in the PortalRenderer. This meant that large meshes weren't being sprawled across these portals. The fix involves doing the autolinking BEFORE adding the static meshes.

Fixes a bug in the warning for portals being in the wrong direction, they should have only been checkout for outgoing portals. This was resulting in erroneous warnings.

Also the room conversion logs are refined to be more compact and informative.

A warning icon is also added in the gizmo for portals where autolink fails.
2021-07-15 13:04:05 +01:00
kobewi
dd62aa1bf9 [3.x] Fix valign with stylebox borders 2021-07-15 13:58:18 +02:00
Rémi Verschelde
231efe0c6d Merge pull request #50166 from fabriceci/fix-2d-moving-platform
[3.x] Fixing 2D moving platform logic
2021-07-15 13:34:30 +02:00
Rémi Verschelde
bc40546406 Merge pull request #50457 from lawnjelly/portals_config_warn 2021-07-15 12:30:33 +02:00
Rémi Verschelde
d07fb152d9 Merge pull request #50475 from akien-mga/3.x-cherrypicks 2021-07-15 12:19:47 +02:00
fabriceci
fba4c9d552 Fixing 2D moving platform logic
Fixing by applying the movement in two steps, first the platform
movement, and then the body movement. Plus, add the platform movement
when we are on_wall.
2021-07-15 11:57:58 +02:00
kleonc
6d48b67f14 Node::add_child Check for cyclic dependency
Node Replace string addition with vformat()

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
(cherry picked from commit 81388db8a7)
2021-07-15 10:52:33 +02:00
kobewi
4941d2001c Add set_pressed_no_signal method to BaseButton
(cherry picked from commit 50c63bdc4c)
2021-07-15 10:52:22 +02:00
Tomasz Chabora
6021ab5b01 Document remaining Visual Script classes
(cherry picked from commit 1054956461)
2021-07-15 10:46:04 +02:00
Sergey Minakov
f3da335416 [iOS] Fix plugin configuration loading
Clear ConfigFile parameter before loading new file.
Ignore duplicate input plist keys

(cherry picked from commit aa321f0a24)
2021-07-15 10:40:56 +02:00
David Kennedy
72db6016ba Fixes move_to_trash() on Linux
Fixes #42840 OS move_to_trash() on Linux is not compliant with the Freedesktop specification

(cherry picked from commit 8b68c6808d)
2021-07-15 10:39:47 +02:00
Hendrik Brucker
fe616d443a Fix color properties of particle nodes/material
(cherry picked from commit 3a4a2198ed)
2021-07-15 10:25:35 +02:00
Rémi Verschelde
91241d9944 Merge pull request #50472 from akien-mga/room_manager-fix-csg-dependency
RoomManager: Fix build with CSG module disabled
2021-07-15 09:07:15 +02:00
lawnjelly
b663acef93 Portals - Add configuration warnings for nodes
Checks for invalid children / grandchildren etc.
2021-07-15 08:01:42 +01:00
Rémi Verschelde
041115ca41 RoomManager: Fix build with CSG module disabled
Fixes #50462.
2021-07-15 08:51:15 +02:00
Rémi Verschelde
669bf7cf08 Merge pull request #50466 from akien-mga/3.x-scons-modules-enabled-header 2021-07-15 00:49:56 +02:00
Andrea Catania
74e6adda57 Add env.Depends to modules_enabled.gen.h generator
Sometimes scons doesn't detects that a new module is being added. This commit fix it.

(cherry picked from commit b667e72adf)
2021-07-14 23:46:44 +02:00
Rémi Verschelde
875045adde Use modules_enabled.gen.h to improve inter dependency checks
- Fix build with gdscript module disabled. Fixes #31011.
- Remove unused `gdscript` compile option.
- Fix build with regex module disabled.
- Fix ImageLoaderSVG to forward declare thirdparty structs.

(cherry picked from commit f3726ee994)
2021-07-14 23:36:38 +02:00
Rémi Verschelde
cbbea6084d SCons: Generate header with info on which modules are enabled
We already had `MODULE_*_ENABLED` defines but only in the modules
environment, and a few custom `*_ENABLED` defines in the main env
when we needed the information in core.

Now this is defined in a single header which can be included in the
files that need this information.

(cherry picked from commit b7297fb39c)
2021-07-14 23:09:47 +02:00
Rémi Verschelde
aecb1c32ab Merge pull request #50459 from MisoMosiSpy/image-lock-issue-3.x
Fixes 50428, added missing checks for image lock
2021-07-14 22:49:10 +02:00
Dipal M Zambare
b626c57bc7 Fixes 50428, added missing checks for image lock 2021-07-14 21:49:23 +05:30
Rémi Verschelde
a3310c1da2 Merge pull request #46130 from lawnjelly/portals
Portal occlusion culling [3.4]
2021-07-14 13:38:01 +02:00
lawnjelly
eb6f98ec55 Portal occlusion culling
Adds support for occlusion culling via rooms and portals.
2021-07-14 11:43:23 +01:00
Rémi Verschelde
6cff43e093 Merge pull request #50150 from Valeryn4/3.x-fix_lightmap_cpu 2021-07-14 12:19:53 +02:00
Rémi Verschelde
aa3a5c9f6a Merge pull request #50184 from JFonS/cpu_lightmapper_soft_shadows
[3.x] Add soft shadows to the CPU lightmapper
2021-07-14 12:18:08 +02:00
Anilforextra
d9e48a9c58 Add missing graphnode setters.
Documentation Updates.
2021-07-14 15:37:59 +05:45
lawnjelly
6914d7c6e0 Add frame delta smoothing option
Frame deltas are currently measured by querying the OS timer each frame. This is subject to random error. Frame delta smoothing instead filters the delta read from the OS by replacing it with the refresh rate delta wherever possible.

This PR also contains code to estimate the refresh rate based on the input deltas, without reading the refresh rate from the host OS.
2021-07-14 08:44:31 +01:00
Rémi Verschelde
b0b2b7df31 Merge pull request #50257 from Calinou/physicsserver3d-add-set-iterations-3.x
Add a method to set the number of physics solver iterations in 3D (3.x)
2021-07-14 07:56:57 +02:00
PouleyKetchoupp
788db5cf47 Clean convex hull decomposition code
Remove unnecessary conversion between triangle data and vertex data
whenever possible.
2021-07-13 11:13:25 -07:00
Fabio Alessandrelli
207fb165bf [HTML5] Raise default initial memory to 32 MiB.
The memory was resized in any case during start.

Mitigate Chromium issue:
https://bugs.chromium.org/p/v8/issues/detail?id=11863

Also fix a warning about SAFE_HEAP being a linker only flag.

(cherry picked from commit 897c906ebf)
2021-07-13 17:03:44 +02:00
Rémi Verschelde
9a04e2afeb Revert "Fix gdnative api generation for methods that return enums"
This reverts commit aaacc753a7.
2021-07-13 17:02:59 +02:00
Rémi Verschelde
2004c7cdca Merge pull request #50419 from Calinou/fix-to-stop-word-casing-3.x
Fix casing of the "to" stop word in editor strings
2021-07-13 16:13:28 +02:00
Hugo Locurcio
e8c9877ad8 Fix casing of the "to" stop word in editor strings 2021-07-13 15:28:00 +02:00
Rémi Verschelde
b217f824ff Merge pull request #50416 from akien-mga/3.x-cherrypicks 2021-07-13 14:40:08 +02:00
Rémi Verschelde
7842168305 Update AUTHORS and DONORS list
New contributors added to AUTHORS:
@LightningAA, @thebestnom

Thanks to all contributors and donors for making Godot possible!

(cherry picked from commit 9e0e74e58e)
2021-07-13 13:16:47 +02:00
Rémi Verschelde
7af4a94b72 i18n: Sync translations with Weblate
(cherry picked from commit 1c840a31a5)
2021-07-13 12:33:17 +02:00
Haoyu Qiu
958e1e9ae2 Fix decompression with FastLZ when buffer size is less than 16 bytes
(cherry picked from commit ccf292df38)
2021-07-13 12:13:01 +02:00
Faymoon
03f7d707e7 Let thread func have optional parameter
Fixes #38042.

(cherry picked from commit 78ead60372)
2021-07-13 11:40:09 +02:00
Hugo Locurcio
9343ee5c2b Automatically display the installer after downloading an asset
- To make things easier to follow, display the asset name in
  confirmation dialogs.
- Display the number of conflicting files in the asset extraction dialog.

This reduces the number of clicks required to install an asset.

(cherry picked from commit 2708fcf13d)
2021-07-13 11:19:46 +02:00
bowling-allie
86e5893755 Fixes BlendSpace2D BLEND_MODE_DISCRETE_CARRY.
When BlendSpace2D switches animations, it will now correctly
calculate the previous animation position and length and
apply is to the new animation.

(cherry picked from commit bcb1e2b79f)
2021-07-13 10:47:20 +02:00
Jonas Bernemann
3b5ee6a38a String::format leave passed values untouched
If the passed value or key contains double quotation marks it will no
longer get removed.

(cherry picked from commit a403efb67c)
2021-07-13 10:20:03 +02:00
Haoyu Qiu
6179f76547 Merge similar editor strings
(cherry picked from commit 4383f8a790)
2021-07-13 10:20:03 +02:00
Haoyu Qiu
2b2f3d7f2d Fix memfree parameter name
(cherry picked from commit 542d7d6460)
2021-07-13 10:20:03 +02:00
Andrii Doroshenko (Xrayez)
1747569019 Set minimum size for "Version Control" diff bottom panel
Allows to see version diffs without having to expand the bottom panel
manually when clicking on a changed file in the "Commit" dock.

(cherry picked from commit 0fce7aea88)
2021-07-13 10:20:03 +02:00
TaskManagerCZ
b444bec1f3 Explicit error message when setting active a Viewport that is already active.
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
(cherry picked from commit e3be0913d7)
2021-07-13 10:20:03 +02:00
Haoyu Qiu
9184f58dc7 Fix unicode invalid skip error in AssetLib
(cherry picked from commit 0caaaf4018)
2021-07-13 10:20:03 +02:00
Haoyu Qiu
5a54cdf4fd Handle Z_BUF_ERROR in decompress_dynamic
(cherry picked from commit 293050a919)
2021-07-13 10:20:03 +02:00
Haoyu Qiu
a29b834930 Fix doc description of HTTPClient::request
(cherry picked from commit 422f821be9)
2021-07-13 10:20:03 +02:00
Hugo Locurcio
bcfa5beb8d Make makerst.py create folders automatically, print a message when done
(cherry picked from commit f05aa9cc01)
2021-07-13 10:20:03 +02:00
Francois Belair
5774098a91 Implement didClose notification in LSP
(cherry picked from commit 10429019ad)
2021-07-13 10:20:02 +02:00
Nick Huelin
88fc178d57 Add method description to PopupMenu
This pull request adds a missing method description to `PopupMenu`.

This completes the documentation for `PopupMenu` and enhances usability by doing so.

Update doc/classes/PopupMenu.xml

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
(cherry picked from commit 2e3cbbcd11)
2021-07-13 10:20:02 +02:00
Hendrik Brucker
55dbf24b98 Add elapsed time print statement to build system
(cherry picked from commit d070159094)
2021-07-13 10:20:02 +02:00
Hugo Locurcio
c0ccc34eeb Tweak the GradientTexture property hint to follow CurveTexture
This prevents setting too large values and crashing the editor.

Very low values are also no longer allowed since they are generally
not detailed enough to represent complex gradients, leading to confusion.

(cherry picked from commit 2c7813385d)
2021-07-13 10:20:02 +02:00
Fabio Alessandrelli
b8f1f13b85 [HTML5] Fix JavaScript string parsing with new interface.
Strings are UTF-8 encoded and should be parsed as such, while it was
being parsed as a C string before.

(cherry picked from commit d4e302a3a4)
2021-07-13 10:20:02 +02:00
Rémi Verschelde
32f5bee985 LineEdit: Respect max_length by truncating text to append
When appending text (either via `set_text()` or by pasting from clipboard),
if the input would make the `LineEdit` exceed its configured `max_length`,
the input text is truncated to fit. The discard part is passed as a parameter
in the `text_change_rejected` signal.

Fixes #33321.
Fixes #41278.

Also cleaned up unimplemented `max_chars` property in `TextEdit`.

Co-authored-by: Tony-Goat <70238376+Tony-Goat@users.noreply.github.com>
(cherry picked from commit 9a1ce8e6c3)
2021-07-13 10:20:02 +02:00
voxelv
e6f420aabf Avoid using a nullptr root in Tree._range_click_timeout().
Fixes #46648

(cherry picked from commit f17f3f8830)
2021-07-13 09:47:07 +02:00
Andrii Doroshenko (Xrayez)
4fec6d4697 Make EditorVCSInterface proxy functions virtual in C++
Allows to implement VCS plugins via C++ modules without affecting
the existing script instance mechanism.

(cherry picked from commit 23c1b39570)
2021-07-13 09:46:49 +02:00
Eric M
c696847f3d Added 'Select Current' option when user is prompted to select main scene after clicking play
(cherry picked from commit 2296b57739)
2021-07-13 09:46:31 +02:00
Rémi Verschelde
9d2cbe2c02 Merge pull request #50328 from nekomatata/convex-hull-simplification-3.x
[3.x] Options to clean/simplify convex hull generated from mesh
2021-07-12 22:34:22 +02:00
JestemStefan
b7817c7b59 Added minimum scale for node 2D 2021-07-12 12:15:33 +02:00
Rémi Verschelde
6ec2caf12c Merge pull request #48763 from QbieShay/plane-offset
[3.x] Added a center_offset property to both plane primitive and quad primitive
2021-07-12 10:32:19 +02:00
bruvzg
71e30e3032 [macOS, Mono] Automatically enable JIT entitlements for the Mono exports.
(cherry picked from commit f37981b83f)
2021-07-11 01:06:04 +02:00
Hugo Locurcio
9259b4adc4 Add a method to set the number of physics solver iterations in 3D
This is only for GodotPhysics, and adds a 3D counterpart to the 2D
method that was recently added.
2021-07-10 16:29:41 +02:00
PouleyKetchoupp
240c33708c Options to clean/simplify convex hull generated from mesh
Clean: remove duplicate and interior vertices (uses Bullet algorithm)
Simplify: modify the geometry for further simplification (uses VHACD
algorithm)

In the editor, single convex hull now uses the clean option.
Added a new editor entry to create a simplified convex hull, can be
useful for creating convex hull from highly tessellated triangle meshes.

Specific change for 3.x:
Add support for Vector<Vector3> and PoolVector<Vector3> in the convex hull generator.
2021-07-09 17:45:59 -07:00
Rémi Verschelde
7c00a875f7 Merge pull request #50305 from JestemStefan/3.x-signed_angle_to
[3.x] Added signed_angle_to for Vector3
2021-07-09 21:08:04 +02:00
PouleyKetchoupp
8185c5fe8a Optimize NodePath update when renaming or deleting nodes in the editor
Now the process uses a Map to lookup node pointers instead of iterating
over all modified node paths in a list and comparing them for each
property to check.

The process also avoids checking properties with empty node paths and
does an early exit on deleted nodes to avoid checking the node and its
descendants.

Also made a minor change in NodePath::rel_path_to() to avoid resizing a
Vector many times for long paths (with copy-on-write each time). Now
it's down to 2 resize calls in any case.
2021-07-09 11:43:05 -07:00
JestemStefan
9513354f68 Added signed_angle_to for Vector3
Added signed_angle_to method for Vector3

Added signed_angle_to for Vector3

formatting fix...
2021-07-09 12:49:12 +02:00
Rémi Verschelde
83ad0dddad Merge pull request #50276 from uuuuuup/fix_gles3
fix 3D scene not rendered on GLES3 HTML5 export
2021-07-08 17:35:55 +02:00
uuuuuup
0dc0a4a523 fix 3D scene not rendered on GLES3 HTML5 export
fix pad size of SceneDataUBO
2021-07-08 22:03:03 +09:00
Rémi Verschelde
85dffab1b9 Merge pull request #50237 from BastiaanOlij/fix_view_index_precision
Add precision to view_index
2021-07-08 09:07:20 +02:00
Bastiaan Olij
34d9b6140b Add precision to view_index 2021-07-08 10:47:07 +10:00
Rémi Verschelde
66aadc2981 Merge pull request #50270 from akien-mga/filedialog-overwrite-capitalization
FileDialog: Fix capitalization for overwrite prompt
2021-07-08 01:14:05 +02:00
Rémi Verschelde
7f971089fb FileDialog: Fix capitalization for overwrite prompt
Sorry I can't take it anymore, I wince every time I see it.
Already fixed in master :)
2021-07-08 01:05:45 +02:00
Rémi Verschelde
76f3bd52d5 Merge pull request #50266 from Razoric480/3x-cache-color-picker-presets
[3.x] Add cache to color picker for presets
2021-07-08 00:32:32 +02:00
Francois Belair
a4a2ab3ee0 Add cache to color picker for presets
This prevents loading from the project metadata more than once,
significantly saving performance with nodes that have color pickers.
2021-07-07 18:06:31 -04:00
Rémi Verschelde
a57a78e483 Merge pull request #50242 from KoBeWi/backdoor_err_backport
[3.x] Allow to create a node at specific position
2021-07-07 23:38:31 +02:00
Rémi Verschelde
c75dd046cf Merge pull request #50263 from Calinou/bullet-fix-typo
Fix typo in Bullet method name: "collisin" -> "collision"
2021-07-07 23:08:00 +02:00
Hugo Locurcio
4a140294fe Fix typo in Bullet method name: "collisin" -> "collision"
This method is not exposed to scripting, so compatibility with
existing projects should be preserved.
2021-07-07 22:07:32 +02:00
kobewi
ff7cae4c4c Allow to create a node at specific position 2021-07-07 13:19:59 +02:00
Rémi Verschelde
31143baa57 Merge pull request #50223 from Calinou/editor-information-use-multiply-sign-3.x
Use the Unicode multiplication symbol for the viewport size display (3.x)
2021-07-07 10:03:25 +02:00
Rémi Verschelde
ac8807bd5a Merge pull request #50211 from kleonc/accept_dialog-remove_button-3x
[3.x] Add AcceptDialog::remove_button method
2021-07-07 09:12:31 +02:00
Rémi Verschelde
e5b32eda8d Merge pull request #50234 from akien-mga/3.x-android-fix-50224
Android: Fix truncated `application` attributes after #50028 cherry-pick
2021-07-07 01:28:46 +02:00
Rémi Verschelde
46c68c0fb9 Android: Fix truncated application attributes after #50028 cherry-pick
The `android:icon` attribute is expected to be the last one in the application
definition, as documented by the comment. cd64bcd missed that and caused some
arguments to be truncated.

Fixes #50224.
2021-07-07 00:49:07 +02:00
Rémi Verschelde
031a034a28 Merge pull request #50230 from akien-mga/3.x-fix-syntax-error-50227
Android: Fix syntax error in #50227
2021-07-07 00:39:04 +02:00
Rémi Verschelde
3d16bfcc40 Android: Fix syntax error in #50227 2021-07-07 00:08:59 +02:00
Rémi Verschelde
7c8cc037ad Merge pull request #50221 from madmiraal/fix-50125-3.x
[3.x] Queue the calls to GodotLib.key when Android virtual done is pressed
2021-07-06 23:46:36 +02:00
Rémi Verschelde
4fc5a9436d Merge pull request #50227 from akien-mga/3.x-android-manifest-xr_mode_metadata_name
Android: Fix `xr_mode_metadata_name` removal after cd64bcdae
2021-07-06 23:37:49 +02:00
Rémi Verschelde
8c5c79e020 Android: Fix xr_mode_metadata_name removal after cd64bcdae
I had lost that line when resolving merge conflicts.
2021-07-06 23:24:54 +02:00
Rémi Verschelde
98f3c96053 Merge pull request #50111 from madmiraal/android-remove-onkeymultiple-3.x
[3.x] Remove Android onKeyMultiple override
2021-07-06 23:10:44 +02:00
Hugo Locurcio
8592620a8e Use the Unicode multiplication symbol for the viewport size display 2021-07-06 21:59:26 +02:00
Marcel Admiraal
2bd3cc0e16 Queue the calls to GodotLib.key when Android virtual done is pressed 2021-07-06 17:54:14 +01:00
Marcel Admiraal
d40f73e3a4 Remove Android onKeyMultiple override 2021-07-06 17:37:53 +01:00
kleonc
23ad87cc92 Add AcceptDialog::remove_button method 2021-07-06 18:27:03 +02:00
Rémi Verschelde
009aa63a57 Merge pull request #50108 from madmiraal/android-use-lambdas-3.x
[3.x] Replace single method anonymous classes with lambdas in Godot Java code
2021-07-06 18:10:45 +02:00
Nick Huelin
ad1aea9a46 Add multiple descriptions to several classes
This pull request adds several descriptions to multiple different classes.

This improves the completeness of the documentation and enhances usability by doing so.

(cherry picked from commit 27e9df7778)
2021-07-06 15:30:13 +02:00
Rémi Verschelde
39c89b51d7 Merge pull request #50202 from akien-mga/3.x-cherrypicks 2021-07-06 14:31:04 +02:00
Hugo Locurcio
37ff524d8c Improve error reporting in WebSocketServer
This should make troubleshooting easier.

(cherry picked from commit 58455b18b5)
2021-07-06 13:38:54 +02:00
Bartłomiej T. Listwon
6f3b03824a Change search results limit in FileSystem dock from 128 to 10000
(cherry picked from commit 5aa88afa5d)
2021-07-06 13:38:11 +02:00
Ranie Jade Ramiso
aaacc753a7 Fix gdnative api generation for methods that return enums
(cherry picked from commit 78f55698f2)
2021-07-06 13:36:07 +02:00
Thakee Nathees
9c74452636 Windows error logs directed to stderr
(cherry picked from commit efef236e43)
2021-07-06 12:14:49 +02:00
bruvzg
c7a0113a4b Fix Variant tags parsing.
(cherry picked from commit eca4d2fccc)
2021-07-06 11:24:06 +02:00
miere43
9a22f4b8df Replace backslash with forward slash in OS_Windows path methods
(cherry picked from commit 119a59f872)
2021-07-06 11:22:04 +02:00
Marcel Admiraal
4b03e05573 Use static inner classes in Godot Java code
(cherry picked from commit 23e152040b)
2021-07-06 11:20:42 +02:00
Haoyu Qiu
f252622d82 Add numpad emulation in 3D viewport
(cherry picked from commit 4a26e61e89)
2021-07-06 11:20:30 +02:00
Hugo Locurcio
3b11b1022d Remove unused code related to Travis CI
(cherry picked from commit 257a8a337e)
2021-07-06 11:19:56 +02:00
Hugo Locurcio
59c5c04e38 Allow using the 3D editor's View menu while previewing a camera
This is already allowed when using cinematic preview, but not
when previewing a Camera3D the usual way.

Many operations from the View menu still work while previewing
a camera, such as switching between debug draw modes and toggling
information panes.

(cherry picked from commit fab3d136e0)
2021-07-06 11:19:38 +02:00
PouleyKetchoupp
5a66ab1ef4 Coding style fix in editor NodePath update
Added r_ prefix for reference arguments that can be modified.

(cherry picked from commit 62ce81ec15)
2021-07-06 11:10:47 +02:00
PouleyKetchoupp
daa0977c68 NodePath properly updated in the editor in more cases
Fix more cases of node path needing an update when nodes are renamed or
moved in the editor.

Built-in node properties:
Before, node paths were checked only for script export variables. Now
all properties are checked from the node, which includes built-in node
properties.
Allows proper node path updates for nodes like remote transform, physics
joints, etc.

Arrays and dictionaries:
Node paths nested in array and dictionary properties are now also
updated in the editor.

Also update the documentation to be clear about node path update in the
editor and at runtime.

Co-authored-by: latorril <latorril@gmail.com>
(cherry picked from commit 3e4e530523)
2021-07-06 11:10:47 +02:00
Hugo Locurcio
8c08b52871 Add icons for more file types in the editor asset installer
(cherry picked from commit 9698486605)
2021-07-06 11:10:47 +02:00
Fabio Alessandrelli
32e91b232c [Crypto] Delete mbedtls ctx in deconstructor.
Would cause memory leak when the context was `start`ed but not
`finish`ed.

(cherry picked from commit a28d25c441)
2021-07-06 11:10:47 +02:00
kobewi
245b9400ea Support single quote when dropping files to script
(cherry picked from commit 5e593dda9b)
2021-07-06 11:10:47 +02:00
Michael Alexsander
d453b59cba Make invisible SplitContainer nodes correctly calculate the minimal size of its children
(cherry picked from commit e4d56e4c62)
2021-07-06 11:10:46 +02:00
Marcel Admiraal
ab1162e918 Remove redundant explicit types in Godot Java code
(cherry picked from commit 3f95bbed73)
2021-07-06 11:10:46 +02:00
Marcel Admiraal
6a07253bb6 Use StringBuilder instead StringBuffer in Godot Java code
(cherry picked from commit 61ee51d2bf)
2021-07-06 11:10:46 +02:00
Marcel Admiraal
c1abbfb605 Fix raw use of parameterized Class
(cherry picked from commit d237f7d33d)
2021-07-06 11:10:46 +02:00
Marcel Admiraal
01ecec451c Use Java array declarations not C-style declarations in Android Java code
(cherry picked from commit 721b3d56c5)
2021-07-06 11:10:46 +02:00
Marcel Admiraal
2b78d618f4 Remove unnecessary semicolons from Android Java code
(cherry picked from commit 360447001d)
2021-07-06 11:10:45 +02:00
Nick H
ca1a2e1124 Add get_dead_zone() method to InputMap
This commit adds a new method to the `InputMap`, allowing the user to get the value of an action's dead zone as a float.

(cherry picked from commit c6f28ed62b)
2021-07-06 11:10:45 +02:00
Pitanov V.V
d3dab1d06c Fix GridMap erase Octans
(cherry picked from commit 4da4514b71)
2021-07-06 11:10:45 +02:00
Rémi Verschelde
cd64bcdae5 Android: Add isGame application attribute, default to true
It can be turned off in the export preset with `package/classify_as_game`.

Upstream definition: https://developer.android.com/guide/topics/manifest/application-element#isGame

> `android:isGame`
>
> Whether or not the application is a game. The system may group together
> applications classifed as games or display them separately from other
> applications.

Also fixes replacing `android:allowBackup` in custom builds.

(cherry picked from commit 40a594c6ea)
2021-07-06 11:10:45 +02:00
Marcel Admiraal
76c1a0e91d Fix unchecked call to put() warning in GodotInputHandler.java
(cherry picked from commit 8270e101a7)
2021-07-06 11:10:44 +02:00
Hugo Locurcio
65063dbe0a Tweak the 2D game camera override tooltips to match 3D
(cherry picked from commit bdca0daadc)
2021-07-06 11:10:44 +02:00
Rémi Verschelde
b35e61ba85 Script editor: Rename 'Clone Down' to 'Duplicate Selection'
Fixes #36670.

(cherry picked from commit d41f4aca77)
2021-07-06 11:10:44 +02:00
Rémi Verschelde
f0e76377cb LocalVector: Don't error if from >= count
Vector handles this silently by returning -1, and we should do the same here.
Otherwise we get errors when calling `find()` on e.g. a LocalVector of size 0,
while `find()` is expected to always work (if the parameters are invalid then
it doesn't find anything, so -1).

Fixup to #49925.

(cherry picked from commit 7b7ccf25b6)
2021-07-06 11:10:44 +02:00
Eric
09b231e15f Enable Camera2D smoothing on limit change
(cherry picked from commit 525ad7c37e)
2021-07-06 11:10:35 +02:00
Rémi Verschelde
153b67419f Merge pull request #50101 from nekomatata/remove-shape-query-result-3.x
[3.x] Remove unused PhysicsShapeQueryResult & Physics2DShapeQueryResult
2021-07-05 21:08:39 +02:00
PouleyKetchoupp
9eb6a43cff Remove unused PhysicsShapeQueryResult & Physics2DShapeQueryResult 2021-07-05 11:21:15 -07:00
JFonS
a2ba7910ba Add soft shadows to the CPU lightmapper
Adds the "light_size" property to Lights. It's only considered in baked
lightmaps for soft shadowing purposes.
2021-07-05 19:02:35 +02:00
Питанов Валера
47b9afa3e9 fix lightmap cpu crashes 2021-07-06 01:45:04 +10:00
Rémi Verschelde
19359a9654 Merge pull request #50140 from Calinou/debug-overdraw-lower-opacity-3.x
Decrease opacity of the overdraw debug draw mode (3.x)
2021-07-04 09:40:09 +02:00
Hugo Locurcio
a28a4ef98a Decrease opacity of the overdraw debug draw mode
This allows distinguishing higher amounts of overlapping objects.
2021-07-04 00:23:06 +02:00
lawnjelly
21a24eb959 Most recently added current Camera2D takes precedence
The situation when multiple current Camera2Ds were in the scene was not dealt with. This could leave several cameras with their current bool set, and each competing to update the viewport scroll, in a random / accidental fashion.

This PR standardises the rule that the most recent current Camera2D added to the scene tree takes over the current status, and sets all other current cameras in the scene tree to non-current. This makes the bools correct, and also prevents the competition over viewport scroll.
2021-07-03 08:58:20 +01:00
Rémi Verschelde
6fe9a0d717 Merge pull request #50103 from nekomatata/expose-body-test-motion-3d-3.x
[3.x] Expose body_test_motion in 3D physics server
2021-07-03 09:30:10 +02:00
Marcel Admiraal
4108dd0145 Replace single method anonymous classes with lambdas in Godot Java code 2021-07-03 05:13:08 +01:00
PouleyKetchoupp
c89476ad41 Expose body_test_motion in 3D physics server
Results are exposed through PhysicsTestMotionResult, the same way it's
done for 2D.

Also cleaned a few things in the 2D version.
2021-07-02 18:04:39 -07:00
Rémi Verschelde
14e7e7ad71 Merge pull request #50079 from madmiraal/android-remove-unused-imports-3.x
[3.x] Remove unused imports from Android Java code
2021-07-02 17:45:37 +02:00
Marcel Admiraal
1ed89353b0 Remove unused imports from Android Java code 2021-07-02 14:41:57 +01:00
Rémi Verschelde
9a31c09b6c Merge pull request #50073 from madmiraal/android-remove-interface-modifiers-3.x
[3.x] Remove redundant interface modifiers from Android Java code
2021-07-02 12:35:21 +02:00
Marcel Admiraal
96e56af9b9 Remove redundant interface modifiers from Android Java code 2021-07-02 09:41:09 +01:00
Rémi Verschelde
d59ad7cdd4 Merge pull request #50045 from Calinou/doc-debanding-mobile-issues
Document debanding being broken on mobile
2021-07-01 12:57:21 +02:00
Hugo Locurcio
9c4ebea9ef Document debanding being broken on mobile 2021-07-01 12:25:23 +02:00
Rémi Verschelde
ef3c346df2 Merge pull request #49835 from nekomatata/soft-body-disable-physics-3.x
[3.x] Support for disabling physics on SoftBody
2021-07-01 10:01:33 +02:00
Rémi Verschelde
5601d86a27 Merge pull request #49915 from Calinou/bakedlightmap-print-time-request-attention-3.x
Print time taken and request attention when lightmaps are done baking
2021-07-01 09:49:21 +02:00
Rémi Verschelde
cbf6d51d01 Merge pull request #49845 from nekomatata/physics-disabled-shapes-3.x
[3.x] Fix and clean disabled shapes handling in godot physics servers
2021-06-30 10:09:17 +02:00
Rémi Verschelde
e3d48d7e2c Merge pull request #49999 from kleonc/visual_script_editor-fix-position-when-zooming
[3.x] VisualScriptEditor Fix in graph position calculation (do not skip zoom)
2021-06-29 16:31:27 +02:00
kleonc
3336453dff VisualScriptEditor Fix in graph position calculation (do not skip zoom) 2021-06-29 15:32:16 +02:00
Rémi Verschelde
7e934e31f4 Merge pull request #49912 from madmiraal/fix-49878-3.x
[3.x] Add GDNative libraries to Android custom Gradle builds
2021-06-29 14:58:45 +02:00
Rémi Verschelde
0e5d249a39 i18n: Sync translations with Weblate
(cherry picked from commit 30bb133e01)
2021-06-29 14:56:54 +02:00
Ricard Rovira
84474c0e6f Use unused from in local vector find function.
(cherry picked from commit 14d5908057)
2021-06-29 14:56:48 +02:00
Rémi Verschelde
48fe8da245 Merge pull request #49997 from akien-mga/3.x-cherrypicks 2021-06-29 14:56:18 +02:00
Levi Lindsey
f72ce41700 Update File.store_var description to mention which properties of an object are included.
(cherry picked from commit 2b7c0cfb34)
2021-06-29 14:02:24 +02:00
bruvzg
ad748adf53 [Windows Export] Use temporary file for osslsigncode signing.
(cherry picked from commit 8f7c2ccefd)
2021-06-29 14:02:24 +02:00
trollodel
814e25d2d8 Fix GraphNode port position when the control has the Expand flag
(cherry picked from commit 07c3b40aa2)
2021-06-29 14:02:23 +02:00
Fabio Alessandrelli
63f6b29f51 [Net] Add WebSocketServer handshake_timeout property.
Allows customization of the maximum time a client is allowed to stay in
the the "pending" state (i.e. awaiting HTTP handshake).

This used to be 1 second by before, the new default is 3 seconds.

(cherry picked from commit 458437edef)
2021-06-29 14:02:23 +02:00
Fabio Alessandrelli
4994b3a99e [Net] Fix WebSocketClient path parsing.
Recent changes to parse_url caused the client to make invalid HTTP
requests if no path was specified.

(cherry picked from commit d244dda597)
2021-06-29 14:02:23 +02:00
Haoyu Qiu
91ea7530bd Validates the p_format parameter in Image::create functions.
(cherry picked from commit 0b7ffd4f68)
2021-06-29 14:02:23 +02:00
Nick H
d08717d0ee Amend Label.clip_text() Method Description
This update fixes an inconsistencies in the documentation about the `clip_text()` method.

(cherry picked from commit ea94aeac48)
2021-06-29 14:02:23 +02:00
Fabio Alessandrelli
69645b0e44 [HTML5] Add option to focus canvas on start.
Enabled by default.

(cherry picked from commit c12fca57f4)
2021-06-29 14:02:23 +02:00
Paweł Fertyk
2676d815ab Validate image formats, check if resize_to_po2 failed
(cherry picked from commit 3dae9993ac)
2021-06-29 14:02:23 +02:00
Hugo Locurcio
b268fdc980 Use Ctrl + G to toggle the 3D editor grid visibility by default
The 2D editor grid toggle shortcut has been changed to use
`KEY_MASK_CMD` for consistency. This means it will now use Cmd
on macOS instead of Ctrl.

(cherry picked from commit 2cc053c64b)
2021-06-29 14:02:23 +02:00
Haoyu Qiu
38e0ca9b47 Strip query string when parsing HTTP request line for path
(cherry picked from commit 91477cd4a9)
2021-06-29 14:02:23 +02:00
ne0fhyk
c952201d97 Update config versions and deprecate the use of the jcenter maven repo.
(cherry picked from commit d1a9363c4c)
2021-06-29 14:02:22 +02:00
Hugo Locurcio
e7d6f8b8b8 Allow a top and bottom radius equal to 0 in CylinderMesh
The CylinderMesh generation code handles this special case and
avoids generating the top and bottom faces if their radius is equal
to 0. This improves performance by reducing the number of vertices
to draw.

If both values are set to 0, nothing will be visible but the mesh
generation will still succeed.

This also improves the CylinderMesh class documentation.

(cherry picked from commit b4ed84ba2b)
2021-06-29 14:02:22 +02:00
AndreaCatania
eb3ddbc050 Remove early return from gizmo intersect_ray
Remove early returns from `EditorNode3DGizmo::intersect_ray` that is preventing to have gizmos that use Mesh collision + Segment collision + Icon.

(cherry picked from commit 2c12297ee1)
2021-06-29 14:02:22 +02:00
bruvzg
5ff9b52214 [macOS] Fix custom mouse cursor not set after mouse mode change.
(cherry picked from commit f7797bf1b3)
2021-06-29 14:02:21 +02:00
Hugo Locurcio
17b6771778 Improve descriptions for ProjectSettings' disable_stdout/disable_stderr
(cherry picked from commit e3ef50db38)
2021-06-29 13:15:51 +02:00
Marcel Admiraal
42c9fefcca Add adb output to error message when install fails
(cherry picked from commit de2acbd495)
2021-06-29 13:13:29 +02:00
Pedro J. Estébanez
cd96e30fee Remove side effects of scene save
(cherry picked from commit 598fd51277)
2021-06-29 13:13:06 +02:00
PouleyKetchoupp
cad2ba013a Fix export var override in PackedScene at runtime
Regression fix: update_exports is tool only and should be used only in
the editor, otherwise it can cause export variable overrides from
instances to be discarded in favor of the parent's value.

(cherry picked from commit f1587c8a7d)
2021-06-29 13:12:52 +02:00
kleonc
4ae0310cec AnimationMultiTrackKeyEdit Allow editing easing if it's possible for all edited tracks
(cherry picked from commit 1d890e16f7)
2021-06-29 13:12:34 +02:00
Francois Belair
59d72279ae Translate file path to URI on LSP symbol requests
(cherry picked from commit a56c2e459b)
2021-06-29 13:12:15 +02:00
Gromph
565d205d91 UWP: Keep upstream names for capabilities preset settings to avoid mismatch
The previous code used `camelcase_to_underscore` to prettify the names for
display in the export preset, but it leads to inconsistencies if we don't make
sure to do the reverse operation when writing to the `AppxManifest.xml`.

It's simpler to keep the same names as in the manifest, which is also what
users will see referenced in MS documentation.

Fixes #47900.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
(cherry picked from commit c87e49d7bc)
2021-06-29 13:11:56 +02:00
Lightning_A
898d404f66 Add "Suggest a Feature" to the help dialog.
Links to Godot Proposals's readme.

(cherry picked from commit 70fb239a25)
2021-06-29 13:11:47 +02:00
Umang Kalra
71da90f5bb Fixes missing descriptions in search window of visualscript
(cherry picked from commit 5e8d31ef0e)
2021-06-29 13:11:47 +02:00
Hugo Locurcio
8beb57476f Add keyboard shortcuts to the project manager
- Ctrl + N: New Project
- Ctrl + I: Import Project
- Ctrl + S: Scan for Projects
- Ctrl + E: Edit Project
- Ctrl + R: Run Project
- F2: Rename Project
- Delete: Remove Project
  - Already implemented previously, but moved to use `ED_SHORTCUT()`.

Note that depsite using `ED_SHORTCUT()`, these shortcuts won't appear
in the Editor Settings' Shortcuts dialog and won't be remappable since
the project manager code isn't run in the editor.

(cherry picked from commit 9bda49e030)
2021-06-29 13:11:47 +02:00
Hugo Locurcio
bf22de76f7 Allow selecting frames by holding down the mouse in SpriteFrames editor
This complements the existing (Ctrl +) Shift + Left mouse button
multiple frame (de)selection.

(cherry picked from commit 5e8eb20ad6)
2021-06-29 13:11:46 +02:00
floppyhammer
fa77e501f7 Improve nine patch behavior of TextureProgressBar
(cherry picked from commit b08dc1ea35)
2021-06-29 12:59:23 +02:00
Marcel Admiraal
e021cab45b Add GDNative libraries to Android custom Gradle builds 2021-06-29 09:22:08 +01:00
Rémi Verschelde
c550033420 Merge pull request #49955 from Calinou/prevent-setting-big-small-collision-mask-layer-3.x
Prevent setting too big or too small Collision Mask and Layer (3.x)
2021-06-28 14:08:54 +02:00
Rémi Verschelde
109df27745 Merge pull request #49950 from Calinou/spatialmaterial-fix-triplanar-binormal
Fix flipped binormal in SpatialMaterial triplanar mapping (3.x)
2021-06-28 12:58:47 +02:00
Rafał Mikrut
cb5faca39a Prevent setting too big or too small Collision Mask and Layer 2021-06-27 17:40:07 +02:00
Hugo Locurcio
11033be5c6 Fix flipped binormal in SpatialMaterial triplanar mapping
This made normal maps on triplanar materials use an inverted Y direction
compared to non-triplanar materials.
2021-06-27 16:32:03 +02:00
Hugo Locurcio
d9a2e34357 Print time taken and request attention when lightmaps are done baking
Since lightmap baking can take a very long time, printing the time
spent can be useful for users tweaking the lightmap settings
to optimize bake times.

Completing lightmap baking will also request attention, which is
useful if you're doing something else while waiting for lightmaps
to bake.
2021-06-25 20:58:05 +02:00
Rémi Verschelde
3a8bea3ae3 Merge pull request #49875 from Calinou/tweak-script-export-text-3.x
Tweak script export text in the export dialog to be more explicit (3.x)
2021-06-24 17:52:28 +02:00
Hugo Locurcio
065972a631 Tweak script export text in the export dialog to be more explicit 2021-06-24 10:01:41 +02:00
Rémi Verschelde
c045219869 Merge pull request #49804 from m4gr3d/add_support_for_custom_debug_keystore
[3.x] Add support for custom debug keystore
2021-06-23 15:28:40 +02:00
PouleyKetchoupp
10fdd196b7 Fix and clean disabled shapes handling in godot physics servers
In 3D, disabled shapes are now not added to the broadphase anymore.
Since they are removed right away when disabled, no need to check for
disabled shapes for any query that comes from the broadphase.
Also Fixes raycast queries returning disabled shapes.

In 2D, disabled shapes where already not added to the broadphase.
Remove the same unnecessary checks as in 3D.

Overall harmonized API for disabled shapes in the physics servers and
removed duplicate method.
2021-06-22 16:48:24 -07:00
PouleyKetchoupp
4694b2b3e4 Support for disabling physics on SoftBody
New property physics_enabled, can be useful for optimization purpose.
2021-06-22 11:38:17 -07:00
Rémi Verschelde
0c775ece14 Merge pull request #49802 from naithar/feature/ios-plugin-multitype-plist
[3.x] [iOS] Support multiple `plist` types in plugin
2021-06-22 12:49:22 +02:00
Rémi Verschelde
c5058d72d0 Merge pull request #49799 from pycbouh/tree-lines-items-draw-order-3.x
[3.x] Make relationship lines draw on top of `TreeItem`s
2021-06-21 20:55:16 +02:00
Rémi Verschelde
f447b79bc6 Merge pull request #49791 from madmiraal/fix-android-gles3-crash-3.x
[3.x] Clear glErrors instead of crashing when initializing GLES3
2021-06-21 20:35:49 +02:00
ne0fhyk
d5b4045ea4 Add support for custom debug keystore. 2021-06-21 10:03:58 -07:00
Marcel Admiraal
8788472b8c Clear glErrors instead of crashing when initializing GLES3 2021-06-21 17:53:24 +01:00
Sergey Minakov
ab03dcf44d [iOS] Support multiple plist types 2021-06-21 17:46:27 +03:00
Yuri Sizov
b91e3237c6 Make relationship lines draw on top of TreeItems 2021-06-21 16:54:59 +03:00
Hugo Locurcio
a9c0c5484f Add support for contrast-adaptive sharpening in 3D (GLES3 only)
This is an older, easier to implement variant of CAS as a pure
fragment shader. It doesn't support upscaling, but we won't make
use of it (at least for now).

The sharpening intensity can be adjusted on a per-Viewport basis.
For the root viewport, it can be adjusted in the Project Settings.

Since `textureLodOffset()` isn't available in GLES2, there is no
way to support contrast-adaptive sharpening in GLES2.
2021-06-21 15:37:31 +02:00
Rémi Verschelde
296608460b Merge pull request #49774 from pycbouh/editor-theme-editor-overhaul-3.x
[3.x] Overhaul the theme editor and improve user experience
2021-06-21 09:52:59 +02:00
Yuri Sizov
7120be9ff5 Overhaul the theme editor and improve user experience
Backport of #49388, #49772.
2021-06-21 01:37:54 +03:00
Rémi Verschelde
eec079ea47 Merge pull request #49512 from pycbouh/editor-better-theme-management-3.x
[3.x] Refactor `Theme` item management in the theme editor
2021-06-20 23:47:36 +02:00
Yuri Sizov
014cb0c33a Refactor Theme item management in the theme editor
Backport of #46593, #46808, #49227
2021-06-20 20:34:37 +03:00
Rémi Verschelde
03f275e66f Merge pull request #49167 from amoriqbal/3.3-inspector-patch
Fixed inspector not updating anchor
2021-06-20 12:42:21 +02:00
Rémi Verschelde
6fecaddbec Merge pull request #49731 from Calinou/cylindermesh-allow-zero-rings-3.x
Tweak CylinderMesh `rings` property hint to allow a value of 0
2021-06-20 00:44:08 +02:00
Rémi Verschelde
09c2bd597a Merge pull request #49732 from Calinou/expose-data-dirs-3.x
Expose OS data directory getter methods (3.x)
2021-06-20 00:31:41 +02:00
Rémi Verschelde
aee507b532 Merge pull request #49733 from Calinou/raycast3d-draw-double-sided-3.x
Use double-sided material for RayCast (3.x)
2021-06-20 00:30:39 +02:00
Hugo Locurcio
21ad630e11 Expose OS data directory getter methods
This can be used by editor plugins and non-game applications to
store data in the correct directories according to the
XDG Base Directory specification.
2021-06-19 09:28:53 +02:00
Hugo Locurcio
3143f5fcc5 Use double-sided material for RayCast
This makes RayCasts visible if the camera is fully inside one
(e.g. a RayCast parented to the current Camera).
2021-06-19 09:16:42 +02:00
Rémi Verschelde
622f744ad0 Merge pull request #49726 from Calinou/raycast-improve-debug-shape-3.x
Add custom debug shape thickness and color options to RayCast
2021-06-19 09:09:31 +02:00
Hugo Locurcio
a82c90ca55 Tweak CylinderMesh rings property hint to allow a value of 0
A value of 0 rings is valid and results in a non-subdivided cylinder.

Compared to the previous lowest allowed value (1), a value of 0 halves
the triangle count in any cylinder.
2021-06-19 08:52:24 +02:00
Hugo Locurcio
a6a6ad5c08 Add custom debug shape thickness and color options to RayCast
This backports the improved RayCast debug drawing functionality
from the `master` branch.

`ArrayMesh.clear_surfaces()` was also backported from the `master`
branch and exposed because the new debug drawing code requires it.
2021-06-19 06:01:25 +02:00
Rémi Verschelde
2827d6be19 Merge pull request #49699 from nekomatata/mass-properties-disabled-shapes-3.x
[3.x] Ignore disabled shapes for mass property calculations
2021-06-18 18:37:56 +02:00
Rémi Verschelde
efee3534f9 Merge pull request #49710 from aaronfranke/3.x-quat-angle-to
[3.x] Add Quat angle_to method
2021-06-18 18:32:24 +02:00
Aaron Franke
85a0345d57 [3.x] Add Quat angle_to method 2021-06-18 11:00:44 -04:00
Rémi Verschelde
460c53740f Merge pull request #49707 from madmiraal/remove-warn_prints-3.x
[3.x] Remove duplicate WARN_PRINTS macro
2021-06-18 15:36:07 +02:00
Marcel Admiraal
7e03bd1671 Remove duplicate WARN_PRINTS macro 2021-06-18 12:57:59 +01:00
Rémi Verschelde
fc95c4d84c Merge pull request #49476 from nekomatata/kinematic-collision-rid-3.x
[3.x] Expose collider RID in 2D/3D kinematic collision
2021-06-18 12:32:42 +02:00
Rémi Verschelde
160514724e Merge pull request #49702 from aaronfranke/3.x-cs-bindings
[3.x] Fix C# bindings generator for default value types
2021-06-18 11:22:03 +02:00
Aaron Franke
b3ac1669c0 [3.x] Fix C# bindings generator for default value types 2021-06-18 01:07:28 -04:00
PouleyKetchoupp
c3107349a4 Ignore disabled shapes for mass property calculations 2021-06-17 17:17:05 -07:00
Rémi Verschelde
c7f27f1d9d Merge pull request #48651 from tavurth/3.x
Port HTTPRequest gzip compression to 3.4
2021-06-18 02:01:11 +02:00
Rémi Verschelde
2f08881347 Merge pull request #49679 from akien-mga/3.x-cherrypicks 2021-06-17 13:25:41 +02:00
Hugo Locurcio
415c1ccaaa Add a "save on focus loss" editor setting (disabled by default)
This performs a Ctrl + S action every time the editor window loses focus,
saving both scenes and scripts as needed.

(cherry picked from commit f10c30a9ed)
2021-06-17 12:51:21 +02:00
Hugo Locurcio
7991d0fb22 Decrease the editor FPS limit when unfocused from 20 to 10
This provides better power savings compared to the previous value.
This also speeds up project execution slightly while the editor
is running in the background.

The setting hint can now go as low as 1 FPS (1 million microseconds
per frame), for those who really need the best possible power savings.
This will make previewing animated shaders or particles impossible
when the editor window isn't focused though.

(cherry picked from commit 6f6a09cce2)
2021-06-17 12:48:50 +02:00
kobewi
dac54b6db3 Fix GridMap still drawing when Alt+Tabbing
(cherry picked from commit 9fbef6f7db)
2021-06-17 12:47:55 +02:00
Fabio Alessandrelli
e05a7a4a4b [Net] ENet non-relaying server now process broadcasts.
Setting `server_relay = false` prevents the server from letting clients
communicate with each other, but without this fix, the server would also
ignore broadcast packets.
With this change, the server still does not relay messages to other
clients, but will correctly process broadcast messages (and "exclusive"
messages) as if they were directed to just the server.

(cherry picked from commit fc255bde29)
2021-06-17 12:47:55 +02:00
K. S. Ernest (iFire) Lee
37fdd656c0 ERR_FAIL_NULL check file access
Null in ResourceImporterTexture::_save_stex

(cherry picked from commit b74bc42a43)
2021-06-17 12:47:55 +02:00
Haoyu Qiu
95c60b76a4 Save binary ProjectSettings key length properly
(cherry picked from commit 06c0a5f9f2)
2021-06-17 12:47:55 +02:00
Paweł Fertyk
7520e57947 Remove trailing slash from recent dir if needed
(cherry picked from commit 709e71ae9c)
2021-06-17 12:47:55 +02:00
Fabio Alessandrelli
2c64218415 [HTML5] Update eslint and jsdoc dependencies.
(cherry picked from commit a1cbb6daa6)
2021-06-17 12:47:55 +02:00
bruvzg
30393b6401 Add LSApplicationCategoryType to the template and export dialog.
(cherry picked from commit cb480376d8)
2021-06-17 12:47:55 +02:00
Fabio Alessandrelli
cfedd60e6b [HTML5] Fix JS build without eval.
Also fix download_buffer return type.

(cherry picked from commit 049b5159f1)
2021-06-17 12:47:55 +02:00
Fabio Alessandrelli
0f5fbf5fbf [HTML5] Fix some JS library signature.
(cherry picked from commit 9b7b0a28b9)
2021-06-17 12:47:54 +02:00
Pedro J. Estébanez
2d1943b8d1 Fix slow load/save of scenes with many instances of the same script
(cherry picked from commit 2ca6b9c610)
2021-06-17 12:47:54 +02:00
Haoyu Qiu
6c07784dba Validate parameters when adding plugins
(cherry picked from commit 1a9e3edd30)
2021-06-17 12:47:54 +02:00
Hugo Locurcio
dd70aea77c Fix game camera override tooltips being swapped
Previously, the wrong tooltip was shown.

This also tweaks the tooltips' texts to be clearer and remove
references to "game" (since Godot is used for more than just games).

(cherry picked from commit d1c5dd5b68)
2021-06-17 12:47:54 +02:00
Hugo Locurcio
63d0485a6a Fix duplicate paragraph in ArrayMesh.add_surface_from_arrays() description
(cherry picked from commit 033985f9c2)
2021-06-17 12:47:54 +02:00
Andrii Doroshenko (Xrayez)
9a087da5d1 Use "Delete" in FileSystemDock on all platforms
The consensus is that the per-platform strings are not so useful in the
first place, so it's better to revert back to "Delete" for every platform.

(cherry picked from commit 77daadac1d)
2021-06-17 12:47:54 +02:00
kleonc
ce763fe402 TextureButton Update min size on any texture change
(cherry picked from commit 6c3c269f24)
2021-06-17 12:47:54 +02:00
Philip Whitfield
606331fdcb fix url parsing with port numbers
String.get_slice_count is always at least 1 or 2 for bases with a port number.
Before this change the following URL would return ERR_INVALID_PARAMETER ```ws://127.0.0.1:8000/test```

(cherry picked from commit 3d9f29910c)
2021-06-17 12:47:54 +02:00
Hugo Locurcio
28aacbfe85 Allow higher and lower maximum zoom values in GraphEdit
Low zoom values result in unreadable text, but it can still be
useful for previewing purposes.

Eventually, characters could be replaced by rectangles at very low
zoom levels to improve the visual appearance.

(cherry picked from commit 74c584472c)
2021-06-17 12:47:54 +02:00
Hugo Locurcio
6d60d92b87 Tweak the physics FPS property hint to only allow reasonable values
Physics FPS above 1000 cause the whole project to slow down
and are not very practical in the first place (since no CPU currently
available can keep up).

(cherry picked from commit 8f4ac7bc4a)
2021-06-17 12:47:53 +02:00
Andrii Doroshenko (Xrayez)
6aed7e349f Separate version hash from version number in editor and project manager
When copy-pasting the version from About dialog to bug reports at GitHub,
this makes the version hash linkable to commits at GitHub.

(cherry picked from commit 293550f56a)
2021-06-17 12:47:53 +02:00
kobewi
bdc8d29749 Clarify animation_changed signal
(cherry picked from commit 8d0cbded3f)
2021-06-17 12:47:53 +02:00
Hugo Locurcio
86c72acf4d Improve radio checkboxes in the default editor theme
(cherry picked from commit 0f4df474c9)
2021-06-17 12:47:53 +02:00
Jason Knight
7510e1c24b Emit button_up signal after setting pressed to false.
(cherry picked from commit 4c6ad8abcd)
2021-06-17 12:47:53 +02:00
Lightning_A
4f87bd2bc4 Add the ability to reload the current project
(cherry picked from commit a6984f8d28)
2021-06-17 12:47:53 +02:00
Haoyu Qiu
41b6fdf946 Fix json dump and print of circular structure
(cherry picked from commit b3bd54001f)
2021-06-17 12:47:53 +02:00
fox
a61ec597a1 Make easing properties drawn with anti aliasing
(cherry picked from commit 36236843f6)
2021-06-17 12:47:53 +02:00
Hugo Locurcio
f88dc1fd44 Fix editor constantly redrawing when freelook is active with still camera
The editor only needs to redraw when the camera is moving.

This helps preserver battery life on laptops when using freelook,
especially with the toggle mode (Shift + F).

(cherry picked from commit 21807f8d88)
2021-06-17 12:47:53 +02:00
daniel-mcclintock
a34d5c31b7 Fix out of sync separate distraction-free mode
(cherry picked from commit 45fc6c4706)
2021-06-17 12:47:52 +02:00
Hugo Locurcio
483f8e0ef8 Improve AudioStreamGenerator and AudioEffectSpectrumAnalyzer documentation
- Mention audio sample rate caveats in other classes where relevant.

(cherry picked from commit c872819be6)
2021-06-17 12:47:52 +02:00
Hugo Locurcio
45e8f75952 Complete documentation for the AudioEffectPitchShift class
(cherry picked from commit 6be32d8cbc)
2021-06-17 12:47:52 +02:00
Hugo Locurcio
f45a2f4dea Rename "Singleton" to "Global Variable" in the AutoLoad editor
The name "Singleton" was misleading because Godot does not actually
enforce a singleton pattern for autoloads. They can be instanced
multiple times.

"Global Variable" makes it more obvious that all the checkbox does
is expose the AutoLoad with a global variable for easy access.

(cherry picked from commit 1e53bac8b4)
2021-06-17 12:47:52 +02:00
Hugo Locurcio
dd2fc60abc Handle portrait mode monitors in the automatic editor scale detection
Using the smallest dimension of the width and height makes it possible
to support both landscape and portrait monitors.

(cherry picked from commit 728fa3ff71)

EditorSettings: Factor code to compute auto display scale

Also fixes typo introduced in https://github.com/godotengine/godot/pull/48597/files#r652636544.

(cherry picked from commit f862f9a056)
2021-06-17 12:47:52 +02:00
Haoyu Qiu
770de6f579 Don't use the abbrevation "Sep." in UI text
(cherry picked from commit 5046a7d1b1)
2021-06-17 11:49:31 +02:00
Rémi Verschelde
752211391f Merge pull request #49674 from madmiraal/cleanup-android-export-fixme
Remove FIXME comment from fixed issue in Android Export
2021-06-17 11:15:26 +02:00
Marcel Admiraal
68b1a80a5d Remove FIXME comment from fixed issue in Android Export 2021-06-17 09:20:14 +01:00
Rémi Verschelde
6b98f0b615 Merge pull request #49668 from nekomatata/fix-external-resource-cache-regression-3.x
[3.x] Fix external resource cache regression
2021-06-17 01:24:40 +02:00
PouleyKetchoupp
c957035320 Fix external resource cache regression 2021-06-16 16:07:04 -07:00
Rémi Verschelde
465ab36ddf Merge pull request #49653 from madmiraal/remove-err_prints-3.x
[3.x] Remove duplicate ERR_PRINTS macro
2021-06-16 17:33:22 +02:00
Rémi Verschelde
65466371bf Style fix in DONORS.md (trailing space)
(cherry picked from commit 2b5b33706e)
2021-06-16 13:50:05 +02:00
Rémi Verschelde
9c92ecae21 i18n: Sync translations with Weblate
(cherry picked from commit a812779cc5)
2021-06-16 13:48:12 +02:00
Rémi Verschelde
9f32752fd5 Update AUTHORS and DONORS list
Thanks to all contributors and donors for making Godot possible!

(cherry picked from commit c5d6fb599c)
2021-06-16 13:43:55 +02:00
Marcel Admiraal
5a58516231 Remove duplicate ERR_PRINTS macro 2021-06-16 11:56:25 +01:00
Rémi Verschelde
b27179130e Merge pull request #49644 from Calinou/remove-3d-camera-gizmo-icon-3.x
Remove the 3D camera gizmo icon (3.x)
2021-06-16 12:10:36 +02:00
Rémi Verschelde
dd81884e6e Merge pull request #49643 from Calinou/improve-editor-feature-profiles-3.x 2021-06-16 12:10:06 +02:00
Rémi Verschelde
a373f1c0e8 Merge pull request #49642 from Calinou/tweak-changes-may-be-lost-color-3.x
Tweak the "Changes may be lost!" text color to match the icon's color (3.x)
2021-06-16 12:08:49 +02:00
Rémi Verschelde
b4d4db0539 Merge pull request #49640 from Calinou/add-soft-line-length-guideline-3.x
Add a soft line length guideline to the script editor (3.x)
2021-06-16 12:08:23 +02:00
Hugo Locurcio
28512bb389 Improve the editor feature profiles UX
- Add an help message when no profile is selected.
  - This replaces the class/property trees which are now hidden
    when no profile is selected.
- Display `(none)` as the current profile when no profile is
  currently active.
- Make the newly created/imported profile the current if it's the
  first profile to be added to the list.
- Make more strings localizable.
2021-06-16 07:04:13 +02:00
Hugo Locurcio
7c8a8d9bf5 Remove the 3D camera gizmo icon
The gizmo icon obstructed the line-based camera gizmo, which made it
difficult to see the actual camera orientation.

This also removes the unused SpatialStreamPlayer gizmo icon.
2021-06-16 07:03:11 +02:00
Hugo Locurcio
fd65104ad5 Tweak the "Changes may be lost!" text color to match the icon's color 2021-06-16 06:35:27 +02:00
Hugo Locurcio
f36c90b82f Add a soft line length guideline to the script editor
The default value is 80. The hard line length guideline's default column
has been moved to 100 to account for the new soft line length guideline.

It can be disabled by setting its value to the same column as the
hard line length guideline.
2021-06-16 06:00:02 +02:00
Rémi Verschelde
3b944e9d99 Merge pull request #49635 from godotengine/revert-49486-49451-fix-selection-changed-multinodeeditor-3.x
Revert "[3.x] Fix SceneTreeDock::_selection_changed"
2021-06-16 02:35:53 +02:00
Rémi Verschelde
990b6e7e95 Revert "[3.x] Fix SceneTreeDock::_selection_changed" 2021-06-16 02:34:33 +02:00
Rémi Verschelde
de04394c73 Merge pull request #49625 from nekomatata/fix-sub-resource-cache-3.x
[3.x] Fix sub-resource storing the wrong index in cache
2021-06-15 20:39:28 +02:00
PouleyKetchoupp
f9abd1ec0e Fix sub-resource storing the wrong index in cache
1. Backport sub-resource cache fixes from master.
Uses a cache by index to keep sub resource indices consistent.

2. The subindex within Resource wasn't synchronized with the path stored in cache when saving a packed scene. It could cause
sub-resources to be swapped when loading the same packed scene in
the same session.

Now the subindex in Resource reflects the sub-resource path in cache,
making saving and loading sub-resources consistent.

Co-authored-by: latorril <latorril@gmail.com>
2021-06-15 09:54:58 -07:00
Rémi Verschelde
8028122c83 Merge pull request #49486 from unsignedFoo/49451-fix-selection-changed-multinodeeditor-3.x
[3.x] Fix SceneTreeDock::_selection_changed
2021-06-15 15:08:18 +02:00
Rémi Verschelde
87532d2711 Merge pull request #49606 from azagaya/3.x
[3.x] Fix vertical slider `grabber_area` height calculation
2021-06-15 00:12:23 +02:00
Rémi Verschelde
26a7eed614 Merge pull request #49603 from bruvzg/tga_loader_fixes_3x
[3.x] Fix loading RLE compressed TGA files.
2021-06-15 00:09:19 +02:00
azagaya
3b84c32b52 Fix vertical slider grabber_area height calculation 2021-06-14 15:46:09 -03:00
Rémi Verschelde
e8581e5ea4 Merge pull request #49577 from Calinou/improve-console-error-logging-3.x
Improve the console error logging appearance (3.x)
2021-06-14 19:05:11 +02:00
bruvzg
d86ccf8309 Fix loading RLE compressed TGA files.
Fix memory reads outside of input buffer when loading invalid TGA files.
2021-06-14 18:51:09 +03:00
Hugo Locurcio
9be9304238 Improve the console error logging appearance
This makes secondary information less visually prominent to improve
overall readability.

Various loggers were also tweaked for consistency.
2021-06-13 19:18:09 +02:00
Rémi Verschelde
2d3c0d311c Merge pull request #49516 from Calinou/doc-projectsettings-vram-compression-change-3.x
Document applying VRAM compression setting changes retroactively
2021-06-11 19:42:32 +02:00
Rémi Verschelde
c45ce768b1 Merge pull request #47854 from mortarroad/3.x-lossless-webp
[3.x] Implement lossless WebP encoding
2021-06-11 19:35:47 +02:00
Morris Tabor
5de08ef1d6 Implement lossless WebP encoding 2021-06-11 18:48:04 +02:00
Hugo Locurcio
d0d717809e Document applying VRAM compression setting changes retroactively 2021-06-11 18:44:37 +02:00
Rémi Verschelde
a9f56d80f0 Merge pull request #49341 from lawnjelly/vis_notifier_fix 2021-06-11 14:43:53 +02:00
Yuri Roubinsky
2d7c9f1ef1 [3.x] Makes shader 'TIME' available in custom functions by default 2021-06-11 15:23:24 +03:00
Rémi Verschelde
e6a6293146 Merge pull request #49487 from pycbouh/theme-utility-methods-3.x 2021-06-11 13:40:21 +02:00
Rémi Verschelde
72ae4ca94f Merge pull request #49491 from pycbouh/editor-expose-resource-picker-3.x 2021-06-11 13:39:44 +02:00
Rémi Verschelde
fed44e3acb Merge pull request #42637 from madmiraal/fix-infinite-inertia-3.2
[3.x] Apply infinite inertia checks to Godot physics 3D
2021-06-11 13:00:43 +02:00
Yuri Sizov
b622dfa956 Use EditorResourcePicker in the Inspector
Backported from #48854
2021-06-11 13:32:15 +03:00
Yuri Sizov
343ba504d3 Add EditorResourcePicker control based on the Inspector editor for Resources
Backported from #47260
2021-06-11 13:32:15 +03:00
Marcel Admiraal
01dd6b0593 Apply infinite inertia checks to Godot physics 3D 2021-06-11 09:24:58 +01:00
Rémi Verschelde
caaac22240 Merge pull request #49494 from madmiraal/graph_edit-default-in-declaration-3.x
Move default values from definition to declaration in GraphEdit
2021-06-10 23:19:33 +02:00
Rémi Verschelde
c7c93355e3 Merge pull request #49436 from madmiraal/add-android-external-dir-3.x
[3.x] Add OS.get_external_data_dir() to get Android external directory
2021-06-10 18:24:21 +02:00
Marcel Admiraal
88b8f28acc Move default values from definition to declaration in GraphEdit 2021-06-10 17:17:18 +01:00
Marcel Admiraal
6d63ccba31 Add OS.get_external_data_dir() to get Android external directory 2021-06-10 16:48:37 +01:00
Rémi Verschelde
1147213c48 Merge pull request #49481 from madmiraal/fix-27725-3.x
[3.x] Remove unused AudioDriverAndroid from Android
2021-06-10 16:44:56 +02:00
Yuri Sizov
fddd09de17 Fix typo in Control's theme icon look-up method
Backported from #47544 where it was originally identified
2021-06-10 16:44:24 +03:00
Yuri Sizov
de1ba1f260 Add utility methods to Theme, improve error messages and documentation
Backport of relevant parts of #47251, #49308
2021-06-10 16:44:24 +03:00
Rémi Verschelde
0ff487e6fe Merge pull request #49464 from Calinou/ios-export-generate-missing-icons-3.x
[iOS] Option to automatically generate icons and launch screens
2021-06-10 15:23:31 +02:00
Aitor Cereceto
f0df770a56 Fix SceneTreeDock::_selection_changed
Now handles properly selecting one single node after
select multiple nodes (MultiNodeEditor)

Fixes #49451
2021-06-10 15:20:13 +02:00
Yuri Sizov
83012d6927 Expose missing Theme methods
Backport of relevant, non-breaking parts of #37759
2021-06-10 15:31:23 +03:00
Marcel Admiraal
cdba79ca72 Remove unused AudioDriverAndroid from Android 2021-06-10 08:31:23 +01:00
PouleyKetchoupp
a146e79758 Expose collider RID in 2D/3D kinematic collision
Can be useful to access the colliding body information for bodies
created with the physics server directly.
2021-06-09 18:26:16 -07:00
bruvzg
8790c07562 [iOS] Option to automatically generate icons and launch screens 2021-06-09 17:52:06 +02:00
Rémi Verschelde
d84d5a9665 Merge pull request #49332 from megalobyte/doc-prev-search
[3.x] Fix previous search for built-in-docs
2021-06-09 11:11:15 +02:00
Rémi Verschelde
0d68db1b85 Merge pull request #49280 from timothyqiu/rtl-break
[3.x] Fix RichTextLabel auto-wrapping on CJK texts
2021-06-09 10:53:11 +02:00
Rémi Verschelde
68d5879092 Merge pull request #49423 from Calinou/textedit-completion-auto-width-more-items
Allow more items in automatic width calculation for TextEdit completion
2021-06-09 09:40:49 +02:00
Rémi Verschelde
1c86395ce6 Merge pull request #49020 from sarchar/3.x
Support multiple address resolution in DNS requests
2021-06-09 09:26:23 +02:00
megalobyte
7408b33895 Fix previous search for built-in-docs 2021-06-08 23:11:42 -07:00
Chuck
17ee8ff0d9 Support multiple address resolution in DNS requests
Add two new functions to the IP class that returns all addresses/aliases associated with a given address.

This is a cherry-pick merge from 010a3433df which was merged in 2.1, and has been updated to build with the latest code.

This merge adds two new methods IP.resolve_hostname_addresses and IP.get_resolve_item_addresses that returns a List of all addresses returned from the DNS request.
2021-06-09 12:06:46 +07:00
PouleyKetchoupp
8a095b2b15 Support for 3D sync to physics
Same implementation as in 2D, specific to 3.x branch.
2021-06-08 16:28:58 -07:00
Hugo Locurcio
2e6a4aea99 Allow more items in automatic width calculation for TextEdit completion
Calculating the width for 100 items takes a millisecond in
a debug build on an i7-6700K. It's likely that the editor can remain
smooth even with 1,000 items, especially in a release build.
2021-06-08 16:21:39 +02:00
Haoyu Qiu
3a591aaeeb Fix RichTextLabel auto-wrapping on CJK 2021-06-08 21:04:20 +08:00
Arthur Bikmullin
f3d931410b Fixed missed IDHandler dependency in GodotFetch
(cherry picked from commit ee2bea7a86)
2021-06-08 10:20:35 +02:00
lawnjelly
0c6617887e Fix VisibilityEnabler to work with AnimationTree
Although the visibility enabler worked to turn on and off AnimationPlayer as it enters and exits the view frustum, this was of little use as bones animation and especially software skinning still take place driven by the AnimationTree node.

This PR adds the ability to turn on and off AnimationTree, and AnimationTreePlayer nodes as they enter or exit the view frustum, which achieves the intention of switching off expensive animation processing.
2021-06-08 07:13:25 +01:00
Hugo Locurcio
f80b15bebc Allow clang-format 12 in the pre-commit hook
clang-format 12's formatting is identical to clang-format 11's.

(cherry picked from commit d74413ebd0)
2021-06-07 22:36:31 +02:00
Rémi Verschelde
32047ffd9c FileAccess: Don't err in store_buffer with buffer of size 0
The error check was added for `FileAccessUnix` but it's not an error when both
`p_src` and `p_length` are zero.

Added correct error checks to all implementations to prevent the actual
erroneous case: `p_src` is nullptr but `p_length > 0` (risk of null pointer
indexing).

Fixes #33564.

(cherry picked from commit 01d5c463be)
2021-06-07 22:36:07 +02:00
kobewi
6ce63017d5 Don't remap resources belonging to instance
(cherry picked from commit 8e8398209e)
2021-06-07 22:35:38 +02:00
Rémi Verschelde
a33e0c2d41 Merge pull request #49398 from nekomatata/query-uninitialized-members-3.x
[3.x] Fix uninitialized members in physics query results
2021-06-07 20:39:51 +02:00
PouleyKetchoupp
c6bd0fd0f7 Fix uninitialized members in physics query results 2021-06-07 10:40:15 -07:00
Rémi Verschelde
5d8fe70de5 Merge pull request #49377 from Calinou/readd-dynamicfont-kerning
Readd support for kerning in DynamicFont (3.x)
2021-06-07 14:30:44 +02:00
Marcel Admiraal
1b19545cd8 Don't install Android NDK in CI
(cherry picked from commit a81449be6d)
2021-06-07 12:15:20 +02:00
Marcel Admiraal
9cb878460f Update Gradle archiveName and destinationDir properties
(cherry picked from commit 78e791045c)
2021-06-07 12:15:04 +02:00
kobewi
117e037235 Don't save built-in script when adding method
(cherry picked from commit a97546d4ea)
2021-06-07 12:14:47 +02:00
Nick Huelin
8b09112d5f Edit "quit()" method description in SceneTree
Updated the `SceneTree.quit()` method to include a note that on iOS this method won't work as apps are expected to be closed via the Home button, not programmatically.

(cherry picked from commit c63af17a31)
2021-06-07 12:14:30 +02:00
Aaron Franke
ea476543ea Rename tabs in the project manager
(cherry picked from commit 7813167196)
2021-06-07 12:13:27 +02:00
kobewi
457ccb21b6 Improve sort_custom() description
(cherry picked from commit 48f0368ddc)
2021-06-07 12:11:52 +02:00
RoniPerson
f5fe8ddacc Added documentation to some add_*_plugin methods
Added documentation to some `add_*_plugin` methods and the corresponding `remove_*_plugin` methods.
Added an example of how to register a plugin to `add_inspector_plugin` and linked to it in the other methods.

(cherry picked from commit e849157e07)

Proofread add_*_plugin/remove_*_plugin descriptions in EditorPlugin

(cherry picked from commit 21f0961610)
2021-06-07 12:10:19 +02:00
Rémi Verschelde
80e1585a6e Style: Cleanup uses of double spaces between words
Or after punctuation. Tried to leave third-party stuff alone, unless it has
been heavily modified for Godot.

(cherry picked from commit c1c76850cb)
2021-06-07 12:06:59 +02:00
Rémi Verschelde
b449380235 Merge pull request #49385 from madmiraal/rename-collisionobject3d-input_event-3.x
[3.x] Rename CollisionObject3D input_event signal position and normal parameters
2021-06-07 11:42:36 +02:00
Marcel Admiraal
fd982ecd15 Rename CollisionObject3D input_event signal position and normal parameters 2021-06-07 09:50:47 +01:00
Hugo Locurcio
c5ed95a526 Readd support for kerning in DynamicFont
DynamicFont kerning was removed in
a9b7843dca.

This readds kerning support and fixes it at the same time.

Co-authored-by: follower <follower@rancidbacon.com>
2021-06-07 02:36:10 +02:00
Rémi Verschelde
6580166f39 Merge pull request #48693 from Calinou/editor-import-invert-green-channel-3.x
Add "Normal Map Invert Y" import option for normal maps
2021-06-05 13:36:26 +02:00
Hugo Locurcio
dbf75931d0 Add "Normal Map Invert Y" import option for normal maps
This can be used to invert a normal map's Y direction.

The existing Invert import option that inverts all RGB channels
is kept for compatibility with existing projects.
2021-06-04 18:10:34 +02:00
Rémi Verschelde
f102ba8b2f Merge pull request #48367 from Calinou/doc-navigation-get-simple-path
Document `Navigation.get_simple_path()` often returning non-optimal results
2021-06-03 22:37:07 +02:00
Rémi Verschelde
6aa70c603d Merge pull request #48934 from madmiraal/fix-47579-3.x
[3.x] Fix game controllers ignoring the last listed button
2021-06-03 21:14:56 +02:00
Marcel Admiraal
18825ad4ff Fix game controllers ignoring the last listed button 2021-06-03 15:45:05 +01:00
Hugo Locurcio
8e4afdc71d Document Navigation.get_simple_path() often returning non-optimal results 2021-06-03 16:05:56 +02:00
Rémi Verschelde
87dfd6e6cb Merge pull request #49276 from bruvzg/macos_export_notarization3
[3.x, macOS export] Add notarization support.
2021-06-03 13:25:13 +02:00
bruvzg
261b35d63c [3.x, macOS export] Add notarization support. 2021-06-03 14:13:06 +03:00
Rémi Verschelde
ea6ca86776 Merge pull request #49275 from akien-mga/3.x-cherrypicks 2021-06-03 12:55:01 +02:00
gongpha
0b8e079eec New icons for Gradient and GradientTexture resources
(cherry picked from commit 0ed1915053)
2021-06-03 12:24:57 +02:00
trollodel
802ba1d07a Preview the color animation in the animation editor
(cherry picked from commit 735c8396b0)
2021-06-03 12:24:57 +02:00
Pedro J. Estébanez
612986ab0a Fix crash when using ALSA MIDI with PulseAudio
(cherry picked from commit 958d79828b)
2021-06-03 12:24:57 +02:00
kleonc
dfee7e71c7 TextureRegionEditor Fix not updating on editing region with autoslice cached
(cherry picked from commit 019c99e538)
2021-06-03 12:24:57 +02:00
Nathaniel Morihara
471c0ba700 Exporting: Android Debug Keystore Warnings
(cherry picked from commit 2cf19293ba)
2021-06-03 12:24:57 +02:00
Yuri Sizov
c82cb25a93 Improve the layout and texts of the Editor Feature Profiles dialog
(cherry picked from commit 00bcfaed85)
2021-06-03 12:24:53 +02:00
Rémi Verschelde
3bda26845f Merge pull request #49274 from bruvzg/zoom-visibility3
[3.x] Fix visibility issue with zoom label
2021-06-03 12:16:45 +02:00
Rémi Verschelde
1cd14e38cb Merge pull request #47978 from HenryWConklin/3.x-xml-numeric-entities
Add support for numeric XML entities to XMLParser
2021-06-03 12:16:32 +02:00
Henry Conklin
a28beb3048 Add support for numeric XML entities to XMLParser
* Add support for decimal numeric entities to String::xml_unescape
* Add more error checks to String::xml_unescape
* Refactor XMLParser to use String::xml_unescape instead of an internal
implementation
2021-06-03 11:44:47 +02:00
bruvzg
36ca3fea96 [3.x] Fix visibility issue with zoom label 2021-06-03 12:32:11 +03:00
Rémi Verschelde
ed28ce53bf Merge pull request #47142 from jmb462/fix-tween-is_active-always-true-after-stop-and-start
[3.x] Fix Tween.is_active() always true after stop() and then start() (Fix #39760 & #39801)
2021-06-03 11:16:08 +02:00
Rémi Verschelde
abf8569278 Merge pull request #49267 from Calinou/uncap-area-gravity-property-hints-3.x 2021-06-03 09:16:14 +02:00
Hugo Locurcio
e0facdaf61 Uncap the range for gravity and change the slider hints
There's not really a reason to cap the gravity amount, and we can also
give better hints for the range (for 3D, ±32 is much more sensible
than ±1024).
2021-06-03 02:08:57 +02:00
Rémi Verschelde
b5c445c0c9 i18n: Sync translations with Weblate
(cherry picked from commit 0446cf487f)
2021-06-02 11:10:11 +02:00
Rémi Verschelde
7887ff4113 Merge pull request #49248 from neikeq/mono-ios-fixes 2021-06-02 08:33:29 +02:00
Ignacio Roldán Etchevery
a3722a73aa C#+iOS: Fix crash at exit for passing NULL domain to mono_jit_cleanup 2021-06-02 01:34:00 +02:00
Ignacio Roldán Etchevery
4838e609ee C#+iOS: Fixes for games exported with Use Interpreter disabled
Added `SystemConfiguration.framework` to the Xcode project to fix
undefined symbols errors building without the interpreter, like:
`_SCNetworkReachabilityScheduleWithRunLoop`.

Added explicit static constructors to the generated `NativeCalls`
class to avoid a `TypeInitializationException` at startup when
Godot attempts to read the static fields (like `godot_api_hash`)
from this class.
This seems to be an issue with Mono's AOT compiler and classes
with the `beforefieldinit` attribute. Not sure if it only happens
when the fields are only accessed via reflection as was our case.
Explicitly declaring the static constructor makes the C# compiler
not add the `beforefieldinit` attribute to the class.
2021-06-02 01:34:00 +02:00
Ignacio Roldán Etchevery
21a739e3b1 C#+iOS: Fix P/Invoke symbols being stripped by the linker
We use `Mono.Cecil` to search for P/Invoke methods in assemblies in
order to collect symbols that we must prevent from being stripped.

We could pass the symbols as `-u` linker arguments (`-Wl,-u,symbol`)
for the native target (not for the project), but it was simpler to
generate referencing code and avoid changes to Godot's iOS exporter.
2021-06-02 01:34:00 +02:00
Ignacio Roldán Etchevery
c9047de455 C#+iOS: Fix simulator builds
Replaced obsolete preprocessor check for simulator/device in C code.
Architecture can no longer be used to determine this with Apple Silicon.
The new code uses `TARGET_OS_SIMULATOR` from `TargetConditionals.h`.

We have some mono libs which can only be used in devide builds.
We were adding them as static libs. Previously it was only causing
warnings because missing arch for the simulator, but now this
is treated as an error.

To fix this we turn them into xcframeworks with dummy static libs
for the simulator and the actual ones for devices.
2021-06-02 01:34:00 +02:00
Ignacio Roldán Etchevery
7569f2dccb Fix copying Mono shared libs on macOS 2021-06-02 01:33:55 +02:00
bruvzg
683f96df35 Add separate simulator flag for iOS build, change main library to xcframework.
Build and export iOS Mono libs as `.xcframework`s, for Apple Silicon iOS simulator support.
2021-06-02 01:09:03 +02:00
Rémi Verschelde
92713854a5 Merge pull request #49245 from NoFr1ends/fix-48826
Fix overflow in export template manager
2021-06-01 23:07:35 +02:00
Rémi Verschelde
4fe8941f8c Merge pull request #48957 from phil-shenk/iss48936-control_set_scale
added _change_notify in Control::set_scale to fix iss48936
2021-06-01 23:00:44 +02:00
Jonas Bernemann
4659b2ad4a Fix overflow in export template manager
Fixes the possible overflow of buttons after downloading the
current export template with using custom fonts or custom font size.

Fix #48826
2021-06-01 22:56:43 +02:00
Rémi Verschelde
e0fb05ad30 Merge pull request #49237 from akien-mga/3.x-cherrypicks 2021-06-01 13:35:56 +02:00
Rémi Verschelde
fb294606b5 Merge pull request #48771 from LightningAA/scrollcontainer-ensure-item-visible-3.x
[3.x] ScrollContainer: Expose `_ensure_focused_visible` to the scripting API and rename it to `ensure_control_visible`
2021-06-01 12:58:56 +02:00
Fabio Alessandrelli
b6a5f8422a [Net] Fix HTTPRquest store_buffer error.
HTTPRquest no longer call store_buffer/append_array when the chunk size
is 0.

(cherry picked from commit 507a9beca1)
2021-06-01 12:53:31 +02:00
Haoyu Qiu
0f780084f9 Wrap description TextEdit of plugin config dialog
(cherry picked from commit e83c2cd0c3)
2021-06-01 12:53:31 +02:00
Hugo Locurcio
822b3ec0b1 Document Resource.duplicate() only copying exported variables' values
(cherry picked from commit 2ba893e3ce)
2021-06-01 12:53:31 +02:00
Arkadiusz Marcin Kołek
7f14210a4c Avoid division by zero when calculating inertias for bodies with colliders without areas.
(cherry picked from commit e347baddf3)
2021-06-01 12:53:31 +02:00
Paweł Fertyk
6e67b7a93e Check for _language in PluginScript.instance_has
(cherry picked from commit 4b25892501)
2021-06-01 12:53:31 +02:00
bruvzg
462e57f5e6 Fix Directory::get_space_left() result on macOS and Linux.
(cherry picked from commit 1d7a63fb8f)
2021-06-01 12:53:31 +02:00
Haoyu Qiu
14969a5945 Check cache_parent_physical_bone when rebuilding parent cache
(cherry picked from commit 96fe795bdb)
2021-06-01 12:53:31 +02:00
nobuyuki_nyuu
057c9f601b Bind CanvasItemEditor::_zoom_on_position and CanvasItemEditor::get_state to ClassDB
(cherry picked from commit a715887299)
2021-06-01 12:53:31 +02:00
Emre Aydin
a6ff17c0a6 Fixed changing enabled classes resetting folding in manage editor features.
(cherry picked from commit 0f9913ce33)
2021-06-01 12:53:30 +02:00
Hugo Locurcio
d71077f463 Improve the audio bus editor appearance
- Use the editor font color for notch lines and text instead of a more
  contrasted color.
- Reuse the editor theme's tooltip styling and apply it on theme change.
- Make the preview label display an explicit `+` sign for positive values.
- Prevent a zero value from displaying as `-0.0 dB` instead of `0.0 dB`.
- Scale notch lines on hiDPI displays.

(cherry picked from commit 534c990e41)
2021-06-01 12:53:30 +02:00
Hugo Locurcio
93d157d213 Tweak Camera2D editor line colors for better visibility
The new color for screen drawing was chosen to be easier to distinguish
from the 2D viewport limits.

This also makes lines less opaque when the Camera2D has the Current
property enabled. The increased line width is enough to spot the
camera easily, and the increased opacity on top of that felt obnoxious.

(cherry picked from commit 8e2a7fff1d)
2021-06-01 12:53:30 +02:00
kobewi
f7cfdfb1cc Add preload() to resource path when holding Ctrl
(cherry picked from commit 4bee21bcc4)
2021-06-01 12:53:30 +02:00
Pedro J. Estébanez
0d7130f37c Add iOS export option for device family
(cherry picked from commit 19ae8193ee)
2021-06-01 12:52:19 +02:00
Pedro J. Estébanez
857fd831c1 Set schemes' build config to debug/release in iOS Xcode export
(cherry picked from commit 1534b4e65e)
2021-06-01 12:52:19 +02:00
David Cambré
72bb6dd2be The built in function math/seed was missing the sequenceport.
(cherry picked from commit d7205ef1d0)
2021-06-01 12:52:18 +02:00
Casey Foote
ecf8d99d37 Add support for generating noise images with an offset.
(cherry picked from commit 97c8d9f348)
2021-06-01 12:52:18 +02:00
RaphaelHunter
68f92e6785 Fix OpenSimplexNoise get_image() swap axes
(cherry picked from commit 00cac6e9b6)
2021-06-01 12:52:18 +02:00
Leonardo Christino
21eea9cd6c Make GraphNode handle children with EXPAND flag
(cherry picked from commit 5d574d980d)
2021-06-01 12:52:18 +02:00
Rémi Verschelde
fd4475f652 OS: Better validation of invalid input for get_unix_time_from_datetime
Default missing keys to Unix time 0 (1970-01-01 at 00:00:00 UTC).
Abort if year <= 0, this is not supported by the current algorithm.

Prevents an infinite loop further down.

Fixes #49022.

(cherry picked from commit 62efa30ed2)
2021-06-01 12:52:18 +02:00
PouleyKetchoupp
87ed7d32de Added flip_h and flip_v properties in TextureButton
(cherry picked from commit 5f1d94bb7d)
2021-06-01 12:52:14 +02:00
Lightning_A
6f58e6ce2c ScrollContainer: Expose _ensure_focused_visible to the API
Was renamed to `ensure_control_visible`
2021-05-31 19:05:30 -10:00
Rémi Verschelde
9b35708a21 Merge pull request #49120 from lyuma/gltf-module-3.x 2021-05-31 23:05:51 +02:00
Lyuma
d699600ec7 gltf: Fix mesh nodes which are also bones.
Fix issue when two skeletons end up directly parented.
Prevent animating TRS for skinned Mesh node.
Fix animating weights on meshes with targets but no weights.
2021-05-31 13:18:10 -07:00
K. S. Ernest (iFire) Lee
6ec9468e75 Backport gltf2 module from master. 2021-05-31 13:18:06 -07:00
Rémi Verschelde
8326b8b31a Merge pull request #49195 from madmiraal/fix-43544-3.x
[3.x] Fix UV mapping on CSGSphere
2021-05-31 13:06:10 +02:00
Rémi Verschelde
7713f33cd0 Merge pull request #49174 from NoFr1ends/fix-richtext-theme-update-3
[RichTextLabel] Fix not updating fonts when parent theme changes
2021-05-31 12:40:59 +02:00
Rémi Verschelde
d9cfe532b0 Merge pull request #49219 from aaronfranke/3.x-doc-fov
[3.x] Fix Camera FOV documentation
2021-05-31 12:39:46 +02:00
Rémi Verschelde
fb11927901 Merge pull request #49119 from lyuma/gltf_mesh_nodes_bones_3.x 2021-05-31 11:40:06 +02:00
Aaron Franke
753d0fca1d [3.x] Fix Camera FOV documentation 2021-05-31 05:25:12 -04:00
Rémi Verschelde
b2059caf70 Merge pull request #49160 from lawnjelly/fix_canvas_rect_bound
Fix canvas rect bound calculation
2021-05-31 11:00:27 +02:00
Marcel Admiraal
a2204f3cb3 Fix UV mapping on CSGSphere 2021-05-29 19:13:57 +01:00
Lynx
1b7c2a1428 Fix not updating fonts when parent theme changes
Reparsing the bbcode content when we receieve a theme changed
notification just like we already do in ENTER_TREE.

Resolves #49089
2021-05-28 20:44:00 +02:00
amor
dacc726faf Fixed inspector not updating anchor 2021-05-28 18:20:13 +05:30
Lyuma
a330b6829f gltf: Fix mesh nodes which are also bones for 3.x
Fix issue when two skeletons end up directly parented.
Prevent animating TRS for skinned Mesh node.
Fix animating weights on meshes with targets but no weights.
2021-05-28 03:50:54 -07:00
lawnjelly
6e022a382d Fix canvas rect bound calculation
It turns out the calculation of the bounding rect for canvas items has a nasty bug. When a transform is applied (especially in a custom draw), in the renderer this extra matrix is applied to all later commands in the canvas item. However in the calculation of the bound, the transform is only applied to the first command following the transform.

This PR fixes this inconsistency.
2021-05-28 08:44:59 +01:00
Rémi Verschelde
e9909b763a Merge pull request #49057 from lawnjelly/bvh_current_tree
BVH - fix stale current_tree in deactivate function
2021-05-26 11:13:34 +02:00
Rémi Verschelde
b41262729b Merge pull request #49095 from madmiraal/fix-docs-3977-3.x
[3.x] Update EditorResourcePreview queue_*() documentation
2021-05-26 11:01:34 +02:00
Marcel Admiraal
72446bab1b Update EditorResourcePreview queue_*() documentation 2021-05-26 08:39:52 +01:00
Rémi Verschelde
94b5a82e7d Merge pull request #48943 from Calinou/screen-orientation-remove-ios-duplicate-3.x
Remove duplicate orientation settings in the iOS export preset
2021-05-26 00:24:17 +02:00
Hugo Locurcio
914b5dc525 Remove duplicate orientation settings in the iOS export preset
The screen orientation is now sourced from the Project Settings
like it is done for Android already.
2021-05-25 23:55:37 +02:00
Rémi Verschelde
2555567e7a Merge pull request #49072 from pfertyk/issue-49006-decompress-crashes-godot
[3.x] Return error when decompressing empty PoolByteArray
2021-05-25 21:18:30 +02:00
Rémi Verschelde
00abdaf333 Merge pull request #49075 from nekomatata/tilemap-collision-debug-fix-3.x
Fix logic for showing tilemap debug collision
2021-05-25 21:12:48 +02:00
PouleyKetchoupp
114da550ec Fix logic for showing tilemap debug collision
In editor: only when show_collision property is enabled
In game: only when 'Visible collision shapes' is enabled
2021-05-25 11:49:47 -07:00
Rémi Verschelde
998b6b1c6d Merge pull request #49070 from RandomShaper/android_data_backup_3.x
[3.x] Allow basic user data backup on Android
2021-05-25 18:17:15 +02:00
Pedro J. Estébanez
76a4831cd3 Allow basic user data backup on Android 2021-05-25 17:47:19 +02:00
Paweł Fertyk
f563cabb4e Return error when decompressing empty buffer 2021-05-25 17:31:00 +02:00
lawnjelly
14ce176f10 BVH - thread safety option
Added optional thread safe version through template argument and runtime switch, that wraps access with a mutex.
2021-05-25 10:47:32 +01:00
lawnjelly
0a350845d5 BVH - fix stale current_tree in deactivate function
Changes passing of current_tree from a member variable to a function argument, making bugs due to stale state less likely.

Fix a bug in deactivate where current_tree variable was stale. This may have resulted in visual anomalies.
2021-05-25 10:43:04 +01:00
Rémi Verschelde
bb53fb028c Merge pull request #47751 from Calinou/highlight-control-flow-keywords-3.x
Highlight control flow keywords with a different color (3.x)
2021-05-25 09:20:46 +02:00
Hugo Locurcio
a38b447413 Highlight control flow keywords with a different color
This makes them easier to distinguish from other keywords.
2021-05-25 00:31:39 +02:00
Rémi Verschelde
130ecf0c9f Merge pull request #49044 from akien-mga/3.x-linux-embree-unbundling-aarch64
Linux: Fix embree unbundling on aarch64
2021-05-24 22:04:11 +02:00
Rémi Verschelde
752ed768fa Linux: Fix embree unbundling on aarch64
Embree supports aarch64 since version 3.13.0.
2021-05-24 21:10:43 +02:00
Marcel Admiraal
b84714055b Clarify that eof_reached() cannot be used to check if more data is available 2021-05-24 19:42:37 +01:00
Marcel Admiraal
cfc984aff1 Clarify documentation of Camera3D.get_camera_transform() 2021-05-24 17:54:53 +01:00
Rémi Verschelde
855406c882 Merge pull request #49031 from TwistedTwigleg/skeletonik_bone_detachment_fix_godot3
[3.x] Fixed issue where bones become detached if multiple SkeletonIK nodes are used
2021-05-24 18:35:22 +02:00
TwistedTwigleg
ec7b72e81d SkeletonIK: Fixed issue where bones become detached if multiple SkeletonIK nodes are used 2021-05-24 11:30:16 -04:00
Rémi Verschelde
65ddfd95ee Merge pull request #48967 from akien-mga/3.x-embree-3.13.0
[3.x] Upgrade Embree to the latest official release.
2021-05-24 17:03:04 +02:00
Rémi Verschelde
b94b09cd19 Merge pull request #46860 from bruvzg/symlinks_and_macos_gdn_framework_export 2021-05-24 15:15:10 +02:00
Yuri Roubinsky
8d06dd4371 Fix doc theme not changing when its hidding
(cherry picked from commit 9a5cce35e6)
2021-05-24 12:57:05 +02:00
Zae
3756fbd463 Fix duplicate close files when deconstructing ZipArchive
(cherry picked from commit a65dac3fa7)
2021-05-24 12:56:41 +02:00
kobewi
f78c276abe Reset Shader Editor scroll when changing shader
(cherry picked from commit 0ac5be1e67)
2021-05-24 12:56:23 +02:00
bruvzg
53f05c9167 Add GDNative Framework loading and export support. 2021-05-24 12:50:18 +03:00
Rémi Verschelde
0b136a8066 Merge pull request #49017 from bruvzg/macos_on_top_32
[macOS] Allow "on top" windows to enter full-screen mode.
2021-05-24 11:40:35 +02:00
bruvzg
31be8ae8e9 [macOS] Allow "on top" windows to enter full-screen mode. 2021-05-24 10:47:36 +03:00
Rémi Verschelde
59b6950034 Merge pull request #48993 from kleonc/sprite_frames_editor-zoom-hidpi
[3.x] Scale zoom values in the SpriteFrames editor for hiDPI displays
2021-05-23 17:21:24 +02:00
Rémi Verschelde
714b4dc07b Merge pull request #48992 from lawnjelly/ewok_fix_joined_item_flags
Batching - fix item_batch_flags stale state
2021-05-23 16:22:06 +02:00
kleonc
9f39f8339c Scale zoom values in the SpriteFrames editor for hiDPI displays 2021-05-23 14:25:57 +02:00
lawnjelly
17a51b3a9e Batching - fix item_batch_flags stale state
Fixes bdata.joined_item_batch_flags not being kept up to date during the rendering pass.
2021-05-23 12:39:15 +01:00
Rémi Verschelde
4100a80502 Merge pull request #43506 from QbieShay/fix-depth-sort
[3.x] VisualServer now sorts based on AABB position
2021-05-23 01:23:46 +02:00
Rémi Verschelde
6f31af4c3c Merge pull request #48977 from kleonc/sprite_frames-editor-zoom-3.x
[3.x] SpriteFramesEditorPlugin Added zooming
2021-05-22 23:52:09 +02:00
kleonc
6481a34478 SpriteFramesEditorPlugin Added zooming 2021-05-22 23:33:27 +02:00
Rémi Verschelde
ac3417005d Merge pull request #48533 from mortarroad/3.x-convex-hull-ported
[3.x] Port Bullet's convex hull computer to replace of QuickHull
2021-05-22 23:23:15 +02:00
Hugo Locurcio
c164c07e85 Tweak pressed CheckBox appearance in the editor
This uses the accent color to match pressed CheckButtons after they
were updated. Checked checkboxes are now more prominent in the user's
peripheral vision, which can be useful at times. This also matches
how checkboxes look in most operating systems and web browsers.

(cherry picked from commit 0d27c4d809)
2021-05-22 18:37:56 +02:00
bruvzg
df532ff45c [UWP] Add missing get_scansym argument.
(cherry picked from commit 494c54b98c)
2021-05-22 18:35:16 +02:00
Rémi Verschelde
1d06a7edac Merge pull request #48974 from trollodel/debug_shapes_update_crash_3.x
Fix crash on debug shapes update if CollisionObject is not in tree
2021-05-22 18:29:31 +02:00
trollodel
7043d6d1c6 Fix crash on debug shapes update if CollisionObject is not in tree
Also fix ConcavePolygonShape not emitting the changed signal
2021-05-22 17:33:51 +02:00
bruvzg
6aa8f7d85b Add symlink API to the DirAccess (on macOS and Linux). 2021-05-22 17:36:16 +03:00
jfons
a69cc9f13d Upgrade Embree to the latest official release.
Since Embree v3.13.0 supports AARCH64, switch back to the
official repo instead of using Embree-aarch64.

`thirdparty/embree/patches/godot-changes.patch` should now contain
an accurate diff of the changes done to the library.

(cherry picked from commit 767e374dce)
2021-05-22 15:14:07 +02:00
Morris Tabor
ba396caefc Replace QuickHull with Bullet's convex hull computer.
The code is based on the current version of thirdparty/vhacd and modified to use Godot's types and code style.

Additional changes:
- backported and extended PagedAllocator to allow leaked objects
- applied patch from https://github.com/bulletphysics/bullet3/pull/3037
2021-05-22 08:16:43 +02:00
phil-shenk
04729d9c65 added _change_notify in Control::set_scale to fix iss48936 2021-05-22 01:12:53 -04:00
Rémi Verschelde
2660fafcc0 Merge pull request #48869 from tavurth/feature/hmac-port
Backport HMACContext to 3.x
2021-05-21 19:06:18 +02:00
Rémi Verschelde
7cd5967e99 Merge pull request #48924 from akien-mga/3.x-cherrypicks
Cherry-picks for the 3.x branch (future 3.4) - 4th batch
2021-05-21 19:05:17 +02:00
Rémi Verschelde
94035254ff Merge pull request #48929 from Faless/js/3.x_download_buffer
[3.x] [HTML5] Add easy to use download API.
2021-05-21 18:34:10 +02:00
Fabio Alessandrelli
bf078814cc [HTML5] Add easy to use download API.
New `JavaScript.download_buffer` method to create a prompt that let the
user download a file.
2021-05-21 16:03:38 +02:00
Haoyu Qiu
cf47129f9a Fix STL to Godot type convertion of polypartition
(cherry picked from commit d16bef8b55)
2021-05-21 13:41:28 +02:00
Haoyu Qiu
a26bed52c0 Fix editor crash when exporting profiler data
(cherry picked from commit be79bdc8ab)
2021-05-21 13:41:27 +02:00
Hugo Locurcio
8063d69abd List "Argument" for each extra bind argument in the connect dialog
This makes the dialog more explicit.

(cherry picked from commit 994dd314e0)
2021-05-21 13:41:27 +02:00
Hugo Locurcio
5e735a9c1f Tweak highlight color in the editor Find in Files dialog
The new color is more visible against dark backgrounds.

(cherry picked from commit 82570dec90)
2021-05-21 13:41:27 +02:00
Rémi Verschelde
379ecd532a Dist: Add macOS entitlements files for editor code signing
These are the entitlements we define for official macOS editor builds since
Godot 3.3.

Users making custom builds of the engine can use those files with `codesign` to
sign their own builds. E.g.:
```
codesign --force --timestamp \
  --options=runtime --entitlements editor.entitlements \
  -s <your key> -v osx_template.app
```

(cherry picked from commit 6999e332e4)
2021-05-21 13:41:27 +02:00
Lyuma
a0b8c24d92 Fix incorrect skin deduplication when using named binds
(cherry picked from commit 60f620411e)
2021-05-21 13:41:27 +02:00
Lyuma
ec6a3a0d0c gltf: Fail gracefully when a mesh instance fails.
(cherry picked from commit 5a9eee6b1a)
2021-05-21 13:41:27 +02:00
Aaron Franke
ebfba19b59 Use global scope round method for rounding
(cherry picked from commit b01aa69c80)
2021-05-21 13:41:27 +02:00
Hugo Locurcio
66a8654963 Remove #ifdef catering to MSVC 2012 and earlier in math_funcs.h
For the `master` branch, the minimum supported MSVC version is now
MSVC 2017 (with MSVC 2019 being recommended).

(cherry picked from commit b57d9c8005)
2021-05-21 13:41:27 +02:00
K. S. Ernest (iFire) Lee
d5b6cb4639 When one invalid image fails, it should only fail that single image.
Move to a more graceful degradation 3d asset import model.

(cherry picked from commit a81f4dd5a7)
2021-05-21 13:41:27 +02:00
jfons
2c400a7aae Fix swapped front/rear directions in viewport rotation control.
(cherry picked from commit e70e33ddcf)
2021-05-21 12:55:25 +02:00
Hugo Locurcio
12236d2868 Only allow absolute paths in XDG environment variables
The XDG Base Directory specification does not allow using relative paths
(which broke things in Godot anyway). If a relative path is detected,
it should be ignored.

(cherry picked from commits 011a99316a
and 0e1d45b210)
2021-05-21 12:53:11 +02:00
Haoyu Qiu
3f89287ddb Fix XMLParser behavior for comments and premature endings
(cherry picked from commit 549ad70760)
2021-05-21 12:27:45 +02:00
Rémi Verschelde
c311b4c039 Merge pull request #48911 from timothyqiu/face-crash
[3.x] Fix crash when using get_available_chars with invalid DynamicFontData
2021-05-21 07:59:03 +02:00
Haoyu Qiu
bec1dcb6f6 Fix crash when using get_available_chars with invalid DynamicFontData 2021-05-21 10:22:20 +08:00
Rémi Verschelde
4396ee18af Merge pull request #48906 from Calinou/sky-unexpose-high-radiance-sizes
Remove high radiance sizes from the editor due to issues on specific GPUs
2021-05-21 00:32:58 +02:00
Hugo Locurcio
8d9cef3726 Remove high radiance sizes from the editor due to issues on specific GPUs
These values can still be set by code, but are no longer presented in
the editor.
2021-05-20 23:54:12 +02:00
Rémi Verschelde
463073a966 Merge pull request #48817 from Calinou/import-texture-npot-gles2-warning
Print a warning when importing a repeating NPOT texture in a GLES2 project
2021-05-20 21:38:53 +02:00
Hugo Locurcio
20f79287cd Print a warning when importing a repeating NPOT texture in a GLES2 project
Repeating NPOT textures are not guaranteed to be displayed correctly
in GLES2, since the specification does not mandate support for it.

The warning is also displayed in GLES3 projects that are configured
to allow falling back to GLES2.
2021-05-20 20:38:47 +02:00
Rémi Verschelde
d025f6f797 Merge pull request #48824 from aaronfranke/3.x-scd-minsize
Set a minimum size for status panel elements in ScriptCreateDialog
2021-05-20 18:03:45 +02:00
Rémi Verschelde
f0fa8a103b Merge pull request #48691 from Faless/js/3.x_interfaces
[HTML5] [3.x] Implement Godot <-> JavaScript interface.
2021-05-20 17:13:12 +02:00
Fabio Alessandrelli
203beb69a9 [Doc] Remove reference to UNIX sockets in StreamPeer.
That class can be used as a base to implement them, but there is no
actual implementation for it in Godot.

(cherry picked from commit e858f7c2ea)
2021-05-20 14:35:04 +02:00
Ev1lbl0w
664f1828e2 Fix zip_root not being defined when importing by drag&drop
(cherry picked from commit 056deefa55)
2021-05-20 14:34:32 +02:00
Fabio Alessandrelli
730a894bcf [HTML5] Implement Godot <-> JavaScript interface. 2021-05-20 14:33:00 +02:00
Rémi Verschelde
f479a7972f Merge pull request #48883 from akien-mga/3.x-codespell-2.0.0
[3.x] Fix typos with codespell
2021-05-20 14:32:14 +02:00
Rémi Verschelde
72a8fef99f Merge pull request #48884 from aaronfranke/3.x-approx-use-double
[3.x] Make is_equal_approx have explicit float and double versions
2021-05-20 14:25:03 +02:00
Aaron Franke
573b7247bf Set a minimum size for status panel elements in ScriptCreateDialog 2021-05-20 08:08:24 -04:00
Rémi Verschelde
eb78f80f03 Fix typos with codespell
Using codespell 2.0.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
GIRD
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2021-05-20 12:56:56 +02:00
Aaron Franke
1154b6264c [3.x] Make is_equal_approx have explicit float and double versions 2021-05-20 06:50:09 -04:00
Will Whitty
3f606263d5 Backport HMac crypto to 3.x
Fix headers

Fix docs formatting

Changes for PR

Fix tests
2021-05-20 13:29:38 +03:00
Rémi Verschelde
65ba193ae8 Merge pull request #48868 from kleonc/node2d-z_index-docs
[3.x] Document valid range of Node2D.z_index
2021-05-20 09:01:21 +02:00
kleonc
4871bf4668 Document valid range of Node2D.z_index 2021-05-20 01:24:54 +02:00
Rémi Verschelde
be12a3dd96 Android: Remove -fno-integrated-as, it can break arm64v8 build
We found that this flag causes this error on PR #48812 which does not add any
fancy inline assembly:
```
/tmp/tile_set-ce236a.s: Assembler messages:
/tmp/tile_set-ce236a.s:34676: Error: selected processor does not support `bfc x0,#32,#32'
clang++: error: assembler command failed with exit code 1 (use -v to see invocation)
```

That flag is mentioned in various errors related to assembler failures on
arm64v8 with Clang from the Android NDK.

It was added in Godot in #6958 when migrating from GCC to Clang, and is indeed
referenced in the NDK's Clang migration guide:
https://android.googlesource.com/platform/ndk/+/master/docs/ClangMigration.md

> Especially for ARM and ARM64, Clang is much stricter about assembler rules
> than GCC/GAS. Use `-fno-integrated-as` if Clang reports errors in inline
> assembly or assembly files that you don't wish to modernize.

We don't get those errors nowadays so it seems the flag is no longer needed.

(cherry picked from commit 23f7c75126)
2021-05-19 19:48:36 +02:00
Haoyu Qiu
f75ace5ac5 Fix ragdoll simulation when parent was readded to scene
(cherry picked from commit a701927d89)
2021-05-19 19:48:36 +02:00
Rémi Verschelde
cca2a9d2d5 Merge pull request #38387 from Rhathe/set_iterations
[3.x] Enable setting of collision iterations in Physics2DServer
2021-05-19 19:48:08 +02:00
Rémi Verschelde
0abd9d9f2c Merge pull request #48850 from madmiraal/fix-quat-includes-3.x
[3.x] Fix `Quat` includes
2021-05-19 19:28:27 +02:00
Marcel Admiraal
26a99548f2 Fix Quat includes 2021-05-19 15:13:39 +01:00
Hugo Locurcio
a45db4c208 Fix crash when trying to save with no scenes and scripts open
This could occur when attempting to save project settings when
no scenes or scripts are open (which is common in a brand new project).

(cherry picked from commit 16876bec76)
2021-05-19 15:24:31 +02:00
Rémi Verschelde
a92dd585f7 CI: Install Android NDK 21.4.7075529
This is the version mandated by Godot's gradle setup anyway so it would get
installed when running gradlew. Now we pre-install the correct version.

(cherry picked from commit 7eaf4d445d)
2021-05-19 15:22:56 +02:00
Bartłomiej T. Listwon
ccd8c5ec66 pywin32 is no longer necessary for SCons install
https://github.com/SCons/scons/releases/tag/4.1.0
(cherry picked from commit b6f16671ee)
2021-05-19 15:22:24 +02:00
Fabio Alessandrelli
7d9d795af8 [HTML5] Fix GDNative compilation with emcc 2.0.19+
Add `WARN_ON_UNDEFINED_SYMBOLS=0` for the main module (which defines
`godot_js_main` as extern coming from the "side" module, i.e. the main
Godot binary).

(cherry picked from commit 14c057eab6)
2021-05-19 15:21:41 +02:00
Rémi Verschelde
ea0ccf6381 Merge pull request #42743 from madmiraal/fix-12215-3.2
[3.x] Return RID instead of Object id in area-body_shape_entered-exited signals.
2021-05-19 13:07:10 +02:00
Marcel Admiraal
09456c2a01 Return RID instead of Object id in area-body_shape_entered-exited signals. 2021-05-19 10:51:59 +01:00
Rémi Verschelde
a133d4577c Merge pull request #48820 from Calinou/tileset-editor-increase-max-snap-step
Increase the TileSet editor's snap step to 1024
2021-05-19 10:13:27 +02:00
Hugo Locurcio
a9df687db6 Increase the TileSet editor's snap step to 1024
This also tweaks the autotile bitmaks mode property hint string.
2021-05-18 23:38:22 +02:00
Rémi Verschelde
6355877c0d Merge pull request #47863 from mphe/same_line_warning_ignore
Allow warning-ignore in the same line as the respective warning
2021-05-18 15:08:00 +02:00
Rémi Verschelde
72647cc55c i18n: Sync translations with Weblate
(cherry picked from commit bcedd09742)
2021-05-18 12:09:38 +02:00
Hugo Locurcio
333dfb96da Scroll faster when holding Alt in TextEdit (and script editor)
This feature is inspired by a similar feature found in
Visual Studio Code.

(cherry picked from commit cf1cf6c6eb)
2021-05-18 11:58:09 +02:00
kleonc
57fdddecff BitMask::create Don't request more memory than needed when size is a multiply of 8
(cherry picked from commit 8963be2ef4)
2021-05-18 11:58:09 +02:00
Rémi Verschelde
0a4eb472cf Revert "Tweak lightmapper warning message to mention Rosetta emulation on macOS"
This reverts commit 47f869b731.

This is no longer needed after #48455.
2021-05-18 11:58:09 +02:00
Rémi Verschelde
0053b31592 Merge pull request #47801 from QbieShay/ring-emitter-3.x 2021-05-18 10:54:15 +02:00
Rémi Verschelde
330ddc37b6 Merge pull request #48075 from lyuma/varying_fragment_to_light_3.4 2021-05-18 10:53:34 +02:00
Rémi Verschelde
530a999fb8 Merge pull request #48798 from josefkaragoli/emission_fix
Disable GIProbe emission when disabled on a material
2021-05-18 08:22:18 +02:00
QbieShay
1ec46cb1eb added offset for plane mesh and quad mesh 2021-05-17 22:07:16 +02:00
Sonoracpp
0b723358bb Disable GIProbe emission when disabled on a material
Fixes https://github.com/godotengine/godot/issues/48230
2021-05-17 20:24:33 +04:00
Rémi Verschelde
a246dceb51 FileSystem dock: Fix search shortcut
Follow-up to 533d3e7800 which used a shortcut
not defined in 3.x.
2021-05-17 13:32:44 +02:00
fox
533d3e7800 Make shortcut for focusing searchbar in filesystem dock
(cherry picked from commit 22e2e4334e)
2021-05-17 13:11:07 +02:00
kleonc
0a91c8e972 Fix crash after disabling plugin using set_force_draw_over_forwarding_enabled()
(cherry picked from commit 5a8314016a)
2021-05-17 13:09:14 +02:00
kleonc
7eccdbe693 Fix accessing scene tree without checking: MeshInstance3D::create_debug_tangents, GIProbe::bake
(cherry picked from commit ef589a7cd3)
2021-05-17 13:08:46 +02:00
John Wigg
c3c3497c17 Fix normals of PrismMesh
(cherry picked from commit c8e402324e)
2021-05-17 13:07:58 +02:00
Haoyu Qiu
1866a605e1 Fix Tree::get_column_at_position crash
(cherry picked from commit c8efcf81d2)
2021-05-17 13:07:39 +02:00
Hugo Locurcio
2eea00b036 Add "Support Godot Development" option to the editor's Help menu
(cherry picked from commit 3eae2f9c6d)
2021-05-17 13:06:11 +02:00
Rémi Verschelde
30f252b490 Merge pull request #47254 from akien-mga/file-access-64-bit
[3.x] Make all file access 64-bit (take 2)
2021-05-16 20:55:24 +02:00
Pedro J. Estébanez
817ffc01e1 Make all file access 64-bit (uint64_t)
This changes the types of a big number of variables.

General rules:
- Using `uint64_t` in general. We also considered `int64_t` but eventually
  settled on keeping it unsigned, which is also closer to what one would expect
  with `size_t`/`off_t`.
- We only keep `int64_t` for `seek_end` (takes a negative offset from the end)
  and for the `Variant` bindings, since `Variant::INT` is `int64_t`. This means
  we only need to guard against passing negative values in `core_bind.cpp`.
- Using `uint32_t` integers for concepts not needing such a huge range, like
  pages, blocks, etc.

In addition:
- Improve usage of integer types in some related places; namely, `DirAccess`,
  core binds.

Note:
- On Windows, `_ftelli64` reports invalid values when using 32-bit MinGW with
  version < 8.0. This was an upstream bug fixed in 8.0. It breaks support for
  big files on 32-bit Windows builds made with that toolchain. We might add a
  workaround.

Fixes #44363.
Fixes godotengine/godot-proposals#400.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-05-16 17:52:31 +02:00
Yuri Roubinsky
2d1f8f2352 Prevents shader crash if two struct with the same name are declared 2021-05-14 11:28:49 -07:00
Yuri Roubinsky
ac547031d5 Prevents shader crash if passing invalid struct to the return statement 2021-05-14 11:28:49 -07:00
Yuri Roubinsky
ae8de1f2ce Fix shader crash if duplicated struct members created 2021-05-14 11:28:49 -07:00
Lyuma
fba6b62054 Backport dd0874e "Allow passing varying from fragment to light shader function" to 3.4 2021-05-14 11:28:48 -07:00
Lyuma
0c028ad96e Backport bc0e8e7 "Fix using post-init shader array constructors" to 3.4 2021-05-14 11:28:48 -07:00
Lyuma
25016bf715 Backport 6b99bda "Added support for arrays as shader struct members" to 3.4 2021-05-14 11:28:48 -07:00
Lyuma
fc6bee0750 Backport 6f16239 "Implementation of struct for shaders" to 3.4 2021-05-14 11:28:48 -07:00
Marcus Brummer
74174676b8 Fixed build with SCRIPT_AES256_ENCRYPTION_KEY set
(cherry picked from commit 7e8e40a38e)
2021-05-14 15:15:25 +02:00
Rémi Verschelde
50f4c90205 i18n: Sync translations with Weblate
(cherry picked from commit f6c29d1cf5)
2021-05-14 13:23:57 +02:00
Rémi Verschelde
d8bc5b6b70 Update AUTHORS and DONORS list
New contributor added to AUTHORS:
@kleonc

Thanks to all contributors and donors for making Godot possible!

(cherry picked from commit 44ab5a0471)
2021-05-14 13:19:19 +02:00
Zae
3fd1a5d144 Fix zip file opening twice
(cherry picked from commit f403e62df1)
2021-05-14 12:57:43 +02:00
Rémi Verschelde
a00ef0d27b SCons: Abort if SCRIPT_AES256_ENCRYPTION_KEY is invalid
Helps users figure out that something is wrong if they did define this
environment variable and it turns out being ignored.

(cherry picked from commit 08b4383e3f)
2021-05-14 12:03:55 +02:00
Brennen Green
fac2e5dc67 Manually unpacked normal mapping to fix issue with refraction being offset rather than distorted.
(cherry picked from commit 31f2d946ad)
2021-05-14 11:35:27 +02:00
Will Whitty
c1135cf006 Work on porting HTTPRequest compression to 3.3
Fix doc issues

Use memcpy

Bind RESULT_BODY_DECOMPRESS_FAILED

Docs update
2021-05-14 12:20:31 +03:00
Yuri Sizov
fc67ff3d0a Keep custom editor theme when changing editor settings
(cherry picked from commit 56aedcee17)
2021-05-14 10:34:48 +02:00
Daniel Lungaro
ede0d47ccd Remove plugin from enabled if there's an error
inform user in warning message

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>

Refactor remove plugin from enabled

(cherry picked from commit 2bae31a4df)
2021-05-14 10:34:05 +02:00
Rémi Verschelde
9d1770d4fb Merge pull request #44657 from timothyqiu/inspect-dynamic-3.2
[3.x] Fix display of programmatically created value in remote inspector
2021-05-14 10:23:27 +02:00
Eoin O'Neill
0e7c2ea331 Attempt to fix rich text label effects processing even when
the node is invisible.

ISSUE:47687
(cherry picked from commit c4f976b38b)
2021-05-14 10:17:17 +02:00
R. Alex Hofer
5eff9569c6 Handle having no sinks in the PulseAudio driver.
Also make PulseAudio errors more verbose.

(cherry picked from commit 65a10f4db5)
2021-05-14 10:16:32 +02:00
llschuster
2a18909210 text-editor: fix Clicking warning doesn't center around line
(cherry picked from commit 6b55ec2ca9)
2021-05-13 23:22:54 +02:00
Yuri Sizov
01524c0430 Fix EditorPropertyEasing capturing drag events originated outside of it
(cherry picked from commit 31db95b048)
2021-05-13 23:22:06 +02:00
Rémi Verschelde
cb438028ee CI: Update JavaScript linter deps with known security vulnerabilities
jsdoc has no new release so I'm tracking this PR:
https://github.com/jsdoc/jsdoc/pull/1906

(cherry picked from commit e743b6b24c)
2021-05-13 23:21:37 +02:00
Rémi Verschelde
6b39ec034c Merge pull request #48702 from akien-mga/3.x-visualscript-hint-shouldnt-set-defval
VisualScript: Fix wrongly setting default value on property hint change
2021-05-13 23:02:12 +02:00
Rémi Verschelde
c7182512dd VisualScript: Fix wrongly setting default value on property hint change
PR #45096 put the backported code in the wrong case, it should be for `type`
and not for `hint`.

Also synced `hint` enum values with `Object.PropertyHint`.

Fixes #48698.
2021-05-13 22:37:31 +02:00
Rémi Verschelde
b14d809fa3 Merge pull request #48694 from hlfstr/3.x
Check for valid DynamicFontData before duplicate in Editor
2021-05-13 21:12:24 +02:00
davidh
ae2bc66eae Check for valid DynamicFontData before duplicate 2021-05-13 11:32:57 -05:00
Rémi Verschelde
009a738d09 Merge pull request #48647 from lawnjelly/ewok_2d_skin_unrigged
Batching - fallback for 2d skinning with unrigged polys.
2021-05-13 17:39:52 +02:00
bruvzg
3b0c071ce2 [macOS] Prefer .app bundle icon over the default one. 2021-05-13 09:30:56 +03:00
Lightning_A
0c55ab1bb4 Add the ability to remove project contents from the remove project dialog 2021-05-11 11:06:37 -06:00
lawnjelly
3c68a6d37f Batching - fallback for 2d skinning with unrigged polys.
In the legacy renderer unrigged polys would display with no transform applied, whereas the software skinning didn't deal with these at all (outputted them with position zero). This PR simply copies the source to destination verts and replicates the legacy behaviour.
2021-05-11 17:34:14 +01:00
Hugo Locurcio
fcfce4be67 Fix Ubuntu clang-format version detection in the pre-commit hook
(cherry picked from commit 61aa09097f)
2021-05-11 10:44:24 +02:00
Morris Tabor
9caee3b930 fix misaligned loads in bmp loader
(cherry picked from commit 89a8bbda0a)
2021-05-11 10:44:21 +02:00
Rémi Verschelde
39826d3a94 Merge pull request #47310 from mortarroad/3.x-fix-particles-material-spread
[3.x] Fix ParticlesMaterial spread.
2021-05-11 09:10:31 +02:00
Rémi Verschelde
5d90bc7e8e Merge pull request #48623 from Calinou/colorpicker-click-old-color-to-revert-3.x 2021-05-10 23:38:47 +02:00
Hugo Locurcio
d990035ebb Implement reverting to the old color when clicking it in ColorPicker 2021-05-10 22:43:04 +02:00
Hugo Locurcio
7027791959 Hide the 3D editor selection box when View Gizmos is disabled 2021-05-10 19:28:32 +02:00
Rémi Verschelde
368765db26 Merge pull request #48611 from Calinou/colorpicker-display-old-color-3.x
Display the old color in ColorPicker for easier comparison (3.x)
2021-05-10 18:18:06 +02:00
Hugo Locurcio
6d03fe5194 Display the old color in ColorPicker for easier comparison
This only affects ColorPickerButton nodes that spawn a ColorPicker,
not standalone ColorPickers.
2021-05-10 17:36:03 +02:00
Rémi Verschelde
71f8b910ff Merge pull request #48609 from akien-mga/3.x-fix-tileset-signal-error
TileSet: Fix signal disconnect error in some situation
2021-05-10 16:04:39 +02:00
Rémi Verschelde
6e920d0c14 TileSet: Fix signal disconnect error in some situation
Fixes second issue in #45938.

Co-authored-by: kleonc <9283098+kleonc@users.noreply.github.com>
2021-05-10 15:07:27 +02:00
Rémi Verschelde
18277679a7 Merge pull request #48588 from trollodel/collisionobject3d-no-mi-3.x
[3.x] Create CollisionObject debug shapes using VS
2021-05-09 18:55:25 +02:00
Rémi Verschelde
8bd6cb0ec7 Merge pull request #48589 from akien-mga/3.x-cherrypicks 2021-05-09 18:54:49 +02:00
trollodel
60ee8c9639 Create CollisionObject debug shapes using VS 2021-05-09 18:30:27 +02:00
Hugo Locurcio
0c424abe3c Fix Tree's background focus outline displaying behind section headings
(cherry picked from commit 63897f16b1)
2021-05-09 17:51:36 +02:00
kobewi
cb5870dd4a Display arrow cursor if text is not editable
(cherry picked from commit c3967c80ab)
2021-05-09 17:50:06 +02:00
Tokage
0454848f4d fix unintentional object rotation by animation tree
(cherry picked from commit ddac0e95dc)
2021-05-09 17:48:45 +02:00
Hugo Locurcio
c318cf6ed2 Save the current script when pressing Ctrl + S if no scene is open
- Tweak the dialog messages to be more informative.
  - The "Saved N modified resources" dialog is not a warning per se,
    so make it more explicit.

(cherry picked from commit 39f9b92f54)
2021-05-09 17:47:38 +02:00
besh81
c1e887edb8 Fixed bug in tab_container with hidden tabs
Fix a bug that occour when there are hidden tabs in tab_container.
The visualization isn't correct due to missing values in tab_widths array.

(cherry picked from commit e7e7aa7d12)
2021-05-09 17:47:38 +02:00
Kyle
b47cd82f76 Add ctrl+shift+a to instance scene in scenetree dock
Adds another key shortcut to instance a scene in the scentree dock. Complements ctrl+a to add a node.

(cherry picked from commit ea5445655c)
2021-05-09 17:47:38 +02:00
Hugo Locurcio
8b06085249 Implement the %command% placeholder in the Main Run Args setting
This can be used to tell Godot to run an executable that will run Godot
rather than running Godot directly. This is useful to make Godot start
on the dedicated GPU when using a NVIDIA Optimus setup on Linux:
`prime-run %command%`

The `editor/run/main_run_args` setting declaration was moved to make it
visible in the ProjectSettings documentation.

(cherry picked from commit ce4aa07276)
2021-05-09 17:47:38 +02:00
Gilles Roudière
472f7e9756 Adds a pressed signal to ButtonGroup
(cherry picked from commit 323f176915)
2021-05-09 17:47:37 +02:00
Hugo Locurcio
dc42ef2df9 Save the current script when adding a new method via signal connection
This makes it possible for external editors to pick up the changes.
Most modern editors should reload the file automatically,
but some older/lightweight editors may ask the user instead
(or only warn after trying to save in the external editor).

This closes #41283.

(cherry picked from commit 0ade686601)
2021-05-09 17:41:10 +02:00
Hugo Locurcio
f4e653d88f Improve the editor audio preview inspector appearance and functionality
- Make the timeline indicator thicker and with an indicator triangle,
  similar to the animation editor timeline.
- Add Space bar shortcut to play/pause the audio preview.
- Only seek when clicking or dragging with the left mouse button,
  not other mouse buttons.

(cherry picked from commit a50a81b703)
2021-05-09 17:41:09 +02:00
kleonc
1184013fcf TileMap::world_to_map Ensure half offset is added according to the returned value
Decide whether half offset should be added based on the value used for calculating the return value of this method.

(cherry picked from commit f1420c7cbf)
2021-05-09 17:15:44 +02:00
Hugo Locurcio
cb2cb46907 Document caveats of OS.get_unique_id()
(cherry picked from commit 7350f90c57)
2021-05-09 17:14:36 +02:00
Hugo Locurcio
9f31877e15 Fix EditorPropertyResource focus outline being drawn behind the preview
(cherry picked from commit 0b47f1be8c)
2021-05-09 17:14:36 +02:00
Fabio Alessandrelli
6c1c2ed414 [HTML5] Fix target_fps when window loses focus.
We don't get updates when the window is unfocused/minimized, so we must
detect the situation where the counted ticks start drifting away
resulting in more frames drawn than needed.
This commit adds a check to ensure that the target ticks do not drift
away more than one second.

(cherry picked from commit a1fe6d6899)
2021-05-09 17:14:36 +02:00
Hugo Locurcio
30ec3870c9 Tweak the setting hint for the custom editor theme setting
The custom editor theme is only visible after restarting the editor.

(cherry picked from commit 027301fec7)
2021-05-09 17:14:36 +02:00
Fabio Alessandrelli
73f19ec2da [HTML5] Remove "fixed-size.html".
No longer used in 3.3+.

(cherry picked from commit 3faf8d6e40)
2021-05-09 17:14:36 +02:00
Kyle
629c3e2a0a Remove extra separator
Removes an extra separator when Scene Tree Editing is disabled. Discussed in #48518

(cherry picked from commit e168baf433)
2021-05-09 17:14:36 +02:00
Kyle
f711464030 Fixed cut/copy/paste visibility
Fixes #48514 by moving the visibility of these buttons into their own if statement that depends on if scene tree editing is allowed. Previously it was under the script editing setting which is unexpected as it works with nodes and the scene tree.

(cherry picked from commit 10d5d4d3cd)
2021-05-09 17:14:36 +02:00
Fabio Alessandrelli
23ef985bb8 [HTML5] Use 64KiB chunk size in JS HTTPClient.
For consistency with the native one, and the documentation.

(cherry picked from commit 6243835619)
2021-05-09 17:14:35 +02:00
Hugo Locurcio
9b01143380 Improve the AudioStreamPlayer(2D/3D) class descriptions
(cherry picked from commit b90adec417)
2021-05-09 17:14:35 +02:00
Rémi Verschelde
c03c6ae299 Merge pull request #48586 from akien-mga/tileset-better-errors
[3.x] TileSet: Improve error message for invalid IDs
2021-05-09 17:13:10 +02:00
Rémi Verschelde
ee86dc3011 TileSet: Improve error message for invalid IDs
Supersedes #47321.
Fixes #47313.
2021-05-09 16:56:52 +02:00
Rémi Verschelde
c8c8bcee50 Merge pull request #48540 from Calinou/editor-theme-allow-negative-contrast-3.x
Allow negative contrast values in the editor theme settings (3.x)
2021-05-09 16:38:02 +02:00
QbieShay
3af20b9bdf Added ring emitter for 3D particles
This commits adds a new emitter type for particles material
and 3D CPU particles. The new emitter is called "ring"
and it can emit either in a ring or cylinder fashion.
This adds the following properties for the emitter:
1. ring_emitter_axis: the axis along which the ring/cylinder
    will be constructed
2. ring_emitter_radius: outer radius of the ring/cylinder
3. ring_emitter_inner_radius: inner radius of the cylinder.
    when set to zero, particles will emit in the full volume.
4. ring_emitter_height: height of the ring/cylinder emitter.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-05-09 13:18:05 +02:00
Rémi Verschelde
4730856264 Merge pull request #44558 from RandomShaper/reset_track_3.2
[3.x] Add animation reset track feature
2021-05-09 10:06:00 +02:00
Pedro J. Estébanez
4da9a501f6 Add animation reset track feature
As a bonus, to have consistency between use Beziers and create insert tracks, use Beziers also gets a default via editor settings that is used when the confirmation dialog is disabled, instead of just falling back to creating non-Bezier tracks.
2021-05-09 09:40:16 +02:00
Pedro J. Estébanez
90f13520dd Extend UndoRedo handling of Resource to every Reference 2021-05-09 09:29:45 +02:00
Rémi Verschelde
1e6dccd1c7 Merge pull request #47814 from rafallus/fix/surfacetool_crash
Check input mesh is valid in SurfaceTool methods
2021-05-09 00:49:01 +02:00
rafallus
0ad0f71ba0 Check input mesh is valid in SurfaceTool methods 2021-05-09 00:38:17 +02:00
Rémi Verschelde
0bdadd468f Merge pull request #42771 from madmiraal/fix-26680-3.2
[3.x] Move collision layer and mask into CollisionObject.
2021-05-08 17:50:56 +02:00
Marcel Admiraal
8766769fd4 Move collision layer and mask into CollisionObject. 2021-05-08 11:40:57 +01:00
Rémi Verschelde
84061ab03d Merge pull request #48251 from TwistedTwigleg/skeletonik_changes_and_bug_fixes_regressionfix3_Godot3
[3.x] Fixed issue in SkeletonIK leading to some root bones being twisted incorrectly
2021-05-08 10:40:38 +02:00
PouleyKetchoupp
ea0015a8a6 Optimize area detection and intersect_shape queries with concave shapes
Whenever contact points are not needed, collision checks with concave
shapes (triangle mesh and heightmap) stop at the first colliding
triangle.
2021-05-07 19:19:41 -07:00
Rémi Verschelde
1f202ff099 Merge pull request #48541 from parulina/gles2-viewporttexture-fix
Fixed usage of proxy textures on GLES2 sky
2021-05-07 21:56:37 +02:00
Rémi Verschelde
1690eb7266 Merge pull request #48537 from akien-mga/3.x-android-drop-native-video-api
[3.x] Android: Remove non-functional native video OS methods
2021-05-07 21:26:01 +02:00
paru
eed4655644 Fixed usage of proxy textures on GLES2 sky 2021-05-07 18:33:35 +02:00
Hugo Locurcio
e7e2ef0767 Allow negative contrast values in the editor theme settings
When using a negative contrast value, the base color will be lightened
to create the derivative colors instead of being darkened.

This can lead to better-looking themes, especially for light themes.
2021-05-07 18:14:52 +02:00
Rémi Verschelde
e96f0ea1d7 Android: Remove non-functional native video OS methods
Those methods are only properly implemented for iOS.

Supersedes #43811.
2021-05-07 16:42:17 +02:00
Rémi Verschelde
a0a22ef49f Merge pull request #48480 from parulina/gles2-blendshapes
Added CPU blendshapes for GLES2
2021-05-07 16:30:43 +02:00
TwistedTwigleg
c1bc87ed0d Fixes the SkeletonIK twisting issue by using the skeleton global pose without overrides 2021-05-06 20:11:21 -04:00
Rémi Verschelde
64403ddcab Merge pull request #42543 from clayjohn/vertex-lighting-bug
Force vertex shading in SpatialMaterial when used
2021-05-07 00:48:32 +02:00
Rémi Verschelde
dc612a7651 Merge pull request #46764 from bruvzg/input_fix_non_latin_and_add_hw_scancodes_3 2021-05-06 23:54:53 +02:00
Fabio Alessandrelli
8740e95f15 [HTML5] Add support for physical_keycode.
This uses the `event.code` value to retrieve the physical code, while
still using the extra logic to map the unicode value to our keylist,
when computing the `scancode` (supporting ASCII and Latin-1).
2021-05-06 23:19:46 +03:00
bruvzg
dab4cf3ed6 Add physical_scancode (keyboard layout independent keycodes) to InputEventKey and InputMap.
Fix non-latin keyboard layout keycodes on Linux/X11 (fallback to physical keycodes).
2021-05-06 23:19:45 +03:00
Rémi Verschelde
63391f645c Merge pull request #48499 from clayjohn/Sprite3D-p_rid-error
Only set base in Sprite3D when needed
2021-05-06 21:50:25 +02:00
Rémi Verschelde
6a103a21a2 Merge pull request #48510 from Calinou/shader-editor-tweak-builtins-color-3.x
Tweak the built-ins color highlighting in the shader editor (3.x)
2021-05-06 21:49:59 +02:00
paru
8b0d3657e5 Added CPU blendshapes for GLES2 2021-05-06 20:52:34 +02:00
Rémi Verschelde
4185a22ca8 Merge pull request #48131 from LightningAA/fix-48113-3.x
[3.x] Fix Array.max() navigating to @GDScript.max()
2021-05-06 20:42:23 +02:00
Hugo Locurcio
42a4bd1ca2 Tweak the built-ins color highlighting in the shader editor
This makes built-ins easier to distinguish from keywords at a
quick glance.
2021-05-06 17:51:36 +02:00
Rémi Verschelde
f34a8c7f0e Merge pull request #47527 from Calinou/editor-translations-allow-multiple-selection-3.x
Allow selecting multiple files in the editor translation/remap dialogs (3.x)
2021-05-06 08:49:24 +02:00
Rémi Verschelde
7833751eae Merge pull request #48494 from aaronfranke/3.x-scd-size
Update size when updating ScriptCreateDialog
2021-05-06 08:43:37 +02:00
clayjohn
3dd2e5d870 Only set base in Sprite3D when needed 2021-05-05 22:35:21 -07:00
clayjohn
0445531ced Force vertex shading in SpatialMaterial when used 2021-05-05 19:49:18 -07:00
Hugo Locurcio
35887a2afe Allow selecting multiple files in the editor translation/remap dialogs
This makes it faster to add several translations.

The undo/redo messages were also tweaked to give better context.
2021-05-06 03:02:15 +02:00
Aaron Franke
e82f56e3a9 Update size when updating ScriptCreateDialog 2021-05-05 18:10:17 -04:00
Rémi Verschelde
48d7eff3e3 Merge pull request #48485 from JFonS/3.x_embree_aarch64
Add checks for __SSE2__ in the lightmap raycaster
2021-05-05 18:35:04 +02:00
JFonS
20717990fd Add checks for __SSE2__ in the lightmap raycaster 2021-05-05 18:24:13 +02:00
Rémi Verschelde
78b497bf20 Merge pull request #48483 from akien-mga/3.x-embree-not-on-x86
SCons: Disable embree-based modules on x86 (32-bit)
2021-05-05 18:18:08 +02:00
Rémi Verschelde
e53422c8f9 SCons: Disable embree-based modules on x86 (32-bit)
Fixes #48482.
2021-05-05 18:01:45 +02:00
Rémi Verschelde
1209ee0df4 Merge pull request #48473 from akien-mga/3.x-fix-custom-resource-loader-loop
Fix crash with user-defined `ResourceFormatLoader.load`
2021-05-05 16:51:16 +02:00
Rémi Verschelde
bf9f288c7d Fix crash with user-defined ResourceFormatLoader.load
There's still some fishy recursive relationship between `load_interactive` and
`load` which needs to be investigated here, but this patch solves the crash
when returning an error code in user-defined `load`.

Fixes #48463.
2021-05-05 15:44:42 +02:00
Hugo Locurcio
c0ccde9752 Document that File.open_compressed() can only open files saved by Godot
(cherry picked from commit 5f098d6db6)
2021-05-05 15:28:12 +02:00
CaptainProton42
76f3f6949e Fix 3D scene preview generation.
File system dock previews will now be generated for 3D scenes when no
editor feature profile is set.

(cherry picked from commit 16304aaa3b)
2021-05-05 15:28:12 +02:00
Rémi Verschelde
619482472e Merge pull request #48355 from MaxStgs/3.x
Add PackedDataContainer data pointer check for non nullable
2021-05-05 15:22:40 +02:00
Rémi Verschelde
2a1fb62e96 Merge pull request #48316 from nekomatata/expose-physics-debug-shape-3.x
[3.x] Expose get_debug_mesh in Shape to scripting API
2021-05-05 15:17:48 +02:00
Rémi Verschelde
410b8e8ea7 Merge pull request #48475 from akien-mga/3.x-style-changes 2021-05-05 15:12:55 +02:00
Rémi Verschelde
140350d767 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2021-05-05 15:02:01 +02:00
Rémi Verschelde
b8d198eeed Merge pull request #48455 from JFonS/3.x_embree_aarch64
[3.x] Switch to embree-aarch64
2021-05-05 15:01:18 +02:00
Rémi Verschelde
16bc2a3d24 Merge pull request #48011 from BastiaanOlij/left_right_eye_indicator
Add VIEW_INDEX variable in shader so we know which eye/view we're rendering for
2021-05-05 09:14:10 +02:00
Bastiaan Olij
8f8c9c2f57 Add VIEW_INDEX variable in shader so we know which eye/view we're rendering for 2021-05-05 16:22:03 +10:00
Rémi Verschelde
59eed164c4 Merge pull request #48337 from nekomatata/dynamic-bvh-pairable-optim
[3.x] Fixed unnecessary bvh tree updates when calling set_pairable
2021-05-04 23:32:46 +02:00
PouleyKetchoupp
0dacc681b6 Fixed unnecessary bvh tree updates when calling set_pairable
Dynamic BVH doesn't update the tree anymore when calling set_pairable
with no parameter change.

Also modified Godot Physics broadphase to create objects directly with
pairable (static) set correctly to make use of this optimization for the
BVH broadphase.

Note: Octree broadphase doesn't use this optimization because it forces
an update on move, so passing the proper AABB and static parameters on
creation would cause the tree to update twice.
2021-05-04 12:24:31 -07:00
JFonS
73e2ccd603 Switch to embree-aarch64 2021-05-04 18:59:00 +02:00
Rémi Verschelde
de3168ffa3 Merge pull request #48457 from briansemrau/fix-polygon-rotation-batched
Fix polygon rotation with batching
2021-05-04 18:12:03 +02:00
Rémi Verschelde
0bf06c25a3 Merge pull request #48450 from Calinou/version-click-to-copy-3.x
Make it possible to copy the Godot version identifier by clicking it (3.x)
2021-05-04 17:55:43 +02:00
Rémi Verschelde
60eb2d8cf7 Merge pull request #48454 from akien-mga/3.x-style-changes 2021-05-04 17:55:17 +02:00
Brian Semrau
57e3f357dc Batching fix polygon basis polarity
Changes based on fix in #46898
2021-05-04 10:48:58 -04:00
Rémi Verschelde
0c8b5b5c4d Style: Remove redundant void argument lists
Using clang-tidy's `modernize-redundant-void-arg`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-redundant-void-arg.html
2021-05-04 16:40:33 +02:00
Rémi Verschelde
b4af1eba0a Style: Enforce use of bool literals instead of integers
Using clang-tidy's `modernize-use-bool-literals`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html
2021-05-04 16:39:13 +02:00
Hugo Locurcio
1ceb603de8 Make it possible to copy the Godot version identifier by clicking it
This closes #24317.
2021-05-04 16:38:17 +02:00
Rémi Verschelde
a828398655 Style: Replaces uses of 0/NULL by nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2021-05-04 16:30:23 +02:00
Rémi Verschelde
2b429b24b5 Merge pull request #48447 from akien-mga/3.x-style-changes 2021-05-04 16:30:15 +02:00
Rémi Verschelde
b5e1e05ef2 Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2021-05-04 14:45:16 +02:00
Rémi Verschelde
64a63e0861 Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde
3d15f04668 Style: clang-format: Disable AllowShortIfStatementsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde
6e600cb3f0 Style: Set clang-format Standard to c++14 2021-05-04 14:45:15 +02:00
Rémi Verschelde
7e61be3cb0 Style: Remove executable bit from non-runnable files 2021-05-04 14:45:07 +02:00
Koala
d08666f999 Fix indent left line selection
(cherry picked from commit 2c64008718)
2021-05-04 12:47:36 +02:00
PouleyKetchoupp
cc83557716 Allow values > 1 for friction and bounce in PhysicsMaterial
(cherry picked from commit 67987be644)
2021-05-04 12:46:35 +02:00
Rémi Verschelde
2660f24160 Merge pull request #48429 from kleonc/posmod-change-int-to-int64
[3.x] Make posmod use int64_t instead of int
2021-05-04 12:31:01 +02:00
Rémi Verschelde
9052d56c92 Merge pull request #48217 from nekomatata/fix-mesh-instance-skinning-init
Fix skinning initialization in MeshInstance when loaded from thread
2021-05-04 12:28:04 +02:00
Rémi Verschelde
32cc022267 Merge pull request #48314 from nekomatata/physics-2d-dynamic-bvh
[3.x] Support for Dynamic BVH as 2D Physics broadphase
2021-05-04 09:23:04 +02:00
Rémi Verschelde
0481a9a6c0 Merge pull request #48426 from akien-mga/3.x-ci-doctool-check
[3.x] CI: Add `--doctool` check to find missing classref updates
2021-05-03 23:09:40 +02:00
Rémi Verschelde
b388412270 CI: Add --doctool check to find missing classref updates
This will enforce that PRs properly sync the class reference templates to match
their changes to the public API, and help notice binding bugs in the process
(e.g. missing enum bindings, unexpected API changes or missing argument names).

This should also serve as a reminder to contributors that their changes impact
the scripting API and might warrant actually filling the descriptions for the
new methods/properties/etc.
2021-05-03 22:45:14 +02:00
Rémi Verschelde
62bea72601 doc: Sync classref with Mono build 2021-05-03 22:34:11 +02:00
kleonc
f04a964627 Make posmod use int64_t instead of int 2021-05-03 22:03:16 +02:00
Rémi Verschelde
136c3b1a16 doc: Sync classref with current source 2021-05-03 21:39:44 +02:00
Michael Alexsander
ae99339e9f Add comment highlighting to script thumbnails
(cherry picked from commit 46e0161737)
2021-05-03 21:39:44 +02:00
Mateo Kuruk Miccino
71a9932f38 FileSystem: Force update when we delete a folder from the editor and searching changes only if we change the directory successfully in the scan_fs_changes
(cherry picked from commit dc76938679)
2021-05-03 21:39:44 +02:00
kleonc
93cb416423 TileMapEditor Modulate autotile previews
(cherry picked from commit 3f1b95cfb1)
2021-05-03 21:39:44 +02:00
kleonc
bf63878141 TileMapEditor::_bucket_fill Check autotile coordinates only if autotile is selected
(cherry picked from commit a1b903066e)
2021-05-03 21:39:44 +02:00
MaxStgs
1fc0fb7a5e Add WebSocketMultiplayerPeer _incoming_packets check bound
(cherry picked from commit 05ad08941b)
2021-05-03 21:39:43 +02:00
Fabio Alessandrelli
77e3514315 [Net] Implement String::parse_url for parsing URLs.
Splits the URL into (scheme, host, port, path).
Supports both literal IPv4 and IPv6.
Strip credentials when present (e.g. http://user:pass@example.com/).

Use that function in both HTTPRequest and WebSocketClient.

(cherry picked from commit 3bb40669d5)
2021-05-03 21:39:43 +02:00
Rémi Verschelde
3b60911857 Merge pull request #48382 from MaxStgs/fix_phash_translation
Check PHashTranslation generate p_from is valid
2021-05-03 17:15:41 +02:00
Rémi Verschelde
6abf571d79 Merge pull request #48324 from MaxStgs/fix_comparsion
[3.x] Fix BakedLightmap bias bound check
2021-05-03 17:06:15 +02:00
MaxStgs
0bb40df4bb Check PHashTranslation generate p_from is valid 2021-05-03 19:58:40 +05:00
Rémi Verschelde
2d1aeac6fd Merge pull request #48402 from lawnjelly/ewok_skin_basexform
Fix 2d software skinning relative transforms
2021-05-03 16:14:03 +02:00
lawnjelly
f33e22001f Fix 2d software skinning relative transforms
All my earlier test cases for software skinning had the polys parent transform to be identity. This works fine until you had cases where the user had moved the transform of the parent nodes of skinned polys.

This PR fixes this situation by taking into account the final (concatenated) transform of the polys RELATIVE to the skeleton base transform. It does this by applying the inverse skeleton base transform to the poly final transform.
2021-05-03 14:11:41 +01:00
MaxStgs
94d0c4182b Add PackedDataContainer data pointer check for non nullable 2021-05-02 15:56:36 +05:00
Rémi Verschelde
c37464bd12 Merge pull request #48362 from Calinou/project-manager-add-about-dialog-3.x
Add the About dialog to the project manager (3.x)
2021-05-02 10:05:37 +02:00
Hugo Locurcio
81ca8e4e7e Add the About dialog to the project manager
The About button is located in the bottom-right corner of the
project manager.

This allows removing the copyright notice from the window title
(which looked a bit ugly in comparison to other applications).
2021-05-02 00:01:23 +02:00
Rémi Verschelde
48cc756f88 Merge pull request #37067 from zaksnet/multiple-editor-instances
Automatic remote debugger port assignment.
2021-05-01 12:57:35 +02:00
Zak
c3cfb87548 Allow multiple editor instances to use different ports
Previously if more than one Godot editor was running then the debugger of one editor would not work because both editors were trying to connect on the same port.
This commit attempts to fix this by allowing the debugger to change the port at runtime in such cases.
2021-05-01 11:32:10 +02:00
PouleyKetchoupp
d8f681029f Support for Dynamic BVH as 2D Physics broadphase
List of changes:
- Modified bvh class to handle 2D and 3D as a template
- Changes in Rect2, Vector2, Vector3 interface to uniformize template
calls
- New option in Project Settings to enable BVH for 2D Physics (enabled
by default like in 3D)
2021-04-30 15:53:15 -07:00
MaxStgs
b4cc8ed6f2 Fix BakedLightmap bias bound check 2021-04-30 15:16:51 +05:00
Hugo Locurcio
1f0e570216 Document that SceneTree.call_group() is deferred
(cherry picked from commit 7516ff3805)
2021-04-30 12:15:24 +02:00
Sergey Minakov
f9535554fa [iOS] Nonnegative start index for virtual keyboard range
(cherry picked from commit 275772818d)
2021-04-30 12:15:24 +02:00
Rémi Verschelde
5a20cef857 Merge pull request #48308 from bruvzg/fix_fontdata_race
Duplicate DynamicFontData resources in the editor preview generation thread to avoid race condition.
2021-04-30 12:12:20 +02:00
Rémi Verschelde
859946d27a Merge pull request #48320 from Faless/js/3.x_modern_emcc
[3.x] [HTML5] Fix build for recent emscripten versions.
2021-04-30 09:38:21 +02:00
Fabio Alessandrelli
b0f6dec02e [HTML5] Fix build for recent emscripten versions.
Library suffix should be `.a`, the `EXTRA_` in
`EXTRA_EXPORTED_RUNTIME_METHODS` is deprecated.
2021-04-30 08:02:21 +02:00
PouleyKetchoupp
0ba5001fb6 Expose get_debug_mesh in Shape to scripting API
Can be useful for custom drawing of physics shapes without having to add
a collision object node to the tree.
2021-04-29 18:20:29 -07:00
bruvzg
301bedd5d4 Duplicate DynamicFontData resources in the editor preview generation thread to avoid race condition. 2021-04-29 23:27:52 +03:00
Rémi Verschelde
3f5c106e64 Merge pull request #48276 from thebestnom/cherrypick/allow-build-android-with-symbols 2021-04-29 21:15:42 +02:00
Rémi Verschelde
594764c2ec Revert "make 2d constraint solving more deterministic by solving in push order"
This reverts commit 266314ba26.

There seems to be some performance concerns, so reverting the cherry-pick for
now and we'll revisit later (see https://github.com/godotengine/godot/pull/44112#issuecomment-829426790).
2021-04-29 19:12:19 +02:00
Rémi Verschelde
780188a7b3 Merge pull request #48301 from akien-mga/3.x-scons-thirdparty-lib-depends
[3.x] SCons: Add explicit dependencies on thirdparty code in cloned env
2021-04-29 17:20:11 +02:00
Rémi Verschelde
e94161dada SCons: Add explicit dependencies on thirdparty code in cloned env
Since we clone the environments to build thirdparty code, we don't get an
explicit dependency on the build objects produced by that environment.

So when we update thirdparty code, Godot code using it is not necessarily
rebuilt (I think it is for changed headers, but not for changed .c/.cpp files),
which can lead to an invalid compilation output (linking old Godot .o files
with a newer, potentially ABI breaking version of thirdparty code).

This was only seen as really problematic with bullet updates (leading to
crashes when rebuilding Godot after a bullet update without cleaning .o files),
but it's safer to fix it everywhere, even if it's a LOT of hacky boilerplate.

(cherry picked from commit c7b53c03ae)
2021-04-29 16:57:00 +02:00
Rémi Verschelde
0c14d10522 Merge pull request #48296 from akien-mga/3.x-cherrypicks 2021-04-29 13:48:49 +02:00
Rémi Verschelde
e20b8b00d5 Merge pull request #48273 from Calinou/doc-spatialmaterial-rim-unshaded
Document that clearcoat/rim lighting is not visible on unshaded materials (3.x)
2021-04-29 13:36:47 +02:00
Rémi Verschelde
f94e76644a Merge pull request #47938 from smix8/doc_skeletonik_3x
[3.x] Document SkeletonIK
2021-04-29 13:34:16 +02:00
Rémi Verschelde
606073db06 Merge pull request #47173 from LightningAA/graphedit-zoom-cherrypicks 2021-04-29 13:33:17 +02:00
Rémi Verschelde
d252ef4c5e Merge pull request #46527 from kuruk-mm/3_2_lineedit 2021-04-29 13:32:33 +02:00
Rémi Verschelde
880b830ca8 Merge pull request #46292 from hilfazer/nested_scene_instances_duplication 2021-04-29 13:31:27 +02:00
Rémi Verschelde
188147e82c Merge pull request #48259 from akien-mga/scenetree-global_menu_action-types
SceneTree: Fix type hints for `global_menu_action` signal
2021-04-29 13:27:32 +02:00
Rémi Verschelde
70ae90e0e8 Core: Drop custom copymem/zeromem defines
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.

There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.

Backport of #48239.
2021-04-29 12:34:11 +02:00
David Snopek
1db31d0afa Fixes #48178: WebXR broken when built with Emscripten 2.0.13 or later
(cherry picked from commit b77925d246)
2021-04-29 12:30:36 +02:00
Rémi Verschelde
d54c13ac1a Tabs: Remove unused 'panel' stylebox from default theme
Cf. https://github.com/godotengine/godot/issues/37875#issuecomment-625297308.

(cherry picked from commit cd8d321961)
2021-04-29 12:30:10 +02:00
Johannes Witt
41a016c1e8 Fix CSG Path Polygon cache being removed after connect
fixes #30229

(cherry picked from commit bab36f1273)
2021-04-29 12:29:28 +02:00
Rémi Verschelde
1489b814aa Android: Upgrade buildTools from 30.0.1 to 30.0.3
It seems 30.0.1 had issues with compatibility with JDK 8 and 11,
which appear to be solved in 30.0.3 as per godotengine/godot-docs#4796.

(cherry picked from commit d88e1f04df)
2021-04-29 12:28:51 +02:00
Fabio Alessandrelli
bfe182f221 [Net] Fix socket poll timeout on Windows.
Now correctly computes the timeout value in milliseconds.

(cherry picked from commit 46f7b0f74b)
2021-04-29 12:28:31 +02:00
Lightning_A
e4addffde1 Put physics override parameters in their own group and document that areas can be used to influence audio
(cherry picked from commit 80b1a29c46)
2021-04-29 12:27:31 +02:00
Aaron Franke
d304187357 Warn when creating a script with the same name as the parent class
(cherry picked from commit 5a9037f828)
2021-04-29 12:23:33 +02:00
Michael Alexsander
917630107c Select non-perfect matches if necessary in the Search Help dialog
(cherry picked from commit 77597ea47c)
2021-04-29 11:41:51 +02:00
Michael Alexsander
b406e904ec Fix EditorInspector not updating its theme on rare occasions
(cherry picked from commit efa3927b49)
2021-04-29 11:40:13 +02:00
floppyhammer
4628ab2a15 ImproveCompletionPanelPositionInShaderEditor
(cherry picked from commit e927a9fef0)
2021-04-29 11:35:52 +02:00
David Hoppenbrouwers
224fce946b Fix joint RID not being passed to _set in PhysicalBone
Also remove default RID() argument from JointData._set()

(cherry picked from commit 41e00b6787)
2021-04-29 11:30:17 +02:00
univeous
43d3eca5e9 allow input echo when changing ui focus
(cherry picked from commit f5b506763e)
2021-04-29 11:27:56 +02:00
lupoDharkael
a5842a8362 Save resource: implement extension priority
give .res less priority and .tres more priority as preferred
extensions.

(cherry picked from commit f2e906496b)
2021-04-29 11:27:56 +02:00
Jordan Schidlowsky
266314ba26 make 2d constraint solving more deterministic by solving in push order
(cherry picked from commit 043b6c2d93)
2021-04-29 11:27:56 +02:00
Lyuma
11b8b8ad27 Allow renaming bones and blendshapes.
(cherry picked from commit d13568a8d1)
2021-04-29 11:27:56 +02:00
Pasi Nuutinmaki
f8c4ffcdde Fix area calculation of Face3
There seemed to be a bug in area calculation in Face3::get_area()-function. It returned the area of "imaginary" parallelogram instead of the triangle. Therefore the area returned was twice the real area. This manifested itself when using a hydro module for godot ( https://gitlab.com/ringtechsolutions/godot-tools/hydro/hydro ) causing the buoyancy to be two times the expected value.

"Reference": http://www.maths.usyd.edu.au/u/MOW/vectors/vectors-11/v-11-7.html

(cherry picked from commit a165eed73b)
2021-04-29 11:10:50 +02:00
skyace65
c05ff94b84 Improve SpriteFrames get_animation_loop description
(cherry picked from commit d311c48d6a)
2021-04-29 11:09:20 +02:00
Rémi Verschelde
0469698b5f Merge pull request #48270 from akien-mga/3.x-deprecate-largetexture
doc: Mark LargeTexture as deprecated (removed in 4.0)
2021-04-29 09:45:20 +02:00
thebestnom
0477256793 [Android] fix generateDevTemplate 2021-04-28 22:00:25 +03:00
thebestnom
fd7141fc03 [Android] Allow to build dev template with symbols 2021-04-28 22:00:25 +03:00
Rémi Verschelde
25b170599b Merge pull request #47129 from mortarroad/3.x-fix-directional-light-order
Fix draw order of transparent materials with multiple directional lights
2021-04-28 19:03:37 +02:00
Hugo Locurcio
8df0e61cc2 Document that clearcoat/rim lighting is not visible on unshaded materials 2021-04-28 17:40:14 +02:00
Rémi Verschelde
31581ca429 Merge pull request #46687 from QbieShay/fix-particle-rotate-y 2021-04-28 17:08:44 +02:00
Rémi Verschelde
135fd8ff8c Merge pull request #34008 from ricmzn/fix-viewport-texture-flags
GLES3: Allow repeat flag in viewport textures
2021-04-28 17:04:47 +02:00
Rémi Verschelde
e9efc349ac Merge pull request #47582 from clayjohn/GLES3-fix-multimesh-modulate
Fix multimesh being colored by other nodes GLES3
2021-04-28 17:02:00 +02:00
Rémi Verschelde
8ec14c917f Merge pull request #47469 from HEAVYPOLY/ios-pen-pressure
Add iOS pen pressure
2021-04-28 17:01:05 +02:00
Rémi Verschelde
a706fb11e5 Merge pull request #47943 from nekomatata/joint-check-body-types-3.x
[3.x] Fix errors related to joints setup with two non-dynamic bodies
2021-04-28 16:58:23 +02:00
Rémi Verschelde
3ded745305 Merge pull request #47887 from Pineapple/separate-set-3x
[3.x] Separate set.h from map.h
2021-04-28 16:58:09 +02:00
Rémi Verschelde
f85d59c97f Merge pull request #47349 from nekomatata/heightmap-support-3.x
[3.x] Heightmap collision shape support in Godot Physics
2021-04-28 16:57:29 +02:00
Rémi Verschelde
80619a00d7 Merge pull request #47979 from HenryWConklin/3.x-optimize-hashgrid-layers
Optimize BroadPhase2dHashGrid to not pair elements on different layers
2021-04-28 16:57:19 +02:00
Rémi Verschelde
3edf1adf91 Merge pull request #38348 from asheraryam/convex-decompose
[3.x] Create GDScript bindings for creating multiple-convex collision bodies
2021-04-28 16:48:59 +02:00
Rémi Verschelde
cdc94387c8 Merge pull request #48154 from ttencate/patch-1
Add OpenSimplexNoise output change to changelog
2021-04-28 16:45:52 +02:00
Rémi Verschelde
581afc76df Merge pull request #48250 from Faless/js/3.x_pwa_final 2021-04-28 16:41:16 +02:00
Rémi Verschelde
562c6bd9ab doc: Mark LargeTexture as deprecated (removed in 4.0)
Cf. https://github.com/godotengine/godot/pull/48269.
2021-04-28 16:21:43 +02:00
Rémi Verschelde
6cb61b67e6 Merge pull request #41471 from Calinou/giprobe-deprecate-compress-3.2 2021-04-28 12:01:55 +02:00
Rémi Verschelde
2b90e92adb Merge pull request #48263 from akien-mga/3.x-ci-emscripten-2.0.15 2021-04-28 11:52:16 +02:00
Rémi Verschelde
9571ae3a33 CI: Upgrade Emscripten to 2.0.15 (same as official standard builds)
We still use Emscripten 1.39.9 for official Mono builds so ideally we want to test
against an old Emscripten version to ensure we don't break compatibility.

But then google-closure-compiler-linux broke compatibility for us and is not properly
pinned, so we need to use a more recent version for now to fix CI.

Cf. https://github.com/emscripten-core/emsdk/issues/802
2021-04-28 10:59:57 +02:00
Rémi Verschelde
6ba10c6c1f SceneTree: Fix type hints for global_menu_action signal
Fixes https://github.com/godotengine/godot-headers/issues/89.
2021-04-28 09:40:59 +02:00
Rémi Verschelde
94235fad03 Merge pull request #48246 from madmiraal/fix-24111-3.x
[3.x] Update CSGMesh's documentation to explain how vertex normals are used
2021-04-27 23:05:11 +02:00
Marcel Admiraal
a68c88adfd Update CSGMesh3D's documentation to explain how vertex normals are used 2021-04-27 18:37:19 +01:00
Rémi Verschelde
3fd77a8404 Merge pull request #48240 from qarmin/3.x_input
[3.x] Fix crashes when using _input functions
2021-04-27 18:39:01 +02:00
Rafał Mikrut
06976c3e84 [3.x] Fix crashes when using _input functions 2021-04-27 16:51:29 +02:00
Fabio Alessandrelli
9446be7dad [HTML5] Export as Progressive Web App.
Adds possibility to export as a progressive web app.
Allows customizing base icons, display mode, orientation and offline
page.
2021-04-27 15:09:03 +02:00
Fabio Alessandrelli
cb65f9d64b [HTML5] HTTP server uses optional SSL.
Generates a key/cert snakeoil pair or use a custom SSL cert/key.
This is of course false security, and potentially detrimental for it.

But, so long, those are the requirements browser vendors agreed on to
use things like the Gamepad API, and more advanced topics like wasm
threads.

You don't need this if you run on localhost (at least!), but you do
need this (or a much safer nginx proxy) to try those things on your
local network (e.g. when debugging a phone, networking, etc).
2021-04-27 15:09:03 +02:00
Fabio Alessandrelli
a7f2b723d6 [HTML5] Optional icon generation, use export name for it.
We used to only generate the favicon if it was specified in the user
project settings, now it's optional, will export it to `NAME.icon.png`,
(falling back to the default project icon if none is set in project
settings), and the `<link>` tag is added using the `$HEAD_INCLUDE`
instead of being hardcoded in the template.
2021-04-27 15:09:03 +02:00
Fabio Alessandrelli
ad160c7f46 [HTML5] Debug HttpServer now runs in web cache subdir.
Serving all files in that folder and using a known list of mime types.
Makes it easy to add more exported files, while still playing safe.
2021-04-27 15:09:03 +02:00
Rémi Verschelde
2d57df60f7 Merge pull request #48144 from Faless/crypto/3.3_encryption_stable 2021-04-27 13:46:49 +02:00
Rémi Verschelde
3b12daa10d Linux: Remove use_static_cpp override on x86_32
After further testing it seems to work fine now when building binaries with GCC 5
on Ubuntu 16.04 (previously we were using GCC 9 on Ubuntu 14.04).

Follow-up to #45629.

(cherry picked from commit aa15ad72ee)
2021-04-27 13:44:04 +02:00
Rémi Verschelde
1ba636ee4a Merge pull request #48227 from akien-mga/3.x-macos-min-req-10.12
OSX: Clarify min version requirement (10.12) in Info.plist
2021-04-27 10:18:35 +02:00
Rémi Verschelde
8851fa7808 OSX: Clarify min version requirement (10.12) in Info.plist
The min requirement was upped by #45618 to have proper support for C++14.

Related to #48222.
2021-04-27 09:54:27 +02:00
asheraryam
342c88841d Create bindings for creating multiple-convex-collision static bodies from gdscript 2021-04-27 06:55:17 +03:00
PouleyKetchoupp
feee9f9695 Fix skinning initialization in MeshInstance when loaded from thread
Fix for a regression from software skinning support:
instance_attach_skeleton wasn't called in set_mesh before, and it's
causing issues when the mesh instance is loaded from a thread.
1. Call from a thread queues instance_attach_skeleton with RID() in the
visual server.
2. Call from the main thread when entering tree calls
instance_attach_skeleton immediately with a valid skeleton
3. Queued instance_attach_skeleton resets the attached skeleton

This change prevents that to happen by making sure
instance_attach_skeleton is not called on set_mesh as it was doing
before, but there might be a more general problem to solve in how
visual server commands are executed when resources are loaded from
a different thread.
2021-04-26 11:42:46 -07:00
Thomas ten Cate
a980bad0b0 Add OpenSimplexNoise output change to changelog 2021-04-26 20:26:58 +02:00
Lightning_A
827f6739a2 Initialize some graphedit values in the header 2021-04-26 09:22:28 -06:00
Rémi Verschelde
a6651de537 Merge pull request #48209 from akien-mga/3.x-cherrypicks 2021-04-26 13:43:34 +02:00
Rémi Verschelde
c3272997cd doc: Update classref headers with 3.4 version 2021-04-26 13:15:29 +02:00
ray90514
bf645099a1 Fix multi-selection doesn't correctly show in the inspector
(cherry picked from commit 16decbc0ee)
2021-04-26 13:15:29 +02:00
Hugo Locurcio
e2934a04e2 Allow Center Selection to work without any selection in 2D/3D editors
When there is no selection, the camera will center around the
world origin.

This helps people get back to the world center if they haven't added
any nodes yet.

(cherry picked from commit fc055e1993)
2021-04-26 13:15:28 +02:00
kobewi
b824895065 Allow to drop files on filtered scene tree
(cherry picked from commit 4e64c9fd4d)
2021-04-26 13:15:28 +02:00
Hugo Locurcio
4881d96ef0 Display scene file extensions in the editor only if there's ambiguity
This also simplifies the Editor Settings as the extension is now
automatically shown to avoid ambiguity.

(cherry picked from commit 218d124755)
2021-04-26 13:15:28 +02:00
kobewi
645842e0e8 Save project after opening
(cherry picked from commit 76240515d8)
2021-04-26 13:15:28 +02:00
Tomasz Chabora
44e84c61a6 Add disabled theme icons for CheckBox
(cherry picked from commit 3a40c268a6)
2021-04-26 13:15:28 +02:00
Kyle
cc419fcf8f Fixes ctrl-click function line centering
When ctrl-clicking in the code editor, the view will now be centered on the function result.

Also replaces a circumstance where goto_line_centered should be used.

(cherry picked from commit 2b775bd698)
2021-04-26 13:07:59 +02:00
Shatur95
41e7cefaa4 Move duplicated code into a function
(cherry picked from commit a1cfc1032c)
2021-04-26 13:07:59 +02:00
Sergey Minakov
78837f5c65 Core: add EOF check for json parser
Additionally reset parse result if error was found.

(cherry picked from commit a2676ff810)
2021-04-26 13:07:59 +02:00
Johannes
a3c67dd3fc Fix removal of rect_min_size not triggering resize
fixes #46672

(cherry picked from commit c8868fcaab)
2021-04-26 13:07:59 +02:00
Hugo Locurcio
58393b544b Tweak error messages for the Save Branch as Scene editor option
See https://github.com/godotengine/godot-proposals/issues/2433.

(cherry picked from commit 4c8f458c90)
2021-04-26 13:07:59 +02:00
Ev1lbl0w
c2b85ed865 Allow Godot to import .ZIP files with non-regular structure
(cherry picked from commit 9b1db715fd)
2021-04-26 13:07:58 +02:00
Nathan Franke
1001bea7ac Collapse Resource Preview Properly
(cherry picked from commit 98c46cbf26)
2021-04-26 13:07:58 +02:00
Maganty Rushyendra
c5e8a81737 Fix AudioServer Crash when bus count equals 0
(cherry picked from commit ccc375f163)
2021-04-26 13:07:58 +02:00
Marcel Admiraal
cfccf77edb Fix CSGMesh undo not refreshing gizmo
(cherry picked from commit 4311c2f66e)
2021-04-26 12:52:15 +02:00
Lightning_A
a853cf25f6 Remove current export template version from "Installed Versions"
**Not tested** (I don't have an easy way to test currently). Resolves https://github.com/godotengine/godot-proposals/issues/2394 .

(cherry picked from commit c562c6943f)
2021-04-26 12:52:15 +02:00
Hugo Locurcio
7cb77a859a Add a menu action to open C++ source on GitHub in the editor debugger
This helps user find back the source code where the error/warning
was emitted from.

(cherry picked from commit 5bc746e60a)
2021-04-26 12:52:15 +02:00
Sushi
79f48642a8 Fix: Selection Only in Find/Replace now preserves selection
(cherry picked from commit a4d5664858)
2021-04-26 12:52:15 +02:00
Hugo Locurcio
a989e08839 Improve error messages for missing export presets when using --export
- Display a specific error message if the project doesn't have an
  `export_presets.cfg` file.
- Display a list of detected export presets if an invalid export
  preset name is supplied.

(cherry picked from commit 09f38ea215)
2021-04-26 12:20:28 +02:00
Rémi Verschelde
263c250067 Main: Default --doctool path to '.' if none given
(cherry picked from commit 096ef0dc91)
2021-04-26 12:20:28 +02:00
Hugo Locurcio
94e0d02079 Strip leading/trailing whitespace for project name in the project manager
This affects creating projects and renaming them.

(cherry picked from commit 86455d0c58)
2021-04-26 12:20:28 +02:00
Rémi Verschelde
030f0f58a3 Scene: Remove unused mesh_materials StringNames
They were added in 8be2fabbe5 (2.1 era) but
were likely a first attempt that didn't get unused in the end.

(cherry picked from commit 764eee03a4)
2021-04-26 12:20:28 +02:00
ray90514
ea8004052d Fix LineEdit undo behaves strangely
(cherry picked from commit 7501c7f48a)
2021-04-26 12:20:28 +02:00
Francois Belair
1f54a75310 Make LSP update the filesystem of changed scripts
This updates global classes and exposes base member variables.
Fixes #39713

(cherry picked from commit b16bb33a5b)
2021-04-26 12:20:28 +02:00
Rémi Verschelde
137f71fd75 Merge pull request #48173 from madmiraal/fix-empty-csgshape-error-3.x
[3.x] Fix new `CSGMesh` errors
2021-04-26 12:20:08 +02:00
Rémi Verschelde
cbd47665ea Merge pull request #48125 from lawnjelly/ewok_fix_translate_size
Batching - fix number of verts in translation
2021-04-26 11:53:00 +02:00
Rémi Verschelde
e554ecd691 Merge pull request #47451 from BastiaanOlij/arvr_positional_tracker_ref
Change ARVRPositionalTracker to a reference (3.x)
2021-04-26 07:45:34 +02:00
Marcel Admiraal
decdf4fcbc Fix empty CSGShape error 2021-04-25 08:01:14 +01:00
Rémi Verschelde
5942a70596 Merge pull request #48151 from lawnjelly/ewok_gles3_light_modulate
Batching - GLES3 fix light pass modulates
2021-04-24 12:24:05 +02:00
lawnjelly
35c5ccce9e Batching - GLES3 fix light pass modulates
The final_modulate was incorrectly being set in the uniform on light passes in GLES3 in situations where color was baked in the vertices. This was already correct in GLES2. This PR makes prevents setting final_modulate in this situation.
2021-04-24 10:21:33 +01:00
Rémi Verschelde
e572be0c5f Merge pull request #47484 from rafallus/fix/rigidbody-crash3.x
Fix crash on RigidBody _direct_state_changed (3.x)
2021-04-24 01:36:24 +02:00
Fabio Alessandrelli
2e7976181b Document AES and new Crypto/CryptoKey functions. 2021-04-24 00:04:56 +02:00
Fabio Alessandrelli
dcd5433b3b Implement RSA encryption/decryption. 2021-04-24 00:04:56 +02:00
Fabio Alessandrelli
09b9e65688 Implement sign and verify in crypto. 2021-04-24 00:04:56 +02:00
Fabio Alessandrelli
09af27fa39 CryptoKey supports public keys. 2021-04-24 00:04:56 +02:00
Fabio Alessandrelli
ef77fb0a38 Add AESContext.
GDScript interface to CryptoCore::AESContext.
Also add CBC mode in CryptoCore::AESContext and expose it.
2021-04-24 00:04:56 +02:00
Fabio Alessandrelli
a486783d3d Better zeroizing in CryptoKey. 2021-04-24 00:04:56 +02:00
Rémi Verschelde
32c1bada99 Merge pull request #47827 from Chaosus/vs_fix_default_input_overriding_3.2
[3.x] Prevents default values of VSNodeCustom from overriding by a script
2021-04-23 22:06:08 +02:00
Hugo Locurcio
6f16302d49 Link to Feature tags more explicitly in ProjectSettings documentation
(cherry picked from commit 188bd5638c)
2021-04-23 22:05:05 +02:00
Bhuvan Vemula
1c1ec81455 instance-scene: make parent as edited_scene if no parent selected.
(cherry picked from commit 9eb3546f38)
2021-04-23 21:52:21 +02:00
Arthur Paulino
d27fbe10ad Updating KinematicBody2D "is_on" functions' descriptions
(cherry picked from commit 0c9a1a1cd4)
2021-04-23 21:51:42 +02:00
kobewi
07fb3c6aca Make randomize() use unix time too
(cherry picked from commit 22efa850bd)
2021-04-23 21:50:34 +02:00
Rémi Verschelde
6ed82812aa NodePath: Remove unimplemented get_parent() method
Fixes #48100.

(cherry picked from commit 12f826da7d)
2021-04-23 21:50:00 +02:00
Rémi Verschelde
5820e36705 Android: Fix get_buffer false positive on empty dest buffer
Follow-up to #46810, this was missed in #47079 when fixing the issue
for other platforms.

Fixes #48135.

(cherry picked from commit a09f3833bd)
2021-04-23 21:49:31 +02:00
Lightning_A
2c4aa50648 Fix Array.max() navigating to @GDScript.max() etc. 2021-04-23 09:40:24 -06:00
Rémi Verschelde
ed9c366370 Merge pull request #48105 from kleonc/arg3x
[3.x] Improve some argument names for core types
2021-04-23 17:13:32 +02:00
kleonc
4d7f642fb3 Improve some argument names for core types 2021-04-23 15:34:24 +02:00
Rémi Verschelde
aa4cb409ce Merge pull request #48124 from akien-mga/3.x-linux-more-embree3-woes
Linux: Don't attempt linking embree3 on non-tools, link it for headless too
2021-04-23 12:33:55 +02:00
Rémi Verschelde
a14b51df92 Linux: Don't attempt linking embree3 on non-tools, link it for headless too
`tech_debt++`, that's what we get for not taking the time to cleanup all this
and do it right...

Follow-up to #48073 and #48102.
2021-04-23 10:40:53 +02:00
lawnjelly
d08cf5f434 Batching - fix number of verts in translation
The translation to larger vertex formats was assuming that batches were rects, and not accounting that the num_commands had a different meaning for lines and polys, so the calculation for number of vertices to translate was incorrect in these cases.

Also prevents infinite loop if a single polygon has too many vertices to fit in the batch buffer.
2021-04-23 09:24:15 +01:00
Rémi Verschelde
adaf488963 Merge pull request #48107 from pycbouh/the-rose-by-any-other-name
Correct pre-deprecation warning message regarding linuxbsd/x11 platform
2021-04-23 10:14:42 +02:00
Yuri Sizov
dbd4b45ca2 Correct pre-deprication warning message regarding linuxbsd/x11 platform 2021-04-22 21:54:35 +03:00
Rémi Verschelde
3768a37e39 Merge pull request #48102 from akien-mga/3.x-no-lightmapper-if-no-embree
lightmapper: Disable build if raycast module can't build
2021-04-22 19:42:02 +02:00
Rémi Verschelde
a2c68d9da7 lightmapper: Disable build if raycast module can't build
We need to propagate the hacky checks from the raycast config to the
lightmapper config, as the failure of a `can_build()` check is not notified to
other modules (which might even be checked further depending on the processing
order in SConstruct).

A more thorough fix would be to change SConstruct to do two loops on modules:
one to check `can_build()` and disable modules which can't build, then another
one to rechecked `can_build()` with the new lineup and do further config.
But there would be more risk for regressions than with this ad hoc hack.

Similar story for the `platform/x11/detect.py` change... oh my eyes :(
2021-04-22 19:12:37 +02:00
Rémi Verschelde
b1898c77fb Merge pull request #48073 from akien-mga/3.x-unbundle-embree
embree: Allow building against system library on Linux
2021-04-22 18:06:49 +02:00
Rémi Verschelde
10e86bc017 Add type_traits include for std::is_trivially_destructible
(cherry picked from commit 3d46f28558)
2021-04-22 17:22:52 +02:00
Rémi Verschelde
2a00a6bfca fbx: Fix include for zlib that broke unbundling
It's possible to link against system zlib on Linux, so we should use system paths.

(cherry picked from commit 93b7406138)
2021-04-22 17:22:18 +02:00
bruvzg
575433b997 Fix crash on GDNative API json generator exit.
(cherry picked from commit a4423c82f8)
2021-04-22 17:21:52 +02:00
Rémi Verschelde
b266cc2315 embree: Allow building against system library on Linux 2021-04-22 17:06:28 +02:00
Rémi Verschelde
a86f5462cf Merge pull request #48089 from JFonS/cpulm_fixes
[3.x] CPU lightmapper environment energy fixes.
2021-04-22 16:52:19 +02:00
Rémi Verschelde
f36046f0ab Merge pull request #48094 from Calinou/editor-lightmap-warning-apple-silicon
Tweak lightmapper warning message to mention Rosetta emulation on macOS
2021-04-22 16:41:59 +02:00
JFonS
2db2d1153d CPU lightmapper environment energy fixes.
* Better handling of the scene's environment energy in the lightmapper
  bakes.
* Fixed a bug where ProceduralSky::get_panorama() returned a reference
  instead of a copy.
* Removed includes to Embree's internal header files.
2021-04-22 16:26:04 +02:00
Hugo Locurcio
47f869b731 Tweak lightmapper warning message to mention Rosetta emulation on macOS 2021-04-22 15:57:52 +02:00
Rémi Verschelde
5e74554c9a Bump version to 3.4-beta
Feature work in 3.x likely won't have a big impact on stability so we can skip
the dev/alpha phases and we'll start directly with a 3.4 beta 1 build once
significant changes have been implemented.
2021-04-22 15:27:35 +02:00
smix8
84e603ec7e Add SkeletonIK function documentation
Add SkeletonIK function documentation
2021-04-20 22:16:43 +02:00
Henry Conklin
8e4641bc88 Optimize BroadPhase2dHashGrid to not pair elements on different layers
Clean up logic in _check_motion

Closes 45824
2021-04-17 10:49:06 -04:00
PouleyKetchoupp
64b11b6126 Fix errors related to joints setup with two non-dynamic bodies 2021-04-15 17:53:15 -07:00
Bartłomiej T. Listwon
011a3d69e2 Separate set.h from map.h 2021-04-14 13:06:12 +02:00
Marvin Ewald
3715ea268f Allow warning-ignore in same line 2021-04-13 13:55:33 +02:00
Yuri Roubinsky
ac91e2ca0d [3.2] Prevents default values of VSNodeCustom from overriding by a script 2021-04-12 14:52:19 +03:00
rafallus
e075b6b411 Check if _direct_state_changed() argument is valid
- Modified classes: RigidBody, PhysicalBone, VehicleBody, RigidBody2D, KinematicBody2D
- The input argument is untrusted even in release mode
2021-04-07 20:00:30 -05:00
Lightning_A
77cf07c013 Make scrollwheel zoom based on mouse position, cherry-picked for 3.x 2021-04-06 09:36:15 -06:00
Vaughan Ling
f60b90d92e Add iOS Apple Pencil pressure 2021-04-03 10:30:57 -07:00
clayjohn
92bf493821 Fix multimesh being colored by other nodes GLES3 2021-04-02 14:01:47 -07:00
Bastiaan Olij
4cce36e35d Change ARVRPositionalTracker to a reference and better expose it to GDNative 2021-03-29 23:01:04 +11:00
Morris Tabor
63b7b7773c Fix draw order of transparent materials with multiple directional lights 2021-03-26 12:31:40 +01:00
PouleyKetchoupp
3ea72b273d Heightmap collision shape support in Godot Physics 2021-03-25 16:52:20 -07:00
Morris Tabor
e06b096994 Fix ParticlesMaterial spread 2021-03-25 17:27:00 +01:00
PouleyKetchoupp
14d3a8dd83 Draw triangles for HeightMapShape debug collision
Helps with ambiguous cases where it's not possible to tell which diagonal is used for collision in quads.
2021-03-24 17:51:27 -07:00
Dominik 'dreamsComeTrue' Jasiński
de63d0ffa7 Make Animation's SceneTreeDialog filter nodes properly
3.x version of https://github.com/godotengine/godot/pull/46938
2021-03-21 14:02:39 +01:00
Lightning_A
72c54c10eb Enable zooming graph_edit with scrollwheel, cherry-picked for 3.x 2021-03-19 14:18:46 -06:00
Yuri Roubinsky
70cd4c5958 Fix GraphEdit connects when graph is zoomed/unzoomed, cherry-picked for 3.x 2021-03-19 14:12:23 -06:00
Yuri Roubinsky
3ad676cbbe Fix GraphEdit reconnecting to disconnected port, cherry-picked for 3.x 2021-03-19 14:12:11 -06:00
Yuri Roubinsky
0b7384621e Prevents incorrect connection attempt on port clicking in GraphEdit, cherry-picked for 3.x 2021-03-19 14:11:54 -06:00
jmb462
c695ef29b8 3.2 - Fix Tween.is_active() always true after stop() and then start()
Fix #39760 & #39801

These issues were resolved in master branch (and closed) but are still active in the 3.2 branch.
2021-03-18 22:01:59 +01:00
QbieShay
ffbb81e769 fixed particle rotate y flag 2021-03-05 11:31:03 +01:00
QbieShay
b239c6706e visual server now sorts based on aabb position
this was causing issues with scenes where the origin of the objects
was set for all objects to the center of the scene, making transparent
objects sort improperly

This work was kindly sponsored by IMVU

Co-authored-by: RevoluPowered <gordon@gordonite.tech>
2021-03-05 11:06:11 +01:00
Mateo Kuruk Miccino
74b3021691 LineEdit: Now double click to select a word, and triple click to select all the content 2021-02-28 17:41:11 -03:00
hilfazer
c76e832b1c Support for duplication of nested instanced scenes 2021-02-21 18:34:52 +01:00
Haoyu Qiu
e3b7b861b0 Fixes display of programmatically created value in remote inspector 2020-12-24 22:39:38 +08:00
Hugo Locurcio
34ac0387d6 Deprecate the GIProbe Compress property due to known bugs
This property introduced green artifacts in GI and didn't improve
performance.

The new GIProbe in `master` no longer has a Compress property.
2020-10-19 14:51:23 +02:00
Marcel Admiraal
e7d779dbb3 Increment index when populating PhysicsShapeQueryParameters exclude array. 2020-09-27 10:33:35 +01:00
Rhathe
768f4e684c Enable setting of collision iterations in Physics2DServer
This allows fine-tuning of collision iterations for more
accurate collision physics with a performance cost.
2020-05-01 03:49:21 -04:00
Ricardo Maes
ebf2759a1c Fix render target textures not allowing repeat flag 2019-11-29 18:40:22 -03:00
3420 changed files with 3050549 additions and 212789 deletions

View File

@@ -1,31 +1,41 @@
# Commented out parameters are those with the same value as base LLVM style
# Commented out parameters are those with the same value as base LLVM style.
# We can uncomment them if we want to change their value, or enforce the
# chosen value in case the base style changes (last sync: Clang 6.0.1).
# chosen value in case the base style changes (last sync: Clang 13.0).
---
### General config, applies to all languages ###
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
# AlignConsecutiveAssignments: false
# AlignConsecutiveDeclarations: false
# AlignArrayOfStructures: None
# AlignConsecutiveMacros: None
# AlignConsecutiveAssignments: None
# AlignConsecutiveBitFields: None
# AlignConsecutiveDeclarations: None
# AlignEscapedNewlines: Right
# AlignOperands: true
AlignOperands: DontAlign
AlignTrailingComments: false
# AllowAllArgumentsOnNextLine: true
# AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
# AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: true
# AllowShortEnumsOnASingleLine: true
# AllowShortBlocksOnASingleLine: Never
# AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: true
# AllowShortLambdasOnASingleLine: All
# AllowShortIfStatementsOnASingleLine: Never
# AllowShortLoopsOnASingleLine: false
# AlwaysBreakAfterDefinitionReturnType: None
# AlwaysBreakAfterReturnType: None
# AlwaysBreakBeforeMultilineStrings: false
# AlwaysBreakTemplateDeclarations: false
# AlwaysBreakTemplateDeclarations: MultiLine
# AttributeMacros:
# - __capability
# BinPackArguments: true
# BinPackParameters: true
# BraceWrapping:
# AfterCaseLabel: false
# AfterClass: false
# AfterControlStatement: false
# AfterControlStatement: Never
# AfterEnum: false
# AfterFunction: false
# AfterNamespace: false
@@ -35,14 +45,18 @@ AllowShortIfStatementsOnASingleLine: true
# AfterExternBlock: false
# BeforeCatch: false
# BeforeElse: false
# BeforeLambdaBody: false
# BeforeWhile: false
# IndentBraces: false
# SplitEmptyFunction: true
# SplitEmptyRecord: true
# SplitEmptyNamespace: true
# BreakBeforeBinaryOperators: None
# BreakBeforeConceptDeclarations: true
# BreakBeforeBraces: Attach
# BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: false
# BreakInheritanceList: BeforeColon
# BreakBeforeTernaryOperators: true
# BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: AfterColon
# BreakStringLiterals: true
@@ -53,14 +67,19 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
Cpp11BracedListStyle: false
# DeriveLineEnding: true
# DerivePointerAlignment: false
# DisableFormat: false
# EmptyLineAfterAccessModifier: Never
# EmptyLineBeforeAccessModifier: LogicalBlock
# ExperimentalAutoDetectBinPacking: false
# FixNamespaceComments: true
# ForEachMacros:
# - foreach
# - Q_FOREACH
# - BOOST_FOREACH
# IfMacros:
# - KJ_IF_MAYBE
# IncludeBlocks: Preserve
IncludeCategories:
- Regex: '".*"'
@@ -70,13 +89,21 @@ IncludeCategories:
- Regex: '^<.*'
Priority: 3
# IncludeIsMainRegex: '(Test)?$'
# IncludeIsMainSourceRegex: ''
# IndentAccessModifiers: false
IndentCaseLabels: true
# IndentCaseBlocks: false
# IndentGotoLabels: true
# IndentPPDirectives: None
# IndentExternBlock: AfterExternBlock
# IndentRequires: false
IndentWidth: 4
# IndentWrappedFunctionNames: false
# InsertTrailingCommas: None
# JavaScriptQuotes: Leave
# JavaScriptWrapImports: true
# KeepEmptyLinesAtTheStartOfBlocks: true
KeepEmptyLinesAtTheStartOfBlocks: false
# LambdaBodyIndentation: Signature
# MacroBlockBegin: ''
# MacroBlockEnd: ''
# MaxEmptyLinesToKeep: 1
@@ -86,38 +113,72 @@ IndentWidth: 4
# PenaltyBreakComment: 300
# PenaltyBreakFirstLessLess: 120
# PenaltyBreakString: 1000
# PenaltyBreakTemplateDeclaration: 10
# PenaltyExcessCharacter: 1000000
# PenaltyReturnTypeOnItsOwnLine: 60
# PenaltyIndentedWhitespace: 0
# PointerAlignment: Right
# RawStringFormats:
# - Delimiter: pb
# Language: TextProto
# BasedOnStyle: google
# PPIndentWidth: -1
# ReferenceAlignment: Pointer
# ReflowComments: true
# SortIncludes: true
# ShortNamespaceLines: 1
# SortIncludes: CaseSensitive
# SortJavaStaticImport: Before
# SortUsingDeclarations: true
# SpaceAfterCStyleCast: false
# SpaceAfterLogicalNot: false
# SpaceAfterTemplateKeyword: true
# SpaceBeforeAssignmentOperators: true
# SpaceBeforeCaseColon: false
# SpaceBeforeCpp11BracedList: false
# SpaceBeforeCtorInitializerColon: true
# SpaceBeforeInheritanceColon: true
# SpaceBeforeParens: ControlStatements
# SpaceAroundPointerQualifiers: Default
# SpaceBeforeRangeBasedForLoopColon: true
# SpaceInEmptyParentheses: false
# SpacesBeforeTrailingComments: 1
# SpacesInAngles: false
# SpaceInEmptyBlock: false
# SpaceInEmptyParentheses: false
# SpacesBeforeTrailingComments: 1
# SpacesInAngles: Never
# SpacesInContainerLiterals: true
# SpacesInConditionalStatement: false
# SpacesInContainerLiterals: true
# SpacesInCStyleCastParentheses: false
## Godot TODO: We'll want to use a min of 1, but we need to see how to fix
## our comment capitalization at the same time.
SpacesInLineCommentPrefix:
Minimum: 0
Maximum: -1
# SpacesInParentheses: false
# SpacesInSquareBrackets: false
# SpaceBeforeSquareBrackets: false
# BitFieldColonSpacing: Both
# StatementAttributeLikeMacros:
# - Q_EMIT
# StatementMacros:
# - Q_UNUSED
# - QT_REQUIRE_VERSION
TabWidth: 4
# UseCRLF: false
UseTab: Always
# WhitespaceSensitiveMacros:
# - STRINGIZE
# - PP_STRINGIZE
# - BOOST_PP_STRINGIZE
# - NS_SWIFT_NAME
# - CF_SWIFT_NAME
---
### C++ specific config ###
Language: Cpp
Standard: Cpp03
Standard: c++14
---
### ObjC specific config ###
Language: ObjC
Standard: Cpp03
# ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
# ObjCBreakBeforeNestedBlockParam: true
# ObjCSpaceAfterProperty: false
# ObjCSpaceBeforeProtocolList: true
---

44
.clang-tidy Normal file
View File

@@ -0,0 +1,44 @@
---
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-use-nullptr,readability-braces-around-statements'
WarningsAsErrors: ''
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
FormatStyle: none
CheckOptions:
CheckOptions:
- key: cert-dcl16-c.NewSuffixes
value: 'L;LL;LU;LLU'
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
value: '0'
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
value: '1'
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: '1'
- key: google-readability-function-size.StatementThreshold
value: '800'
- key: google-readability-namespace-comments.ShortNamespaceLines
value: '10'
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '2'
- key: modernize-loop-convert.MaxCopySize
value: '16'
- key: modernize-loop-convert.MinConfidence
value: reasonable
- key: modernize-loop-convert.NamingStyle
value: CamelCase
- key: modernize-pass-by-value.IncludeStyle
value: llvm
- key: modernize-replace-auto-ptr.IncludeStyle
value: llvm
- key: modernize-use-bool-literals.IgnoreMacros
value: '0'
- key: modernize-use-default-member-init.IgnoreMacros
value: '0'
- key: modernize-use-default-member-init.UseAssignment
value: '1'
- key: modernize-use-nullptr.NullMacros
value: 'NULL'
- key: readability-braces-around-statements.ShortStatementLines
value: '0'
...

View File

@@ -13,7 +13,7 @@ trim_trailing_whitespace = true
indent_style = space
indent_size = 4
[{*.{py,cs},SConstruct,SCsub}]
[{*.py,SConstruct,SCsub}]
indent_style = space
indent_size = 4
@@ -21,7 +21,3 @@ indent_size = 4
[*.{yml,yaml}]
indent_style = space
indent_size = 2
[*.{csproj,props,targets,nuspec}]
indent_style = space
indent_size = 2

2
.gitattributes vendored
View File

@@ -5,6 +5,8 @@ thirdparty/* linguist-vendored
# Normalize EOL for all files that Git considers text files
* text=auto eol=lf
# Except for bat files, which are Windows only files
*.bat eol=crlf
# The above only works properly for Git 2.10+, so for older versions
# we need to manually list the binary files we don't want modified.

36
.github/actions/godot-build/action.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: Build Godot
description: Build Godot with the provided options.
inputs:
target:
description: The scons target (debug/release_debug/release).
default: "debug"
tools:
description: If tools are to be built.
default: false
tests:
description: If tests are to be built.
default: false
platform:
description: The Godot platform to build.
required: false
sconsflags:
default: ""
scons-cache:
description: The scons cache path.
default: "${{ github.workspace }}/.scons-cache/"
scons-cache-limit:
description: The scons cache size limit.
default: 4096
runs:
using: "composite"
steps:
- name: Scons Build
shell: sh
env:
SCONSFLAGS: ${{ inputs.sconsflags }}
SCONS_CACHE: ${{ inputs.scons-cache }}
SCONS_CACHE_LIMIT: ${{ inputs.scons-cache-limit }}
run: |
echo "Building with flags:" ${{ env.SCONSFLAGS }}
scons p=${{ inputs.platform }} target=${{ inputs.target }} tools=${{ inputs.tools }} tests=${{ inputs.tests }} --jobs=2 ${{ env.SCONSFLAGS }}
ls -l bin/

22
.github/actions/godot-cache/action.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: Setup Godot build cache
description: Setup Godot build cache.
inputs:
cache-name:
description: The cache base name (job name by default).
default: "${{github.job}}"
scons-cache:
description: The scons cache path.
default: "${{github.workspace}}/.scons-cache/"
runs:
using: "composite"
steps:
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
uses: actions/cache@v2
with:
path: ${{inputs.scons-cache}}
key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}

27
.github/actions/godot-deps/action.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
name: Setup python and scons
description: Setup python, install the pip version of scons.
inputs:
python-version:
description: The python version to use.
default: "3.x"
python-arch:
description: The python architecture.
default: "x64"
runs:
using: "composite"
steps:
# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: ${{ inputs.python-version }}
# Optional - x64 or x86 architecture, defaults to x64
architecture: ${{ inputs.python-arch }}
- name: Setup scons
shell: bash
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
scons --version

View File

@@ -0,0 +1,19 @@
name: Upload Godot artifact
description: Upload the Godot artifact.
inputs:
name:
description: The artifact name.
default: "${{ github.job }}"
path:
description: The path to upload.
required: true
default: "bin/*"
runs:
using: "composite"
steps:
- name: Upload Godot Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ inputs.name }}
path: ${{ inputs.path }}
retention-days: 14

View File

@@ -3,10 +3,12 @@ on: [push, pull_request]
# Global Settings
env:
GODOT_BASE_BRANCH: 3.x
SCONSFLAGS: platform=android verbose=yes warnings=all werror=yes debug_symbols=no --jobs=2
SCONS_CACHE_LIMIT: 4096
ANDROID_NDK_VERSION: 21.1.6352462
GODOT_BASE_BRANCH: 3.4
SCONSFLAGS: verbose=yes warnings=all werror=yes debug_symbols=no
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-android
cancel-in-progress: true
jobs:
android-template:
@@ -24,57 +26,40 @@ jobs:
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
sudo apt-get update
- name: Set up Java 8
- name: Set up Java 11
uses: actions/setup-java@v1
with:
java-version: 8
java-version: 11
- name: Install Android NDK r21
run: |
sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install 'ndk;${{env.ANDROID_NDK_VERSION}}'
- name: Setup Godot build cache
uses: ./.github/actions/godot-cache
continue-on-error: true
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: android-template-cache
uses: actions/cache@v2
- name: Setup python and scons
uses: ./.github/actions/godot-deps
- name: Compilation (armv7)
uses: ./.github/actions/godot-build
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
sconsflags: ${{ env.SCONSFLAGS }} android_arch=armv7
platform: android
target: release
tools: false
# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
- name: Compilation (arm64v8)
uses: ./.github/actions/godot-build
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
sconsflags: ${{ env.SCONSFLAGS }} android_arch=arm64v8
platform: android
target: release
tools: false
- name: Configuring Python packages
- name: Generate Godot templates
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
ANDROID_NDK_ROOT: /usr/local/lib/android/sdk/ndk/${{env.ANDROID_NDK_VERSION}}/
run: |
scons target=release tools=no android_arch=armv7
scons target=release tools=no android_arch=arm64v8
cd platform/android/java
./gradlew generateGodotTemplates
cd ../../..
ls -l bin/
- uses: actions/upload-artifact@v2
with:
name: ${{ github.job }}
path: bin/*
retention-days: 14
- name: Upload artifact
uses: ./.github/actions/upload-artifact

View File

@@ -3,9 +3,12 @@ on: [push, pull_request]
# Global Settings
env:
GODOT_BASE_BRANCH: 3.x
SCONSFLAGS: platform=iphone verbose=yes warnings=all werror=yes debug_symbols=no --jobs=2
SCONS_CACHE_LIMIT: 4096
GODOT_BASE_BRANCH: 3.4
SCONSFLAGS: verbose=yes warnings=all werror=yes debug_symbols=no
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-ios
cancel-in-progress: true
jobs:
ios-template:
@@ -15,44 +18,20 @@ jobs:
steps:
- uses: actions/checkout@v2
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: ios-template-cache
uses: actions/cache@v2
- name: Setup Godot build cache
uses: ./.github/actions/godot-cache
continue-on-error: true
- name: Setup python and scons
uses: ./.github/actions/godot-deps
- name: Compilation (armv7)
uses: ./.github/actions/godot-build
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
sconsflags: ${{ env.SCONSFLAGS }}
platform: iphone
target: release
tools: false
# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# You can test your matrix by printing the current Python version
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons target=release tools=no
ls -l bin/
- uses: actions/upload-artifact@v2
with:
name: ${{ github.job }}
path: bin/*
retention-days: 14
- name: Upload artifact
uses: ./.github/actions/upload-artifact

View File

@@ -3,11 +3,14 @@ on: [push, pull_request]
# Global Settings
env:
GODOT_BASE_BRANCH: 3.x
SCONSFLAGS: platform=javascript verbose=yes warnings=all werror=yes debug_symbols=no --jobs=2
SCONS_CACHE_LIMIT: 4096
EM_VERSION: 1.39.20
EM_CACHE_FOLDER: 'emsdk-cache'
GODOT_BASE_BRANCH: 3.4
SCONSFLAGS: verbose=yes warnings=all werror=yes debug_symbols=no
EM_VERSION: 2.0.25
EM_CACHE_FOLDER: "emsdk-cache"
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-javascript
cancel-in-progress: true
jobs:
javascript-template:
@@ -17,25 +20,6 @@ jobs:
steps:
- uses: actions/checkout@v2
# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
run: |
sudo rm -f /etc/apt/sources.list.d/*
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
sudo apt-get update
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: javascript-template-cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
# Additional cache for Emscripten generated system libraries
- name: Load Emscripten cache
id: javascript-template-emscripten-cache
@@ -44,25 +28,8 @@ jobs:
path: ${{env.EM_CACHE_FOLDER}}
key: ${{env.EM_VERSION}}-${{github.job}}
# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# You can test your matrix by printing the current Python version
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
- name: Set up Emscripten latest
uses: mymindstorm/setup-emsdk@v7
uses: mymindstorm/setup-emsdk@v10
with:
version: ${{env.EM_VERSION}}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
@@ -71,15 +38,20 @@ jobs:
run: |
emcc -v
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons target=release tools=no use_closure_compiler=yes
ls -l bin/
- name: Setup Godot build cache
uses: ./.github/actions/godot-cache
continue-on-error: true
- uses: actions/upload-artifact@v2
- name: Setup python and scons
uses: ./.github/actions/godot-deps
- name: Compilation
uses: ./.github/actions/godot-build
with:
name: ${{ github.job }}
path: bin/*
retention-days: 14
sconsflags: ${{ env.SCONSFLAGS }}
platform: javascript
target: release
tools: false
- name: Upload artifact
uses: ./.github/actions/upload-artifact

View File

@@ -3,208 +3,135 @@ on: [push, pull_request]
# Global Settings
env:
GODOT_BASE_BRANCH: 3.x
SCONSFLAGS: platform=linuxbsd verbose=yes warnings=all werror=yes debug_symbols=no --jobs=2
SCONS_CACHE_LIMIT: 4096
GODOT_BASE_BRANCH: 3.4
SCONSFLAGS: verbose=yes warnings=all werror=yes
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-linux
cancel-in-progress: true
jobs:
linux-editor-mono:
build-linux:
runs-on: "ubuntu-20.04"
name: Editor w/ Mono (target=release_debug, tools=yes)
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: Editor w/ Mono (target=release_debug, tools=yes)
cache-name: linux-editor-mono
target: release_debug
tools: true
sconsflags: module_mono_enabled=yes mono_glue=no
bin: "./bin/godot.x11.opt.tools.64.mono"
build-mono: true
artifact: true
- name: Editor and sanitizers (target=debug, tools=yes, use_asan=yes, use_ubsan=yes)
cache-name: linux-editor-sanitizers
target: debug
tools: true
sconsflags: use_asan=yes use_ubsan=yes
test: true
bin: "./bin/godot.x11.tools.64s"
build-mono: false
# Skip 2GiB artifact speeding up action.
artifact: false
- name: Template w/ Mono (target=release, tools=no)
cache-name: linux-template-mono
target: release
tools: false
sconsflags: module_mono_enabled=yes mono_glue=no debug_symbols=no
build-mono: false
artifact: true
steps:
- uses: actions/checkout@v2
# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
- name: Linux dependencies
shell: bash
run: |
# Azure repositories are not reliable, we need to prevent azure giving us packages.
sudo rm -f /etc/apt/sources.list.d/*
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
sudo apt-get update
# Install all packages (except scons)
- name: Configure dependencies
run: |
sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev xvfb \
libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev yasm
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: linux-editor-cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# Setup scons, print python version and scons version info, so if anything is broken it won't run the build.
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
# We should always be explicit with our flags usage here since it's gonna be sure to always set those flags
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons tools=yes target=release_debug module_mono_enabled=yes mono_glue=no
xvfb-run ./bin/godot.x11.opt.tools.64.mono --generate-mono-glue modules/mono/glue || true
scons tools=yes target=release_debug module_mono_enabled=yes mono_glue=yes
ls -l bin/
- uses: actions/upload-artifact@v2
with:
name: ${{ github.job }}
path: bin/*
retention-days: 14
linux-template-mono:
runs-on: "ubuntu-20.04"
name: Template w/ Mono (target=release, tools=no)
steps:
- uses: actions/checkout@v2
# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
run: |
sudo rm -f /etc/apt/sources.list.d/*
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
sudo apt-get update
# Install all packages (except scons)
- name: Configure dependencies
run: |
# The actual dependencies
sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \
libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev yasm
libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev \
libdbus-1-dev libudev-dev libxi-dev libxrandr-dev yasm xvfb wget unzip
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: linux-template-cache
uses: actions/cache@v2
- name: Setup Godot build cache
uses: ./.github/actions/godot-cache
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
cache-name: ${{ matrix.cache-name }}
continue-on-error: true
# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# You can test your matrix by printing the current Python version
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
- name: Setup python and scons
uses: ./.github/actions/godot-deps
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons target=release tools=no module_mono_enabled=yes mono_glue=no
ls -l bin/
- uses: actions/upload-artifact@v2
uses: ./.github/actions/godot-build
with:
name: ${{ github.job }}
path: bin/*
retention-days: 14
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
platform: linuxbsd
target: ${{ matrix.target }}
tools: ${{ matrix.tools }}
linux-editor-sanitizers:
runs-on: "ubuntu-20.04"
name: Editor and exported project with sanitizers (target=debug/release, tools=yes/no, use_ubsan=yes, use_asan=yes)
steps:
- uses: actions/checkout@v2
# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
# Generate mono glue
- name: Generate Mono glue code
if: ${{ matrix.build-mono }}
run: |
sudo rm -f /etc/apt/sources.list.d/*
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
sudo apt-get update
DRI_PRIME=0 xvfb-run ${{ matrix.bin }} --generate-mono-glue modules/mono/glue || true
# Install all packages (except scons)
- name: Configure dependencies
run: |
sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \
libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev yasm \
xvfb wget2 unzip
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: linux-sanitizer-cache
uses: actions/cache@v2
# Rebuild with mono
- name: Compilation (mono_glue=yes)
uses: ./.github/actions/godot-build
if: ${{ matrix.build-mono }}
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }} mono_glue=yes
platform: linuxbsd
target: ${{ matrix.target }}
tools: ${{ matrix.tools }}
# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# Setup scons, print python version and scons version info, so if anything is broken it won't run the build.
- name: Configuring Python packages
# Download and extract zip archive with project, folder is renamed to be able to easy change used project
- name: Download test project
if: ${{ matrix.test }}
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
# We should always be explicit with our flags usage here since it's gonna be sure to always set those flags
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons tools=yes target=debug use_asan=yes use_ubsan=yes
ls -l bin/
# Download and test project to check leaks and invalid memory usage.
# CI has no audio device, so use the Dummy audio driver to avoid spurious error messages.
- name: Importing and running project project
run: |
wget2 https://github.com/qarmin/RegressionTestProject/archive/3.x.zip
wget https://github.com/qarmin/RegressionTestProject/archive/3.x.zip
unzip 3.x.zip
mv "RegressionTestProject-3.x" "test_project"
echo "----- Open editor to check for memory leaks -----"
DRI_PRIME=0 xvfb-run bin/godot.x11.tools.64s --audio-driver Dummy -e -q --path test_project 2>&1 | tee sanitizers_log.txt || true
# Editor is quite complicated piece of software, so it is easy to introduce bug here
- name: Open and close editor
if: ${{ matrix.test }}
run: |
DRI_PRIME=0 xvfb-run ${{ matrix.bin }} --audio-driver Dummy -e -q --path test_project 2>&1 | tee sanitizers_log.txt || true
misc/scripts/check_ci_log.py sanitizers_log.txt
echo "----- Run and test project -----"
DRI_PRIME=0 xvfb-run bin/godot.x11.tools.64s 30 --video-driver GLES3 --audio-driver Dummy --path test_project 2>&1 | tee sanitizers_log.txt || true
# Run test project
- name: Run project
if: ${{ matrix.test }}
run: |
DRI_PRIME=0 xvfb-run ${{ matrix.bin }} 30 --video-driver GLES3 --audio-driver Dummy --path test_project 2>&1 | tee sanitizers_log.txt || true
misc/scripts/check_ci_log.py sanitizers_log.txt
# Check class reference
- name: Check for class reference updates
if: ${{ matrix.test }}
run: |
echo "Running --doctool to see if this changes the public API without updating the documentation."
echo -e "If a diff is shown, it means that your code/doc changes are incomplete and you should update the class reference with --doctool.\n\n"
DRI_PRIME=0 xvfb-run ${{ matrix.bin }} --doctool . 2>&1 > /dev/null || true
git diff --color --exit-code && ! git ls-files --others --exclude-standard | sed -e 's/^/New doc file missing in PR: /' | grep 'xml$'
- name: Prepare artifact
if: ${{ matrix.artifact }}
run: |
strip bin/godot.*
- name: Upload artifact
uses: ./.github/actions/upload-artifact
if: ${{ matrix.artifact }}
with:
name: ${{ matrix.cache-name }}

View File

@@ -3,107 +3,53 @@ on: [push, pull_request]
# Global Settings
env:
GODOT_BASE_BRANCH: 3.x
SCONSFLAGS: platform=osx verbose=yes warnings=all werror=yes debug_symbols=no --jobs=2
SCONS_CACHE_LIMIT: 4096
GODOT_BASE_BRANCH: 3.4
SCONSFLAGS: verbose=yes warnings=all werror=yes debug_symbols=no
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-macos
cancel-in-progress: true
jobs:
macos-editor:
build-macos:
runs-on: "macos-latest"
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: Editor (target=release_debug, tools=yes)
cache-name: macos-editor
target: release_debug
tools: true
bin: "./bin/godot.osx.opt.tools.64"
name: Editor (target=release_debug, tools=yes)
- name: Template (target=release, tools=no)
cache-name: macos-template
target: release
tools: false
steps:
- uses: actions/checkout@v2
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: macos-editor-cache
uses: actions/cache@v2
- name: Setup Godot build cache
uses: ./.github/actions/godot-cache
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
cache-name: ${{ matrix.cache-name }}
continue-on-error: true
# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# Setup scons, print python version and scons version info, so if anything is broken it won't run the build.
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
# We should always be explicit with our flags usage here since it's gonna be sure to always set those flags
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons tools=yes target=release_debug
ls -l bin/
- uses: actions/upload-artifact@v2
with:
name: ${{ github.job }}
path: bin/*
retention-days: 14
macos-template:
runs-on: "macos-latest"
name: Template (target=release, tools=no)
steps:
- uses: actions/checkout@v2
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: macos-template-cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# You can test your matrix by printing the current Python version
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
- name: Setup python and scons
uses: ./.github/actions/godot-deps
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons target=release tools=no
ls -l bin/
- uses: actions/upload-artifact@v2
uses: ./.github/actions/godot-build
with:
name: ${{ github.job }}
path: bin/*
retention-days: 14
sconsflags: ${{ env.SCONSFLAGS }}
platform: osx
target: ${{ matrix.target }}
tools: ${{ matrix.tools }}
- name: Upload artifact
uses: ./.github/actions/upload-artifact
with:
name: ${{ matrix.cache-name }}

View File

@@ -1,118 +1,61 @@
name: ☁ Server Builds
on: [push, pull_request]
# Global Cache Settings
# Global Settings
env:
GODOT_BASE_BRANCH: 3.x
SCONSFLAGS: platform=server verbose=yes warnings=all werror=yes debug_symbols=no --jobs=2
SCONS_CACHE_LIMIT: 4096
GODOT_BASE_BRANCH: 3.4
SCONSFLAGS: verbose=yes warnings=all werror=yes debug_symbols=no module_mono_enabled=yes mono_glue=no
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-server
cancel-in-progress: true
jobs:
linux-editor:
build-server:
runs-on: "ubuntu-20.04"
name: Linux Headless w/ Mono (target=release_debug, tools=yes)
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: Linux Headless w/ Mono (target=release_debug, tools=yes)
cache-name: server-editor-mono
target: release_debug
tools: true
- name: Linux Server w/ Mono (target=release, tools=no)
cache-name: server-template-mono
target: release
tools: false
steps:
- uses: actions/checkout@v2
# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
- name: Linux dependencies
shell: bash
run: |
# Azure repositories are not reliable, we need to prevent azure giving us packages.
sudo rm -f /etc/apt/sources.list.d/*
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
sudo apt-get update
# Install all packages (except scons)
- name: Configure dependencies
run: |
# The actual dependencies
sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \
libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev yasm
libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev \
libdbus-1-dev libudev-dev libxi-dev libxrandr-dev yasm xvfb wget unzip
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: linux-headless-cache
uses: actions/cache@v2
- name: Setup Godot build cache
uses: ./.github/actions/godot-cache
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
cache-name: ${{ matrix.cache-name }}
continue-on-error: true
# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# Setup scons, print python version and scons version info, so if anything is broken it won't run the build.
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
# We should always be explicit with our flags usage here since it's gonna be sure to always set those flags
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons -j2 verbose=yes warnings=all werror=yes platform=server tools=yes target=release_debug module_mono_enabled=yes mono_glue=no
linux-server:
runs-on: "ubuntu-20.04"
name: Linux Server w/ Mono (target=release, tools=no)
steps:
- uses: actions/checkout@v2
# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
run: |
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
sudo apt-get update
# Install all packages (except scons)
- name: Configure dependencies
run: |
sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \
libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev yasm
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: linux-server-cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# You can test your matrix by printing the current Python version
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
- name: Setup python and scons
uses: ./.github/actions/godot-deps
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons -j2 target=release tools=no module_mono_enabled=yes mono_glue=no
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
platform: server
target: ${{ matrix.target }}
tools: ${{ matrix.tools }}

View File

@@ -14,14 +14,16 @@ jobs:
run: |
sudo rm -f /etc/apt/sources.list.d/*
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main"
sudo apt-get update
- name: Install dependencies
run: |
sudo apt-get install -qq dos2unix recode clang-format-11
sudo apt-get install -qq dos2unix recode clang-format-13
sudo update-alternatives --remove-all clang-format
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-11 100
sudo pip3 install black==20.8b1 pygments
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-13 100
sudo pip3 install black==21.10b0 pygments
- name: File formatting checks (file_format.sh)
run: |
@@ -44,4 +46,4 @@ jobs:
- name: Documentation checks
run: |
doc/tools/makerst.py --dry-run doc/classes modules
doc/tools/make_rst.py --dry-run doc/classes modules

View File

@@ -4,112 +4,56 @@ on: [push, pull_request]
# Global Settings
# SCONS_CACHE for windows must be set in the build environment
env:
GODOT_BASE_BRANCH: 3.x
SCONSFLAGS: platform=windows verbose=yes warnings=all werror=yes debug_symbols=no --jobs=2
GODOT_BASE_BRANCH: 3.4
SCONSFLAGS: verbose=yes warnings=all werror=yes debug_symbols=no
SCONS_CACHE_MSVC_CONFIG: true
SCONS_CACHE_LIMIT: 4096
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-windows
cancel-in-progress: true
jobs:
windows-editor:
build-windows:
# Windows 10 with latest image
runs-on: "windows-latest"
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: Editor (target=release_debug, tools=yes)
cache-name: windows-editor
target: release_debug
tools: true
bin: "./bin/godot.windows.opt.tools.64.exe"
# Windows Editor - checkout with the plugin
name: Editor (target=release_debug, tools=yes)
- name: Template (target=release, tools=no)
cache-name: windows-template
target: release
tools: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
# Upload cache on completion and check it out now
# Editing this is pretty dangerous for Windows since it can break and needs to be properly tested with a fresh cache.
- name: Load .scons_cache directory
id: windows-editor-cache
uses: actions/cache@v2
with:
path: /.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
- name: Setup Godot build cache
uses: ./.github/actions/godot-cache
with:
cache-name: ${{ matrix.cache-name }}
continue-on-error: true
# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
- name: Setup python and scons
uses: ./.github/actions/godot-deps
# Setup scons, print python version and scons version info, so if anything is broken it won't run the build.
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons pywin32
python --version
scons --version
- name: Compilation
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }}
platform: windows
target: ${{ matrix.target }}
tools: ${{ matrix.tools }}
scons-cache-limit: 3072
# We should always be explicit with our flags usage here since it's gonna be sure to always set those flags
- name: Compilation
env:
SCONS_CACHE: /.scons_cache/
run: |
scons tools=yes target=release_debug
ls -l bin/
- uses: actions/upload-artifact@v2
with:
name: ${{ github.job }}
path: bin/*
retention-days: 14
windows-template:
runs-on: "windows-latest"
name: Template (target=release, tools=no)
steps:
- uses: actions/checkout@v2
# Upload cache on completion and check it out now
# Editing this is pretty dangerous for Windows since it can break and needs to be properly tested with a fresh cache.
- name: Load .scons_cache directory
id: windows-template-cache
uses: RevoluPowered/cache@v2.1
with:
path: /.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# You can test your matrix by printing the current Python version
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons pywin32
python --version
scons --version
- name: Compilation
env:
SCONS_CACHE: /.scons_cache/
run: |
scons target=release tools=no
ls -l bin/
- uses: actions/upload-artifact@v2
with:
name: ${{ github.job }}
path: bin/*
retention-days: 14
- name: Upload artifact
uses: ./.github/actions/upload-artifact
with:
name: ${{ matrix.cache-name }}

View File

@@ -1,3 +1,4 @@
Aaron Record <aaronjrecord@gmail.com>
Alexander Holland <alexander.holland@live.de>
Alexander Holland <alexander.holland@live.de> <alexander.holland@haw-hamburg.de>
Alexander Holland <alexander.holland@live.de> <AlexHolly>
@@ -23,15 +24,19 @@ Clay John <claynjohn@gmail.com> <clayjohn@shaw.ca>
Dana Olson <dana@shineuponthee.com> <adolson@gmail.com>
dankan1890 <mewuidev2@gmail.com>
Daniel J. Ramirez <djrmuv@gmail.com>
David Cambré <david.cambre@gmail.com> <David.Cambre@gmail.com>
Dominik 'dreamsComeTrue' Jasiński <dominikjasinski@o2.pl>
Emmanuel Barroga <emmanuelbarroga@gmail.com>
Eric M <itsjusteza@gmail.com>
Eric Rybicki <info@ericrybicki.com> <stratos695@googlemail.com>
Erik Selecký <35656626+rxlecky@users.noreply.github.com>
Erik Selecký <35656626+rxlecky@users.noreply.github.com> <35656626+SeleckyErik@users.noreply.github.com>
Eveline Jarosz <marqin.pl@gmail.com>
Eveline Jarosz <marqin.pl@gmail.com> <marqin.pl+git@gmail.com>
Fabian <supagu@gmail.com>
Ferenc Arn <tagcup@yahoo.com>
Ferenc Arn <tagcup@yahoo.com> <tagcup@users.noreply.github.com>
foxydevloper <12120644+foxydevloper@users.noreply.github.com>
Fredia Huya-Kouadio <fhuyakou@gmail.com>
Fredia Huya-Kouadio <fhuyakou@gmail.com> <fhuya@google.com>
Geequlim <geequlim@gmail.com>
@@ -42,8 +47,6 @@ Guilherme Felipe <guilhermefelipecgs@gmail.com>
Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
HaSa1002 <johawitt@outlook.de>
Hein-Pieter van Braam-Stewart <hp@tmm.cx>
Hubert Jarosz <marqin.pl@gmail.com>
Hubert Jarosz <marqin.pl@gmail.com> <marqin.pl+git@gmail.com>
Hugo Locurcio <hugo.locurcio@hugo.pro> <hugo.l@openmailbox.org>
Hugo Locurcio <hugo.locurcio@hugo.pro> <Calinou@users.noreply.github.com>
Hugo Locurcio <hugo.locurcio@hugo.pro> Calinou <calinou@opmbx.org>
@@ -55,7 +58,10 @@ Ilaria Cislaghi <cislaghi.ilaria@gmail.com> <ilaria.cislaghi@simedis.com>
Indah Sylvia <ISylvox@yahoo.com>
J08nY <johny@neuromancer.sk> <jancar.jj@gmail.com>
J08nY <johny@neuromancer.sk> <J08nY@users.noreply.github.com>
Jake Young <young9003@gmail.com>
Jakub Grzesik <kubecz3k@gmail.com>
janglee <merupatel123@gmail.com>
Jean-Michel Bernard <jmb462@gmail.com>
Jérôme Gully <jerome.gully0@gmail.com>
JFonS <joan.fonssanchez@gmail.com>
Juan Linietsky <reduzio@gmail.com>
@@ -65,9 +71,13 @@ Juan Linietsky <reduzio@gmail.com> <reduz@Juans-MBP.fibertel.com.ar>
Juan Linietsky <reduzio@gmail.com> <red@kyoko>
Julian Murgia <the.straton@gmail.com>
Kanabenki <lucien.menassol@gmail.com> <18357657+Kanabenki@users.noreply.github.com>
karroffel <therzog@mail.de>
karroffel <therzog@mail.de> <thomas.herzog@mail.com>
karroffel <therzog@mail.de> <thomas.herzog@simedis.com>
Kelly Thomas <kelly.thomas@hotmail.com.au>
Kongfa Waroros <gongpha@hotmail.com>
K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
kleonc <9283098+kleonc@users.noreply.github.com> <kleonc@users.noreply.github.com>
Leon Krause <lk@leonkrause.com> <eska@eska.me>
Leon Krause <lk@leonkrause.com> <eska014@users.noreply.github.com>
Liz Haas <27thLiz@gmail.com>
@@ -75,6 +85,7 @@ Liz Haas <27thLiz@gmail.com> <liu.gam3@gmail.com>
Liz Haas <27thLiz@gmail.com> <hinsbart@gmail.com>
Liz Haas <27thLiz@gmail.com> <hinsbart@users.noreply.github.com>
Liz Haas <27thLiz@gmail.com> <entenflugstuhl@gmail.com>
Manuele Finocchiaro <m4nu3lf@gmail.com>
Manuel Strey <manuel.strey@gmx.de>
Marcel Admiraal <madmiraal@users.noreply.github.com>
Marcelo Fernandez <marcelofg55@gmail.com>
@@ -91,9 +102,11 @@ Michael Alexsander <michaelalexsander@protonmail.com>
Nathan Franke <natfra@pm.me> <nathanwfranke@gmail.com>
Nathan Lovato <nathan@gdquest.com>
Nathan Warden <nathan@nathanwarden.com> <nathanwardenlee@icloud.com>
Nicholas Huelin <62965063+SirQuartz@users.noreply.github.com>
Nils ANDRÉ-CHANG <nils@nilsand.re>
Nils ANDRÉ-CHANG <nils@nilsand.re> <nils.andre.chang@gmail.com>
Nuno Donato <nunodonato@gmail.com> <n.donato@estrelasustentavel.pt>
Pawel Kowal <pkowal1982@gmail.com>
Pedro J. Estébanez <pedrojrulez@gmail.com> <RandomShaper@users.noreply.github.com>
Paul Batty <p_batty@hotmail.co.uk>
Paul Batty <p_batty@hotmail.co.uk> <Paulb23@users.noreply.github.com>
@@ -102,6 +115,7 @@ Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
Pieter-Jan Briers <pieterjan.briers+git@gmail.com> <pieterjan.briers@gmail.com>
Poommetee Ketson <poommetee@protonmail.com>
Przemysław Gołąb (n-pigeon) <golab.przemyslaw@gmail.com>
Rafał Mikrut <mikrutrafal@protonmail.com>
Rafał Mikrut <mikrutrafal@protonmail.com> <mikrutrafal54@gmail.com>
Ralf Hölzemer <r.hoelzemer@posteo.de> <rollenrolm@posteo.de>
Ralf Hölzemer <r.hoelzemer@posteo.de> <rollenrolm@users.noreply.github.com>
@@ -111,16 +125,16 @@ RaphaelHunter <raphael10241024@gmail.com> <Raphael10241024@gmail.com>
RaphaelHunter <raphael10241024@gmail.com> <raphael20141024@gmail.com>
Rémi Verschelde <rverschelde@gmail.com> <remi@verschelde.fr>
Rhody Lugo <rhodylugo@gmail.com> <rhodylugo@me.com>
Ricardo Subtil <ricasubtil@gmail.com>
Robin Hübner <profan@prfn.se> <robinhubner@gmail.com>
romulox_x <romulox_x@yahoo.com>
Ruslan Mustakov <r.mustakov@gmail.com> <ruslan.mustakov@xored.com>
Saracen <SaracenOne@gmail.com>
sheepandshepherd <sheepandshepherd@hotmail.com> <sheepandshepherd@users.noreply.github.com>
Silc 'Tokage' Renew <tokage.it.lab@gmail.com>
Silc 'Tokage' Renew <tokage.it.lab@gmail.com> <61938263+TokageItLab@users.noreply.github.com>
Swarnim Arun <swarnimarun11@gmail.com>
Theo Hallenius <redsymbzone@hotmail.com>
Thomas Herzog <therzog@mail.de>
Thomas Herzog <therzog@mail.de> <thomas.herzog@mail.com>
Thomas Herzog <therzog@mail.de> <thomas.herzog@simedis.com>
Tomasz Chabora <kobewi4e@gmail.com>
Twarit <wtwarit@gmail.com>
V.VamsiKrishna <vk@bsb.in> <vamsikrishna.v@gmail.com>
@@ -129,5 +143,6 @@ Wilhem Barbier <nounoursheureux@openmailbox.org> <schtroumps31@gmail.com>
Will Nations <willnationsdev@gmail.com>
yg2f <yoann@terminajones.com>
Yuri Sizov <yuris@humnom.net> <pycbouh@users.noreply.github.com>
Zae <zaevi@live.com>
Zak Stam <zakscomputers@hotmail.com>
Zher Huei Lee <lee.zh.92@gmail.com>

View File

@@ -28,23 +28,29 @@ name is available.
(in alphabetical order, with over 10 commits excluding merges)
Aaron Franke (aaronfranke)
Aaron Record (LightningAA)
Alexander Holland (AlexHolly)
Alexey Khoroshavin (allkhor)
Alket Rexhepi (alketii)
Andrea Catania (AndreaCatania)
Andrii Doroshenko (Xrayez)
Andy Moss (MillionOstrich)
Angad Kambli (angad-k)
Anilforextra (AnilBK)
Anish Bhobe (KidRigger)
Anton Yabchinskiy (a12n)
Anutrix
Aren Villanueva (kurikaesu)
Ariel Manzur (punto-)
Bartłomiej T. Listwon (Listwon)
Bastiaan Olij (BastiaanOlij)
Ben Brookshire (sheepandshepherd)
Benjamin Larsson (Nallebeorn)
Bernard Liebl (poke1024)
Bhuvan Vemula (Bhu1-V)
Błażej Szczygieł (zaps166)
Bojidar Marinov (bojidar-bg)
Brian Semrau (briansemrau)
Bruno Lourenço (MadEqua)
bruvzg
Cameron Reikes (creikey)
@@ -58,12 +64,14 @@ name is available.
Daniel Rakos (aqnuep)
dankan1890
Danil Alexeev (dalexeev)
David Cambré (Gallilus)
David Sichma (DavidSichma)
David Snopek (dsnopek)
Dharkael (lupoDharkael)
Dmitry Koteroff (Krakean)
Dominik Jasiński (dreamsComeTrue)
DualMatrix
Ellen Poe (ellenhp)
Emmanuel Barroga (codecustard)
Emmanuel Leblond (touilleMan)
Eoin O'Neill (Eoin-ONeill-Yokai)
@@ -72,9 +80,14 @@ name is available.
Eric Rybicki (ericrybick)
Erik Selecký (rxlecky)
est31
Eveline Jarosz (Marqin)
Fabian Mathews (supagu)
Fabio Alessandrelli (Faless)
fabriceci
Ferenc Arn (tagcup)
follower
foxydevloper
François Belair (Razoric480)
Franklin Sobrinho (TheHX)
Fredia Huya-Kouadio (m4gr3d)
Geequlim
@@ -86,9 +99,11 @@ name is available.
Hanif Bin Ariffin (hbina)
Haoyu Qiu (timothyqiu)
Hein-Pieter van Braam-Stewart (hpvb)
Hendrik Brucker (Geometror)
hilfazer
Hiroshi Ogawa (hi-ogawa)
homer666
Hubert Jarosz (Marqin)
hoontee
Hugo Locurcio (Calinou)
Ian Bishop (ianb96)
Ibrahn Sahir (ibrahn)
@@ -96,19 +111,24 @@ name is available.
Ilaria Cislaghi (QbieShay)
Indah Sylvia (ISylvox)
J08nY
Jake Young (Duroxxigar)
Jakub Grzesik (kubecz3k)
James Buck (jbuck3)
Jean-Michel Bernard (jmb462)
Jérôme Gully (Nutriz)
Jia Jun Chai (SkyLucilfer)
jmb462
Joan Fons Sanchez (JFonS)
Johannes Witt (HaSa1002)
Johan Manuel (29jm)
Joshua Grams (JoshuaGrams)
Juan Linietsky (reduz)
Julian Murgia (StraToN)
Julien Nguyen (Blackiris)
Jummit
Justo Delgado (mrcdk)
karroffel
Kelly Thomas (KellyThomas)
kleonc
Kongfa Waroros (gongpha)
Kostadin Damyanov (Max-Might)
K. S. Ernest (iFire) Lee (fire)
@@ -117,14 +137,14 @@ name is available.
Liz Haas (27thLiz)
Lucien Menassol (Kanabenki)
Lyuma
m4nu3lf
Maganty Rushyendra (mrushyendra)
Manuele Finocchiaro (m4nu3lf)
Marcel Admiraal (madmiraal)
Marcelo Fernandez (marcelofg55)
Marc Gilleron (Zylann)
Marcin Zawiejski (dragmz)
Marcus Brummer (mbrlabs)
Marcus (MCrafterzz)
Marcus Elg (MCrafterzz)
Mariano Javier Suligoy (MarianoGnu)
Mario Schlack (hurikhan)
Martin Capitanio (capnm)
@@ -137,6 +157,7 @@ name is available.
Matthias Hölzl (hoelzl)
Max Hilbrunner (mhilbrunner)
merumelu
Meru Patel (Janglee123)
Michael Alexsander (YeldhamDev)
MichiRecRoom (LikeLakers2)
mrezai
@@ -144,6 +165,7 @@ name is available.
Nathan Franke (nathanfranke)
Nathan Lovato (NathanLovato)
Nathan Warden (NathanWarden)
Nicholas Huelin (SirQuartz)
Nils André-Chang (NilsIrl)
Noah Beard (TwistedTwigleg)
Nuno Donato (nunodonato)
@@ -162,6 +184,7 @@ name is available.
Ralf Hölzemer (rollenrolm)
Ramesh Ravone (RameshRavone)
raphael10241024
Raul Santos (raulsntos)
Ray Koopa (RayKoopa)
Rémi Verschelde (akien-mga)
Rhody Lugo (rraallvv)
@@ -177,26 +200,30 @@ name is available.
Sergey Minakov (naithar)
sersoong
Shiqing (kawa-yoiko)
Silc 'Tokage' Renew (TokageItLab)
Simon Wenner (swenner)
Stijn Hinlopen (hinlopen)
Swarnim Arun (minraws)
Thakee Nathees (ThakeeNathees)
thebestnom
Theo Hallenius (TheoXD)
Thomas Herzog (karroffel)
Timo Schwarzer (timoschwarzer)
Timo (toger5)
Tomasz Chabora (KoBeWi)
Twarit Waikar (IronicallySerious)
Umang Kalra (theoway)
Vinzenz Feenstra (vinzenz)
박한얼 (volzhs)
V. Vamsi Krishna (vkbsb)
Wilhem Barbier (nounoursheureux)
William Deurwaarder (williamd67)
Will Nations (willnationsdev)
Wilson E. Alvarez (Rubonnek)
Xavier Cho (mysticfall)
yg2f (SuperUserNameMan)
Yuri Roubinsky (Chaosus)
Yuri Sizov (pycbouh)
Zae Chao (zaevi)
Zak Stam (zaksnet)
Zher Huei Lee (leezh)
ZuBsPaCe

View File

@@ -4,6 +4,679 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [3.4.2] - 2021-12-21
See the [release announcement](https://godotengine.org/article/maintenance-release-godot-3-4-2) for details.
### Changed
#### Thirdparty
- mbedtls updated to 2.16.12 ([GH-56098](https://github.com/godotengine/godot/pull/56098)).
### Fixed
#### GUI
- Fix BaseButton's localization for tooltip text with shortcut ([GH-56109](https://github.com/godotengine/godot/pull/56109)).
#### Input
- Revert #55997 "Fixed event spam when using the Nintendo Switch controller" ([GH-56029](https://github.com/godotengine/godot/pull/56029)).
* This reverts a change introduced in 3.4.1 which drastically reduced the sensitivity for analog joysticks.
#### Mono (C#)
- Check that a `.csproj` exists before trying to edit it ([GH-56101](https://github.com/godotengine/godot/pull/56101)).
#### Porting
- macOS: Fix OpenGL flickering regression ([GH-56059](https://github.com/godotengine/godot/pull/56059)).
#### Rendering
- GLES2: Fix `trunc` shader function compilation on Android ([GH-56061](https://github.com/godotengine/godot/pull/56061)).
#### XR
- Fix size issue for ARVR managed viewport ([GH-56072](https://github.com/godotengine/godot/pull/56072)).
## [3.4.1] - 2021-12-17
See the [release announcement](https://godotengine.org/article/maintenance-release-godot-3-4-1) for details.
### Added
#### Editor
- Expose `ScriptEditor::edit` to scripting ([GH-55709](https://github.com/godotengine/godot/pull/55709)).
#### GUI
- TextEdit: Allow toggling bookmark gutter ([GH-55197](https://github.com/godotengine/godot/pull/55197)).
- TextEdit: Add methods to get position from column and line ([GH-55416](https://github.com/godotengine/godot/pull/55416)).
#### Input
- Add `Input.is_physical_key_pressed()` method ([GH-55251](https://github.com/godotengine/godot/pull/55251)).
#### Physics
- Expose `intersect_point` in 3D physics server ([GH-54577](https://github.com/godotengine/godot/pull/54577)).
- BVH: Add option for expanded AABBs in leaves ([GH-55096](https://github.com/godotengine/godot/pull/55096)).
#### Porting
- Android: Add configs to specify the min and target sdk versions ([GH-55735](https://github.com/godotengine/godot/pull/55735)).
- Android: Add support for configuring the XR hand tracking frequency mode ([GH-55768](https://github.com/godotengine/godot/pull/55768)).
#### XR
- Add support for OpenXR export configurations ([GH-55158](https://github.com/godotengine/godot/pull/55158)).
### Changed
#### Editor
- Clamp rotation for up/down orbiting shortcuts ([GH-54788](https://github.com/godotengine/godot/pull/54788)).
- Improve project export and MeshLibrary export checkboxes ([GH-55215](https://github.com/godotengine/godot/pull/55215)).
- Remove editor splash screen with sponsors logo ([GH-55467](https://github.com/godotengine/godot/pull/55467)).
- Sort and group theme properties in docs, improve formatting for theme and enums ([GH-55526](https://github.com/godotengine/godot/pull/55526)).
#### GUI
- Viewport: Show tooltips even when paused or `time_scale` is 0 ([GH-55224](https://github.com/godotengine/godot/pull/55224)).
#### Porting
- iOS: Capture and display `xcodebuild` output ([GH-54711](https://github.com/godotengine/godot/pull/54711)).
- macOS: Read and ZIP project files in 16K chunks instead of reading the whole file at once ([GH-54673](https://github.com/godotengine/godot/pull/54673)).
#### Thirdparty
- libogg updated to 1.3.5 ([GH-55119](https://github.com/godotengine/godot/pull/55119)).
- libvorbis updated to 1.3.7 ([GH-55129](https://github.com/godotengine/godot/pull/55129)).
- minimp3 updated to 2021-11-30 git snapshot ([GH-55502](https://github.com/godotengine/godot/pull/55502)).
- CA root certificates updated to 2021-11-01 bundle from Mozilla ([GH-55137](https://github.com/godotengine/godot/pull/55137)).
- SDL GameControllerDB updated to 2021-12-14 git snapshot.
### Fixed
#### 2D
- Camera2D: Fix condition on 'jump to limits' logic ([GH-55417](https://github.com/godotengine/godot/pull/55417)).
- Tiles: Fix TileSet editor workspace breaking ([GH-55059](https://github.com/godotengine/godot/pull/55059)).
- Tiles: Only add light occlusion for visible TileMaps ([GH-54435](https://github.com/godotengine/godot/pull/54435)).
- Tiles: Fix selecting next/previous subtile in TileSet editor ([GH-55261](https://github.com/godotengine/godot/pull/55261)).
#### Core
- Fix `Color.v` integer assignment ([GH-55963](https://github.com/godotengine/godot/pull/55963)).
#### Editor
- Fix swapped rest pose action names in the Skeleton2D editor ([GH-54851](https://github.com/godotengine/godot/pull/54851)).
- Fix Theme Editor crash when clicking the element picker ([GH-55186](https://github.com/godotengine/godot/pull/55186)).
- Fix `EditorPlugin.remove_inspector_plugin()` instance cleanup ([GH-55658](https://github.com/godotengine/godot/pull/55658)).
#### GDScript
- Don't ignore the type mismatch in setter function ([GH-54117](https://github.com/godotengine/godot/pull/54117)).
- Support multiline indexing with `[]` ([GH-54227](https://github.com/godotengine/godot/pull/54227)).
- Prevent LSP adding signal callbacks to non GDScripts ([GH-55624](https://github.com/godotengine/godot/pull/55624)).
#### GUI
- RichTextLabel: Fix right alignment regression ([GH-55439](https://github.com/godotengine/godot/pull/55439)).
- RichTextLabel: Fix min/max line width calculation ([GH-55440](https://github.com/godotengine/godot/pull/55440)).
- Tabs: Prevent hidden tab close buttons from intercepting input ([GH-55453](https://github.com/godotengine/godot/pull/55453)).
- TextureProgress: Fix position of reference cross with `progress_offset` ([GH-55377](https://github.com/godotengine/godot/pull/55377)).
- Theme: Make default/project theme wait for modules before initializing (fixes WebP support for custom themes) ([GH-55484](https://github.com/godotengine/godot/pull/55484)).
#### Import
- Prevent OBJ importer from printing misleading error ([GH-54694](https://github.com/godotengine/godot/pull/54694)).
- Fix incorrect glTF cubic spline interpolation times/values size error ([GH-54805](https://github.com/godotengine/godot/pull/54805)).
- Fix support for CSG and GridMap in glTF scene export ([GH-54911](https://github.com/godotengine/godot/pull/54911)).
- Fix texture atlas generation when source sprite is larger than generated atlas ([GH-55094](https://github.com/godotengine/godot/pull/55094)).
- Fix crash when exporting meshes to glTF that have no skin ([GH-55246](https://github.com/godotengine/godot/pull/55246)).
#### Input
- Fix regression in UI navigation with joysticks ([GH-55480](https://github.com/godotengine/godot/pull/55480)).
- Fixed event spam when using the Nintendo Switch controller ([GH-55997](https://github.com/godotengine/godot/pull/55997)).
- Fixed detecting the Valve Streaming Gamepad ([GH-55980](https://github.com/godotengine/godot/pull/55980)).
#### Networking
- Fix WebSocket buffer size checks in `put_packet()`, silent failures/connection hangs ([GH-54381](https://github.com/godotengine/godot/pull/54381)).
- Fix HTTP request headers being included in response ([GH-54683](https://github.com/godotengine/godot/pull/54683)).
- Fix potential infinite loop when connecting HTTPClient ([GH-55358](https://github.com/godotengine/godot/pull/55358)).
- Fix WebRTC returning packets from peers too early ([GH-55953](https://github.com/godotengine/godot/pull/55953)).
#### Physics
- Fix the volume calculation for cylinders in GodotPhysics ([GH-54642](https://github.com/godotengine/godot/pull/54642)).
- Fix errors in KinematicBody when floor is destroyed or removed ([GH-54819](https://github.com/godotengine/godot/pull/54819)).
- Fix `test_move` reporting collision when touching another body ([GH-54845](https://github.com/godotengine/godot/pull/54845)).
- BVH: Fix pairing for teleported or fast moving objects ([GH-54925](https://github.com/godotengine/godot/pull/54925)).
- BVH: Detect shrinkage within expanded bounds ([GH-55050](https://github.com/godotengine/godot/pull/55050)).
#### Porting
- Android: Fix `get_screen_orientation()` not returning valid values ([GH-55210](https://github.com/godotengine/godot/pull/55210)).
- HTML5: Fix input not focusing canvas, check Gamepad API errors ([GH-55111](https://github.com/godotengine/godot/pull/55111), [GH-55342](https://github.com/godotengine/godot/pull/55342)).
- HTML5: Fix multi-touch input handling ([GH-55466](https://github.com/godotengine/godot/pull/55466)).
- HTML5: Use absolute path for JS lib/pre/externs for compatibility with latest Emscripten ([GH-55347](https://github.com/godotengine/godot/pull/55347)).
- HTML5: Use compatibility function for `glGetBufferSubData` to preserve support for older Emscripten ([GH-55354](https://github.com/godotengine/godot/pull/55354)).
- HTML5: Fix `files_dropped` in exported Mono builds ([GH-55594](https://github.com/godotengine/godot/pull/55594)).
- macOS: Enable multithreaded OpenGL engine flag when using multithreaded VisualServer ([GH-54526](https://github.com/godotengine/godot/pull/54526)).
- macOS: Fix crash on DualShock 4 joypad removal ([GH-55034](https://github.com/godotengine/godot/pull/55034)).
- macOS: Fix driver crash when enabling per-pixel transparency on M1 macs ([GH-55464](https://github.com/godotengine/godot/pull/55464)).
- macOS: Fix crash handler not printing function names on M1 Macs ([GH-55019](https://github.com/godotengine/godot/pull/55019)).
- Windows: Open a new console window for the editor instances on Windows 11 ([GH-55925](https://github.com/godotengine/godot/pull/55925), [GH-55967](https://github.com/godotengine/godot/pull/55967)).
* This is needed to workaround a design change in Windows 11's new Windows Terminal, which broke Godot ([GH-54076](https://github.com/godotengine/godot/issues/54076)).
#### Rendering
- Fix for double use of seed in random Particles shader variables ([GH-55607](https://github.com/godotengine/godot/pull/55607)).
- Fix vertex attribute specification for octahedral compression ([GH-54768](https://github.com/godotengine/godot/pull/54768)).
- Update CanvasItem when MultiMesh instance transform changes ([GH-54899](https://github.com/godotengine/godot/pull/54899)).
- Portals: Allow user to set roaming expansion margin ([GH-54921](https://github.com/godotengine/godot/pull/54921)).
- Fix incorrect VisualServer RID cleanup in various locations ([GH-55673](https://github.com/godotengine/godot/pull/55673), [GH-55669](https://github.com/godotengine/godot/pull/55669), [GH-55701](https://github.com/godotengine/godot/pull/55701), [GH-54650](https://github.com/godotengine/godot/pull/54650)).
- Fix occasional dangling OmniLight RID ([GH-41360](https://github.com/godotengine/godot/issues/41360)).
- GLES3: Fix incompatible addition in auto exposure shader ([GH-55983](https://github.com/godotengine/godot/pull/55983)).
## [3.4] - 2021-11-05
See the [release announcement](https://godotengine.org/article/godot-3-4-is-released) for details.
### Added
#### 2D
- Add `Listener2D` node ([GH-53429](https://github.com/godotengine/godot/pull/53429)).
- Add a 2D Viewport scale factor property ([GH-52137](https://github.com/godotengine/godot/pull/52137)).
#### 3D
- Implement octahedral map normal/tangent attribute compression ([GH-46800](https://github.com/godotengine/godot/pull/46800)).
- Add a `center_offset` property to both plane primitive and quad primitive ([GH-48763](https://github.com/godotengine/godot/pull/48763)).
- Options to clean/simplify convex hull generated from mesh ([GH-50328](https://github.com/godotengine/godot/pull/50328)).
- Allow unclamped colors in `Sprite3D` ([GH-51462](https://github.com/godotengine/godot/pull/51462)).
#### Animation
- Add animation "reset" track feature ([GH-44558](https://github.com/godotengine/godot/pull/44558)).
- Allow renaming bones and blend shapes ([GH-42827](https://github.com/godotengine/godot/pull/42827)).
#### Core
- Add frame delta smoothing option ([GH-48390](https://github.com/godotengine/godot/pull/48390)).
* This option is enabled by default (`application/run/delta_smoothing`).
- Add option to sync frame delta after draw ([GH-48555](https://github.com/godotengine/godot/pull/48555)).
* This option is experimental and disabled by default (`application/run/delta_sync_after_draw`).
- Expose OS data directory getter methods ([GH-49732](https://github.com/godotengine/godot/pull/49732)).
- Provide a getter for the project data directory ([GH-52714](https://github.com/godotengine/godot/pull/52714)).
- Add an option to make the project data directory non-hidden ([GH-52556](https://github.com/godotengine/godot/pull/52556), [GH-53779](https://github.com/godotengine/godot/pull/53779)).
- Add support for numeric XML entities to `XMLParser` ([GH-47978](https://github.com/godotengine/godot/pull/47978)).
- Add option for BVH thread safety ([GH-48892](https://github.com/godotengine/godot/pull/48892)).
- Add `Engine.print_error_messages` property to disable printing errors ([GH-50640](https://github.com/godotengine/godot/pull/50640)).
- Implement `OS.get_locale_language()` helper method ([GH-52740](https://github.com/godotengine/godot/pull/52740)).
- Allow using global classes as project `MainLoop` implementation ([GH-52438](https://github.com/godotengine/godot/pull/52438)).
- Add an `Array.pop_at()` method to pop an element at an arbitrary index ([GH-52143](https://github.com/godotengine/godot/pull/52143)).
- Expose enum related methods in ClassDB ([GH-52572](https://github.com/godotengine/godot/pull/52572)).
- Add `Thread.is_alive()` method to check if the thread is still doing work ([GH-53490](https://github.com/godotengine/godot/pull/53490)).
- Allow for platform `Thread` implementation override ([GH-52734](https://github.com/godotengine/godot/pull/52734)).
- Add support for generating `OpenSimplexNoise` noise images with an offset ([GH-48805](https://github.com/godotengine/godot/pull/48805)).
#### Crypto
- Add `AESContext`, RSA public keys, encryption, decryption, sign, and verify ([GH-48144](https://github.com/godotengine/godot/pull/48144)).
- Add `HMACContext` ([GH-48869](https://github.com/godotengine/godot/pull/48869)).
#### Editor
- Automatic remote debugger port assignment ([GH-37067](https://github.com/godotengine/godot/pull/37067)).
- Auto-reload scripts with external editor ([GH-51828](https://github.com/godotengine/godot/pull/51828)).
- Use QuickOpen to load resources in the inspector ([GH-37228](https://github.com/godotengine/godot/pull/37228)).
- Allow to create a node at specific position ([GH-50242](https://github.com/godotengine/godot/pull/50242)).
- Add the ability to reorder array elements from the inspector ([GH-50651](https://github.com/godotengine/godot/pull/50651)).
- Assign value to property by dropping to scene tree ([GH-50700](https://github.com/godotengine/godot/pull/50700)).
- Allow dropping property path into script editor ([GH-51629](https://github.com/godotengine/godot/pull/51629)).
- Save branch as scene by dropping to filesystem ([GH-52503](https://github.com/godotengine/godot/pull/52503)).
- Allow creating nodes in Animation Blend Tree by dragging from in/out ports ([GH-52966](https://github.com/godotengine/godot/pull/52966)).
- Allow dragging multiple resources onto exported array variable at once ([GH-50718](https://github.com/godotengine/godot/pull/50718)).
- Add zoom support to `SpriteFrames` editor plugin ([GH-48977](https://github.com/godotengine/godot/pull/48977)).
- Add `EditorResourcePicker` and `EditorScriptPicker` classes for plugins (and internal editor use) ([GH-49491](https://github.com/godotengine/godot/pull/49491)).
- Add up/down keys to increment/decrement value in editor spin slider ([GH-53090](https://github.com/godotengine/godot/pull/53090)).
- Implement camera orbiting shortcuts ([GH-51984](https://github.com/godotengine/godot/pull/51984)).
- Add ability to copy group name ([GH-53162](https://github.com/godotengine/godot/pull/53162)).
- Implement a `%command%` placeholder in the Main Run Args setting ([GH-35992](https://github.com/godotengine/godot/pull/35992)).
- Add keyboard shortcuts to the project manager ([GH-47894](https://github.com/godotengine/godot/pull/47894)).
- Add history navigation in the script editor using extra mouse buttons ([GH-53067](https://github.com/godotengine/godot/pull/53067)).
#### GDScript
- Allow `warning-ignore` in the same line as the respective warning ([GH-47863](https://github.com/godotengine/godot/pull/47863)).
- LSP: Implement `didSave` notify and rename request ([GH-48616](https://github.com/godotengine/godot/pull/48616)).
- LSP: Add support for custom host setting ([GH-52330](https://github.com/godotengine/godot/pull/52330)).
- LSP: Implement `applyEdit` for signal connecting ([GH-53068](https://github.com/godotengine/godot/pull/53068)).
#### GUI
- Button: Add focus font color to `Button` and derivatives ([GH-54264](https://github.com/godotengine/godot/pull/54264)).
- ButtonGroup: Add a `pressed `signal ([GH-48500](https://github.com/godotengine/godot/pull/48500)).
- CheckBox: Add disabled theme icons ([GH-37755](https://github.com/godotengine/godot/pull/37755)).
- ColorPicker: Display previous color and allow selecting it back ([GH-48611](https://github.com/godotengine/godot/pull/48611), [GH-48623](https://github.com/godotengine/godot/pull/48623)).
- DynamicFont: Allow using WOFF fonts ([GH-52052](https://github.com/godotengine/godot/pull/52052)).
- GraphEdit: Make zoom limits and step adjustable ([GH-50526](https://github.com/godotengine/godot/pull/50526)).
- ScrollBar: Add `increment_pressed` and `decrement_pressed` icons ([GH-51805](https://github.com/godotengine/godot/pull/51805)).
- TextureButton: Add `flip_h` and `flip_v` properties ([GH-30424](https://github.com/godotengine/godot/pull/30424)).
- TextureProgress: Add offset for progress texture ([GH-38722](https://github.com/godotengine/godot/pull/38722)).
- Theme: Various improvements to the Theme API ([GH-49487](https://github.com/godotengine/godot/pull/49487)).
- Theme: Add support for partial custom editor themes ([GH-51648](https://github.com/godotengine/godot/pull/51648)).
- Theme: Add API to retrieve the default font, and optimize property change notification ([GH-53397](https://github.com/godotengine/godot/pull/53397)).
#### Import
- Backport improved glTF module with scene export support ([GH-49120](https://github.com/godotengine/godot/pull/49120)).
- Implement lossless WebP encoding ([GH-47854](https://github.com/godotengine/godot/pull/47854)).
- Add anisotropic filter option for `TextureArray`s ([GH-51402](https://github.com/godotengine/godot/pull/51402)).
- Add "Normal Map Invert Y" import option for normal maps ([GH-48693](https://github.com/godotengine/godot/pull/48693)).
- Add optional region cropping for `TextureAtlas` importer ([GH-52652](https://github.com/godotengine/godot/pull/52652)).
#### Input
- Add support for physical scancodes, fixes non-latin layout scancodes on Linux ([GH-46764](https://github.com/godotengine/godot/pull/46764)).
- Add `action_get_deadzone()` method to InputMap ([GH-50065](https://github.com/godotengine/godot/pull/50065)).
- Allow getting axis/vector values from multiple actions ([GH-50788](https://github.com/godotengine/godot/pull/50788)).
- Allow checking for exact matches with action events ([GH-50874](https://github.com/godotengine/godot/pull/50874)).
- Exposed setters for sensor values ([GH-53742](https://github.com/godotengine/godot/pull/53742)).
- Expose `Input::flush_buffered_events()` ([GH-53812](https://github.com/godotengine/godot/pull/53812)).
- Allow input echo when changing UI focus ([GH-44456](https://github.com/godotengine/godot/pull/44456)).
#### Localization
- Add support for translating the class reference ([GH-53511](https://github.com/godotengine/godot/pull/53511)).
* Includes Chinese (Simplified) and Spanish translations with high completion ratio, and initial translations for French, Japanese, and German.
- Allow overriding `get_message` with virtual method ([GH-53207](https://github.com/godotengine/godot/pull/53207)).
#### Mono (C#)
- iOS: Cache AOT compiler output ([GH-51191](https://github.com/godotengine/godot/pull/51191)).
- Add editor keyboard shortcut (<kbd>Alt+B</kbd>) for Mono Build solution button ([GH-52595](https://github.com/godotengine/godot/pull/52595)).
- Add support to export enum strings for `Array<string>` ([GH-52763](https://github.com/godotengine/godot/pull/52763)).
- Support arrays of `NodePath` and `RID` ([GH-53577](https://github.com/godotengine/godot/pull/53577)).
- Support marshaling generic `Godot.Object` ([GH-53582](https://github.com/godotengine/godot/pull/53582)).
#### Networking
- Add support for multiple address resolution in DNS requests ([GH-49020](https://github.com/godotengine/godot/pull/49020)).
- Implement `String::parse_url()` for parsing URLs ([GH-48205](https://github.com/godotengine/godot/pull/48205)).
- Add `get_buffered_amount()` to `WebRTCDataChannel` ([GH-50659](https://github.com/godotengine/godot/pull/50659)).
- Add `dtls_hostname` property to ENet ([GH-51434](https://github.com/godotengine/godot/pull/51434)).
#### Physics
- Enable setting the number of physics solver iterations ([GH-38387](https://github.com/godotengine/godot/pull/38387), [GH-50257](https://github.com/godotengine/godot/pull/50257)).
- Heightmap collision shape support in Godot Physics 3D ([GH-47349](https://github.com/godotengine/godot/pull/47349)).
- Add support for Dynamic BVH as 2D physics broadphase ([GH-48314](https://github.com/godotengine/godot/pull/48314)).
- Expose `body_test_motion` in 3D physics server ([GH-50103](https://github.com/godotengine/godot/pull/50103)).
- Add option to sync motion to physics in 3D `KinematicBody` ([GH-49446](https://github.com/godotengine/godot/pull/49446)).
- Expose collider RID in 2D/3D kinematic collision ([GH-49476](https://github.com/godotengine/godot/pull/49476)).
- Support for disabling physics on `SoftBody` ([GH-49835](https://github.com/godotengine/godot/pull/49835)).
- Backport new methods for `KinematicBody` and `KinematicCollision` ([GH-52116](https://github.com/godotengine/godot/pull/52116)).
- Expose `SoftBody` pin methods for scripting ([GH-52369](https://github.com/godotengine/godot/pull/52369)).
#### Porting
- Android: Add partial support for Android scoped storage ([GH-50359](https://github.com/godotengine/godot/pull/50359)).
- Android: Add initial support for Play Asset Delivery ([GH-52526](https://github.com/godotengine/godot/pull/52526)).
- Android: Implement per-pixel transparency ([GH-51935](https://github.com/godotengine/godot/pull/51935)).
- Android: Add basic user data backup option ([GH-49070](https://github.com/godotengine/godot/pull/49070)).
- Android: Add support for prompting the user to retain app data on uninstall ([GH-51605](https://github.com/godotengine/godot/pull/51605)).
- HTML5: Export as Progressive Web App (PWA) ([GH-48250](https://github.com/godotengine/godot/pull/48250)).
- HTML5: Implement Godot <-> JavaScript interface ([GH-48691](https://github.com/godotengine/godot/pull/48691)).
- HTML5: Implement AudioWorklet without threads ([GH-52650](https://github.com/godotengine/godot/pull/52650)).
- HTML5: Implement video driver selection for Web editor ([GH-53991](https://github.com/godotengine/godot/pull/53991)).
- HTML5: Add easy to use download API ([GH-48929](https://github.com/godotengine/godot/pull/48929)).
- iOS: Add pen pressure support for Apple Pencil ([GH-47469](https://github.com/godotengine/godot/pull/47469)).
- iOS: Add option to automatically generate icons and launch screens ([GH-49464](https://github.com/godotengine/godot/pull/49464)).
- iOS: Support multiple `plist` types in plugin ([GH-49802](https://github.com/godotengine/godot/pull/49802)).
- iOS: Implement missing OS `set`/`get_clipboard()` methods ([GH-52540](https://github.com/godotengine/godot/pull/52540)).
- Linux: Add initial support for the RISC-V architecture ([GH-53509](https://github.com/godotengine/godot/pull/53509)).
- macOS: Add GDNative Framework support, and minimal support for handling Unix symlinks ([GH-46860](https://github.com/godotengine/godot/pull/46860)).
- macOS: Add notarization support when exporting for macOS on a macOS host ([GH-49276](https://github.com/godotengine/godot/pull/49276)).
- Add support for ARM64 architecture for the Embree raycaster (Apple M1, Linux aarch64) ([GH-48455](https://github.com/godotengine/godot/pull/48455)).
* Note that the OIDN denoiser is still not available on this architecture.
#### Rendering
- GLES2: Add basic support for CPU blendshapes ([GH-48480](https://github.com/godotengine/godot/pull/48480), [GH-51363](https://github.com/godotengine/godot/pull/51363)).
- GLES2: Allow using clearcoat, anisotropy and refraction in SpatialMaterial ([GH-51967](https://github.com/godotengine/godot/pull/51967)).
- GLES2: Implement `Viewport.keep_3d_linear` for VR applications to convert output to linear color space ([GH-51780](https://github.com/godotengine/godot/pull/51780)).
- GLES3: Allow repeat flag in viewport textures ([GH-34008](https://github.com/godotengine/godot/pull/34008)).
- GLES3: Add support for contrast-adaptive sharpening in 3D ([GH-47416](https://github.com/godotengine/godot/pull/47416)).
- Add an editor setting to configure number of threads for lightmap baking ([GH-52952](https://github.com/godotengine/godot/pull/52952)).
- Add ring emitter for 3D particles ([GH-47801](https://github.com/godotengine/godot/pull/47801)).
- Add rooms and portals-based occlusion culling ([GH-46130](https://github.com/godotengine/godot/pull/46130)).
- Add a new high quality tonemapper: ACES Fitted ([GH-52477](https://github.com/godotengine/godot/pull/52477)).
- Add soft shadows to the CPU lightmapper ([GH-50184](https://github.com/godotengine/godot/pull/50184)).
- Add high quality glow mode ([GH-51491](https://github.com/godotengine/godot/pull/51491)).
- Add new 3D point light attenuation as an option ([GH-52918](https://github.com/godotengine/godot/pull/52918)).
- Import option to split vertex buffer stream in positions and attributes ([GH-46574](https://github.com/godotengine/godot/pull/46574)).
- Add horizon specular occlusion ([GH-51416](https://github.com/godotengine/godot/pull/51416)).
#### Shaders
- Add support for structs and fragment-to-light varyings ([GH-48075](https://github.com/godotengine/godot/pull/48075)).
- Add support for global const arrays ([GH-50889](https://github.com/godotengine/godot/pull/50889)).
- Make `TIME` available in custom functions by default ([GH-49509](https://github.com/godotengine/godot/pull/49509)).
#### VisualScript
- Allow dropping custom node scripts in VisualScript editor ([GH-50696](https://github.com/godotengine/godot/pull/50696)).
- Expose visual script custom node type hints ([GH-50705](https://github.com/godotengine/godot/pull/50705)).
- Improve and streamline `VisualScriptFuncNode`s `Call` `Set` `Get` ([GH-50709](https://github.com/godotengine/godot/pull/50709)).
#### XR
- Add `VIEW_INDEX` variable in shader to know which eye/view we're rendering for ([GH-48011](https://github.com/godotengine/godot/pull/48011)).
### Changed
#### 2D
- Make the most recently added current `Camera2D` take precedence ([GH-50112](https://github.com/godotengine/godot/pull/50112)).
#### 3D
- Implement individual mesh transform for `MeshLibrary` items ([GH-52298](https://github.com/godotengine/godot/pull/52298)).
#### Buildsystem
- Refactor module defines into a generated header ([GH-50466](https://github.com/godotengine/godot/pull/50466)).
#### Core
- Promote object validity checks to release builds ([GH-51796](https://github.com/godotengine/godot/pull/51796)).
- Add detailed error messages to release builds (used to be debug-only) ([GH-53405](https://github.com/godotengine/godot/pull/53405)).
- Add Node name to `print()` of all nodes, makes `Object::to_string()` virtual ([GH-38819](https://github.com/godotengine/godot/pull/38819)).
- Thread callbacks can now take optional parameters ([GH-38078](https://github.com/godotengine/godot/pull/38078), [GH-51093](https://github.com/godotengine/godot/pull/51093)).
- Harmonize output of `OS.get_locale()` between platforms ([GH-40708](https://github.com/godotengine/godot/pull/40708)).
- Optimize hash comparison for integer and string keys in Dictionary ([GH-53557](https://github.com/godotengine/godot/pull/53557)).
- Improve the console error logging appearance: ([GH-49577](https://github.com/godotengine/godot/pull/49577)).
- Implement missing stringification for `PoolByteArray` and `PoolColorArray` ([GH-53655](https://github.com/godotengine/godot/pull/53655)).
- `AStar.get_available_point_id()` returns 0 instead of 1 when empty ([GH-48958](https://github.com/godotengine/godot/pull/48958)).
- Compare connections by object ID, making `.tscn` order deterministic ([GH-52493](https://github.com/godotengine/godot/pull/52493)).
#### Editor
- Refactor `Theme` item management in the theme editor ([GH-49512](https://github.com/godotengine/godot/pull/49512)).
- Overhaul the theme editor and improve user experience ([GH-49774](https://github.com/godotengine/godot/pull/49774)).
- Improve 2D editor zoom logic ([GH-50490](https://github.com/godotengine/godot/pull/50490), [GH-50499](https://github.com/godotengine/godot/pull/50499)).
- Make several actions in the Inspector dock more obvious ([GH-50528](https://github.com/godotengine/godot/pull/50528)).
- Improve the editor feature profiles UX ([GH-49643](https://github.com/godotengine/godot/pull/49643)).
- Improve the UI/UX of the Export Template Manager dialog ([GH-50531](https://github.com/godotengine/godot/pull/50531)).
- Improve FileSystem dock sorting ([GH-50565](https://github.com/godotengine/godot/pull/50565)).
- Improve the 3D editor manipulation gizmo ([GH-50597](https://github.com/godotengine/godot/pull/50597)).
- Increase object snapping distances in the 3D editor ([GH-53727](https://github.com/godotengine/godot/pull/53727)).
- Refactor layer property editor grid ([GH-51040](https://github.com/godotengine/godot/pull/51040)).
- Improve the animation bezier editor ([GH-48572](https://github.com/godotengine/godot/pull/48572)).
- Fix logic for showing `TileMap` debug collision shapes ([GH-49075](https://github.com/godotengine/godot/pull/49075)).
- Add custom debug shape thickness and color options to `RayCast` ([GH-49726](https://github.com/godotengine/godot/pull/49726)).
- Handle portrait mode monitors in the automatic editor scale detection ([GH-48597](https://github.com/godotengine/godot/pull/48597)).
- Remove high radiance sizes from the editor due to issues on specific GPUs ([GH-48906](https://github.com/godotengine/godot/pull/48906)).
#### GUI
- GraphEdit: Enable zooming with Ctrl + Scroll wheel and related fixes to zoom handling ([GH-47173](https://github.com/godotengine/godot/pull/47173)).
- Button: Don't change hovering during focus events ([GH-47280](https://github.com/godotengine/godot/pull/47280)).
- DynamicFont: Re-add support for kerning ([GH-49377](https://github.com/godotengine/godot/pull/49377)).
- LineEdit: Double click selects words, triple click selects all the content ([GH-46527](https://github.com/godotengine/godot/pull/46527)).
- LinkButton: Button text is now automatically translated like other Controls ([GH-52138](https://github.com/godotengine/godot/pull/52138)).
- Theme: StyleBox fake anti-aliasing improvements ([GH-51589](https://github.com/godotengine/godot/pull/51589)).
#### Import
- Optimize image channel detection ([GH-47396](https://github.com/godotengine/godot/pull/47396)).
#### Localization
- Only include editor translations above a threshold to save on binary size ([GH-54020](https://github.com/godotengine/godot/pull/54020)).
#### Mono (C#)
- macOS: Mono builds are now universal builds with support for both `x86_64` and `arm64` architectures ([GH-49248](https://github.com/godotengine/godot/pull/49248)).
- Improve C# method listing ([GH-52607](https://github.com/godotengine/godot/pull/52607)).
- Avoid modifying `csproj` globbing includes ([GH-54262](https://github.com/godotengine/godot/pull/54262)).
- Deprecate `Xform` methods removed in 4.0, the `*` operator is preferred ([GH-52762](https://github.com/godotengine/godot/pull/52762)).
#### Networking
- Enable range coder compression by default in `NetworkedMultiplayerENet` ([GH-51525](https://github.com/godotengine/godot/pull/51525)).
#### Physics
- Port Bullet's convex hull computer to replace `QuickHull` ([GH-48533](https://github.com/godotengine/godot/pull/48533)).
- Return RID instead of Object ID in `area`-/`body_shape_entered`/-`exited` signals ([GH-42743](https://github.com/godotengine/godot/pull/42743)).
- Optimize area detection and `intersect_shape` queries with concave shapes ([GH-48551](https://github.com/godotengine/godot/pull/48551)).
- Optimize raycast with large Heightmap shape data ([GH-48709](https://github.com/godotengine/godot/pull/48709)).
- Reload kinematic shapes when changing `PhysicsBody` mode to Kinematic ([GH-53118](https://github.com/godotengine/godot/pull/53118)).
- Wake up 2D and 3D bodies in impulse and force functions ([GH-53113](https://github.com/godotengine/godot/pull/53113)).
- Compile Bullet with threadsafe switch on ([GH-53183](https://github.com/godotengine/godot/pull/53183)).
#### Porting
- Android: Target API level 30, raise min API level to 19 ([GH-50359](https://github.com/godotengine/godot/pull/50359)).
- Android: Improve input responsiveness on underpowered Android devices ([GH-42220](https://github.com/godotengine/godot/pull/42220)).
- Android: Upgrade Android Gradle to version 7.2, now requires Java 11 ([GH-53610](https://github.com/godotengine/godot/pull/53610)).
- HTML5: Debug HTTP server refactor with SSL support ([GH-48250](https://github.com/godotengine/godot/pull/48250)).
- HTML5: Use 64KiB chunk size in JS `HTTPClient`, for consistency with native platforms ([GH-48501](https://github.com/godotengine/godot/pull/48501)).
- HTML5: Raise default initial memory to 64 MiB ([GH-50422](https://github.com/godotengine/godot/pull/50422)).
- HTML5: Use browser mix rate by default on the Web ([GH-52723](https://github.com/godotengine/godot/pull/52723)).
- HTML5: Refactor event handlers, drop most Emscripten HTML5 dependencies ([GH-52812](https://github.com/godotengine/godot/pull/52812)).
- iOS: Disable half float on GLES2 via platform override ([GH-54229](https://github.com/godotengine/godot/pull/54229)).
- macOS: Prefer .app bundle icon over the default one ([GH-48686](https://github.com/godotengine/godot/pull/48686)).
#### Rendering
- `VisualServer` now sorts based on AABB position ([GH-43506](https://github.com/godotengine/godot/pull/43506)).
- Make Blinn and Phong specular consider albedo and specular amount ([GH-51410](https://github.com/godotengine/godot/pull/51410)).
#### Shaders
- Default shader specular render mode to `SCHLICK_GGX` ([GH-51401](https://github.com/godotengine/godot/pull/51401)).
#### Thirdparty
- Bullet uppdated to version 3.17.
- Embree updated to version 3.13.0.
- MbedTLS updated to version 2.16.11 (security update).
- NanoSVG updated to 2021-09-03 git snapshot (security update).
- CA root certificates updated to 2021-07-05 bundle from Mozilla.
- SDL GameControllerDB updated to 2021-10-29 git snapshot.
#### XR
- Only update render target directly if ARVR mode is off ([GH-54258](https://github.com/godotengine/godot/pull/54258)).
### Removed
#### Porting
- Android: Remove non-functional native video OS methods ([GH-48537](https://github.com/godotengine/godot/pull/48537)).
- iOS: Remove duplicate orientation setting in the export preset ([GH-48943](https://github.com/godotengine/godot/pull/48943)).
### Fixed
#### 2D
- TileSet: Fix selection of spaced atlas tile when using priority ([GH-50886](https://github.com/godotengine/godot/pull/50886)).
#### 3D
- CSGSphere: Fix UV mapping ([GH-49195](https://github.com/godotengine/godot/pull/49195)).
- CSGPolygon: Fix multiple issues ([GH-49314](https://github.com/godotengine/godot/pull/49314)).
- CSGPolygon: Fixes and features: Angle simplification, UV tiling distance, interval type ([GH-52509](https://github.com/godotengine/godot/pull/52509)).
- GridMap: Fix erasing octants in the wrong order ([GH-50052](https://github.com/godotengine/godot/pull/50052)).
- PathFollow: Fix forward calculation for the position at the end of the curve ([GH-50986](https://github.com/godotengine/godot/pull/50986)).
- SphereMesh: Fix the normals when the sphere/hemisphere is oblong ([GH-51995](https://github.com/godotengine/godot/pull/51995)).
- Update mesh AABB when software skinning is used ([GH-53144](https://github.com/godotengine/godot/pull/53144)).
#### Animation
- Fix Tween active state and repeat after `stop()` and then `start()` ([GH-47142](https://github.com/godotengine/godot/pull/47142)).
- Fix SkeletonIK root bones being twisted incorrectly when rotated ([GH-48251](https://github.com/godotengine/godot/pull/48251)).
- Fix issues with `BlendSpace2D` `BLEND_MODE_DISCRETE_CARRY` ([GH-48375](https://github.com/godotengine/godot/pull/48375)).
- Fixed issue where bones become detached if multiple SkeletonIK nodes are used ([GH-49031](https://github.com/godotengine/godot/pull/49031)).
- Fix non functional 3D onion skinning ([GH-52664](https://github.com/godotengine/godot/pull/52664)).
- Fix Animation Playback Track not seeking properly ([GH-38107](https://github.com/godotengine/godot/pull/38107)).
- Fix bugs in `AnimationNodeTransition`'s behavior ([GH-52543](https://github.com/godotengine/godot/pull/52543), [GH-52555](https://github.com/godotengine/godot/pull/52555)).
- Fix rendering centered odd-size texture for `AnimatedSprite`/`AnimatedSprite3D` ([GH-53052](https://github.com/godotengine/godot/pull/53052)).
#### Audio
- Fix cubic resampling algorithm ([GH-51082](https://github.com/godotengine/godot/pull/51082)).
#### Core
- Make all file access 64-bit (`uint64_t`) ([GH-47254](https://github.com/godotengine/godot/pull/47254)).
* This adds support for handling files bigger than 2.1 GiB, including on 32-bit OSes.
- Fix negative delta arguments ([GH-52947](https://github.com/godotengine/godot/pull/52947)).
- Complain if casting a freed object in a debug session ([GH-51095](https://github.com/godotengine/godot/pull/51095)).
- Fix read/write issues with `NaN` and `INF` in VariantParser ([GH-47500](https://github.com/godotengine/godot/pull/47500)).
- Fix sub-resource storing the wrong index in cache ([GH-49625](https://github.com/godotengine/godot/pull/49625)).
- Save binary `ProjectSettings` key length properly ([GH-49649](https://github.com/godotengine/godot/pull/49649)).
- Fix ZIP files being opened with two file descriptors ([GH-42337](https://github.com/godotengine/godot/pull/42337)).
- Fix `Transform::xform(Plane)` functions to handle non-uniform scaling ([GH-50637](https://github.com/godotengine/godot/pull/50637)).
- Fix renaming directories with `Directory.rename()` ([GH-51793](https://github.com/godotengine/godot/pull/51793)).
- Fix path with multiple slashes not being corrected on templates ([GH-52513](https://github.com/godotengine/godot/pull/52513)).
- Fix `String.get_base_dir()` handling of Windows top-level directories ([GH-52744](https://github.com/godotengine/godot/pull/52744)).
- Fix potential crash when creating thread with an invalid target instance ([GH-53060](https://github.com/godotengine/godot/pull/53060)).
- Fix behavior of `CONNECT_REFERENCE_COUNTED` option for signal connections ([GH-47442](https://github.com/godotengine/godot/pull/47442)).
- Fix swapped axes in `OpenSimplexNoise.get_image()` ([GH-30424](https://github.com/godotengine/godot/pull/30424)).
* Breaks compat. If you need to preserve the 3.2 behavior, swap your first and second arguments in `get_image()`.
- Fix loading packed scene with editable children at runtime ([GH-49664](https://github.com/godotengine/godot/pull/49664)).
- Quote and escape `ConfigFile` keys when necessary ([GH-52180](https://github.com/godotengine/godot/pull/52180)).
- Write node groups on a single line when saving a `.tscn` file ([GH-52284](https://github.com/godotengine/godot/pull/52284)).
#### Editor
- Rationalize property reversion ([GH-51166](https://github.com/godotengine/godot/pull/51166)).
- Fix Marshalls infinite recursion crash in debugger ([GH-51068](https://github.com/godotengine/godot/pull/51068)).
- Fix slow load/save of scenes with many instances of the same script ([GH-49570](https://github.com/godotengine/godot/pull/49570)).
- Properly update `NodePath`s in the editor in more cases when nodes are moved or renamed ([GH-49812](https://github.com/godotengine/godot/pull/49812)).
- Fix scale sensitivity for 3D objects ([GH-52665](https://github.com/godotengine/godot/pull/52665)).
- Fix preview grid in `SpriteFrames` editor's "Select Frames" dialog ([GH-52461](https://github.com/godotengine/godot/pull/52461)).
- Fix `MeshInstance2D` edit rect ([GH-54070](https://github.com/godotengine/godot/pull/54070)).
#### GDScript
- Ignore property groups and categories in GDScript code completion ([GH-54272](https://github.com/godotengine/godot/pull/54272)).
- Fix parsing multi-line `preload` statement ([GH-52521](https://github.com/godotengine/godot/pull/52521)).
- Speedup running very big GDScript files ([GH-53507](https://github.com/godotengine/godot/pull/53507)).
- LSP: Fix `SymbolKind` reporting wrong types and `get_node()` parsing ([GH-50914](https://github.com/godotengine/godot/pull/50914), [GH-51283](https://github.com/godotengine/godot/pull/51283)).
- LSP: Report `new()` as `_init` & fix docstrings on multiline functions ([GH-53094](https://github.com/godotengine/godot/pull/53094)).
#### GUI
- GraphNode: Properly handle children with "Expand" flag ([GH-39810](https://github.com/godotengine/godot/pull/39810)).
- Label: Fix valign with stylebox borders ([GH-50478](https://github.com/godotengine/godot/pull/50478)).
- RichTextLabel: Fix auto-wrapping on CJK texts ([GH-49280](https://github.com/godotengine/godot/pull/49280)).
- RichTextLabel: Fix character horizontal offset calculation ([GH-52752](https://github.com/godotengine/godot/pull/52752)).
- RichTextLabel: Honor content marging when drawing font shadow ([GH-54054](https://github.com/godotengine/godot/pull/54054)).
- RichTextLabel: Fix meta link detection when used inside a fill tag ([GH-54114](https://github.com/godotengine/godot/pull/54114)).
- TabContainer: Fix moving dropped tab to incorrect child index ([GH-51177](https://github.com/godotengine/godot/pull/51177)).
- Tabs: Fix invisible tabs not being ignored ([GH-53551](https://github.com/godotengine/godot/pull/53551)).
- TextureProgress: Improve behavior with nine patch ([GH-45815](https://github.com/godotengine/godot/pull/45815)).
- Theme: Fix potential crash with custom themes using BitMap fonts ([GH-53410](https://github.com/godotengine/godot/pull/53410)).
#### Import
- Fix loading RLE compressed TGA files ([GH-49603](https://github.com/godotengine/godot/pull/49603)).
- Fix issue in `TextureAtlas` import of images with wrong size ([GH-42103](https://github.com/godotengine/godot/pull/42103)).
- Fix potential crash importing invalid BMP files ([GH-46555](https://github.com/godotengine/godot/pull/46555)).
- glTF: Improved error handling around invalid images and invalid meshes ([GH-48904](https://github.com/godotengine/godot/pull/48904), [GH-48912](https://github.com/godotengine/godot/pull/48912)).
- glTF: Fix incorrect skin deduplication when using named binds ([GH-48913](https://github.com/godotengine/godot/pull/48913)).
#### Input
- Fix game controllers ignoring the last listed button ([GH-48934](https://github.com/godotengine/godot/pull/48934)).
#### Mono (C#)
- iOS: Fix `P/Invoke` symbols being stripped by the linker, resulting in `EntryPointNotFoundException` crash at runtime ([GH-49248](https://github.com/godotengine/godot/pull/49248)).
- macOS: Automatically enable JIT entitlements for the Mono exports ([GH-50317](https://github.com/godotengine/godot/pull/50317)).
- Fix reloading `tool` scripts in the editor ([GH-52883](https://github.com/godotengine/godot/pull/52883)).
- Fix C# bindings generator for default value types ([GH-49702](https://github.com/godotengine/godot/pull/49702)).
- Ignore paths with invalid chars in `PathWhich` ([GH-50918](https://github.com/godotengine/godot/pull/50918)).
- Fix `List<T>` marshalling ([GH-53628](https://github.com/godotengine/godot/pull/53628)).
- Fix `hint_string` for enum arrays ([GH-53638](https://github.com/godotengine/godot/pull/53638)).
- Keep order for C# exported members ([GH-54199](https://github.com/godotengine/godot/pull/54199)).
#### Networking
- Fix parsing some IPv6 URLs for WebSocket ([GH-48205](https://github.com/godotengine/godot/pull/48205)).
- `WebsocketPeer` outbound buffer fixes and buffer size query ([GH-51037](https://github.com/godotengine/godot/pull/51037)).
- Fix IP address resolution incorrectly locking the main thread ([GH-51199](https://github.com/godotengine/godot/pull/51199)).
#### Physics
- Fix 2D and 3D moving platform logic ([GH-50166](https://github.com/godotengine/godot/pull/50166), [GH-51458](https://github.com/godotengine/godot/pull/51458)).
- Various fixes to 2D and 3D `KinematicBody` `move_and_slide` and `move_and_collide` ([GH-50495](https://github.com/godotengine/godot/pull/50495)).
- Improved logic for `KinematicBody` collision recovery depth ([GH-53451](https://github.com/godotengine/godot/pull/53451)).
- Fix `RayShape` recovery in `test_body_ray_separation` ([GH-53453](https://github.com/godotengine/godot/pull/53453)).
- Apply infinite inertia checks to Godot Physics 3D ([GH-42637](https://github.com/godotengine/godot/pull/42637)).
- Fix and clean disabled shapes handling in Godot physics servers ([GH-49845](https://github.com/godotengine/godot/pull/49845)).
- Fix `KinematicBody` axis lock ([GH-45176](https://github.com/godotengine/godot/pull/45176)).
- Don't override `KinematicCollision` reference when still in use in script ([GH-52955](https://github.com/godotengine/godot/pull/52955)).
- Fix ragdoll simulation when parent was readded to scene ([GH-48823](https://github.com/godotengine/godot/pull/48823)).
- Ignore disabled shapes for mass property calculations ([GH-49699](https://github.com/godotengine/godot/pull/49699)).
#### Porting
- Android: Add GDNative libraries to Android custom Gradle builds ([GH-49912](https://github.com/godotengine/godot/pull/49912)).
- Android: Resolve issue where the Godot app remains stuck when resuming ([GH-51584](https://github.com/godotengine/godot/pull/51584)).
- Android: Properly validate `godot_project_name_string` for Android special chars ([GH-54255](https://github.com/godotengine/godot/pull/54255)).
- HTML5: Fix bug in AudioWorklet when reading output buffer ([GH-52696](https://github.com/godotengine/godot/pull/52696)).
- HTML5: Release pressed events when the window is blurred on HTML5 platform ([GH-52973](https://github.com/godotengine/godot/pull/52973)).
- Linux: Fix input events random delay on X11 ([GH-54313](https://github.com/godotengine/godot/pull/54313)).
- Linux: Fix implementation of `move_to_trash` ([GH-44021](https://github.com/godotengine/godot/pull/44021)).
- Linux: Fix crash when using ALSA MIDI with PulseAudio ([GH-48350](https://github.com/godotengine/godot/pull/48350)).
- Linux: Fix `Directory::get_space_left()` result ([GH-49222](https://github.com/godotengine/godot/pull/49222)).
- macOS: Allow "on top" windows to enter fullscreen mode ([GH-49017](https://github.com/godotengine/godot/pull/49017)).
- macOS: Fix editor window missing events on macOS Monterey ([GH-54474](https://github.com/godotengine/godot/pull/54474)).
- macOS: Fix custom mouse cursor not set after mouse mode change ([GH-49848](https://github.com/godotengine/godot/pull/49848)).
- macOS: Fix `Directory::get_space_left()` result ([GH-49222](https://github.com/godotengine/godot/pull/49222)).
- macOS: Fix Xbox controllers in Bluetooth mode on macOS ([GH-51117](https://github.com/godotengine/godot/pull/51117)).
- macOS: Fix incorrect mouse position in fullscreen ([GH-52374](https://github.com/godotengine/godot/pull/52374)).
- macOS: Add entitlements required by OIDN JIT for the editor build ([GH-54067](https://github.com/godotengine/godot/pull/54067)).
- Windows: Fix platform file access to allow file sharing with external programs ([GH-51430](https://github.com/godotengine/godot/pull/51430)).
- Windows: Fix code signing with `osslsigncode` from Linux/macOS ([GH-49985](https://github.com/godotengine/godot/pull/49985)).
- Windows: Send error logs to `stderr` instead of `stdout`, like done on other OSes ([GH-39139](https://github.com/godotengine/godot/pull/39139)).
- Windows: Fix `OS.shell_open()` not returning errors ([GH-52842](https://github.com/godotengine/godot/pull/52842)).
- Windows: Allow renaming to change the case of Windows directories ([GH-43068](https://github.com/godotengine/godot/pull/43068)).
- Windows: Disable WebM SIMD optimization with YASM which triggers crashes ([GH-53959](https://github.com/godotengine/godot/pull/53959)).
#### Rendering
- GLES2: Fix ambient light flickering with multiple refprobes ([GH-53740](https://github.com/godotengine/godot/pull/53740)).
- GLES3: Fix draw order of transparent materials with multiple directional lights ([GH-47129](https://github.com/godotengine/godot/pull/47129)).
- GLES3: Fix multimesh being colored by other nodes ([GH-47582](https://github.com/godotengine/godot/pull/47582)).
- GLES3: Only add emission on base pass ([GH-53938](https://github.com/godotengine/godot/pull/53938)).
- GLES3: Fudge irradiance map lookup to avoid precision issues ([GH-54197](https://github.com/godotengine/godot/pull/54197)).
- Fixed `rotate_y` property of particle shaders ([GH-46687](https://github.com/godotengine/godot/pull/46687)).
- Fixed behavior of velocity spread in particles ([GH-47310](https://github.com/godotengine/godot/pull/47310)).
- Fixes depth sorting of meshes with transparent textures ([GH-50721](https://github.com/godotengine/godot/pull/50721)).
- Fix flipped binormal in `SpatialMaterial` triplanar mapping ([GH-49950](https://github.com/godotengine/godot/pull/49950)).
- Fix `CanvasItem` bounding rect calculation in some cases ([GH-49160](https://github.com/godotengine/godot/pull/49160)).
- Clamp negative colors regardless of the tonemapper to avoid artifacts ([GH-51439](https://github.com/godotengine/godot/pull/51439)).
- Fix Y billboard shear when rotating camera ([GH-52151](https://github.com/godotengine/godot/pull/52151)).
- Add half frame to `floor()` for animated particles UV to compensate precision errors ([GH-53233](https://github.com/godotengine/godot/pull/53233)).
- Prevent shaders from generating code before the constructor finishes ([GH-52475](https://github.com/godotengine/godot/pull/52475)).
## [3.3] - 2021-04-21
See the [release announcement](https://godotengine.org/article/godot-3-3-has-arrived) for details.
@@ -148,6 +821,8 @@ See the [release announcement](https://godotengine.org/article/godot-3-3-has-arr
- [SVG images can now be used as a project icon](https://github.com/godotengine/godot/pull/43369).
- [Tweaked log file names for consistency between Mono and non-Mono builds](https://github.com/godotengine/godot/pull/44148).
- [Tweaked command line `--print-fps` display to display milliseconds per frame timings in addition to FPS](https://github.com/godotengine/godot/pull/47735).
- [OpenSimplexNoise is now guaranteed to give consistent results across platforms](https://github.com/godotengine/godot/issues/47211).
- This change breaks compatibility: you get different results even for the same seed.
#### Editor
@@ -1645,6 +2320,9 @@ See the [release announcement](https://godotengine.org/article/maintenance-relea
- HTML5 export using asm.js.
- Only WebAssembly is supported now, since all browsers supporting WebGL 2.0 also support WebAssembly.
[3.4.2]: https://downloads.tuxfamily.org/godotengine/3.4.2/Godot_v3.4.2-stable_changelog_chrono.txt
[3.4.1]: https://downloads.tuxfamily.org/godotengine/3.4.1/Godot_v3.4.1-stable_changelog_chrono.txt
[3.4]: https://downloads.tuxfamily.org/godotengine/3.4/Godot_v3.4-stable_changelog_chrono.txt
[3.3]: https://downloads.tuxfamily.org/godotengine/3.3/Godot_v3.3-stable_changelog_chrono.txt
[3.2.3]: https://downloads.tuxfamily.org/godotengine/3.2.3/Godot_v3.2.3-stable_changelog_chrono.txt
[3.2.2]: https://downloads.tuxfamily.org/godotengine/3.2.2/Godot_v3.2.2-stable_changelog_chrono.txt

View File

@@ -55,6 +55,14 @@ Comment: Godot Engine logo
Copyright: 2017, Andrea Calabró
License: CC-BY-4.0
Files: ./core/math/convex_hull.cpp
./core/math/convex_hull.h
Comment: Bullet Continuous Collision Detection and Physics Library
Copyright: 2011, Ole Kniemeyer, MAXON, www.maxon.net
2007-2021, Juan Linietsky, Ariel Manzur.
2014-2021, Godot Engine contributors.
License: Expat and Zlib
Files: ./modules/fbx/fbx_parser/
Comment: Open Asset Import Library (FBX parser)
Copyright: 2006-2020, assimp team
@@ -103,6 +111,8 @@ Files: ./servers/physics/gjk_epa.cpp
./servers/physics/joints/pin_joint_sw.h
./servers/physics/joints/slider_joint_sw.cpp
./servers/physics/joints/slider_joint_sw.h
./servers/physics/shape_sw.cpp
./servers/physics/shape_sw.h
Comment: Bullet Continuous Collision Detection and Physics Library
Copyright: 2003-2008, Erwin Coumans
2007-2021, Juan Linietsky, Ariel Manzur.
@@ -133,6 +143,11 @@ Copyright: 2018, Eric Lasota
2018, Microsoft Corp.
License: Expat
Files: ./thirdparty/embree/
Comment: Embree
Copyright: 2009-2021, Intel Corporation
License: Apache-2.0
Files: ./thirdparty/enet/
Comment: ENet
Copyright: 2002-2020, Lee Salzman

451
DONORS.md
View File

@@ -7,14 +7,13 @@ support of generous donors.
The ways to donate to the project, as well as details on how the funds are
used, are described on [Godot's website](https://godotengine.org/donate).
The following is a list of the current monthly donors, to be have their
The following is a list of the current monthly donors, who will have their
generous deed immortalized in the next stable release of Godot Engine.
## Platinum sponsors
Gamblify <https://www.gamblify.com>
Heroic Labs <https://heroiclabs.com>
Spiffcode <http://www.spiffcode.com>
Spiffcode <http://spiffcode.com>
## Gold sponsors
@@ -23,30 +22,35 @@ generous deed immortalized in the next stable release of Godot Engine.
## Silver sponsors
ASIFA-Hollywood <https://www.asifa-hollywood.org>
Moonwards <https://www.moonwards.com>
Zenva Academy <https://academy.zenva.com>
LITSLINK <https://litslink.com>
ORE System <https://ore-system.com>
## Bronze sponsors
Ben Nolan
Brandon Lamb
Bri
Daniel Kaplan
Garry Newman
Gordon MacPherson
Hunter Dickson
Kitcat490
Kyle Szklenski
Moonwards <https://www.moonwards.com>
TrampolineTales <http://trampolinetales.com>
## Mini sponsors
AD Ford
Alejandro Saucedo
alex brown
Andrew Bowen
Andrew Dunai
Angry Skull
anti666
Ben Nolan
blurp
CD
Christian Baune
Christoffer Sundbom
Christopher Montesano
Christopher Shifflett
Daniel Edwards
Darrin Massena
David Mydlarz
Digital Grows
@@ -56,264 +60,285 @@ generous deed immortalized in the next stable release of Godot Engine.
Gamechuck
GameDev.net
Hein-Pieter van Braam
Jacob McKenney
Jasper Brooks
Javary Co.
Jeffery Chiu
John G Gentzel
Jonah Stich
Justin Arnold
Kamil Brzezinski
Justo Delgado Baudí
Kossi Selom Banybah
Marcel Kräml
Marek Belski
Matthieu Huvé
Maxim Karsten
Michael
Mike King
Nathan Warden
Neal Gompa (Conan Kudo)
Ninja_5tyl3
Patrick Horn
Patrick Schmidt
Péter Magyar
Rami
Relintai
Ronnie Cheng
Slobodan Milnovic
Stephan Lanfermann
Steve
Thomas Krampl
Tristan Pemble
Violin Iliev
Xwdit
Zetaphor
## Gold donors
Acheron
Adam Brown
albinaask
Alvaro A Baena R
Andres Hernandez
Arisaka Mayuki
Asher Glick
Barugon
Benito
Carlo Cabanilla
Chris Goddard
Christopher Case
Daniel James
David Gehrig
David Snopek
Don B
Ed Morley
Ellen Poe
First Last
Florian Rämisch
Forge
Gamejunkey
Hoojib
Jacobus Dens
Jakub Grzesik
Javier Roman
Joan Fons
Johnny IV Young
Jonathan Wright
Jon Woodward
Karl Werf
Klavdij Voncina
kuku
Lex Steers
Luke
Maciej Pendolski
Manuele Finocchiaro
Markus Wiesner
Mason Bially
Mathieu
Matthew Hillier
Michael
m kaersten
Monster Vial
Mick
Officine Pixel S.n.c.
Rene
Patrick Brock
Paul E Hansen
Pedro Silva
Retro Village
Rob Messick
Roland Fredenhagen
Ronan Zeegers
Sandro Jenny
Sarksus
Scott B
Sean
Sergey
Sofox
Stephan Kessler
Stephen Molyneaux
Taylor Ritenour
Tom Langwaldt
Tricky Fat Cat
tukon
Vitaliy Sapronenko
William Wold
xagonist
Vagabond Arcade
Victor
Xeno Coliseum
Zaven Muradyan
Adam McLaughlin
Adam Nakonieczny
Adam Nelson
Adrian Adamiak
Alexander Erlemann
Alexander J Maynard
Alex de la Mare
Alexey Dyadchenko
Alex Khayrullin
alice gambrell
Andreas Funke
Amar Šahinović
Andrew Cunningham
Andrew Farr
Andriy
Antanas Paskauskas
Antoni Batchelli
Arisaka Mayuki
Arch Henderson III
Arthur S. Muszynski
Ben Botwin
Brandon Hawkinson
Caleb Sizemore
Can Eris
Cameron Connolly
Charlie Whitfield
Chase Taranto
Chelsea Hash
Chris Petrich
Chris Serino
Christian Leth Jeppesen
Cow
Craig Ostrin
Craig Scarborough
Craig Smith
Cristopher
CzechBlueBear
D
dan didenko
Daniel
Daniel Hernández Alcojor
Daniel Tebbutt
Darrian Little
Dennis Belfrage
Dev To be curious
Digital Denizen
Dimitri Nüscheler
Donn Eddy
Easypete
Douglas Hammond
Edgar Sun
Eric Brand
Eugenio Hugo Salgüero Jáñez
EXUREI
Felix Winterhalter
flesk
F S
foxydevloper
Fransiska
Gabrielius Vaiškūnas
Gary Hulst
gavlig
General Chicken
Geoffroy Warin
GGGames.org
gisora
GlassBrick
GrayDwarf
Guilherme Felipe de C. G. da Silva
Harvey Fong
Hayden Whitehead
Heath Hayes
Horváth Péter
Hu Hund
Hunter Barabas
HurrieCrane
Jake Burga
James Couzens
Jan Sælid
Jared
Jared White
Jennifer Wilcox
Jeremi Biernacki
Jesús Chicharro
Joel Fivat
Joel Höglund
Johnathan Kupferer
Jose Fernando Alexandre
Josef Stumpfegger
Jose Malheiro
Jose Manuel Muñoz Perez
Joseph Crane
Joshie Sparks
Joshua Flores
Joshua Lesperance
Juan T Chen
Juan Velandia
Judd
Julian Todd
Juraj Móza
JUSTIN CARROLL
Justo Delgado Baudí
Kelteseth
kickmaniac
kinfox
Kos
Lachie
Lain Ballard
Lakshaya Goel
Laszlo Kiss
leetNightshade
Leo Fidel R Liban
Liam Smyth
Luc-Frédéric Langis
Łukasz Nowak
LoparPanda
Luca Vazzano
Luke
MadScientistCarl
Marcelo Dornbusch Lopes
Marcus Dobler
Marcus Richter
Marek Belski
Mark Barrett
Martin Eigel
Martin Kotz
Martin Soucek
Matt Eunson
matt
Matt Greene
Matthias Toepp
Matthew Hall
medecau
Michael
Michael Dürwald
Michael Policastro
MightyPossum
MikadoSC
MuffinManKen
Mike B
Mike Barbee
nate etan
Nick Abousselam
Nicola Cocchiaro
Nicole Barovic
Oliver Dick
Oscar Campos
Patrick Ting
Paul Hocker
Paul Von Zimmerman
Pavel Kotlyar
Pedro Silva
Pete Goodwin
Peter Richmond
Petr Malac
PhaineOfCatz
pl
Piotr Wyszyński
Raymond Harris
Raz A
Reilt
Rene Tailleur
Rhodochrone
Ricardo Alcantara
Robert Larnach
Rickard Hermanson
Rob
Robert McDermott
Robert Willes
Rob McInroy
Rocknight Studios
Rodrigo Favarete
Rod Zilla
Romeo Disca
Ronnie Ashlock
Ronny Mühle
Ryan Heath
Ryan Scott
Ryszard Sommefeldt
Samuel Hummerstone
Samuel Judd
Sean Morgan
Sebastian Hutter
Sébastien
Serban Serafimescu
Sergey Fonaryov
Sergey Minakov
Shishir Tandale
Sing Chun Lee
SKison
Song Junwoo
spacechase0
SpiderGlitch_2002
Stephan Hennion
Stephen Brown
Steven Landow
Stoned Xander
Super Izzo
Sven F.
Thomas Bjarnelöf
Thomas Kurz
Tim Howard
Timothy van der Valk
Tobias Bocanegra
Tobias Raggl
Todd Smith
Tom Wor
Torbulous
toto bibi
Troy Kinsella
Turntsnaco
tweaklab
Tyler Chase
Valryia
Vincent Cloutier
Vlad Ceru Opran
VoidPointer
voxelv
Winston
Wojciech Chojnacki
xzibiting
Yifan Lai
Yuancheng Zhang
Zhou Tuizhi
Zie Weaver
Zoran Kukulj
## Silver donors
1D_Inc
Abraham Haskins
Adam
Adam Brown
Aaron Mayfield
Aaron Oldenburg
A. B.
Adam Brunnmeier
Adam Carr
Adam Long
@@ -322,109 +347,122 @@ generous deed immortalized in the next stable release of Godot Engine.
Adam Smeltzer
Adam Szymański
Adisibio
Agar3s - Giovanny Beltrán
Adrien de Pierres
Agustinus Arya
Ahmet Kalyoncu
Aidan O'Flannagain
Aki Mimoto
Alan Beauchamp
Alberto Salazar Muñoz
Alberto Vilches
Albin Jonasson Svärdsby
Alder Stefano
Alejandro Saucedo
AleMax
Ales Jelovcan
Alessandro Senese
Alexander Erlemann
Alexander Ryndin
Alexander Ravenheart
Alexander Walter (SilvanuZ)
Alexandre Beaudoin
alex clavelle
Alex Chan
Alex Clavelle
alex raeside
Alex (Well Done Games)
Allan Davis
Allen Schade
Anders Marstein Kruke
Andreas Krampitz
Andre Altmueller
Andre Stackhouse
Andrew Groot
andrew james morris
Andrew Mansuetti
Andrew Thomas
angrykoala
Ano Nim
Anthony Avina
Anton Bouwer
aomimezura11
AP Condomines
Antti Vesanen
Arch Toasty
Arda Erol
Armin Preiml
Arseniy M
Arthur Brainville
Arturo Rosales
Ashley Claymore
Astier Mickael
Aubrey Falconer
aurelien condomines
Avner
AzulCrescent
b110110
Balázs Batári
Bartosz Bielecki
Balázs Kondákor
Bálint Horváth
Baptiste Le Bourhis
bcat
Benedikt
Benoit Jauvin-Girard
Ben Ridley
Ben Vercammen
Bernd Jänichen
Bernhard Werner
Bill Thibault
bitbrain
Bjarne Voigtländer
Black Block
blackjacksike
Blair Allen
Blunderjack
Bobby CC Wong
Borkzilla
Boyd Trolinger
Brad Harms
Bram
brian
Brandon
Brian Klein
Brodie Fairhall
Bronson Zgeb
Bùi Việt Thành
Bruno Hurth
Burney Waring
bwhirt
c64cosmin
Caleb Gartner
Caleb Makela
Cameron Meyer
Carlos Cejudo
Carlos Rios
Carl van der Geest
Carwyn Edwards
Cas Brugman
Casey
Cassidy James
Cédric Givord
Chad Steadman
Charles Alston
Checkpoint Charlie
Chris Chapin
Chris Jagusch
Chris Langford
Christian Clavet
Christian Mauduit
Christian Winter
Christoffer Dahlblom
Christophe Gagnier
Christopher Chin
Christopher Schmitt
Chris Truebe
Clay Heaton
Christoph Woinke
Cody Parker
Conall O
Conner Lane
Corchari
Craig Maloney
Craig Post
CzechBlueBear
C. R. Messen
damucz
Daniel Cheney
Daniel Johnson
DanielMaximiano
Daren Scot Wilson
Dave Walker
David Baker
David Bôle
David May
David Maziarka
David Woodard
deadwithbread
David Rapisarda
Devin Carraway
Diego Pereira
Dimitri Roche
Dmitry Fisher
Dmytro Korchynskyi
Dominik Wetzel
Don B
Douglas Plumley
Dragontrapper
Dr Ewan Murray
Dr.Raccoon
Duobix
Duodecimal
DurrDiss
@@ -434,305 +472,370 @@ generous deed immortalized in the next stable release of Godot Engine.
Egon Elbre
Elgenzay
Elias Nykrem
Emerson MX
Ephemeral
Eric Stokes
Eric Walkingshaw
Eric Williams
Erika Sanders
Erkki Seppälä
Evan Rose
Faisal Alkubaisi
Fancy Ants Studios
fby
Fekinox
Felix Adam
Felix Bohmann
Flaredown
Fer DC
Filip Lundby
Forty Doubleu
Francisco Garcia Florez
Francois Holland
Frank
freakazoid
FrostMarble
Game Endeavor
Gareth Knowles
Gary Thomas
gebba
George Marques
georgios katsanakis
GFizz
Georgi Petkov
Graham Overby
Green Fox
Greg Lincoln
Greg Olson
Greyson Richey
Grid
Guillaume Audirac
Grok Games
Grominet
Guillaume Pham Ngoc
Guldoman
Gustavo Loureiro dos Reis
Hal A
helija
Haplo
Hayden Foley
Heribert Hirth
Houdini Blueprints
Hunter Jones
Ian ORourke
Ian Williams
Iiari
IndustrialRobot
Ivan Nikolaev
iveks
Jackson Harmer
Jacob
Jacob D
Jaguar
Jaime Ruiz-Borau Vizárraga
Jake D
Jake Huxell
Jako Danar
James
James A F Manley
James Gary
James Guardino
James Quincy
James Thomas
Jamie Massey
Janis Skuja
Jan Vetulani
JARKKO PARVIAINEN
Jason Bolton
Jason Evans
Jason Uechi
Jeff Hungerford
Jeffrey Berube
Jennifer Graves
Jesse Dubay
Jhon Adams
Jim Engstrand
Joe Hurdle
Joe Klemmer
Joel Höglund
John Bruce
John Gabriel
Jonah Branch
John Szevin
Jonas
Jonas Arndt
Jonas Bernemann
Jonas Rudlang
Jonas Yamazaki
Jonatan R
Jonathan Bieber
Jonathan Ellis
Jonathan G
Jonathan Turner
Jon Bonazza
Jon Oakes
Jon Sully
Jordan West
Jordy Goodridge
Jorge Antunes
Jorge Araya Navarro
Jose C. Rubio
Joseph Catrambone
Josep Sanchez
Josh P
Josh Taylor
Joshua Heidrich
jromkjrom
Juanfran
Juan Maggi
Juan Uys
Jueast
Julian Murgia
June Little
Justin Hamilton
Justin Hurst
Justin Oaksford
Justin Spedding
Justin W. Flory
KaDokta
Kalin
Keedong Park
keeganstoybox
Keinan Powers
Keith Bradner
Kenji Kawabata
Ken Minardo
Kenneth Lee
Kent Jofur
Kerotasma
Ketafuki
Kevin van Rooijen
Kiri Jolly
Kjetil Haugland
Kodera Software
Kolandrious
Konstantin Goncharov
Kridsada Thanabulpong
Kquona
Kristian Nygaard Jensen
KR McGinley
Kronarq
KsyTek Games
kycho
Kyle Burnett
Kyle Jacobs
Kyuppin
La diagonale du poulpe
Lasse le Dous
Laurent CHEA
Laurent Tréguier
Laxman Pradhan
LEMMiNO
Leonardo Dimano
Lin Chear
Linus Lind Lundgren
Logan Apple
Ludovic DELVAL
Luigi Renna
Luis Gaemperle
Luis M
LunaticInAHat
Major Haul
makoto asano
Malcolm
Marco Lardelli
Mark Jad
Mark Malone
Markus Martin
Markus Michael Egger
Markus Ort
Martin FIbik
Martin Holas
Martin Liška
Martin Trbola
Marvin
Mathieu
Martin Zabinski
Mathieu Meissonnier
Matt Edwards
Matthew Booe
Matt Sylvia
Maverick
Max Fiedler
Maxime Blade
Maxwell
Megasploot
Melissa Mears
Merlyn Morgan-Graham
mewin
mhilbrunner
Michael
Michael Bruce-Lockhart
Michael Haney
Michael Morrison
Michael Toporkov
Michał Skwarek
Michel Candries
MidoriBunn 'tis BS
Mikael Nordenberg
Mikayla
Mike
Mike Birkhead
Mike Copley
Mike Cunningham
Mitchell
Mitchell J. Wagner
MJacred
ModularMind
Molinghu
Molly Jameson
MoltenGears
Moowool
MrAZIE
Mrjemandem
Nathan Fish
Nathaniel
nee
neighty
Neil Blakey-Milner
Neil Wang
Nerdforge
Nerdyninja
Nicholas
Nicholas La Roux
Nicholas Orlowski
Nick Eldrenkamp
Nick Macholl
Niclas Eriksen
Nicolas Goll-Perrier
Nicolas Rosset
Nicolas SAN AGUSTIN
Nils Nordmark
Nima Farid
Noel Billig
NZ
oceoh
Okatima
OKV
Oleg Reva
Oleksandr Kryvonos
Omar Delarosa
Oriol Muñoz Princep
Orionis
oscar1000108
Oscar Domingo
Patrick Brock
Pascal
Patrick Indermühle
Patrick Nafarrete
Paul Gieske
Paweł Kowal
Paweł Łyczkowski
Peter Höglund
Peter Richmond
Petrus Prinsloo
Philip Cohoe
Philip Ludington (MrPhil)
Pierre Caye
Piotr Góral
pingudroid
pj
Point08
Preethi Vaidyanathan
pwab
Rad Cat
RabidTunes
RackBar Dingum
Rafa Laguna
Raffaele Aramo
Ragnar Pettersson
Rainer Amler
Rami Hanano
RAMupgrade
Rammeow
Ramunas Leknickas
red1939
Remi Rampin
Rémi Verschelde
Reneator
René Habermann
Riccardo Marini
Richard Hayes
Richard Ivánek
Richard Néveri
Riley
Robert Farr (Larington)
RobotCritter
Rob Ruana
Rodrigo Loli
Roger Smith
Roglozor
Roland Rząsa
Roman Tinkov
Ronald Ho Hip (CrimsonZA)
Ronan
Ross Squires
Roy Scayged
Ryan Groom
Sam Caulfield
Sam Edson
Samuele Zolfanelli
scapegoat57
Scott D. Yelich
Samuel Egger
Sangeeth Pavithran
Scott Longley
Sean Lynch
Sean Wall
Sebastian Michailidis
Sébastien
SeongWan Kim
Sergey
Sergiy Onenko
Sessamekesh
SeungJong k
Shaidak
Shane
Shane Sicienski
Shane Spoor
Siim Raidma
Silver1063
simdee
Simon Jonas Larsen
Simon Schoenenberger
Simon Wenner
Sina Yeganeh
sirn
Skalli
slavfox
smbe19
smo1704
soft circles
Solene Waked
Sophie Winter
Spencer Everhart
Squirrel
Stéphane Roussel
Stephen Rice
Steve Cloete
Steven Drovie
summerblind
Sung soo Choi
Svenne Krap
SxP
tadashi endo
tannhauser_gate
Tarch
Terry
The Domis4
Theodore Lindsey
TheVoiceInMyHead
Thibaut DECROMBECQUE
thomas
Thomas Bechtold
Thomas Detoy
Thomas Horwath
Thomas Pickett
Tianren Qin
Till1805
Tim Drumheller
Tim Erskine
Tim Gleason
Timothy B. MacDonald
Title Plinsut
TMoney
Toadile
Tobias Bradtke
Tom Coxon
Toni Duran
Tony Zhao
Tom Webster
Torgeir Lilleskog
Torsten Crass
toupeira
Travis O'Brien
Trent Skinner
tril zerobyte
Triumph263 .
Troy Bonneau
Tryggve Sollid
Turgut Temucin
Tyler Compton
Tycho
Tyler Stafos
UltyX
Uther
v01tech
Vaida
Vaughan Ling
Victor
Viktor Ismagilov
VikFro
Vincent Foulon
Vitaliy Sapronenko
Vi Watch
Vladimir Savin
Vladislav Smirnov
Vytenis Narušis
waka nya
Wayne Haak
werner mendizabal
VoxelVisions.com
Wapiti .
Watchinofoye
Wiley Thompson
William Bodin
William Edwards
William F Siqueira
William Hogben
Woonki Moon
Wyatt Goodin
x1212
xenomat
yakcyll
Yan Shi
Yegor Smirnov
Zak Stephens
Эльдар Будагов
Zher Huei Lee
蕭惟允
貴宏 小松
郝晨煜
## Bronze donors

View File

@@ -2,7 +2,7 @@
<p align="center">
<a href="https://godotengine.org">
<img src="logo.svg" width="400" alt="Godot Engine logo">
<img src="logo_outlined.svg" width="400" alt="Godot Engine logo">
</a>
</p>

View File

@@ -3,10 +3,12 @@
EnsureSConsVersion(0, 98, 1)
# System
import atexit
import glob
import os
import pickle
import sys
import time
from collections import OrderedDict
# Local
@@ -25,6 +27,8 @@ active_platform_ids = []
platform_exporters = []
platform_apis = []
time_at_start = time.time()
for x in sorted(glob.glob("platform/*")):
if not os.path.isdir(x) or not os.path.exists(x + "/detect.py"):
continue
@@ -121,7 +125,6 @@ opts.Add(BoolVariable("use_lto", "Use link-time optimization", False))
# Components
opts.Add(BoolVariable("deprecated", "Enable deprecated features", True))
opts.Add(BoolVariable("gdscript", "Enable GDScript support", True))
opts.Add(BoolVariable("minizip", "Enable ZIP archive support using minizip", True))
opts.Add(BoolVariable("xaudio2", "Enable the XAudio2 audio driver", False))
opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "")
@@ -144,13 +147,14 @@ opts.Add(
)
opts.Add(BoolVariable("disable_3d", "Disable 3D nodes for a smaller executable", False))
opts.Add(BoolVariable("disable_advanced_gui", "Disable advanced GUI nodes and behaviors", False))
opts.Add(BoolVariable("no_editor_splash", "Don't use the custom splash screen for the editor", False))
opts.Add(BoolVariable("no_editor_splash", "Don't use the custom splash screen for the editor", True))
opts.Add("system_certs_path", "Use this path as SSL certificates default for editor (for package maintainers)", "")
opts.Add(BoolVariable("use_precise_math_checks", "Math checks use very precise epsilon (debug option)", False))
# Thirdparty libraries
opts.Add(BoolVariable("builtin_bullet", "Use the built-in Bullet library", True))
opts.Add(BoolVariable("builtin_certs", "Use the built-in SSL certificates bundles", True))
opts.Add(BoolVariable("builtin_embree", "Use the built-in Embree library", True))
opts.Add(BoolVariable("builtin_enet", "Use the built-in ENet library", True))
opts.Add(BoolVariable("builtin_freetype", "Use the built-in FreeType library", True))
opts.Add(BoolVariable("builtin_libogg", "Use the built-in libogg library", True))
@@ -194,7 +198,13 @@ elif env_base["p"] != "":
selected_platform = env_base["p"]
else:
# Missing `platform` argument, try to detect platform automatically
if sys.platform.startswith("linux"):
if (
sys.platform.startswith("linux")
or sys.platform.startswith("dragonfly")
or sys.platform.startswith("freebsd")
or sys.platform.startswith("netbsd")
or sys.platform.startswith("openbsd")
):
selected_platform = "x11"
elif sys.platform == "darwin":
selected_platform = "osx"
@@ -212,7 +222,7 @@ else:
if selected_platform in ["linux", "bsd", "linuxbsd"]:
if selected_platform == "linuxbsd":
# Alias for forward compatibility.
print('Platform "linuxbsd" is still called "x11" in Godot 3.2.x. Building for platform "x11".')
print('Platform "linuxbsd" is still called "x11" in Godot 3.x. Building for platform "x11".')
# Alias for convenience.
selected_platform = "x11"
@@ -287,22 +297,23 @@ env_base.Prepend(CPPPATH=["#"])
env_base.platform_exporters = platform_exporters
env_base.platform_apis = platform_apis
# Build type defines - more platform-specific ones can be in detect.py.
if env_base["target"] == "release_debug" or env_base["target"] == "debug":
# DEBUG_ENABLED enables debugging *features* and debug-only code, which is intended
# to give *users* extra debugging information for their game development.
env_base.Append(CPPDEFINES=["DEBUG_ENABLED"])
if env_base["target"] == "debug":
# DEV_ENABLED enables *engine developer* code which should only be compiled for those
# working on the engine itself.
env_base.Append(CPPDEFINES=["DEV_ENABLED"])
if env_base["use_precise_math_checks"]:
env_base.Append(CPPDEFINES=["PRECISE_MATH_CHECKS"])
if env_base["target"] == "debug":
env_base.Append(CPPDEFINES=["DEBUG_MEMORY_ALLOC", "DISABLE_FORCED_INLINE"])
# The two options below speed up incremental builds, but reduce the certainty that all files
# will properly be rebuilt. As such, we only enable them for debug (dev) builds, not release.
# To decide whether to rebuild a file, use the MD5 sum only if the timestamp has changed.
# http://scons.org/doc/production/HTML/scons-user/ch06.html#idm139837621851792
env_base.Decider("MD5-timestamp")
# Use cached implicit dependencies by default. Can be overridden by specifying `--implicit-deps-changed` in the command line.
# http://scons.org/doc/production/HTML/scons-user/ch06s04.html
env_base.SetOption("implicit_cache", 1)
if not env_base.File("#main/splash_editor.png").exists():
# Force disabling editor splash if missing.
env_base["no_editor_splash"] = True
if env_base["no_editor_splash"]:
env_base.Append(CPPDEFINES=["NO_EDITOR_SPLASH"])
@@ -421,17 +432,21 @@ if selected_platform in platform_list:
else: # GCC, Clang
version = methods.get_compiler_version(env) or [-1, -1]
gcc_common_warnings = []
common_warnings = []
if methods.using_gcc(env):
gcc_common_warnings += ["-Wno-misleading-indentation"]
common_warnings += ["-Wno-misleading-indentation"]
if version[0] >= 7:
gcc_common_warnings += ["-Wshadow-local"]
common_warnings += ["-Wshadow-local"]
elif methods.using_clang(env) or methods.using_emcc(env):
# We often implement `operator<` for structs of pointers as a requirement
# for putting them in `Set` or `Map`. We don't mind about unreliable ordering.
common_warnings += ["-Wno-ordered-compare-function-pointers"]
if env["warnings"] == "extra":
# Note: enable -Wimplicit-fallthrough for Clang (already part of -Wextra for GCC)
# once we switch to C++11 or later (necessary for our FALLTHROUGH macro).
env.Append(CCFLAGS=["-Wall", "-Wextra", "-Wwrite-strings", "-Wno-unused-parameter"] + gcc_common_warnings)
env.Append(CCFLAGS=["-Wall", "-Wextra", "-Wwrite-strings", "-Wno-unused-parameter"] + common_warnings)
env.Append(CXXFLAGS=["-Wctor-dtor-privacy", "-Wnon-virtual-dtor"])
if methods.using_gcc(env):
env.Append(
@@ -447,9 +462,9 @@ if selected_platform in platform_list:
if version[0] >= 9:
env.Append(CCFLAGS=["-Wattribute-alias=2"])
elif env["warnings"] == "all":
env.Append(CCFLAGS=["-Wall"] + gcc_common_warnings)
env.Append(CCFLAGS=["-Wall"] + common_warnings)
elif env["warnings"] == "moderate":
env.Append(CCFLAGS=["-Wall", "-Wno-unused"] + gcc_common_warnings)
env.Append(CCFLAGS=["-Wall", "-Wno-unused"] + common_warnings)
else: # 'no'
env.Append(CCFLAGS=["-w"])
@@ -570,8 +585,6 @@ if selected_platform in platform_list:
sys.exit(255)
else:
env.Append(CPPDEFINES=["_3D_DISABLED"])
if env["gdscript"]:
env.Append(CPPDEFINES=["GDSCRIPT_ENABLED"])
if env["disable_advanced_gui"]:
if env["tools"]:
print(
@@ -584,7 +597,7 @@ if selected_platform in platform_list:
if env["minizip"]:
env.Append(CPPDEFINES=["MINIZIP_ENABLED"])
editor_module_list = ["freetype", "regex"]
editor_module_list = ["freetype"]
for x in editor_module_list:
if not env["module_" + x + "_enabled"]:
if env["tools"]:
@@ -675,3 +688,12 @@ if "env" in locals():
# TODO: replace this with `env.Dump(format="json")`
# once we start requiring SCons 4.0 as min version.
methods.dump(env)
def print_elapsed_time():
elapsed_time_sec = round(time.time() - time_at_start, 3)
time_ms = round((elapsed_time_sec % 1) * 1000)
print("[Time elapsed: {}.{:03}]".format(time.strftime("%H:%M:%S", time.gmtime(elapsed_time_sec)), time_ms))
atexit.register(print_elapsed_time)

View File

@@ -14,25 +14,28 @@ import os
txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0"
if "SCRIPT_AES256_ENCRYPTION_KEY" in os.environ:
e = os.environ["SCRIPT_AES256_ENCRYPTION_KEY"]
txt = ""
key = os.environ["SCRIPT_AES256_ENCRYPTION_KEY"]
ec_valid = True
if len(e) != 64:
if len(key) != 64:
ec_valid = False
else:
for i in range(len(e) >> 1):
txt = ""
for i in range(len(key) >> 1):
if i > 0:
txt += ","
txts = "0x" + e[i * 2 : i * 2 + 2]
txts = "0x" + key[i * 2 : i * 2 + 2]
try:
int(txts, 16)
except Exception:
ec_valid = False
txt += txts
if not ec_valid:
txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0"
print("Invalid AES256 encryption key, not 64 bits hex: " + e)
print("Error: Invalid AES256 encryption key, not 64 hexadecimal characters: '" + key + "'.")
print(
"Unset 'SCRIPT_AES256_ENCRYPTION_KEY' in your environment "
"or make sure that it contains exactly 64 hexadecimal characters."
)
Exit(255)
# NOTE: It is safe to generate this file here, since this is still executed serially
with open("script_encryption_key.gen.cpp", "w") as f:
@@ -40,6 +43,9 @@ with open("script_encryption_key.gen.cpp", "w") as f:
# Add required thirdparty code.
thirdparty_obj = []
env_thirdparty = env.Clone()
env_thirdparty.disable_warnings()
@@ -57,7 +63,7 @@ thirdparty_misc_sources = [
"clipper.cpp",
]
thirdparty_misc_sources = [thirdparty_misc_dir + file for file in thirdparty_misc_sources]
env_thirdparty.add_source_files(env.core_sources, thirdparty_misc_sources)
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_misc_sources)
# Zlib library, can be unbundled
if env["builtin_zlib"]:
@@ -83,7 +89,7 @@ if env["builtin_zlib"]:
if env["target"] == "debug":
env_thirdparty.Append(CPPDEFINES=["ZLIB_DEBUG"])
env_thirdparty.add_source_files(env.core_sources, thirdparty_zlib_sources)
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_zlib_sources)
# Minizip library, could be unbundled in theory
# However, our version has some custom modifications, so it won't compile with the system one
@@ -94,7 +100,7 @@ thirdparty_minizip_sources = [
"zip.c",
]
thirdparty_minizip_sources = [thirdparty_minizip_dir + file for file in thirdparty_minizip_sources]
env_thirdparty.add_source_files(env.core_sources, thirdparty_minizip_sources)
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_minizip_sources)
# Zstd library, can be unbundled in theory
# though we currently use some private symbols
@@ -136,11 +142,16 @@ if env["builtin_zstd"]:
# Also needed in main env includes will trigger warnings
env.Append(CPPDEFINES=["ZSTD_STATIC_LINKING_ONLY"])
env_thirdparty.add_source_files(env.core_sources, thirdparty_zstd_sources)
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_zstd_sources)
# Godot's own sources
env.core_sources += thirdparty_obj
# Godot source files
env.add_source_files(env.core_sources, "*.cpp")
env.add_source_files(env.core_sources, "script_encryption_key.gen.cpp")
# Certificates
env.Depends(
@@ -185,3 +196,6 @@ SConscript("bind/SCsub")
# Build it all as a library
lib = env.add_library("core", env.core_sources)
env.Prepend(LIBS=[lib])
# Needed to force rebuilding the core files when the thirdparty code is updated.
env.Depends(lib, thirdparty_obj)

View File

@@ -42,13 +42,13 @@ public:
};
void Array::_ref(const Array &p_from) const {
ArrayPrivate *_fp = p_from._p;
ERR_FAIL_COND(!_fp); // should NOT happen.
if (_fp == _p)
if (_fp == _p) {
return; // whatever it is, nothing to do here move along
}
bool success = _fp->refcount.ref();
@@ -60,80 +60,66 @@ void Array::_ref(const Array &p_from) const {
}
void Array::_unref() const {
if (!_p)
if (!_p) {
return;
}
if (_p->refcount.unref()) {
memdelete(_p);
}
_p = NULL;
_p = nullptr;
}
Variant &Array::operator[](int p_idx) {
return _p->array.write[p_idx];
}
const Variant &Array::operator[](int p_idx) const {
return _p->array[p_idx];
}
int Array::size() const {
return _p->array.size();
}
bool Array::empty() const {
return _p->array.empty();
}
void Array::clear() {
_p->array.clear();
}
bool Array::operator==(const Array &p_array) const {
return _p == p_array._p;
}
uint32_t Array::hash() const {
uint32_t h = hash_djb2_one_32(0);
for (int i = 0; i < _p->array.size(); i++) {
h = hash_djb2_one_32(_p->array[i].hash(), h);
}
return h;
}
void Array::operator=(const Array &p_array) {
_ref(p_array);
}
void Array::push_back(const Variant &p_value) {
_p->array.push_back(p_value);
}
void Array::append_array(const Array &p_array) {
_p->array.append_array(p_array._p->array);
}
Error Array::resize(int p_new_size) {
return _p->array.resize(p_new_size);
}
void Array::insert(int p_pos, const Variant &p_value) {
_p->array.insert(p_pos, p_value);
}
void Array::erase(const Variant &p_value) {
_p->array.erase(p_value);
}
@@ -148,14 +134,13 @@ Variant Array::back() const {
}
int Array::find(const Variant &p_value, int p_from) const {
return _p->array.find(p_value, p_from);
}
int Array::rfind(const Variant &p_value, int p_from) const {
if (_p->array.size() == 0)
if (_p->array.size() == 0) {
return -1;
}
if (p_from < 0) {
// Relative offset from the end
@@ -167,7 +152,6 @@ int Array::rfind(const Variant &p_value, int p_from) const {
}
for (int i = p_from; i >= 0; i--) {
if (_p->array[i] == p_value) {
return i;
}
@@ -177,18 +161,16 @@ int Array::rfind(const Variant &p_value, int p_from) const {
}
int Array::find_last(const Variant &p_value) const {
return rfind(p_value);
}
int Array::count(const Variant &p_value) const {
if (_p->array.size() == 0)
if (_p->array.size() == 0) {
return 0;
}
int amount = 0;
for (int i = 0; i < _p->array.size(); i++) {
if (_p->array[i] == p_value) {
amount++;
}
@@ -202,22 +184,18 @@ bool Array::has(const Variant &p_value) const {
}
void Array::remove(int p_pos) {
_p->array.remove(p_pos);
}
void Array::set(int p_idx, const Variant &p_value) {
operator[](p_idx) = p_value;
}
const Variant &Array::get(int p_idx) const {
return operator[](p_idx);
}
Array Array::duplicate(bool p_deep) const {
Array new_arr;
int element_count = size();
new_arr.resize(element_count);
@@ -229,7 +207,6 @@ Array Array::duplicate(bool p_deep) const {
}
int Array::_clamp_slice_index(int p_index) const {
int arr_size = size();
int fixed_index = CLAMP(p_index, -arr_size, arr_size - 1);
if (fixed_index < 0) {
@@ -244,14 +221,17 @@ Array Array::slice(int p_begin, int p_end, int p_step, bool p_deep) const { // l
ERR_FAIL_COND_V_MSG(p_step == 0, new_arr, "Array slice step size cannot be zero.");
if (empty()) // Don't try to slice empty arrays.
if (empty()) { // Don't try to slice empty arrays.
return new_arr;
}
if (p_step > 0) {
if (p_begin >= size() || p_end < -size())
if (p_begin >= size() || p_end < -size()) {
return new_arr;
}
} else { // p_step < 0
if (p_begin < -size() || p_end >= size())
if (p_begin < -size() || p_end >= size()) {
return new_arr;
}
}
int begin = _clamp_slice_index(p_begin);
@@ -278,40 +258,37 @@ Array Array::slice(int p_begin, int p_end, int p_step, bool p_deep) const { // l
}
struct _ArrayVariantSort {
_FORCE_INLINE_ bool operator()(const Variant &p_l, const Variant &p_r) const {
bool valid = false;
Variant res;
Variant::evaluate(Variant::OP_LESS, p_l, p_r, res, valid);
if (!valid)
if (!valid) {
res = false;
}
return res;
}
};
Array &Array::sort() {
_p->array.sort_custom<_ArrayVariantSort>();
return *this;
}
struct _ArrayVariantSortCustom {
Object *obj;
StringName func;
_FORCE_INLINE_ bool operator()(const Variant &p_l, const Variant &p_r) const {
const Variant *args[2] = { &p_l, &p_r };
Variant::CallError err;
bool res = obj->call(func, args, 2, err);
if (err.error != Variant::CallError::CALL_OK)
if (err.error != Variant::CallError::CALL_OK) {
res = false;
}
return res;
}
};
Array &Array::sort_custom(Object *p_obj, const StringName &p_function) {
ERR_FAIL_NULL_V(p_obj, *this);
SortArray<Variant, _ArrayVariantSortCustom, true> avs;
@@ -322,10 +299,10 @@ Array &Array::sort_custom(Object *p_obj, const StringName &p_function) {
}
void Array::shuffle() {
const int n = _p->array.size();
if (n < 2)
if (n < 2) {
return;
}
Variant *data = _p->array.ptrw();
for (int i = n - 1; i >= 1; i--) {
const int j = Math::rand() % (i + 1);
@@ -337,7 +314,6 @@ void Array::shuffle() {
template <typename Less>
_FORCE_INLINE_ int bisect(const Vector<Variant> &p_array, const Variant &p_value, bool p_before, const Less &p_less) {
int lo = 0;
int hi = p_array.size();
if (p_before) {
@@ -363,12 +339,10 @@ _FORCE_INLINE_ int bisect(const Vector<Variant> &p_array, const Variant &p_value
}
int Array::bsearch(const Variant &p_value, bool p_before) {
return bisect(_p->array, p_value, p_before, _ArrayVariantSort());
}
int Array::bsearch_custom(const Variant &p_value, Object *p_obj, const StringName &p_function, bool p_before) {
ERR_FAIL_NULL_V(p_obj, 0);
_ArrayVariantSortCustom less;
@@ -379,21 +353,18 @@ int Array::bsearch_custom(const Variant &p_value, Object *p_obj, const StringNam
}
Array &Array::invert() {
_p->array.invert();
return *this;
}
void Array::push_front(const Variant &p_value) {
_p->array.insert(0, p_value);
}
Variant Array::pop_back() {
if (!_p->array.empty()) {
int n = _p->array.size() - 1;
Variant ret = _p->array.get(n);
const int n = _p->array.size() - 1;
const Variant ret = _p->array.get(n);
_p->array.resize(n);
return ret;
}
@@ -401,17 +372,40 @@ Variant Array::pop_back() {
}
Variant Array::pop_front() {
if (!_p->array.empty()) {
Variant ret = _p->array.get(0);
const Variant ret = _p->array.get(0);
_p->array.remove(0);
return ret;
}
return Variant();
}
Variant Array::min() const {
Variant Array::pop_at(int p_pos) {
if (_p->array.empty()) {
// Return `null` without printing an error to mimic `pop_back()` and `pop_front()` behavior.
return Variant();
}
if (p_pos < 0) {
// Relative offset from the end
p_pos = _p->array.size() + p_pos;
}
ERR_FAIL_INDEX_V_MSG(
p_pos,
_p->array.size(),
Variant(),
vformat(
"The calculated index %s is out of bounds (the array has %s elements). Leaving the array untouched and returning `null`.",
p_pos,
_p->array.size()));
const Variant ret = _p->array.get(p_pos);
_p->array.remove(p_pos);
return ret;
}
Variant Array::min() const {
Variant minval;
for (int i = 0; i < size(); i++) {
if (i == 0) {
@@ -434,7 +428,6 @@ Variant Array::min() const {
}
Variant Array::max() const {
Variant maxval;
for (int i = 0; i < size(); i++) {
if (i == 0) {
@@ -461,17 +454,14 @@ const void *Array::id() const {
}
Array::Array(const Array &p_from) {
_p = NULL;
_p = nullptr;
_ref(p_from);
}
Array::Array() {
_p = memnew(ArrayPrivate);
_p->refcount.init();
}
Array::~Array() {
_unref();
}

View File

@@ -39,7 +39,6 @@ class Object;
class StringName;
class Array {
mutable ArrayPrivate *_p;
void _ref(const Array &p_from) const;
void _unref() const;
@@ -91,6 +90,7 @@ public:
void push_front(const Variant &p_value);
Variant pop_back();
Variant pop_front();
Variant pop_at(int p_pos);
Array duplicate(bool p_deep = false) const;

File diff suppressed because it is too large Load Diff

View File

@@ -256,6 +256,7 @@ public:
Vector<String> get_cmdline_args();
String get_locale() const;
String get_locale_language() const;
String get_latin_keyboard_variant() const;
int keyboard_get_layout_count() const;
int keyboard_get_current_layout() const;
@@ -311,7 +312,7 @@ public:
void delay_usec(int p_usec) const;
void delay_msec(int p_msec) const;
uint32_t get_ticks_msec() const;
uint64_t get_ticks_msec() const;
uint64_t get_ticks_usec() const;
uint32_t get_splash_tick_msec() const;
@@ -347,9 +348,12 @@ public:
SCREEN_ORIENTATION_SENSOR,
};
String get_system_dir(SystemDir p_dir) const;
String get_system_dir(SystemDir p_dir, bool p_shared_storage = true) const;
String get_user_data_dir() const;
String get_config_dir() const;
String get_data_dir() const;
String get_cache_dir() const;
void alert(const String &p_alert, const String &p_title = "ALERT!");
@@ -370,6 +374,9 @@ public:
void set_vsync_via_compositor(bool p_enable);
bool is_vsync_via_compositor_enabled() const;
void set_delta_smoothing(bool p_enabled);
bool is_delta_smoothing_enabled() const;
PowerState get_power_state();
int get_power_seconds_left();
int get_power_percent_left();
@@ -399,7 +406,6 @@ VARIANT_ENUM_CAST(_OS::ScreenOrientation);
VARIANT_ENUM_CAST(_OS::HandleType);
class _Geometry : public Object {
GDCLASS(_Geometry, Object);
static _Geometry *singleton;
@@ -480,7 +486,6 @@ VARIANT_ENUM_CAST(_Geometry::PolyJoinType);
VARIANT_ENUM_CAST(_Geometry::PolyEndType);
class _File : public Reference {
GDCLASS(_File, Reference);
FileAccess *f;
bool eswap;
@@ -518,8 +523,8 @@ public:
void seek(int64_t p_position); // Seek to a given position.
void seek_end(int64_t p_position = 0); // Seek from the end of file.
int64_t get_position() const; // Get position in the file.
int64_t get_len() const; // Get size of the file.
uint64_t get_position() const; // Get position in the file.
uint64_t get_len() const; // Get size of the file.
bool eof_reached() const; // Reading passed EOF.
@@ -534,7 +539,7 @@ public:
Variant get_var(bool p_allow_objects = false) const;
PoolVector<uint8_t> get_buffer(int p_length) const; // Get an array of bytes.
PoolVector<uint8_t> get_buffer(int64_t p_length) const; // Get an array of bytes.
String get_line() const;
Vector<String> get_csv_line(const String &p_delim = ",") const;
String get_as_text() const;
@@ -583,7 +588,6 @@ VARIANT_ENUM_CAST(_File::ModeFlags);
VARIANT_ENUM_CAST(_File::CompressionMode);
class _Directory : public Reference {
GDCLASS(_Directory, Reference);
DirAccess *d;
@@ -612,7 +616,7 @@ public:
bool file_exists(String p_file);
bool dir_exists(String p_dir);
int get_space_left();
uint64_t get_space_left();
Error copy(String p_from, String p_to);
Error rename(String p_from, String p_to);
@@ -627,7 +631,6 @@ private:
};
class _Marshalls : public Object {
GDCLASS(_Marshalls, Object);
static _Marshalls *singleton;
@@ -648,11 +651,10 @@ public:
String base64_to_utf8(const String &p_str);
_Marshalls() { singleton = this; }
~_Marshalls() { singleton = NULL; }
~_Marshalls() { singleton = nullptr; }
};
class _Mutex : public Reference {
GDCLASS(_Mutex, Reference);
Mutex mutex;
@@ -665,7 +667,6 @@ public:
};
class _Semaphore : public Reference {
GDCLASS(_Semaphore, Reference);
Semaphore semaphore;
@@ -677,14 +678,13 @@ public:
};
class _Thread : public Reference {
GDCLASS(_Thread, Reference);
protected:
Variant ret;
Variant userdata;
SafeFlag active;
Object *target_instance;
SafeFlag running;
ObjectID target_instance_id;
StringName target_method;
Thread thread;
static void _bind_methods();
@@ -702,6 +702,7 @@ public:
Error start(Object *p_instance, const StringName &p_method, const Variant &p_userdata = Variant(), Priority p_priority = PRIORITY_NORMAL);
String get_id() const;
bool is_active() const;
bool is_alive() const;
Variant wait_to_finish();
_Thread();
@@ -711,7 +712,6 @@ public:
VARIANT_ENUM_CAST(_Thread::Priority);
class _ClassDB : public Object {
GDCLASS(_ClassDB, Object);
protected:
@@ -743,6 +743,11 @@ public:
int get_integer_constant(const StringName &p_class, const StringName &p_name) const;
StringName get_category(const StringName &p_node) const;
bool has_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false) const;
PoolStringArray get_enum_list(const StringName &p_class, bool p_no_inheritance = false) const;
PoolStringArray get_enum_constants(const StringName &p_class, const StringName &p_enum, bool p_no_inheritance = false) const;
StringName get_integer_constant_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false) const;
bool is_class_enabled(StringName p_class) const;
_ClassDB();
@@ -794,6 +799,9 @@ public:
void set_editor_hint(bool p_enabled);
bool is_editor_hint() const;
void set_print_error_messages(bool p_enabled);
bool is_printing_error_messages() const;
_Engine();
};

View File

@@ -1,5 +1,5 @@
/*************************************************************************/
/* audio_driver_jandroid.h */
/* bitfield_dynamic.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,52 +28,52 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef AUDIO_DRIVER_ANDROID_H
#define AUDIO_DRIVER_ANDROID_H
#include "bitfield_dynamic.h"
#include "servers/audio_server.h"
#include "core/os/memory.h"
#include "java_godot_lib_jni.h"
#include <string.h>
class AudioDriverAndroid : public AudioDriver {
void BitFieldDynamic::copy_from(const BitFieldDynamic &p_source) {
create(p_source.get_num_bits(), false);
memcpy(_data, p_source.get_data(), p_source.get_num_bytes());
}
static Mutex mutex;
static AudioDriverAndroid *s_ad;
static jobject io;
static jmethodID _init_audio;
static jmethodID _write_buffer;
static jmethodID _quit;
static jmethodID _pause;
static bool active;
static bool quit;
void BitFieldDynamic::create(uint32_t p_num_bits, bool p_blank) {
// first delete any initial
destroy();
static jclass cls;
_num_bits = p_num_bits;
if (p_num_bits) {
_num_bytes = (p_num_bits / 8) + 1;
_data = (uint8_t *)memalloc(_num_bytes);
static jobject audioBuffer;
static void *audioBufferPinned;
static int32_t *audioBuffer32;
static int audioBufferFrames;
static int mix_rate;
if (p_blank) {
blank(false);
}
}
}
public:
void set_singleton();
void BitFieldDynamic::destroy() {
if (_data) {
memfree(_data);
_data = nullptr;
}
virtual const char *get_name() const;
_num_bytes = 0;
_num_bits = 0;
}
virtual Error init();
virtual void start();
virtual int get_mix_rate() const;
virtual SpeakerMode get_speaker_mode() const;
virtual void lock();
virtual void unlock();
virtual void finish();
void BitFieldDynamic::blank(bool p_set_or_zero) {
if (p_set_or_zero) {
memset(_data, 255, _num_bytes);
} else {
memset(_data, 0, _num_bytes);
}
}
virtual void set_pause(bool p_pause);
static void setup(jobject p_io);
static void thread_func(JNIEnv *env);
AudioDriverAndroid();
};
#endif // AUDIO_DRIVER_ANDROID_H
void BitFieldDynamic::invert() {
for (uint32_t n = 0; n < _num_bytes; n++) {
_data[n] = ~_data[n];
}
}

111
core/bitfield_dynamic.h Normal file
View File

@@ -0,0 +1,111 @@
/*************************************************************************/
/* bitfield_dynamic.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef BITFIELD_DYNAMIC_H
#define BITFIELD_DYNAMIC_H
#include "core/error_macros.h"
class BitFieldDynamic {
public:
~BitFieldDynamic() { destroy(); }
private:
// prevent copying (see effective C++ scott meyers)
// there is no implementation for copy constructor, hence compiler will complain if you try to copy
// feel free to add one if needed...
BitFieldDynamic &operator=(const BitFieldDynamic &);
public:
// create automatically blanks
void create(uint32_t p_num_bits, bool p_blank = true);
void destroy();
// public funcs
uint32_t get_num_bits() const { return _num_bits; }
uint32_t get_bit(uint32_t p_bit) const;
void set_bit(uint32_t p_bit, uint32_t p_set);
bool check_and_set(uint32_t p_bit);
void blank(bool p_set_or_zero = false);
void invert();
void copy_from(const BitFieldDynamic &p_source);
// loading / saving
uint8_t *get_data() { return _data; }
const uint8_t *get_data() const { return _data; }
uint32_t get_num_bytes() const { return _num_bytes; }
protected:
// member vars
uint8_t *_data = nullptr;
uint32_t _num_bytes = 0;
uint32_t _num_bits = 0;
};
inline uint32_t BitFieldDynamic::get_bit(uint32_t p_bit) const {
DEV_ASSERT(_data);
uint32_t byte_number = p_bit >> 3; // divide by 8
DEV_ASSERT(byte_number < _num_bytes);
uint8_t uc = _data[byte_number];
uint32_t bit_set = uc & (1 << (p_bit & 7));
return bit_set;
}
inline bool BitFieldDynamic::check_and_set(uint32_t p_bit) {
DEV_ASSERT(_data);
uint32_t byte_number = p_bit >> 3; // divide by 8
DEV_ASSERT(byte_number < _num_bytes);
uint8_t &uc = _data[byte_number];
uint32_t mask = (1 << (p_bit & 7));
uint32_t bit_set = uc & mask;
if (bit_set) {
return false;
}
// set
uc = uc | mask;
return true;
}
inline void BitFieldDynamic::set_bit(uint32_t p_bit, uint32_t p_set) {
DEV_ASSERT(_data);
uint32_t byte_number = p_bit >> 3; // divide by 8
DEV_ASSERT(byte_number < _num_bytes);
uint8_t uc = _data[byte_number];
uint32_t mask = 1 << (p_bit & 7);
if (p_set) {
uc = uc | mask;
} else {
uc &= ~mask;
}
_data[byte_number] = uc;
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -46,7 +46,6 @@
#ifdef DEBUG_METHODS_ENABLED
struct MethodDefinition {
StringName name;
Vector<StringName> args;
MethodDefinition() {}
@@ -101,7 +100,6 @@ public:
public:
struct PropertySetGet {
int index;
StringName setter;
StringName getter;
@@ -111,13 +109,12 @@ public:
};
struct ClassInfo {
APIType api;
ClassInfo *inherits_ptr;
void *class_ptr;
HashMap<StringName, MethodBind *> method_map;
HashMap<StringName, int> constant_map;
HashMap<StringName, List<StringName> > enum_map;
HashMap<StringName, List<StringName>> enum_map;
HashMap<StringName, MethodInfo> signal_map;
List<PropertyInfo> property_list;
#ifdef DEBUG_METHODS_ENABLED
@@ -158,7 +155,7 @@ public:
static void _add_class2(const StringName &p_class, const StringName &p_inherits);
static HashMap<StringName, HashMap<StringName, Variant> > default_values;
static HashMap<StringName, HashMap<StringName, Variant>> default_values;
static Set<StringName> default_values_cached;
private:
@@ -170,13 +167,11 @@ public:
// DO NOT USE THIS!!!!!! NEEDS TO BE PUBLIC BUT DO NOT USE NO MATTER WHAT!!!
template <class T>
static void _add_class() {
_add_class2(T::get_class_static(), T::get_parent_class_static());
}
template <class T>
static void register_class() {
GLOBAL_LOCK_FUNCTION;
T::initialize_class();
ClassInfo *t = classes.getptr(T::get_class_static());
@@ -189,7 +184,6 @@ public:
template <class T>
static void register_virtual_class() {
GLOBAL_LOCK_FUNCTION;
T::initialize_class();
ClassInfo *t = classes.getptr(T::get_class_static());
@@ -201,13 +195,11 @@ public:
template <class T>
static Object *_create_ptr_func() {
return T::create();
}
template <class T>
static void register_custom_instance_class() {
GLOBAL_LOCK_FUNCTION;
T::initialize_class();
ClassInfo *t = classes.getptr(T::get_class_static());
@@ -233,15 +225,13 @@ public:
template <class N, class M>
static MethodBind *bind_method(N p_method_name, M p_method) {
MethodBind *bind = create_method_bind(p_method);
return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, NULL, 0); //use static function, much smaller binary usage
return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, nullptr, 0); //use static function, much smaller binary usage
}
template <class N, class M>
static MethodBind *bind_method(N p_method_name, M p_method, const Variant &p_def1) {
MethodBind *bind = create_method_bind(p_method);
const Variant *ptr[1] = { &p_def1 };
@@ -250,7 +240,6 @@ public:
template <class N, class M>
static MethodBind *bind_method(N p_method_name, M p_method, const Variant &p_def1, const Variant &p_def2) {
MethodBind *bind = create_method_bind(p_method);
const Variant *ptr[2] = { &p_def1, &p_def2 };
@@ -259,7 +248,6 @@ public:
template <class N, class M>
static MethodBind *bind_method(N p_method_name, M p_method, const Variant &p_def1, const Variant &p_def2, const Variant &p_def3) {
MethodBind *bind = create_method_bind(p_method);
const Variant *ptr[3] = { &p_def1, &p_def2, &p_def3 };
@@ -268,7 +256,6 @@ public:
template <class N, class M>
static MethodBind *bind_method(N p_method_name, M p_method, const Variant &p_def1, const Variant &p_def2, const Variant &p_def3, const Variant &p_def4) {
MethodBind *bind = create_method_bind(p_method);
const Variant *ptr[4] = { &p_def1, &p_def2, &p_def3, &p_def4 };
@@ -277,7 +264,6 @@ public:
template <class N, class M>
static MethodBind *bind_method(N p_method_name, M p_method, const Variant &p_def1, const Variant &p_def2, const Variant &p_def3, const Variant &p_def4, const Variant &p_def5) {
MethodBind *bind = create_method_bind(p_method);
const Variant *ptr[5] = { &p_def1, &p_def2, &p_def3, &p_def4, &p_def5 };
@@ -286,7 +272,6 @@ public:
template <class N, class M>
static MethodBind *bind_method(N p_method_name, M p_method, const Variant &p_def1, const Variant &p_def2, const Variant &p_def3, const Variant &p_def4, const Variant &p_def5, const Variant &p_def6) {
MethodBind *bind = create_method_bind(p_method);
const Variant *ptr[6] = { &p_def1, &p_def2, &p_def3, &p_def4, &p_def5, &p_def6 };
@@ -295,7 +280,6 @@ public:
template <class N, class M>
static MethodBind *bind_method(N p_method_name, M p_method, const Variant &p_def1, const Variant &p_def2, const Variant &p_def3, const Variant &p_def4, const Variant &p_def5, const Variant &p_def6, const Variant &p_def7) {
MethodBind *bind = create_method_bind(p_method);
const Variant *ptr[7] = { &p_def1, &p_def2, &p_def3, &p_def4, &p_def5, &p_def6, &p_def7 };
@@ -304,7 +288,6 @@ public:
template <class N, class M>
static MethodBind *bind_method(N p_method_name, M p_method, const Variant &p_def1, const Variant &p_def2, const Variant &p_def3, const Variant &p_def4, const Variant &p_def5, const Variant &p_def6, const Variant &p_def7, const Variant &p_def8) {
MethodBind *bind = create_method_bind(p_method);
const Variant *ptr[8] = { &p_def1, &p_def2, &p_def3, &p_def4, &p_def5, &p_def6, &p_def7, &p_def8 };
@@ -313,11 +296,10 @@ public:
template <class M>
static MethodBind *bind_vararg_method(uint32_t p_flags, StringName p_name, M p_method, const MethodInfo &p_info = MethodInfo(), const Vector<Variant> &p_default_args = Vector<Variant>(), bool p_return_nil_is_variant = true) {
GLOBAL_LOCK_FUNCTION;
MethodBind *bind = create_vararg_method_bind(p_method, p_info, p_return_nil_is_variant);
ERR_FAIL_COND_V(!bind, NULL);
ERR_FAIL_COND_V(!bind, nullptr);
bind->set_name(p_name);
bind->set_default_arguments(p_default_args);
@@ -327,13 +309,13 @@ public:
ClassInfo *type = classes.getptr(instance_type);
if (!type) {
memdelete(bind);
ERR_FAIL_COND_V(!type, NULL);
ERR_FAIL_COND_V(!type, nullptr);
}
if (type->method_map.has(p_name)) {
memdelete(bind);
// overloading not supported
ERR_FAIL_V_MSG(NULL, "Method already bound: " + instance_type + "::" + p_name + ".");
ERR_FAIL_V_MSG(nullptr, "Method already bound: " + instance_type + "::" + p_name + ".");
}
type->method_map[p_name] = bind;
#ifdef DEBUG_METHODS_ENABLED
@@ -353,12 +335,12 @@ public:
static void add_property_group(StringName p_class, const String &p_name, const String &p_prefix = "");
static void add_property(StringName p_class, const PropertyInfo &p_pinfo, const StringName &p_setter, const StringName &p_getter, int p_index = -1);
static void set_property_default_value(StringName p_class, const StringName &p_name, const Variant &p_default);
static void get_property_list(StringName p_class, List<PropertyInfo> *p_list, bool p_no_inheritance = false, const Object *p_validator = NULL);
static bool set_property(Object *p_object, const StringName &p_property, const Variant &p_value, bool *r_valid = NULL);
static void get_property_list(StringName p_class, List<PropertyInfo> *p_list, bool p_no_inheritance = false, const Object *p_validator = nullptr);
static bool set_property(Object *p_object, const StringName &p_property, const Variant &p_value, bool *r_valid = nullptr);
static bool get_property(Object *p_object, const StringName &p_property, Variant &r_value);
static bool has_property(const StringName &p_class, const StringName &p_property, bool p_no_inheritance = false);
static int get_property_index(const StringName &p_class, const StringName &p_property, bool *r_is_valid = NULL);
static Variant::Type get_property_type(const StringName &p_class, const StringName &p_property, bool *r_is_valid = NULL);
static int get_property_index(const StringName &p_class, const StringName &p_property, bool *r_is_valid = nullptr);
static Variant::Type get_property_type(const StringName &p_class, const StringName &p_property, bool *r_is_valid = nullptr);
static StringName get_property_setter(StringName p_class, const StringName &p_property);
static StringName get_property_getter(StringName p_class, const StringName &p_property);
@@ -373,13 +355,14 @@ public:
static void bind_integer_constant(const StringName &p_class, const StringName &p_enum, const StringName &p_name, int p_constant);
static void get_integer_constant_list(const StringName &p_class, List<String> *p_constants, bool p_no_inheritance = false);
static int get_integer_constant(const StringName &p_class, const StringName &p_name, bool *p_success = NULL);
static int get_integer_constant(const StringName &p_class, const StringName &p_name, bool *p_success = nullptr);
static StringName get_integer_constant_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false);
static void get_enum_list(const StringName &p_class, List<StringName> *p_enums, bool p_no_inheritance = false);
static void get_enum_constants(const StringName &p_class, const StringName &p_enum, List<StringName> *p_constants, bool p_no_inheritance = false);
static bool has_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false);
static Variant class_get_default_property_value(const StringName &p_class, const StringName &p_property, bool *r_valid = NULL);
static Variant class_get_default_property_value(const StringName &p_class, const StringName &p_property, bool *r_valid = nullptr);
static StringName get_category(const StringName &p_node);

View File

@@ -36,7 +36,6 @@
#include "core/print_string.h"
uint32_t Color::to_argb32() const {
uint32_t c = (uint8_t)Math::round(a * 255);
c <<= 8;
c |= (uint8_t)Math::round(r * 255);
@@ -49,7 +48,6 @@ uint32_t Color::to_argb32() const {
}
uint32_t Color::to_abgr32() const {
uint32_t c = (uint8_t)Math::round(a * 255);
c <<= 8;
c |= (uint8_t)Math::round(b * 255);
@@ -62,7 +60,6 @@ uint32_t Color::to_abgr32() const {
}
uint32_t Color::to_rgba32() const {
uint32_t c = (uint8_t)Math::round(r * 255);
c <<= 8;
c |= (uint8_t)Math::round(g * 255);
@@ -75,7 +72,6 @@ uint32_t Color::to_rgba32() const {
}
uint64_t Color::to_abgr64() const {
uint64_t c = (uint16_t)Math::round(a * 65535);
c <<= 16;
c |= (uint16_t)Math::round(b * 65535);
@@ -88,7 +84,6 @@ uint64_t Color::to_abgr64() const {
}
uint64_t Color::to_argb64() const {
uint64_t c = (uint16_t)Math::round(a * 65535);
c <<= 16;
c |= (uint16_t)Math::round(r * 65535);
@@ -101,7 +96,6 @@ uint64_t Color::to_argb64() const {
}
uint64_t Color::to_rgba64() const {
uint64_t c = (uint16_t)Math::round(r * 65535);
c <<= 16;
c |= (uint16_t)Math::round(g * 65535);
@@ -114,7 +108,6 @@ uint64_t Color::to_rgba64() const {
}
float Color::get_h() const {
float min = MIN(r, g);
min = MIN(min, b);
float max = MAX(r, g);
@@ -122,26 +115,28 @@ float Color::get_h() const {
float delta = max - min;
if (delta == 0)
if (delta == 0) {
return 0;
}
float h;
if (r == max)
if (r == max) {
h = (g - b) / delta; // between yellow & magenta
else if (g == max)
} else if (g == max) {
h = 2 + (b - r) / delta; // between cyan & yellow
else
} else {
h = 4 + (r - g) / delta; // between magenta & cyan
}
h /= 6.0;
if (h < 0)
if (h < 0) {
h += 1.0;
}
return h;
}
float Color::get_s() const {
float min = MIN(r, g);
min = MIN(min, b);
float max = MAX(r, g);
@@ -153,14 +148,12 @@ float Color::get_s() const {
}
float Color::get_v() const {
float max = MAX(r, g);
max = MAX(max, b);
return max;
}
void Color::set_hsv(float p_h, float p_s, float p_v, float p_alpha) {
int i;
float f, p, q, t;
a = p_alpha;
@@ -215,25 +208,21 @@ void Color::set_hsv(float p_h, float p_s, float p_v, float p_alpha) {
}
bool Color::is_equal_approx(const Color &p_color) const {
return Math::is_equal_approx(r, p_color.r) && Math::is_equal_approx(g, p_color.g) && Math::is_equal_approx(b, p_color.b) && Math::is_equal_approx(a, p_color.a);
}
void Color::invert() {
r = 1.0 - r;
g = 1.0 - g;
b = 1.0 - b;
}
void Color::contrast() {
r = Math::fmod(r + 0.5, 1.0);
g = Math::fmod(g + 0.5, 1.0);
b = Math::fmod(b + 0.5, 1.0);
}
Color Color::hex(uint32_t p_hex) {
float a = (p_hex & 0xFF) / 255.0;
p_hex >>= 8;
float b = (p_hex & 0xFF) / 255.0;
@@ -246,7 +235,6 @@ Color Color::hex(uint32_t p_hex) {
}
Color Color::hex64(uint64_t p_hex) {
float a = (p_hex & 0xFFFF) / 65535.0;
p_hex >>= 16;
float b = (p_hex & 0xFFFF) / 65535.0;
@@ -259,7 +247,6 @@ Color Color::hex64(uint64_t p_hex) {
}
Color Color::from_rgbe9995(uint32_t p_rgbe) {
float r = p_rgbe & 0x1ff;
float g = (p_rgbe >> 9) & 0x1ff;
float b = (p_rgbe >> 18) & 0x1ff;
@@ -274,11 +261,9 @@ Color Color::from_rgbe9995(uint32_t p_rgbe) {
}
static float _parse_col(const String &p_str, int p_ofs) {
int ig = 0;
for (int i = 0; i < 2; i++) {
int c = p_str[i + p_ofs];
int v = 0;
@@ -294,36 +279,36 @@ static float _parse_col(const String &p_str, int p_ofs) {
return -1;
}
if (i == 0)
if (i == 0) {
ig += v * 16;
else
} else {
ig += v;
}
}
return ig;
}
Color Color::inverted() const {
Color c = *this;
c.invert();
return c;
}
Color Color::contrasted() const {
Color c = *this;
c.contrast();
return c;
}
Color Color::html(const String &p_color) {
String color = p_color;
if (color.length() == 0)
if (color.length() == 0) {
return Color();
if (color[0] == '#')
}
if (color[0] == '#') {
color = color.substr(1, color.length() - 1);
}
if (color.length() == 3 || color.length() == 4) {
String exp_color;
for (int i = 0; i < color.length(); i++) {
@@ -362,13 +347,14 @@ Color Color::html(const String &p_color) {
}
bool Color::html_is_valid(const String &p_color) {
String color = p_color;
if (color.length() == 0)
if (color.length() == 0) {
return false;
if (color[0] == '#')
}
if (color[0] == '#') {
color = color.substr(1, color.length() - 1);
}
bool alpha = false;
@@ -406,7 +392,9 @@ bool Color::html_is_valid(const String &p_color) {
}
Color Color::named(const String &p_name) {
if (_named_colors.empty()) _populate_named_colors(); // from color_names.inc
if (_named_colors.empty()) {
_populate_named_colors(); // from color_names.inc
}
String name = p_name;
// Normalize name
name = name.replace(" ", "");
@@ -422,19 +410,18 @@ Color Color::named(const String &p_name) {
}
String _to_hex(float p_val) {
int v = Math::round(p_val * 255);
v = CLAMP(v, 0, 255);
String ret;
for (int i = 0; i < 2; i++) {
CharType c[2] = { 0, 0 };
int lv = v & 0xF;
if (lv < 10)
if (lv < 10) {
c[0] = '0' + lv;
else
} else {
c[0] = 'a' + lv - 10;
}
v >>= 4;
String cs = (const CharType *)c;
@@ -445,13 +432,13 @@ String _to_hex(float p_val) {
}
String Color::to_html(bool p_alpha) const {
String txt;
txt += _to_hex(r);
txt += _to_hex(g);
txt += _to_hex(b);
if (p_alpha)
if (p_alpha) {
txt = _to_hex(a) + txt;
}
return txt;
}
@@ -463,18 +450,15 @@ Color Color::from_hsv(float p_h, float p_s, float p_v, float p_a) const {
// FIXME: Remove once Godot 3.1 has been released
float Color::gray() const {
WARN_DEPRECATED_MSG("'Color.gray()' is deprecated and will be removed in a future version. Use 'Color.v' for a better grayscale approximation.");
return (r + g + b) / 3.0;
}
Color::operator String() const {
return rtos(r) + ", " + rtos(g) + ", " + rtos(b) + ", " + rtos(a);
}
Color Color::operator+(const Color &p_color) const {
return Color(
r + p_color.r,
g + p_color.g,
@@ -483,7 +467,6 @@ Color Color::operator+(const Color &p_color) const {
}
void Color::operator+=(const Color &p_color) {
r = r + p_color.r;
g = g + p_color.g;
b = b + p_color.b;
@@ -491,7 +474,6 @@ void Color::operator+=(const Color &p_color) {
}
Color Color::operator-(const Color &p_color) const {
return Color(
r - p_color.r,
g - p_color.g,
@@ -500,7 +482,6 @@ Color Color::operator-(const Color &p_color) const {
}
void Color::operator-=(const Color &p_color) {
r = r - p_color.r;
g = g - p_color.g;
b = b - p_color.b;
@@ -508,7 +489,6 @@ void Color::operator-=(const Color &p_color) {
}
Color Color::operator*(const Color &p_color) const {
return Color(
r * p_color.r,
g * p_color.g,
@@ -517,7 +497,6 @@ Color Color::operator*(const Color &p_color) const {
}
Color Color::operator*(const real_t &rvalue) const {
return Color(
r * rvalue,
g * rvalue,
@@ -526,7 +505,6 @@ Color Color::operator*(const real_t &rvalue) const {
}
void Color::operator*=(const Color &p_color) {
r = r * p_color.r;
g = g * p_color.g;
b = b * p_color.b;
@@ -534,7 +512,6 @@ void Color::operator*=(const Color &p_color) {
}
void Color::operator*=(const real_t &rvalue) {
r = r * rvalue;
g = g * rvalue;
b = b * rvalue;
@@ -542,7 +519,6 @@ void Color::operator*=(const real_t &rvalue) {
}
Color Color::operator/(const Color &p_color) const {
return Color(
r / p_color.r,
g / p_color.g,
@@ -551,7 +527,6 @@ Color Color::operator/(const Color &p_color) const {
}
Color Color::operator/(const real_t &rvalue) const {
return Color(
r / rvalue,
g / rvalue,
@@ -560,7 +535,6 @@ Color Color::operator/(const real_t &rvalue) const {
}
void Color::operator/=(const Color &p_color) {
r = r / p_color.r;
g = g / p_color.g;
b = b / p_color.b;
@@ -568,7 +542,6 @@ void Color::operator/=(const Color &p_color) {
}
void Color::operator/=(const real_t &rvalue) {
if (rvalue == 0) {
r = 1.0;
g = 1.0;
@@ -583,7 +556,6 @@ void Color::operator/=(const real_t &rvalue) {
};
Color Color::operator-() const {
return Color(
1.0 - r,
1.0 - g,

View File

@@ -35,9 +35,7 @@
#include "core/ustring.h"
struct Color {
union {
struct {
float r;
float g;
@@ -93,20 +91,18 @@ struct Color {
Color inverted() const;
Color contrasted() const;
_FORCE_INLINE_ Color linear_interpolate(const Color &p_b, float p_t) const {
_FORCE_INLINE_ Color linear_interpolate(const Color &p_to, float p_weight) const {
Color res = *this;
res.r += (p_t * (p_b.r - r));
res.g += (p_t * (p_b.g - g));
res.b += (p_t * (p_b.b - b));
res.a += (p_t * (p_b.a - a));
res.r += (p_weight * (p_to.r - r));
res.g += (p_weight * (p_to.g - g));
res.b += (p_weight * (p_to.b - b));
res.a += (p_weight * (p_to.a - a));
return res;
}
_FORCE_INLINE_ Color darkened(float p_amount) const {
Color res = *this;
res.r = res.r * (1.0f - p_amount);
res.g = res.g * (1.0f - p_amount);
@@ -115,7 +111,6 @@ struct Color {
}
_FORCE_INLINE_ Color lightened(float p_amount) const {
Color res = *this;
res.r = res.r + (1.0f - res.r) * p_amount;
res.g = res.g + (1.0f - res.g) * p_amount;
@@ -124,7 +119,6 @@ struct Color {
}
_FORCE_INLINE_ uint32_t to_rgbe9995() const {
const float pow2to9 = 512.0f;
const float B = 15.0f;
//const float Emax = 31.0f;
@@ -158,7 +152,6 @@ struct Color {
}
_FORCE_INLINE_ Color blend(const Color &p_over) const {
Color res;
float sa = 1.0 - p_over.a;
res.a = a * sa + p_over.a;
@@ -173,7 +166,6 @@ struct Color {
}
_FORCE_INLINE_ Color to_linear() const {
return Color(
r < 0.04045 ? r * (1.0 / 12.92) : Math::pow((r + 0.055) * (1.0 / (1 + 0.055)), 2.4),
g < 0.04045 ? g * (1.0 / 12.92) : Math::pow((g + 0.055) * (1.0 / (1 + 0.055)), 2.4),
@@ -181,7 +173,6 @@ struct Color {
a);
}
_FORCE_INLINE_ Color to_srgb() const {
return Color(
r < 0.0031308 ? 12.92 * r : (1.0 + 0.055) * Math::pow(r, 1.0f / 2.4f) - 0.055,
g < 0.0031308 ? 12.92 * g : (1.0 + 0.055) * Math::pow(g, 1.0f / 2.4f) - 0.055,
@@ -222,17 +213,19 @@ struct Color {
};
bool Color::operator<(const Color &p_color) const {
if (r == p_color.r) {
if (g == p_color.g) {
if (b == p_color.b) {
return (a < p_color.a);
} else
} else {
return (b < p_color.b);
} else
}
} else {
return g < p_color.g;
} else
}
} else {
return r < p_color.r;
}
}
#endif

View File

@@ -3,7 +3,9 @@
static Map<String, Color> _named_colors;
static void _populate_named_colors() {
if (!_named_colors.empty()) return;
if (!_named_colors.empty()) {
return;
}
_named_colors.insert("aliceblue", Color(0.94, 0.97, 1.00));
_named_colors.insert("antiquewhite", Color(0.98, 0.92, 0.84));
_named_colors.insert("aqua", Color(0.00, 1.00, 1.00));

View File

@@ -34,30 +34,24 @@
#include "core/project_settings.h"
void CommandQueueMT::lock() {
mutex.lock();
}
void CommandQueueMT::unlock() {
mutex.unlock();
}
void CommandQueueMT::wait_for_flush() {
// wait one millisecond for a flush to happen
OS::get_singleton()->delay_usec(1000);
}
CommandQueueMT::SyncSemaphore *CommandQueueMT::_alloc_sync_sem() {
int idx = -1;
while (true) {
lock();
for (int i = 0; i < SYNC_SEMAPHORES; i++) {
if (!sync_sems[i].in_use) {
sync_sems[i].in_use = true;
idx = i;
@@ -101,7 +95,6 @@ tryagain:
}
CommandQueueMT::CommandQueueMT(bool p_sync) {
read_ptr_and_epoch = 0;
write_ptr_and_epoch = 0;
dealloc_ptr = 0;
@@ -112,19 +105,18 @@ CommandQueueMT::CommandQueueMT(bool p_sync) {
command_mem = (uint8_t *)memalloc(command_mem_size);
for (int i = 0; i < SYNC_SEMAPHORES; i++) {
sync_sems[i].in_use = false;
}
if (p_sync) {
sync = memnew(Semaphore);
} else {
sync = NULL;
sync = nullptr;
}
}
CommandQueueMT::~CommandQueueMT() {
if (sync)
if (sync) {
memdelete(sync);
}
memfree(command_mem);
}

View File

@@ -233,7 +233,8 @@
cmd->method = p_method; \
SEMIC_SEP_LIST(CMD_ASSIGN_PARAM, N); \
unlock(); \
if (sync) sync->post(); \
if (sync) \
sync->post(); \
}
#define CMD_RET_TYPE(N) CommandRet##N<T, M, COMMA_SEP_LIST(TYPE_ARG, N) COMMA(N) R>
@@ -249,7 +250,8 @@
cmd->ret = r_ret; \
cmd->sync_sem = ss; \
unlock(); \
if (sync) sync->post(); \
if (sync) \
sync->post(); \
ss->sem.wait(); \
ss->in_use = false; \
}
@@ -266,7 +268,8 @@
SEMIC_SEP_LIST(CMD_ASSIGN_PARAM, N); \
cmd->sync_sem = ss; \
unlock(); \
if (sync) sync->post(); \
if (sync) \
sync->post(); \
ss->sem.wait(); \
ss->in_use = false; \
}
@@ -274,22 +277,18 @@
#define MAX_CMD_PARAMS 13
class CommandQueueMT {
struct SyncSemaphore {
Semaphore sem;
bool in_use;
};
struct CommandBase {
virtual void call() = 0;
virtual void post(){};
virtual ~CommandBase(){};
};
struct SyncCommand : public CommandBase {
SyncSemaphore *sync_sem;
virtual void post() {
@@ -326,12 +325,11 @@ class CommandQueueMT {
template <class T>
T *allocate() {
// alloc size is size+T+safeguard
uint32_t alloc_size = ((sizeof(T) + 8 - 1) & ~(8 - 1)) + 8;
// Assert that the buffer is big enough to hold at least two messages.
ERR_FAIL_COND_V(alloc_size * 2 + sizeof(uint32_t) > command_mem_size, NULL);
ERR_FAIL_COND_V(alloc_size * 2 + sizeof(uint32_t) > command_mem_size, nullptr);
tryagain:
uint32_t write_ptr = write_ptr_and_epoch >> 1;
@@ -339,12 +337,11 @@ class CommandQueueMT {
if (write_ptr < dealloc_ptr) {
// behind dealloc_ptr, check that there is room
if ((dealloc_ptr - write_ptr) <= alloc_size) {
// There is no more room, try to deallocate something
if (dealloc_one()) {
goto tryagain;
}
return NULL;
return nullptr;
}
} else {
// ahead of dealloc_ptr, check that there is room
@@ -358,11 +355,11 @@ class CommandQueueMT {
if (dealloc_one()) {
goto tryagain;
}
return NULL;
return nullptr;
}
// if this happens, it's a bug
ERR_FAIL_COND_V((command_mem_size - write_ptr) < 8, NULL);
ERR_FAIL_COND_V((command_mem_size - write_ptr) < 8, nullptr);
// zero means, wrap to beginning
uint32_t *p = (uint32_t *)&command_mem[write_ptr];
@@ -392,12 +389,10 @@ class CommandQueueMT {
template <class T>
T *allocate_and_lock() {
lock();
T *ret;
while ((ret = allocate<T>()) == NULL) {
while ((ret = allocate<T>()) == nullptr) {
unlock();
// sleep a little until fetch happened and some room is made
wait_for_flush();
@@ -408,12 +403,16 @@ class CommandQueueMT {
}
bool flush_one(bool p_lock = true) {
if (p_lock) lock();
if (p_lock) {
lock();
}
tryagain:
// tried to read an empty queue
if (read_ptr_and_epoch == write_ptr_and_epoch) {
if (p_lock) unlock();
if (p_lock) {
unlock();
}
return false;
}
@@ -436,15 +435,21 @@ class CommandQueueMT {
read_ptr_and_epoch = (read_ptr << 1) | (read_ptr_and_epoch & 1);
if (p_lock) unlock();
if (p_lock) {
unlock();
}
cmd->call();
if (p_lock) lock();
if (p_lock) {
lock();
}
cmd->post();
cmd->~CommandBase();
*(uint32_t *)&command_mem[size_ptr] &= ~1;
if (p_lock) unlock();
if (p_lock) {
unlock();
}
return true;
}
@@ -474,11 +479,11 @@ public:
}
void flush_all() {
//ERR_FAIL_COND(sync);
lock();
while (flush_one(false))
while (flush_one(false)) {
;
}
unlock();
}

View File

@@ -37,7 +37,6 @@ extern "C" {
}
struct _PHashTranslationCmp {
int orig_len;
CharString compressed;
int offset;
@@ -45,13 +44,14 @@ struct _PHashTranslationCmp {
void PHashTranslation::generate(const Ref<Translation> &p_from) {
#ifdef TOOLS_ENABLED
ERR_FAIL_COND(p_from.is_null());
List<StringName> keys;
p_from->get_message_list(&keys);
int size = Math::larger_prime(keys.size());
Vector<Vector<Pair<int, CharString> > > buckets;
Vector<Map<uint32_t, int> > table;
Vector<Vector<Pair<int, CharString>>> buckets;
Vector<Map<uint32_t, int>> table;
Vector<uint32_t> hfunc_table;
Vector<_PHashTranslationCmp> compressed;
@@ -62,10 +62,8 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
int idx = 0;
int total_compression_size = 0;
int total_string_size = 0;
for (List<StringName>::Element *E = keys.front(); E; E = E->next()) {
//hash string
CharString cs = E->get().operator String().utf8();
uint32_t h = hash(0, cs.get_data());
@@ -101,28 +99,25 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
compressed.write[idx] = ps;
total_compression_size += ps.compressed.size();
total_string_size += src_s.size();
idx++;
}
int bucket_table_size = 0;
for (int i = 0; i < size; i++) {
const Vector<Pair<int, CharString> > &b = buckets[i];
const Vector<Pair<int, CharString>> &b = buckets[i];
Map<uint32_t, int> &t = table.write[i];
if (b.size() == 0)
if (b.size() == 0) {
continue;
}
int d = 1;
int item = 0;
while (item < b.size()) {
uint32_t slot = hash(d, b[item].second.get_data());
if (t.has(slot)) {
item = 0;
d++;
t.clear();
@@ -148,16 +143,12 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
uint32_t *btw = (uint32_t *)&btwb[0];
int btindex = 0;
int collisions = 0;
for (int i = 0; i < size; i++) {
const Map<uint32_t, int> &t = table[i];
if (t.size() == 0) {
htw[i] = 0xFFFFFFFF; //nothing
continue;
} else if (t.size() > 1) {
collisions += t.size() - 1;
}
htw[i] = btindex;
@@ -165,7 +156,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
btw[btindex++] = hfunc_table[i];
for (Map<uint32_t, int>::Element *E = t.front(); E; E = E->next()) {
btw[btindex++] = E->key();
btw[btindex++] = compressed[E->get()].offset;
btw[btindex++] = compressed[E->get()].compressed.size();
@@ -187,7 +177,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {
}
bool PHashTranslation::_set(const StringName &p_name, const Variant &p_value) {
String name = p_name.operator String();
if (name == "hash_table") {
hash_table = p_value;
@@ -197,33 +186,34 @@ bool PHashTranslation::_set(const StringName &p_name, const Variant &p_value) {
strings = p_value;
} else if (name == "load_from") {
generate(p_value);
} else
} else {
return false;
}
return true;
}
bool PHashTranslation::_get(const StringName &p_name, Variant &r_ret) const {
String name = p_name.operator String();
if (name == "hash_table")
if (name == "hash_table") {
r_ret = hash_table;
else if (name == "bucket_table")
} else if (name == "bucket_table") {
r_ret = bucket_table;
else if (name == "strings")
} else if (name == "strings") {
r_ret = strings;
else
} else {
return false;
}
return true;
}
StringName PHashTranslation::get_message(const StringName &p_src_text) const {
int htsize = hash_table.size();
if (htsize == 0)
if (htsize == 0) {
return StringName();
}
CharString str = p_src_text.operator String().utf8();
uint32_t h = hash(0, str.get_data());
@@ -248,9 +238,7 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const {
int idx = -1;
for (int i = 0; i < bucket.size; i++) {
if (bucket.elem[i].key == h) {
idx = i;
break;
}
@@ -261,13 +249,11 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const {
}
if (bucket.elem[idx].comp_size == bucket.elem[idx].uncomp_size) {
String rstr;
rstr.parse_utf8(&sptr[bucket.elem[idx].str_offset], bucket.elem[idx].uncomp_size);
return rstr;
} else {
CharString uncomp;
uncomp.resize(bucket.elem[idx].uncomp_size + 1);
smaz_decompress(&sptr[bucket.elem[idx].str_offset], bucket.elem[idx].comp_size, uncomp.ptrw(), bucket.elem[idx].uncomp_size);
@@ -278,14 +264,12 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const {
}
void PHashTranslation::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::POOL_INT_ARRAY, "hash_table"));
p_list->push_back(PropertyInfo(Variant::POOL_INT_ARRAY, "bucket_table"));
p_list->push_back(PropertyInfo(Variant::POOL_BYTE_ARRAY, "strings"));
p_list->push_back(PropertyInfo(Variant::OBJECT, "load_from", PROPERTY_HINT_RESOURCE_TYPE, "Translation", PROPERTY_USAGE_EDITOR));
}
void PHashTranslation::_bind_methods() {
ClassDB::bind_method(D_METHOD("generate", "from"), &PHashTranslation::generate);
}

View File

@@ -34,7 +34,6 @@
#include "core/translation.h"
class PHashTranslation : public Translation {
GDCLASS(PHashTranslation, Translation);
//this translation uses a sort of modified perfect hash algorithm
@@ -48,12 +47,10 @@ class PHashTranslation : public Translation {
PoolVector<uint8_t> strings;
struct Bucket {
int size;
uint32_t func;
struct Elem {
uint32_t key;
uint32_t str_offset;
uint32_t comp_size;
@@ -64,11 +61,10 @@ class PHashTranslation : public Translation {
};
_FORCE_INLINE_ uint32_t hash(uint32_t d, const char *p_str) const {
if (d == 0)
if (d == 0) {
d = 0x1000193;
}
while (*p_str) {
d = (d * 0x1000193) ^ uint32_t(*p_str);
p_str++;
}

View File

@@ -1,8 +1,8 @@
"""Functions used to generate source files during build time
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
"""
from platform_methods import subprocess_main
from compat import iteritems, itervalues, open_utf8, escape_string, byte_to_str

View File

@@ -30,7 +30,7 @@
#include "core_string_names.h"
CoreStringNames *CoreStringNames::singleton = NULL;
CoreStringNames *CoreStringNames::singleton = nullptr;
CoreStringNames::CoreStringNames() :
_free(StaticCString::create("free")),

View File

@@ -34,14 +34,13 @@
#include "core/string_name.h"
class CoreStringNames {
friend void register_core_types();
friend void unregister_core_types();
static void create() { singleton = memnew(CoreStringNames); }
static void free() {
memdelete(singleton);
singleton = NULL;
singleton = nullptr;
}
CoreStringNames();

View File

@@ -63,25 +63,25 @@ private:
// internal helpers
_FORCE_INLINE_ SafeNumeric<uint32_t> *_get_refcount() const {
if (!_ptr)
return NULL;
if (!_ptr) {
return nullptr;
}
return reinterpret_cast<SafeNumeric<uint32_t> *>(_ptr) - 2;
}
_FORCE_INLINE_ uint32_t *_get_size() const {
if (!_ptr)
return NULL;
if (!_ptr) {
return nullptr;
}
return reinterpret_cast<uint32_t *>(_ptr) - 1;
}
_FORCE_INLINE_ T *_get_data() const {
if (!_ptr)
return NULL;
if (!_ptr) {
return nullptr;
}
return reinterpret_cast<T *>(_ptr);
}
@@ -99,7 +99,9 @@ private:
return false;
}
*out = next_power_of_2(o);
if (_add_overflow(o, static_cast<size_t>(32), &p)) return false; //no longer allocated here
if (_add_overflow(o, static_cast<size_t>(32), &p)) {
return false; //no longer allocated here
}
return true;
#else
// Speed is more important than correctness here, do the operations unchecked
@@ -128,31 +130,29 @@ public:
_FORCE_INLINE_ int size() const {
uint32_t *size = (uint32_t *)_get_size();
if (size)
if (size) {
return *size;
else
} else {
return 0;
}
}
_FORCE_INLINE_ void clear() { resize(0); }
_FORCE_INLINE_ bool empty() const { return _ptr == 0; }
_FORCE_INLINE_ bool empty() const { return _ptr == nullptr; }
_FORCE_INLINE_ void set(int p_index, const T &p_elem) {
CRASH_BAD_INDEX(p_index, size());
_copy_on_write();
_get_data()[p_index] = p_elem;
}
_FORCE_INLINE_ T &get_m(int p_index) {
CRASH_BAD_INDEX(p_index, size());
_copy_on_write();
return _get_data()[p_index];
}
_FORCE_INLINE_ const T &get(int p_index) const {
CRASH_BAD_INDEX(p_index, size());
return _get_data()[p_index];
@@ -161,12 +161,10 @@ public:
Error resize(int p_size);
_FORCE_INLINE_ void remove(int p_index) {
ERR_FAIL_INDEX(p_index, size());
T *p = ptrw();
int len = size();
for (int i = p_index; i < len - 1; i++) {
p[i] = p[i + 1];
};
@@ -174,11 +172,11 @@ public:
};
Error insert(int p_pos, const T &p_val) {
ERR_FAIL_INDEX_V(p_pos, size() + 1, ERR_INVALID_PARAMETER);
resize(size() + 1);
for (int i = (size() - 1); i > p_pos; i--)
for (int i = (size() - 1); i > p_pos; i--) {
set(i, get(i - 1));
}
set(p_pos, p_val);
return OK;
@@ -193,14 +191,15 @@ public:
template <class T>
void CowData<T>::_unref(void *p_data) {
if (!p_data)
if (!p_data) {
return;
}
SafeNumeric<uint32_t> *refc = _get_refcount();
if (refc->decrement() > 0)
if (refc->decrement() > 0) {
return; // still in use
}
// clean up
if (!__has_trivial_destructor(T)) {
@@ -219,9 +218,9 @@ void CowData<T>::_unref(void *p_data) {
template <class T>
uint32_t CowData<T>::_copy_on_write() {
if (!_ptr)
if (!_ptr) {
return 0;
}
SafeNumeric<uint32_t> *refc = _get_refcount();
@@ -257,18 +256,18 @@ uint32_t CowData<T>::_copy_on_write() {
template <class T>
Error CowData<T>::resize(int p_size) {
ERR_FAIL_COND_V(p_size < 0, ERR_INVALID_PARAMETER);
int current_size = size();
if (p_size == current_size)
if (p_size == current_size) {
return OK;
}
if (p_size == 0) {
// wants to clean up
_unref(_ptr);
_ptr = NULL;
_ptr = nullptr;
return OK;
}
@@ -280,7 +279,6 @@ Error CowData<T>::resize(int p_size) {
ERR_FAIL_COND_V(!_get_alloc_size_checked(p_size, &alloc_size), ERR_OUT_OF_MEMORY);
if (p_size > current_size) {
if (alloc_size != current_alloc_size) {
if (current_size == 0) {
// alloc from scratch
@@ -313,7 +311,6 @@ Error CowData<T>::resize(int p_size) {
*_get_size() = p_size;
} else if (p_size < current_size) {
if (!__has_trivial_destructor(T)) {
// deinitialize no longer needed elements
for (uint32_t i = p_size; i < *_get_size(); i++) {
@@ -361,15 +358,16 @@ void CowData<T>::_ref(const CowData *p_from) {
template <class T>
void CowData<T>::_ref(const CowData &p_from) {
if (_ptr == p_from._ptr)
if (_ptr == p_from._ptr) {
return; // self assign, do nothing.
}
_unref(_ptr);
_ptr = NULL;
_ptr = nullptr;
if (!p_from._ptr)
if (!p_from._ptr) {
return; //nothing to do
}
if (p_from._get_refcount()->conditional_increment() > 0) { // could reference
_ptr = p_from._ptr;
@@ -378,13 +376,11 @@ void CowData<T>::_ref(const CowData &p_from) {
template <class T>
CowData<T>::CowData() {
_ptr = NULL;
_ptr = nullptr;
}
template <class T>
CowData<T>::~CowData() {
_unref(_ptr);
}

View File

@@ -6,6 +6,7 @@ env_crypto = env.Clone()
is_builtin = env["builtin_mbedtls"]
has_module = env["module_mbedtls_enabled"]
thirdparty_obj = []
if is_builtin or not has_module:
# Use our headers for builtin or if the module is not going to be compiled.
@@ -35,6 +36,16 @@ if not has_module:
"godot_core_mbedtls_platform.c",
]
thirdparty_mbedtls_sources = [thirdparty_mbedtls_dir + file for file in thirdparty_mbedtls_sources]
env_thirdparty.add_source_files(env.core_sources, thirdparty_mbedtls_sources)
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_mbedtls_sources)
env.core_sources += thirdparty_obj
env_crypto.add_source_files(env.core_sources, "*.cpp")
# Godot source files
core_obj = []
env_crypto.add_source_files(core_obj, "*.cpp")
env.core_sources += core_obj
# Needed to force rebuilding the core files when the thirdparty library is updated.
env.Depends(core_obj, thirdparty_obj)

116
core/crypto/aes_context.cpp Normal file
View File

@@ -0,0 +1,116 @@
/*************************************************************************/
/* aes_context.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "core/crypto/aes_context.h"
Error AESContext::start(Mode p_mode, PoolByteArray p_key, PoolByteArray p_iv) {
ERR_FAIL_COND_V_MSG(mode != MODE_MAX, ERR_ALREADY_IN_USE, "AESContext already started. Call 'finish' before starting a new one.");
ERR_FAIL_COND_V_MSG(p_mode < 0 || p_mode >= MODE_MAX, ERR_INVALID_PARAMETER, "Invalid mode requested.");
// Key check.
int key_bits = p_key.size() << 3;
ERR_FAIL_COND_V_MSG(key_bits != 128 && key_bits != 256, ERR_INVALID_PARAMETER, "AES key must be either 16 or 32 bytes");
// Initialization vector.
if (p_mode == MODE_CBC_ENCRYPT || p_mode == MODE_CBC_DECRYPT) {
ERR_FAIL_COND_V_MSG(p_iv.size() != 16, ERR_INVALID_PARAMETER, "The initialization vector (IV) must be exactly 16 bytes.");
iv.resize(0);
iv.append_array(p_iv);
}
// Encryption/decryption key.
if (p_mode == MODE_CBC_ENCRYPT || p_mode == MODE_ECB_ENCRYPT) {
ctx.set_encode_key(p_key.read().ptr(), key_bits);
} else {
ctx.set_decode_key(p_key.read().ptr(), key_bits);
}
mode = p_mode;
return OK;
}
PoolByteArray AESContext::update(PoolByteArray p_src) {
ERR_FAIL_COND_V_MSG(mode < 0 || mode >= MODE_MAX, PoolByteArray(), "AESContext not started. Call 'start' before calling 'update'.");
int len = p_src.size();
ERR_FAIL_COND_V_MSG(len % 16, PoolByteArray(), "The number of bytes to be encrypted must be multiple of 16. Add padding if needed");
PoolByteArray out;
out.resize(len);
const uint8_t *src_ptr = p_src.read().ptr();
uint8_t *out_ptr = out.write().ptr();
switch (mode) {
case MODE_ECB_ENCRYPT: {
for (int i = 0; i < len; i += 16) {
Error err = ctx.encrypt_ecb(src_ptr + i, out_ptr + i);
ERR_FAIL_COND_V(err != OK, PoolByteArray());
}
} break;
case MODE_ECB_DECRYPT: {
for (int i = 0; i < len; i += 16) {
Error err = ctx.decrypt_ecb(src_ptr + i, out_ptr + i);
ERR_FAIL_COND_V(err != OK, PoolByteArray());
}
} break;
case MODE_CBC_ENCRYPT: {
Error err = ctx.encrypt_cbc(len, iv.write().ptr(), p_src.read().ptr(), out.write().ptr());
ERR_FAIL_COND_V(err != OK, PoolByteArray());
} break;
case MODE_CBC_DECRYPT: {
Error err = ctx.decrypt_cbc(len, iv.write().ptr(), p_src.read().ptr(), out.write().ptr());
ERR_FAIL_COND_V(err != OK, PoolByteArray());
} break;
default:
ERR_FAIL_V_MSG(PoolByteArray(), "Bug!");
}
return out;
}
PoolByteArray AESContext::get_iv_state() {
ERR_FAIL_COND_V_MSG(mode != MODE_CBC_ENCRYPT && mode != MODE_CBC_DECRYPT, PoolByteArray(), "Calling 'get_iv_state' only makes sense when the context is started in CBC mode.");
PoolByteArray out;
out.append_array(iv);
return out;
}
void AESContext::finish() {
mode = MODE_MAX;
iv.resize(0);
}
void AESContext::_bind_methods() {
ClassDB::bind_method(D_METHOD("start", "mode", "key", "iv"), &AESContext::start, DEFVAL(PoolByteArray()));
ClassDB::bind_method(D_METHOD("update", "src"), &AESContext::update);
ClassDB::bind_method(D_METHOD("get_iv_state"), &AESContext::get_iv_state);
ClassDB::bind_method(D_METHOD("finish"), &AESContext::finish);
BIND_ENUM_CONSTANT(MODE_ECB_ENCRYPT);
BIND_ENUM_CONSTANT(MODE_ECB_DECRYPT);
BIND_ENUM_CONSTANT(MODE_CBC_ENCRYPT);
BIND_ENUM_CONSTANT(MODE_CBC_DECRYPT);
BIND_ENUM_CONSTANT(MODE_MAX);
}
AESContext::AESContext() {
mode = MODE_MAX;
}

View File

@@ -1,5 +1,5 @@
/*************************************************************************/
/* library_godot_editor_tools.js */
/* aes_context.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,30 +28,41 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
const GodotEditorTools = {
godot_js_editor_download_file__deps: ['$FS'],
godot_js_editor_download_file__sig: 'viii',
godot_js_editor_download_file: function (p_path, p_name, p_mime) {
const path = GodotRuntime.parseString(p_path);
const name = GodotRuntime.parseString(p_name);
const mime = GodotRuntime.parseString(p_mime);
const size = FS.stat(path)['size'];
const buf = new Uint8Array(size);
const fd = FS.open(path, 'r');
FS.read(fd, buf, 0, size);
FS.close(fd);
FS.unlink(path);
const blob = new Blob([buf], { type: mime });
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = name;
a.style.display = 'none';
document.body.appendChild(a);
a.click();
a.remove();
window.URL.revokeObjectURL(url);
},
#ifndef AES_CONTEXT_H
#define AES_CONTEXT_H
#include "core/crypto/crypto_core.h"
#include "core/reference.h"
class AESContext : public Reference {
GDCLASS(AESContext, Reference);
public:
enum Mode {
MODE_ECB_ENCRYPT,
MODE_ECB_DECRYPT,
MODE_CBC_ENCRYPT,
MODE_CBC_DECRYPT,
MODE_MAX
};
private:
Mode mode;
CryptoCore::AESContext ctx;
PoolByteArray iv;
protected:
static void _bind_methods();
public:
Error start(Mode p_mode, PoolByteArray p_key, PoolByteArray p_iv = PoolByteArray());
PoolByteArray update(PoolByteArray p_src);
PoolByteArray get_iv_state();
void finish();
AESContext();
};
mergeInto(LibraryManager.library, GodotEditorTools);
VARIANT_ENUM_CAST(AESContext::Mode);
#endif // AES_CONTEXT_H

View File

@@ -36,23 +36,28 @@
/// Resources
CryptoKey *(*CryptoKey::_create)() = NULL;
CryptoKey *(*CryptoKey::_create)() = nullptr;
CryptoKey *CryptoKey::create() {
if (_create)
if (_create) {
return _create();
return NULL;
}
return nullptr;
}
void CryptoKey::_bind_methods() {
ClassDB::bind_method(D_METHOD("save", "path"), &CryptoKey::save);
ClassDB::bind_method(D_METHOD("load", "path"), &CryptoKey::load);
ClassDB::bind_method(D_METHOD("save", "path", "public_only"), &CryptoKey::save, DEFVAL(false));
ClassDB::bind_method(D_METHOD("load", "path", "public_only"), &CryptoKey::load, DEFVAL(false));
ClassDB::bind_method(D_METHOD("is_public_only"), &CryptoKey::is_public_only);
ClassDB::bind_method(D_METHOD("save_to_string", "public_only"), &CryptoKey::save_to_string, DEFVAL(false));
ClassDB::bind_method(D_METHOD("load_from_string", "string_key", "public_only"), &CryptoKey::load_from_string, DEFVAL(false));
}
X509Certificate *(*X509Certificate::_create)() = NULL;
X509Certificate *(*X509Certificate::_create)() = nullptr;
X509Certificate *X509Certificate::create() {
if (_create)
if (_create) {
return _create();
return NULL;
}
return nullptr;
}
void X509Certificate::_bind_methods() {
@@ -60,26 +65,78 @@ void X509Certificate::_bind_methods() {
ClassDB::bind_method(D_METHOD("load", "path"), &X509Certificate::load);
}
/// HMACContext
void HMACContext::_bind_methods() {
ClassDB::bind_method(D_METHOD("start", "hash_type", "key"), &HMACContext::start);
ClassDB::bind_method(D_METHOD("update", "data"), &HMACContext::update);
ClassDB::bind_method(D_METHOD("finish"), &HMACContext::finish);
}
HMACContext *(*HMACContext::_create)() = nullptr;
HMACContext *HMACContext::create() {
if (_create) {
return _create();
}
ERR_FAIL_V_MSG(nullptr, "HMACContext is not available when the mbedtls module is disabled.");
}
/// Crypto
void (*Crypto::_load_default_certificates)(String p_path) = NULL;
Crypto *(*Crypto::_create)() = NULL;
void (*Crypto::_load_default_certificates)(String p_path) = nullptr;
Crypto *(*Crypto::_create)() = nullptr;
Crypto *Crypto::create() {
if (_create)
if (_create) {
return _create();
ERR_FAIL_V_MSG(NULL, "Crypto is not available when the mbedtls module is disabled.");
}
ERR_FAIL_V_MSG(nullptr, "Crypto is not available when the mbedtls module is disabled.");
}
void Crypto::load_default_certificates(String p_path) {
if (_load_default_certificates)
if (_load_default_certificates) {
_load_default_certificates(p_path);
}
}
PoolByteArray Crypto::hmac_digest(HashingContext::HashType p_hash_type, PoolByteArray p_key, PoolByteArray p_msg) {
Ref<HMACContext> ctx = Ref<HMACContext>(HMACContext::create());
ERR_FAIL_COND_V_MSG(ctx.is_null(), PoolByteArray(), "HMAC is not available witout mbedtls module.");
Error err = ctx->start(p_hash_type, p_key);
ERR_FAIL_COND_V(err != OK, PoolByteArray());
err = ctx->update(p_msg);
ERR_FAIL_COND_V(err != OK, PoolByteArray());
return ctx->finish();
}
// Compares two HMACS for equality without leaking timing information in order to prevent timing attakcs.
// @see: https://paragonie.com/blog/2015/11/preventing-timing-attacks-on-string-comparison-with-double-hmac-strategy
bool Crypto::constant_time_compare(PoolByteArray p_trusted, PoolByteArray p_received) {
const uint8_t *t = p_trusted.read().ptr();
const uint8_t *r = p_received.read().ptr();
int tlen = p_trusted.size();
int rlen = p_received.size();
// If the lengths are different then nothing else matters.
if (tlen != rlen) {
return false;
}
uint8_t v = 0;
for (int i = 0; i < tlen; i++) {
v |= t[i] ^ r[i];
}
return v == 0;
}
void Crypto::_bind_methods() {
ClassDB::bind_method(D_METHOD("generate_random_bytes", "size"), &Crypto::generate_random_bytes);
ClassDB::bind_method(D_METHOD("generate_rsa", "size"), &Crypto::generate_rsa);
ClassDB::bind_method(D_METHOD("generate_self_signed_certificate", "key", "issuer_name", "not_before", "not_after"), &Crypto::generate_self_signed_certificate, DEFVAL("CN=myserver,O=myorganisation,C=IT"), DEFVAL("20140101000000"), DEFVAL("20340101000000"));
ClassDB::bind_method(D_METHOD("sign", "hash_type", "hash", "key"), &Crypto::sign);
ClassDB::bind_method(D_METHOD("verify", "hash_type", "hash", "signature", "key"), &Crypto::verify);
ClassDB::bind_method(D_METHOD("encrypt", "key", "plaintext"), &Crypto::encrypt);
ClassDB::bind_method(D_METHOD("decrypt", "key", "ciphertext"), &Crypto::decrypt);
ClassDB::bind_method(D_METHOD("hmac_digest", "hash_type", "key", "msg"), &Crypto::hmac_digest);
ClassDB::bind_method(D_METHOD("constant_time_compare", "trusted", "received"), &Crypto::constant_time_compare);
}
Crypto::Crypto() {
@@ -88,52 +145,58 @@ Crypto::Crypto() {
/// Resource loader/saver
RES ResourceFormatLoaderCrypto::load(const String &p_path, const String &p_original_path, Error *r_error) {
String el = p_path.get_extension().to_lower();
if (el == "crt") {
X509Certificate *cert = X509Certificate::create();
if (cert)
if (cert) {
cert->load(p_path);
}
return cert;
} else if (el == "key") {
CryptoKey *key = CryptoKey::create();
if (key)
key->load(p_path);
if (key) {
key->load(p_path, false);
}
return key;
} else if (el == "pub") {
CryptoKey *key = CryptoKey::create();
if (key) {
key->load(p_path, true);
}
return key;
}
return NULL;
return nullptr;
}
void ResourceFormatLoaderCrypto::get_recognized_extensions(List<String> *p_extensions) const {
p_extensions->push_back("crt");
p_extensions->push_back("key");
p_extensions->push_back("pub");
}
bool ResourceFormatLoaderCrypto::handles_type(const String &p_type) const {
return p_type == "X509Certificate" || p_type == "CryptoKey";
}
String ResourceFormatLoaderCrypto::get_resource_type(const String &p_path) const {
String el = p_path.get_extension().to_lower();
if (el == "crt")
if (el == "crt") {
return "X509Certificate";
else if (el == "key")
} else if (el == "key" || el == "pub") {
return "CryptoKey";
}
return "";
}
Error ResourceFormatSaverCrypto::save(const String &p_path, const RES &p_resource, uint32_t p_flags) {
Error err;
Ref<X509Certificate> cert = p_resource;
Ref<CryptoKey> key = p_resource;
if (cert.is_valid()) {
err = cert->save(p_path);
} else if (key.is_valid()) {
err = key->save(p_path);
String el = p_path.get_extension().to_lower();
err = key->save(p_path, el == "pub");
} else {
ERR_FAIL_V(ERR_INVALID_PARAMETER);
}
@@ -142,17 +205,18 @@ Error ResourceFormatSaverCrypto::save(const String &p_path, const RES &p_resourc
}
void ResourceFormatSaverCrypto::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const {
const X509Certificate *cert = Object::cast_to<X509Certificate>(*p_resource);
const CryptoKey *key = Object::cast_to<CryptoKey>(*p_resource);
if (cert) {
p_extensions->push_back("crt");
}
if (key) {
p_extensions->push_back("key");
if (!key->is_public_only()) {
p_extensions->push_back("key");
}
p_extensions->push_back("pub");
}
}
bool ResourceFormatSaverCrypto::recognize(const RES &p_resource) const {
return Object::cast_to<X509Certificate>(*p_resource) || Object::cast_to<CryptoKey>(*p_resource);
}

View File

@@ -31,6 +31,7 @@
#ifndef CRYPTO_H
#define CRYPTO_H
#include "core/crypto/hashing_context.h"
#include "core/reference.h"
#include "core/resource.h"
@@ -46,8 +47,11 @@ protected:
public:
static CryptoKey *create();
virtual Error load(String p_path) = 0;
virtual Error save(String p_path) = 0;
virtual Error load(String p_path, bool p_public_only = false) = 0;
virtual Error save(String p_path, bool p_public_only = false) = 0;
virtual String save_to_string(bool p_public_only = false) = 0;
virtual Error load_from_string(String p_string_key, bool p_public_only = false) = 0;
virtual bool is_public_only() const = 0;
};
class X509Certificate : public Resource {
@@ -64,6 +68,24 @@ public:
virtual Error save(String p_path) = 0;
};
class HMACContext : public Reference {
GDCLASS(HMACContext, Reference);
protected:
static void _bind_methods();
static HMACContext *(*_create)();
public:
static HMACContext *create();
virtual Error start(HashingContext::HashType p_hash_type, PoolByteArray p_key) = 0;
virtual Error update(PoolByteArray p_data) = 0;
virtual PoolByteArray finish() = 0;
HMACContext() {}
virtual ~HMACContext() {}
};
class Crypto : public Reference {
GDCLASS(Crypto, Reference);
@@ -80,12 +102,23 @@ public:
virtual Ref<CryptoKey> generate_rsa(int p_bytes) = 0;
virtual Ref<X509Certificate> generate_self_signed_certificate(Ref<CryptoKey> p_key, String p_issuer_name, String p_not_before, String p_not_after) = 0;
virtual Vector<uint8_t> sign(HashingContext::HashType p_hash_type, Vector<uint8_t> p_hash, Ref<CryptoKey> p_key) = 0;
virtual bool verify(HashingContext::HashType p_hash_type, Vector<uint8_t> p_hash, Vector<uint8_t> p_signature, Ref<CryptoKey> p_key) = 0;
virtual Vector<uint8_t> encrypt(Ref<CryptoKey> p_key, Vector<uint8_t> p_plaintext) = 0;
virtual Vector<uint8_t> decrypt(Ref<CryptoKey> p_key, Vector<uint8_t> p_ciphertext) = 0;
PoolByteArray hmac_digest(HashingContext::HashType p_hash_type, PoolByteArray p_key, PoolByteArray p_msg);
// Compares two PoolByteArrays for equality without leaking timing information in order to prevent timing attacks.
// @see: https://paragonie.com/blog/2015/11/preventing-timing-attacks-on-string-comparison-with-double-hmac-strategy
bool constant_time_compare(PoolByteArray p_trusted, PoolByteArray p_received);
Crypto();
};
class ResourceFormatLoaderCrypto : public ResourceFormatLoader {
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;
virtual String get_resource_type(const String &p_path) const;

View File

@@ -145,6 +145,16 @@ Error CryptoCore::AESContext::decrypt_ecb(const uint8_t p_src[16], uint8_t r_dst
return ret ? FAILED : OK;
}
Error CryptoCore::AESContext::encrypt_cbc(size_t p_length, uint8_t r_iv[16], const uint8_t *p_src, uint8_t *r_dst) {
int ret = mbedtls_aes_crypt_cbc((mbedtls_aes_context *)ctx, MBEDTLS_AES_ENCRYPT, p_length, r_iv, p_src, r_dst);
return ret ? FAILED : OK;
}
Error CryptoCore::AESContext::decrypt_cbc(size_t p_length, uint8_t r_iv[16], const uint8_t *p_src, uint8_t *r_dst) {
int ret = mbedtls_aes_crypt_cbc((mbedtls_aes_context *)ctx, MBEDTLS_AES_DECRYPT, p_length, r_iv, p_src, r_dst);
return ret ? FAILED : OK;
}
// CryptoCore
String CryptoCore::b64_encode_str(const uint8_t *p_src, int p_src_len) {
int b64len = p_src_len / 3 * 4 + 4 + 1;

View File

@@ -34,10 +34,8 @@
#include "core/reference.h"
class CryptoCore {
public:
class MD5Context {
private:
void *ctx; // To include, or not to include...
@@ -51,7 +49,6 @@ public:
};
class SHA1Context {
private:
void *ctx; // To include, or not to include...
@@ -65,7 +62,6 @@ public:
};
class SHA256Context {
private:
void *ctx; // To include, or not to include...
@@ -79,7 +75,6 @@ public:
};
class AESContext {
private:
void *ctx; // To include, or not to include...
@@ -91,6 +86,8 @@ public:
Error set_decode_key(const uint8_t *p_key, size_t p_bits);
Error encrypt_ecb(const uint8_t p_src[16], uint8_t r_dst[16]);
Error decrypt_ecb(const uint8_t p_src[16], uint8_t r_dst[16]);
Error encrypt_cbc(size_t p_length, uint8_t r_iv[16], const uint8_t *p_src, uint8_t *r_dst);
Error decrypt_cbc(size_t p_length, uint8_t r_iv[16], const uint8_t *p_src, uint8_t *r_dst);
};
static String b64_encode_str(const uint8_t *p_src, int p_src_len);

View File

@@ -33,9 +33,9 @@
#include "core/crypto/crypto_core.h"
Error HashingContext::start(HashType p_type) {
ERR_FAIL_COND_V(ctx != NULL, ERR_ALREADY_IN_USE);
ERR_FAIL_COND_V(ctx != nullptr, ERR_ALREADY_IN_USE);
_create_ctx(p_type);
ERR_FAIL_COND_V(ctx == NULL, ERR_UNAVAILABLE);
ERR_FAIL_COND_V(ctx == nullptr, ERR_UNAVAILABLE);
switch (type) {
case HASH_MD5:
return ((CryptoCore::MD5Context *)ctx)->start();
@@ -48,7 +48,7 @@ Error HashingContext::start(HashType p_type) {
}
Error HashingContext::update(PoolByteArray p_chunk) {
ERR_FAIL_COND_V(ctx == NULL, ERR_UNCONFIGURED);
ERR_FAIL_COND_V(ctx == nullptr, ERR_UNCONFIGURED);
size_t len = p_chunk.size();
ERR_FAIL_COND_V(len == 0, FAILED);
PoolByteArray::Read r = p_chunk.read();
@@ -64,7 +64,7 @@ Error HashingContext::update(PoolByteArray p_chunk) {
}
PoolByteArray HashingContext::finish() {
ERR_FAIL_COND_V(ctx == NULL, PoolByteArray());
ERR_FAIL_COND_V(ctx == nullptr, PoolByteArray());
PoolByteArray out;
Error err = FAILED;
switch (type) {
@@ -99,12 +99,11 @@ void HashingContext::_create_ctx(HashType p_type) {
ctx = memnew(CryptoCore::SHA256Context);
break;
default:
ctx = NULL;
ctx = nullptr;
}
}
void HashingContext::_delete_ctx() {
switch (type) {
case HASH_MD5:
memdelete((CryptoCore::MD5Context *)ctx);
@@ -116,7 +115,7 @@ void HashingContext::_delete_ctx() {
memdelete((CryptoCore::SHA256Context *)ctx);
break;
}
ctx = NULL;
ctx = nullptr;
}
void HashingContext::_bind_methods() {
@@ -129,10 +128,11 @@ void HashingContext::_bind_methods() {
}
HashingContext::HashingContext() {
ctx = NULL;
ctx = nullptr;
}
HashingContext::~HashingContext() {
if (ctx != NULL)
if (ctx != nullptr) {
_delete_ctx();
}
}

View File

@@ -35,15 +35,14 @@
#include "core/variant.h"
struct DictionaryPrivate {
SafeRefCount refcount;
OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator> variant_map;
};
void Dictionary::get_key_list(List<Variant> *p_keys) const {
if (_p->variant_map.empty())
if (_p->variant_map.empty()) {
return;
}
for (OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.front(); E; E = E.next()) {
p_keys->push_back(E.key());
@@ -51,7 +50,6 @@ void Dictionary::get_key_list(List<Variant> *p_keys) const {
}
Variant Dictionary::get_key_at_index(int p_index) const {
int index = 0;
for (OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.front(); E; E = E.next()) {
if (index == p_index) {
@@ -64,7 +62,6 @@ Variant Dictionary::get_key_at_index(int p_index) const {
}
Variant Dictionary::get_value_at_index(int p_index) const {
int index = 0;
for (OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.front(); E; E = E.next()) {
if (index == p_index) {
@@ -77,38 +74,36 @@ Variant Dictionary::get_value_at_index(int p_index) const {
}
Variant &Dictionary::operator[](const Variant &p_key) {
return _p->variant_map[p_key];
}
const Variant &Dictionary::operator[](const Variant &p_key) const {
return _p->variant_map[p_key];
}
const Variant *Dictionary::getptr(const Variant &p_key) const {
OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::ConstElement E = ((const OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator> *)&_p->variant_map)->find(p_key);
if (!E)
return NULL;
if (!E) {
return nullptr;
}
return &E.get();
}
Variant *Dictionary::getptr(const Variant &p_key) {
OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.find(p_key);
if (!E)
return NULL;
if (!E) {
return nullptr;
}
return &E.get();
}
Variant Dictionary::get_valid(const Variant &p_key) const {
OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::ConstElement E = ((const OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator> *)&_p->variant_map)->find(p_key);
if (!E)
if (!E) {
return Variant();
}
return E.get();
}
@@ -122,16 +117,13 @@ Variant Dictionary::get(const Variant &p_key, const Variant &p_default) const {
}
int Dictionary::size() const {
return _p->variant_map.size();
}
bool Dictionary::empty() const {
return !_p->variant_map.size();
}
bool Dictionary::has(const Variant &p_key) const {
return _p->variant_map.has(p_key);
}
@@ -145,51 +137,46 @@ bool Dictionary::has_all(const Array &p_keys) const {
}
bool Dictionary::erase(const Variant &p_key) {
return _p->variant_map.erase(p_key);
}
bool Dictionary::operator==(const Dictionary &p_dictionary) const {
return _p == p_dictionary._p;
}
bool Dictionary::operator!=(const Dictionary &p_dictionary) const {
return _p != p_dictionary._p;
}
void Dictionary::_ref(const Dictionary &p_from) const {
//make a copy first (thread safe)
if (!p_from._p->refcount.ref())
if (!p_from._p->refcount.ref()) {
return; // couldn't copy
}
//if this is the same, unreference the other one
if (p_from._p == _p) {
_p->refcount.unref();
return;
}
if (_p)
if (_p) {
_unref();
}
_p = p_from._p;
}
void Dictionary::clear() {
_p->variant_map.clear();
}
void Dictionary::_unref() const {
ERR_FAIL_COND(!_p);
if (_p->refcount.unref()) {
memdelete(_p);
}
_p = NULL;
_p = nullptr;
}
uint32_t Dictionary::hash() const {
uint32_t h = hash_djb2_one_32(Variant::DICTIONARY);
for (OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.front(); E; E = E.next()) {
@@ -201,10 +188,10 @@ uint32_t Dictionary::hash() const {
}
Array Dictionary::keys() const {
Array varr;
if (_p->variant_map.empty())
if (_p->variant_map.empty()) {
return varr;
}
varr.resize(size());
@@ -218,10 +205,10 @@ Array Dictionary::keys() const {
}
Array Dictionary::values() const {
Array varr;
if (_p->variant_map.empty())
if (_p->variant_map.empty()) {
return varr;
}
varr.resize(size());
@@ -235,22 +222,22 @@ Array Dictionary::values() const {
}
const Variant *Dictionary::next(const Variant *p_key) const {
if (p_key == NULL) {
if (p_key == nullptr) {
// caller wants to get the first element
if (_p->variant_map.front())
if (_p->variant_map.front()) {
return &_p->variant_map.front().key();
return NULL;
}
return nullptr;
}
OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.find(*p_key);
if (E && E.next())
if (E && E.next()) {
return &E.next().key();
return NULL;
}
return nullptr;
}
Dictionary Dictionary::duplicate(bool p_deep) const {
Dictionary n;
for (OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.front(); E; E = E.next()) {
@@ -261,7 +248,6 @@ Dictionary Dictionary::duplicate(bool p_deep) const {
}
void Dictionary::operator=(const Dictionary &p_dictionary) {
_ref(p_dictionary);
}
@@ -270,16 +256,14 @@ const void *Dictionary::id() const {
}
Dictionary::Dictionary(const Dictionary &p_from) {
_p = NULL;
_p = nullptr;
_ref(p_from);
}
Dictionary::Dictionary() {
_p = memnew(DictionaryPrivate);
_p->refcount.init();
}
Dictionary::~Dictionary() {
_unref();
}

View File

@@ -40,7 +40,6 @@ class Variant;
struct DictionaryPrivate;
class Dictionary {
mutable DictionaryPrivate *_p;
void _ref(const Dictionary &p_from) const;
@@ -75,7 +74,7 @@ public:
uint32_t hash() const;
void operator=(const Dictionary &p_dictionary);
const Variant *next(const Variant *p_key = NULL) const;
const Variant *next(const Variant *p_key = nullptr) const;
Array keys() const;
Array values() const;

View File

@@ -37,18 +37,17 @@
#include "core/version_hash.gen.h"
void Engine::set_iterations_per_second(int p_ips) {
ERR_FAIL_COND_MSG(p_ips <= 0, "Engine iterations per second must be greater than 0.");
ips = p_ips;
}
int Engine::get_iterations_per_second() const {
return ips;
}
void Engine::set_physics_jitter_fix(float p_threshold) {
if (p_threshold < 0)
if (p_threshold < 0) {
p_threshold = 0;
}
physics_jitter_fix = p_threshold;
}
@@ -65,32 +64,30 @@ int Engine::get_target_fps() const {
}
uint64_t Engine::get_frames_drawn() {
return frames_drawn;
}
void Engine::set_frame_delay(uint32_t p_msec) {
_frame_delay = p_msec;
}
uint32_t Engine::get_frame_delay() const {
return _frame_delay;
}
void Engine::set_time_scale(float p_scale) {
_time_scale = p_scale;
}
float Engine::get_time_scale() const {
return _time_scale;
}
Dictionary Engine::get_version_info() const {
void Engine::set_portals_active(bool p_active) {
_portals_active = p_active;
}
Dictionary Engine::get_version_info() const {
Dictionary dict;
dict["major"] = VERSION_MAJOR;
dict["minor"] = VERSION_MINOR;
@@ -104,8 +101,9 @@ Dictionary Engine::get_version_info() const {
dict["hash"] = hash.length() == 0 ? String("unknown") : hash;
String stringver = String(dict["major"]) + "." + String(dict["minor"]);
if ((int)dict["patch"] != 0)
if ((int)dict["patch"] != 0) {
stringver += "." + String(dict["patch"]);
}
stringver += "-" + String(dict["status"]) + " (" + String(dict["build"]) + ")";
dict["string"] = stringver;
@@ -114,8 +112,8 @@ Dictionary Engine::get_version_info() const {
static Array array_from_info(const char *const *info_list) {
Array arr;
for (int i = 0; info_list[i] != NULL; i++) {
arr.push_back(info_list[i]);
for (int i = 0; info_list[i] != nullptr; i++) {
arr.push_back(String::utf8(info_list[i]));
}
return arr;
}
@@ -123,7 +121,7 @@ static Array array_from_info(const char *const *info_list) {
static Array array_from_info_count(const char *const *info_list, int info_count) {
Array arr;
for (int i = 0; i < info_count; i++) {
arr.push_back(info_list[i]);
arr.push_back(String::utf8(info_list[i]));
}
return arr;
}
@@ -144,14 +142,14 @@ Array Engine::get_copyright_info() const {
for (int component_index = 0; component_index < COPYRIGHT_INFO_COUNT; component_index++) {
const ComponentCopyright &cp_info = COPYRIGHT_INFO[component_index];
Dictionary component_dict;
component_dict["name"] = cp_info.name;
component_dict["name"] = String::utf8(cp_info.name);
Array parts;
for (int i = 0; i < cp_info.part_count; i++) {
const ComponentCopyrightPart &cp_part = cp_info.parts[i];
Dictionary part_dict;
part_dict["files"] = array_from_info_count(cp_part.files, cp_part.file_count);
part_dict["copyright"] = array_from_info_count(cp_part.copyright_statements, cp_part.copyright_count);
part_dict["license"] = cp_part.license;
part_dict["license"] = String::utf8(cp_part.license);
parts.push_back(part_dict);
}
component_dict["parts"] = parts;
@@ -186,38 +184,42 @@ String Engine::get_license_text() const {
return String(GODOT_LICENSE_TEXT);
}
void Engine::add_singleton(const Singleton &p_singleton) {
void Engine::set_print_error_messages(bool p_enabled) {
_print_error_enabled = p_enabled;
}
bool Engine::is_printing_error_messages() const {
return _print_error_enabled;
}
void Engine::add_singleton(const Singleton &p_singleton) {
singletons.push_back(p_singleton);
singleton_ptrs[p_singleton.name] = p_singleton.ptr;
}
Object *Engine::get_singleton_object(const String &p_name) const {
const Map<StringName, Object *>::Element *E = singleton_ptrs.find(p_name);
ERR_FAIL_COND_V_MSG(!E, NULL, "Failed to retrieve non-existent singleton '" + p_name + "'.");
ERR_FAIL_COND_V_MSG(!E, nullptr, "Failed to retrieve non-existent singleton '" + p_name + "'.");
return E->get();
};
bool Engine::has_singleton(const String &p_name) const {
return singleton_ptrs.has(p_name);
};
void Engine::get_singletons(List<Singleton> *p_singletons) {
for (List<Singleton>::Element *E = singletons.front(); E; E = E->next())
for (List<Singleton>::Element *E = singletons.front(); E; E = E->next()) {
p_singletons->push_back(E->get());
}
}
Engine *Engine::singleton = NULL;
Engine *Engine::singleton = nullptr;
Engine *Engine::get_singleton() {
return singleton;
}
Engine::Engine() {
singleton = this;
frames_drawn = 0;
ips = 60;
@@ -234,6 +236,7 @@ Engine::Engine() {
_frame_ticks = 0;
_frame_step = 0;
editor_hint = false;
_portals_active = false;
}
Engine::Singleton::Singleton(const StringName &p_name, Object *p_ptr) :

View File

@@ -37,12 +37,11 @@
#include "core/vector.h"
class Engine {
public:
struct Singleton {
StringName name;
Object *ptr;
Singleton(const StringName &p_name = StringName(), Object *p_ptr = NULL);
Singleton(const StringName &p_name = StringName(), Object *p_ptr = nullptr);
};
private:
@@ -61,6 +60,8 @@ private:
bool _gpu_pixel_snap;
uint64_t _physics_frames;
float _physics_interpolation_fraction;
bool _portals_active;
bool _occlusion_culling_active;
uint64_t _idle_frames;
bool _in_physics;
@@ -101,12 +102,17 @@ public:
void set_frame_delay(uint32_t p_msec);
uint32_t get_frame_delay() const;
void set_print_error_messages(bool p_enabled);
bool is_printing_error_messages() const;
void add_singleton(const Singleton &p_singleton);
void get_singletons(List<Singleton> *p_singletons);
bool has_singleton(const String &p_name) const;
Object *get_singleton_object(const String &p_name) const;
_FORCE_INLINE_ bool get_use_gpu_pixel_snap() const { return _gpu_pixel_snap; }
bool are_portals_active() const { return _portals_active; }
void set_portals_active(bool p_active);
#ifdef TOOLS_ENABLED
_FORCE_INLINE_ void set_editor_hint(bool p_enabled) { editor_hint = p_enabled; }

View File

@@ -34,10 +34,9 @@
#include "core/ustring.h"
#include "os/os.h"
static ErrorHandlerList *error_handler_list = NULL;
static ErrorHandlerList *error_handler_list = nullptr;
void add_error_handler(ErrorHandlerList *p_handler) {
_global_lock();
p_handler->next = error_handler_list;
error_handler_list = p_handler;
@@ -45,20 +44,18 @@ void add_error_handler(ErrorHandlerList *p_handler) {
}
void remove_error_handler(ErrorHandlerList *p_handler) {
_global_lock();
ErrorHandlerList *prev = NULL;
ErrorHandlerList *prev = nullptr;
ErrorHandlerList *l = error_handler_list;
while (l) {
if (l == p_handler) {
if (prev)
if (prev) {
prev->next = l->next;
else
} else {
error_handler_list = l->next;
}
break;
}
prev = l;
@@ -77,13 +74,11 @@ void _err_print_error(const char *p_function, const char *p_file, int p_line, co
}
void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, const char *p_message, ErrorHandlerType p_type) {
OS::get_singleton()->print_error(p_function, p_file, p_line, p_error, p_message, (Logger::ErrorType)p_type);
_global_lock();
ErrorHandlerList *l = error_handler_list;
while (l) {
l->errfunc(l->userdata, p_function, p_file, p_line, p_error, p_message, p_type);
l = l->next;
}
@@ -104,7 +99,6 @@ void _err_print_error(const char *p_function, const char *p_file, int p_line, co
}
void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, const char *p_message, bool fatal) {
String fstr(fatal ? "FATAL: " : "");
String err(fstr + "Index " + p_index_str + " = " + itos(p_index) + " is out of bounds (" + p_size_str + " = " + itos(p_size) + ").");
_err_print_error(p_function, p_file, p_line, err.utf8().get_data(), p_message);

View File

@@ -61,16 +61,15 @@ class String;
typedef void (*ErrorHandlerFunc)(void *, const char *, const char *, int p_line, const char *, const char *, ErrorHandlerType p_type);
struct ErrorHandlerList {
ErrorHandlerFunc errfunc;
void *userdata;
ErrorHandlerList *next;
ErrorHandlerList() {
errfunc = 0;
next = 0;
userdata = 0;
errfunc = nullptr;
next = nullptr;
userdata = nullptr;
}
};
@@ -113,13 +112,6 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
#define GENERATE_TRAP __builtin_trap();
#endif
// Used to strip debug messages in release mode
#ifdef DEBUG_ENABLED
#define DEBUG_STR(m_msg) m_msg
#else
#define DEBUG_STR(m_msg) ""
#endif
// (*): See https://stackoverflow.com/questions/257418/do-while-0-what-is-it-good-for
/**
@@ -127,91 +119,84 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* error message and returns from the function. This macro should be preferred to
* `ERR_FAIL_COND` for bounds checking.
*/
#define ERR_FAIL_INDEX(m_index, m_size) \
do { \
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
return; \
} \
} while (0); // (*)
#define ERR_FAIL_INDEX(m_index, m_size) \
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
return; \
} else \
((void)0)
/**
* If `m_index` is less than 0 or greater than or equal to `m_size`, prints a custom
* error message and returns from the function. This macro should be preferred to
* `ERR_FAIL_COND_MSG` for bounds checking.
*/
#define ERR_FAIL_INDEX_MSG(m_index, m_size, m_msg) \
do { \
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), DEBUG_STR(m_msg)); \
return; \
} \
} while (0); // (*)
#define ERR_FAIL_INDEX_MSG(m_index, m_size, m_msg) \
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg); \
return; \
} else \
((void)0)
/**
* If `m_index` is less than 0 or greater than or equal to `m_size`,
* prints a generic error message and returns the value specified in `m_retval`.
* This macro should be preferred to `ERR_FAIL_COND_V` for bounds checking.
*/
#define ERR_FAIL_INDEX_V(m_index, m_size, m_retval) \
do { \
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
return m_retval; \
} \
} while (0); // (*)
#define ERR_FAIL_INDEX_V(m_index, m_size, m_retval) \
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
return m_retval; \
} else \
((void)0)
/**
* If `m_index` is less than 0 or greater than or equal to `m_size`,
* prints a custom error message and returns the value specified in `m_retval`.
* This macro should be preferred to `ERR_FAIL_COND_V_MSG` for bounds checking.
*/
#define ERR_FAIL_INDEX_V_MSG(m_index, m_size, m_retval, m_msg) \
do { \
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), DEBUG_STR(m_msg)); \
return m_retval; \
} \
} while (0); // (*)
#define ERR_FAIL_INDEX_V_MSG(m_index, m_size, m_retval, m_msg) \
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg); \
return m_retval; \
} else \
((void)0)
/**
* If `m_index` is greater than or equal to `m_size`,
* prints a generic error message and returns the value specified in `m_retval`.
* This macro should be preferred to `ERR_FAIL_COND_V` for unsigned bounds checking.
*/
#define ERR_FAIL_UNSIGNED_INDEX(m_index, m_size) \
do { \
if (unlikely((m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
return; \
} \
} while (0); // (*)
#define ERR_FAIL_UNSIGNED_INDEX(m_index, m_size) \
if (unlikely((m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
return; \
} else \
((void)0)
/**
* If `m_index` is greater than or equal to `m_size`,
* prints a generic error message and returns the value specified in `m_retval`.
* This macro should be preferred to `ERR_FAIL_COND_V` for unsigned bounds checking.
*/
#define ERR_FAIL_UNSIGNED_INDEX_V(m_index, m_size, m_retval) \
do { \
if (unlikely((m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
return m_retval; \
} \
} while (0); // (*)
#define ERR_FAIL_UNSIGNED_INDEX_V(m_index, m_size, m_retval) \
if (unlikely((m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
return m_retval; \
} else \
((void)0)
/**
* If `m_index` is greater than or equal to `m_size`,
* prints a custom error message and returns the value specified in `m_retval`.
* This macro should be preferred to `ERR_FAIL_COND_V_MSG` for unsigned bounds checking.
*/
#define ERR_FAIL_UNSIGNED_INDEX_V_MSG(m_index, m_size, m_retval, m_msg) \
do { \
if (unlikely((m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), DEBUG_STR(m_msg)); \
return m_retval; \
} \
} while (0); // (*)
#define ERR_FAIL_UNSIGNED_INDEX_V_MSG(m_index, m_size, m_retval, m_msg) \
if (unlikely((m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg); \
return m_retval; \
} else \
((void)0)
/**
* If `m_index` is less than 0 or greater than or equal to `m_size`,
@@ -219,13 +204,12 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* Only use this if there's no sensible fallback (i.e. the error is unrecoverable).
* This macro should be preferred to `CRASH_COND` for bounds checking.
*/
#define CRASH_BAD_INDEX(m_index, m_size) \
do { \
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), "", true); \
GENERATE_TRAP \
} \
} while (0); // (*)
#define CRASH_BAD_INDEX(m_index, m_size) \
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), "", true); \
GENERATE_TRAP \
} else \
((void)0)
/**
* If `m_index` is less than 0 or greater than or equal to `m_size`,
@@ -233,13 +217,12 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* Only use this if there's no sensible fallback (i.e. the error is unrecoverable).
* This macro should be preferred to `CRASH_COND` for bounds checking.
*/
#define CRASH_BAD_INDEX_MSG(m_index, m_size, m_msg) \
do { \
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg, true); \
GENERATE_TRAP \
} \
} while (0); // (*)
#define CRASH_BAD_INDEX_MSG(m_index, m_size, m_msg) \
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), m_msg, true); \
GENERATE_TRAP \
} else \
((void)0)
/**
* If `m_index` is greater than or equal to `m_size`,
@@ -247,311 +230,323 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* Only use this if there's no sensible fallback (i.e. the error is unrecoverable).
* This macro should be preferred to `CRASH_COND` for bounds checking.
*/
#define CRASH_BAD_UNSIGNED_INDEX(m_index, m_size) \
do { \
if (unlikely((m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), "", true); \
GENERATE_TRAP \
} \
} while (0); // (*)
#define CRASH_BAD_UNSIGNED_INDEX(m_index, m_size) \
if (unlikely((m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size), "", true); \
GENERATE_TRAP \
} else \
((void)0)
/**
* If `m_param` is `null`, prints a generic error message and returns from the function.
*/
#define ERR_FAIL_NULL(m_param) \
{ \
if (unlikely(!m_param)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null."); \
return; \
} \
}
#define ERR_FAIL_NULL(m_param) \
if (unlikely(!m_param)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null."); \
return; \
} else \
((void)0)
/**
* If `m_param` is `null`, prints a custom error message and returns from the function.
*/
#define ERR_FAIL_NULL_MSG(m_param, m_msg) \
{ \
if (unlikely(!m_param)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null.", DEBUG_STR(m_msg)); \
return; \
} \
}
#define ERR_FAIL_NULL_MSG(m_param, m_msg) \
if (unlikely(!m_param)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null.", m_msg); \
return; \
} else \
((void)0)
/**
* If `m_param` is `null`, prints a generic error message and returns the value specified in `m_retval`.
*/
#define ERR_FAIL_NULL_V(m_param, m_retval) \
{ \
if (unlikely(!m_param)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null."); \
return m_retval; \
} \
}
#define ERR_FAIL_NULL_V(m_param, m_retval) \
if (unlikely(!m_param)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null."); \
return m_retval; \
} else \
((void)0)
/**
* If `m_param` is `null`, prints a custom error message and returns the value specified in `m_retval`.
*/
#define ERR_FAIL_NULL_V_MSG(m_param, m_retval, m_msg) \
{ \
if (unlikely(!m_param)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null.", DEBUG_STR(m_msg)); \
return m_retval; \
} \
}
#define ERR_FAIL_NULL_V_MSG(m_param, m_retval, m_msg) \
if (unlikely(!m_param)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null.", m_msg); \
return m_retval; \
} else \
((void)0)
/**
* If `m_cond` evaluates to `true`, prints a generic error message and returns from the function.
*/
#define ERR_FAIL_COND(m_cond) \
{ \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true."); \
return; \
} \
}
#define ERR_FAIL_COND(m_cond) \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true."); \
return; \
} else \
((void)0)
/**
* If `m_cond` evaluates to `true`, prints a custom error message and returns from the function.
*/
#define ERR_FAIL_COND_MSG(m_cond, m_msg) \
{ \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true.", DEBUG_STR(m_msg)); \
return; \
} \
}
#define ERR_FAIL_COND_MSG(m_cond, m_msg) \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true.", m_msg); \
return; \
} else \
((void)0)
/**
* If `m_cond` evaluates to `true`, crashes the engine immediately with a generic error message.
* Only use this if there's no sensible fallback (i.e. the error is unrecoverable).
*/
#define CRASH_COND(m_cond) \
{ \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Condition \"" _STR(m_cond) "\" is true."); \
GENERATE_TRAP \
} \
}
#define CRASH_COND(m_cond) \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Condition \"" _STR(m_cond) "\" is true."); \
GENERATE_TRAP \
} else \
((void)0)
/**
* If `m_cond` evaluates to `true`, crashes the engine immediately with a custom error message.
* Only use this if there's no sensible fallback (i.e. the error is unrecoverable).
*/
#define CRASH_COND_MSG(m_cond, m_msg) \
{ \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Condition \"" _STR(m_cond) "\" is true.", DEBUG_STR(m_msg)); \
GENERATE_TRAP \
} \
}
#define CRASH_COND_MSG(m_cond, m_msg) \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Condition \"" _STR(m_cond) "\" is true.", m_msg); \
GENERATE_TRAP \
} else \
((void)0)
/**
* If `m_cond` evaluates to `true`, prints a generic error message and returns the value specified in `m_retval`.
*/
#define ERR_FAIL_COND_V(m_cond, m_retval) \
{ \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Returned: " _STR(m_retval)); \
return m_retval; \
} \
}
#define ERR_FAIL_COND_V(m_cond, m_retval) \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Returned: " _STR(m_retval)); \
return m_retval; \
} else \
((void)0)
/**
* If `m_cond` evaluates to `true`, prints a custom error message and returns the value specified in `m_retval`.
*/
#define ERR_FAIL_COND_V_MSG(m_cond, m_retval, m_msg) \
{ \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Returned: " _STR(m_retval), DEBUG_STR(m_msg)); \
return m_retval; \
} \
}
#define ERR_FAIL_COND_V_MSG(m_cond, m_retval, m_msg) \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Returned: " _STR(m_retval), m_msg); \
return m_retval; \
} else \
((void)0)
/**
* If `m_cond` evaluates to `true`, prints a custom error message and continues the loop the macro is located in.
*/
#define ERR_CONTINUE(m_cond) \
{ \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Continuing."); \
continue; \
} \
}
#define ERR_CONTINUE(m_cond) \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Continuing."); \
continue; \
} else \
((void)0)
/**
* If `m_cond` evaluates to `true`, prints a custom error message and continues the loop the macro is located in.
*/
#define ERR_CONTINUE_MSG(m_cond, m_msg) \
{ \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Continuing.", DEBUG_STR(m_msg)); \
continue; \
} \
}
#define ERR_CONTINUE_MSG(m_cond, m_msg) \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Continuing.", m_msg); \
continue; \
} else \
((void)0)
/**
* If `m_cond` evaluates to `true`, prints a generic error message and breaks from the loop the macro is located in.
*/
#define ERR_BREAK(m_cond) \
{ \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Breaking."); \
break; \
} \
}
#define ERR_BREAK(m_cond) \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Breaking."); \
break; \
} else \
((void)0)
/**
* If `m_cond` evaluates to `true`, prints a custom error message and breaks from the loop the macro is located in.
*/
#define ERR_BREAK_MSG(m_cond, m_msg) \
{ \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Breaking.", DEBUG_STR(m_msg)); \
break; \
} \
}
#define ERR_BREAK_MSG(m_cond, m_msg) \
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Breaking.", m_msg); \
break; \
} else \
((void)0)
/**
* Prints a generic error message and returns from the function.
*/
#define ERR_FAIL() \
{ \
if (true) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method failed."); \
return; \
}
} else \
((void)0)
/**
* Prints a custom error message and returns from the function.
*/
#define ERR_FAIL_MSG(m_msg) \
{ \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method failed.", DEBUG_STR(m_msg)); \
return; \
}
#define ERR_FAIL_MSG(m_msg) \
if (true) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method failed.", m_msg); \
return; \
} else \
((void)0)
/**
* Prints a generic error message and returns the value specified in `m_retval`.
*/
#define ERR_FAIL_V(m_retval) \
{ \
if (true) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method failed. Returning: " __STR(m_retval)); \
return m_retval; \
}
} else \
((void)0)
/**
* Prints a custom error message and returns the value specified in `m_retval`.
*/
#define ERR_FAIL_V_MSG(m_retval, m_msg) \
{ \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method failed. Returning: " __STR(m_retval), DEBUG_STR(m_msg)); \
return m_retval; \
}
#define ERR_FAIL_V_MSG(m_retval, m_msg) \
if (true) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method failed. Returning: " __STR(m_retval), m_msg); \
return m_retval; \
} else \
((void)0)
/**
* Crashes the engine immediately with a generic error message.
* Only use this if there's no sensible fallback (i.e. the error is unrecoverable).
*/
#define CRASH_NOW() \
{ \
if (true) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Method failed."); \
GENERATE_TRAP \
}
} else \
((void)0)
/**
* Crashes the engine immediately with a custom error message.
* Only use this if there's no sensible fallback (i.e. the error is unrecoverable).
*/
#define CRASH_NOW_MSG(m_msg) \
{ \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Method failed.", DEBUG_STR(m_msg)); \
GENERATE_TRAP \
}
#define CRASH_NOW_MSG(m_msg) \
if (true) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Method failed.", m_msg); \
GENERATE_TRAP \
} else \
((void)0)
/**
* Prints an error message without returning.
*/
#define ERR_PRINT(m_string) \
{ \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_string); \
}
/**
* Prints an error message without returning.
* FIXME: Remove this macro and replace all uses with `ERR_PRINT` as it's identical.
*/
#define ERR_PRINTS(m_string) \
{ \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_string); \
}
#define ERR_PRINT(m_string) \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_string)
/**
* Prints an error message without returning, but only do so once in the application lifecycle.
* This can be used to avoid spamming the console with error messages.
*/
#define ERR_PRINT_ONCE(m_string) \
{ \
if (true) { \
static bool first_print = true; \
if (first_print) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_string); \
first_print = false; \
} \
}
} else \
((void)0)
/**
* Prints a warning message without returning. To warn about deprecated usage,
* use `WARN_DEPRECATED` or `WARN_DEPRECATED_MSG` instead.
*/
#define WARN_PRINT(m_string) \
{ \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_string, ERR_HANDLER_WARNING); \
}
/**
* Prints a warning message without returning.
* FIXME: Remove this macro and replace all uses with `WARN_PRINT` as it's identical.
*/
#define WARN_PRINTS(m_string) \
{ \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_string, ERR_HANDLER_WARNING); \
}
#define WARN_PRINT(m_string) \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_string, ERR_HANDLER_WARNING)
/**
* Prints a warning message without returning, but only do so once in the application lifecycle.
* This can be used to avoid spamming the console with warning messages.
*/
#define WARN_PRINT_ONCE(m_string) \
{ \
if (true) { \
static bool first_print = true; \
if (first_print) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_string, ERR_HANDLER_WARNING); \
first_print = false; \
} \
}
} else \
((void)0)
/**
* Prints a generic deprecation warning message without returning.
* This should be preferred to `WARN_PRINT` for deprecation warnings.
*/
#define WARN_DEPRECATED \
{ \
if (true) { \
static SafeFlag warning_shown; \
if (!warning_shown.is_set()) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "This method has been deprecated and will be removed in the future.", ERR_HANDLER_WARNING); \
warning_shown.set(); \
} \
}
} else \
((void)0)
/**
* Prints a custom deprecation warning message without returning.
* This should be preferred to `WARN_PRINT` for deprecation warnings.
*/
#define WARN_DEPRECATED_MSG(m_msg) \
{ \
if (true) { \
static SafeFlag warning_shown; \
if (!warning_shown.is_set()) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "This method has been deprecated and will be removed in the future.", m_msg, ERR_HANDLER_WARNING); \
warning_shown.set(); \
} \
}
} else \
((void)0)
#endif
/**
* This should be a 'free' assert for program flow and should not be needed in any releases,
* only used in dev builds.
*/
#ifdef DEV_ENABLED
#define DEV_ASSERT(m_cond) \
if (unlikely(!(m_cond))) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: DEV_ASSERT failed \"" _STR(m_cond) "\" is false."); \
GENERATE_TRAP \
} else \
((void)0)
#else
#define DEV_ASSERT(m_cond)
#endif
/**
* These should be 'free' checks for program flow and should not be needed in any releases,
* only used in dev builds.
*/
#ifdef DEV_ENABLED
#define DEV_CHECK(m_cond) \
if (unlikely(!(m_cond))) { \
ERR_PRINT("DEV_CHECK failed \"" _STR(m_cond) "\" is false."); \
} else \
((void)0)
#else
#define DEV_CHECK(m_cond)
#endif
#ifdef DEV_ENABLED
#define DEV_CHECK_ONCE(m_cond) \
if (unlikely(!(m_cond))) { \
ERR_PRINT_ONCE("DEV_CHECK_ONCE failed \"" _STR(m_cond) "\" is false."); \
} else \
((void)0)
#else
#define DEV_CHECK_ONCE(m_cond)
#endif

View File

@@ -31,7 +31,6 @@
#include "func_ref.h"
Variant FuncRef::call_func(const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
if (id == 0) {
r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL;
return Variant();
@@ -47,7 +46,6 @@ Variant FuncRef::call_func(const Variant **p_args, int p_argcount, Variant::Call
}
Variant FuncRef::call_funcv(const Array &p_args) {
ERR_FAIL_COND_V(id == 0, Variant());
Object *obj = ObjectDB::get_instance(id);
@@ -58,13 +56,11 @@ Variant FuncRef::call_funcv(const Array &p_args) {
}
void FuncRef::set_instance(Object *p_obj) {
ERR_FAIL_NULL(p_obj);
id = p_obj->get_instance_id();
}
void FuncRef::set_function(const StringName &p_func) {
function = p_func;
}
@@ -73,18 +69,19 @@ StringName FuncRef::get_function() {
}
bool FuncRef::is_valid() const {
if (id == 0)
if (id == 0) {
return false;
}
Object *obj = ObjectDB::get_instance(id);
if (!obj)
if (!obj) {
return false;
}
return obj->has_method(function);
}
void FuncRef::_bind_methods() {
{
MethodInfo mi;
mi.name = "call_func";

View File

@@ -34,7 +34,6 @@
#include "core/reference.h"
class FuncRef : public Reference {
GDCLASS(FuncRef, Reference);
ObjectID id;
StringName function;

View File

@@ -36,9 +36,9 @@
#include "core/variant.h"
struct _GlobalConstant {
#ifdef DEBUG_METHODS_ENABLED
StringName enum_name;
bool ignore_value_in_docs;
#endif
const char *name;
int value;
@@ -46,8 +46,9 @@ struct _GlobalConstant {
_GlobalConstant() {}
#ifdef DEBUG_METHODS_ENABLED
_GlobalConstant(const StringName &p_enum_name, const char *p_name, int p_value) :
_GlobalConstant(const StringName &p_enum_name, const char *p_name, int p_value, bool p_ignore_value_in_docs = false) :
enum_name(p_enum_name),
ignore_value_in_docs(p_ignore_value_in_docs),
name(p_name),
value(p_value) {
}
@@ -72,6 +73,15 @@ static Vector<_GlobalConstant> _global_constants;
#define BIND_GLOBAL_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \
_global_constants.push_back(_GlobalConstant(__constant_get_enum_name(m_constant, #m_constant), m_custom_name, m_constant));
#define BIND_GLOBAL_CONSTANT_NO_VAL(m_constant) \
_global_constants.push_back(_GlobalConstant(StringName(), #m_constant, m_constant, true));
#define BIND_GLOBAL_ENUM_CONSTANT_NO_VAL(m_constant) \
_global_constants.push_back(_GlobalConstant(__constant_get_enum_name(m_constant, #m_constant), #m_constant, m_constant, true));
#define BIND_GLOBAL_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \
_global_constants.push_back(_GlobalConstant(__constant_get_enum_name(m_constant, #m_constant), m_custom_name, m_constant, true));
#else
#define BIND_GLOBAL_CONSTANT(m_constant) \
@@ -83,6 +93,15 @@ static Vector<_GlobalConstant> _global_constants;
#define BIND_GLOBAL_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \
_global_constants.push_back(_GlobalConstant(m_custom_name, m_constant));
#define BIND_GLOBAL_CONSTANT_NO_VAL(m_constant) \
_global_constants.push_back(_GlobalConstant(#m_constant, m_constant));
#define BIND_GLOBAL_ENUM_CONSTANT_NO_VAL(m_constant) \
_global_constants.push_back(_GlobalConstant(#m_constant, m_constant));
#define BIND_GLOBAL_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \
_global_constants.push_back(_GlobalConstant(m_custom_name, m_constant));
#endif
VARIANT_ENUM_CAST(KeyList);
@@ -92,7 +111,6 @@ VARIANT_ENUM_CAST(JoystickList);
VARIANT_ENUM_CAST(MidiMessageList);
void register_global_constants() {
//{ KEY_BACKSPACE, VK_BACK },// (0x08) // backspace
BIND_GLOBAL_ENUM_CONSTANT(MARGIN_LEFT);
@@ -371,7 +389,7 @@ void register_global_constants() {
BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_ALT);
BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_META);
BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_CTRL);
BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_CMD);
BIND_GLOBAL_ENUM_CONSTANT_NO_VAL(KEY_MASK_CMD);
BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_KPAD);
BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_GROUP_SWITCH);
@@ -415,6 +433,7 @@ void register_global_constants() {
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_19);
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_20);
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_21);
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_22);
BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_MAX);
BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_CIRCLE);
@@ -448,6 +467,7 @@ void register_global_constants() {
BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_DOWN);
BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_LEFT);
BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_RIGHT);
BIND_GLOBAL_ENUM_CONSTANT(JOY_GUIDE);
BIND_GLOBAL_ENUM_CONSTANT(JOY_MISC1);
BIND_GLOBAL_ENUM_CONSTANT(JOY_PADDLE1);
BIND_GLOBAL_ENUM_CONSTANT(JOY_PADDLE2);
@@ -667,33 +687,35 @@ void register_global_constants() {
}
void unregister_global_constants() {
_global_constants.clear();
}
int GlobalConstants::get_global_constant_count() {
return _global_constants.size();
}
#ifdef DEBUG_METHODS_ENABLED
StringName GlobalConstants::get_global_constant_enum(int p_idx) {
return _global_constants[p_idx].enum_name;
}
bool GlobalConstants::get_ignore_value_in_docs(int p_idx) {
return _global_constants[p_idx].ignore_value_in_docs;
}
#else
StringName GlobalConstants::get_global_constant_enum(int p_idx) {
return StringName();
}
bool GlobalConstants::get_ignore_value_in_docs(int p_idx) {
return false;
}
#endif
const char *GlobalConstants::get_global_constant_name(int p_idx) {
return _global_constants[p_idx].name;
}
int GlobalConstants::get_global_constant_value(int p_idx) {
return _global_constants[p_idx].value;
}

View File

@@ -37,6 +37,7 @@ class GlobalConstants {
public:
static int get_global_constant_count();
static StringName get_global_constant_enum(int p_idx);
static bool get_ignore_value_in_docs(int p_idx);
static const char *get_global_constant_name(int p_idx);
static int get_global_constant_value(int p_idx);
};

View File

@@ -53,13 +53,12 @@
* @param RELATIONSHIP Relationship at which the hash table is resized. if amount of elements is RELATIONSHIP
* times bigger than the hash table, table is resized to solve this condition. if RELATIONSHIP is zero, table is always MIN_HASH_TABLE_POWER.
*
*/
*/
template <class TKey, class TData, class Hasher = HashMapHasherDefault, class Comparator = HashMapComparatorDefault<TKey>, uint8_t MIN_HASH_TABLE_POWER = 3, uint8_t RELATIONSHIP = 8>
class HashMap {
public:
struct Pair {
TKey key;
TData data;
@@ -76,7 +75,7 @@ public:
uint32_t hash;
Element *next;
Element() { next = 0; }
Element() { next = nullptr; }
Pair pair;
public:
@@ -99,29 +98,27 @@ private:
uint32_t elements;
void make_hash_table() {
ERR_FAIL_COND(hash_table);
hash_table = memnew_arr(Element *, (1 << MIN_HASH_TABLE_POWER));
hash_table_power = MIN_HASH_TABLE_POWER;
elements = 0;
for (int i = 0; i < (1 << MIN_HASH_TABLE_POWER); i++)
hash_table[i] = 0;
for (int i = 0; i < (1 << MIN_HASH_TABLE_POWER); i++) {
hash_table[i] = nullptr;
}
}
void erase_hash_table() {
ERR_FAIL_COND_MSG(elements, "Cannot erase hash table if there are still elements inside.");
memdelete_arr(hash_table);
hash_table = 0;
hash_table = nullptr;
hash_table_power = 0;
elements = 0;
}
void check_hash_table() {
int new_hash_table_power = -1;
if ((int)elements > ((1 << hash_table_power) * RELATIONSHIP)) {
@@ -129,40 +126,36 @@ private:
new_hash_table_power = hash_table_power + 1;
while ((int)elements > ((1 << new_hash_table_power) * RELATIONSHIP)) {
new_hash_table_power++;
}
} else if ((hash_table_power > (int)MIN_HASH_TABLE_POWER) && ((int)elements < ((1 << (hash_table_power - 1)) * RELATIONSHIP))) {
/* rehash down */
new_hash_table_power = hash_table_power - 1;
while ((int)elements < ((1 << (new_hash_table_power - 1)) * RELATIONSHIP)) {
new_hash_table_power--;
}
if (new_hash_table_power < (int)MIN_HASH_TABLE_POWER)
if (new_hash_table_power < (int)MIN_HASH_TABLE_POWER) {
new_hash_table_power = MIN_HASH_TABLE_POWER;
}
}
if (new_hash_table_power == -1)
if (new_hash_table_power == -1) {
return;
}
Element **new_hash_table = memnew_arr(Element *, ((uint64_t)1 << new_hash_table_power));
ERR_FAIL_COND_MSG(!new_hash_table, "Out of memory.");
for (int i = 0; i < (1 << new_hash_table_power); i++) {
new_hash_table[i] = 0;
new_hash_table[i] = nullptr;
}
if (hash_table) {
for (int i = 0; i < (1 << hash_table_power); i++) {
while (hash_table[i]) {
Element *se = hash_table[i];
hash_table[i] = se->next;
int new_pos = se->hash & ((1 << new_hash_table_power) - 1);
@@ -179,17 +172,14 @@ private:
/* I want to have only one function.. */
_FORCE_INLINE_ const Element *get_element(const TKey &p_key) const {
uint32_t hash = Hasher::hash(p_key);
uint32_t index = hash & ((1 << hash_table_power) - 1);
Element *e = hash_table[index];
while (e) {
/* checking hash first avoids comparing key, which may take longer */
if (e->hash == hash && Comparator::compare(e->pair.key, p_key)) {
/* the pair exists in this hashtable, so just update data */
return e;
}
@@ -197,14 +187,13 @@ private:
e = e->next;
}
return NULL;
return nullptr;
}
Element *create_element(const TKey &p_key) {
/* if element doesn't exist, create it */
Element *e = memnew(Element);
ERR_FAIL_COND_V_MSG(!e, NULL, "Out of memory.");
ERR_FAIL_COND_V_MSG(!e, nullptr, "Out of memory.");
uint32_t hash = Hasher::hash(p_key);
uint32_t index = hash & ((1 << hash_table_power) - 1);
e->next = hash_table[index];
@@ -219,27 +208,26 @@ private:
}
void copy_from(const HashMap &p_t) {
if (&p_t == this)
if (&p_t == this) {
return; /* much less bother with that */
}
clear();
if (!p_t.hash_table || p_t.hash_table_power == 0)
if (!p_t.hash_table || p_t.hash_table_power == 0) {
return; /* not copying from empty table */
}
hash_table = memnew_arr(Element *, (uint64_t)1 << p_t.hash_table_power);
hash_table_power = p_t.hash_table_power;
elements = p_t.elements;
for (int i = 0; i < (1 << p_t.hash_table_power); i++) {
hash_table[i] = NULL;
hash_table[i] = nullptr;
const Element *e = p_t.hash_table[i];
while (e) {
Element *le = memnew(Element); /* local element */
*le = *e; /* copy data */
@@ -259,20 +247,20 @@ public:
}
Element *set(const Pair &p_pair) {
Element *e = NULL;
if (!hash_table)
Element *e = nullptr;
if (!hash_table) {
make_hash_table(); // if no table, make one
else
} else {
e = const_cast<Element *>(get_element(p_pair.key));
}
/* if we made it up to here, the pair doesn't exist, create and assign */
if (!e) {
e = create_element(p_pair.key);
if (!e)
return NULL;
if (!e) {
return nullptr;
}
check_hash_table(); // perform mantenience routine
}
@@ -281,8 +269,7 @@ public:
}
bool has(const TKey &p_key) const {
return getptr(p_key) != NULL;
return getptr(p_key) != nullptr;
}
/**
@@ -292,14 +279,12 @@ public:
*/
const TData &get(const TKey &p_key) const {
const TData *res = getptr(p_key);
CRASH_COND_MSG(!res, "Map key not found.");
return *res;
}
TData &get(const TKey &p_key) {
TData *res = getptr(p_key);
CRASH_COND_MSG(!res, "Map key not found.");
return *res;
@@ -311,29 +296,31 @@ public:
*/
_FORCE_INLINE_ TData *getptr(const TKey &p_key) {
if (unlikely(!hash_table))
return NULL;
if (unlikely(!hash_table)) {
return nullptr;
}
Element *e = const_cast<Element *>(get_element(p_key));
if (e)
if (e) {
return &e->pair.data;
}
return NULL;
return nullptr;
}
_FORCE_INLINE_ const TData *getptr(const TKey &p_key) const {
if (unlikely(!hash_table))
return NULL;
if (unlikely(!hash_table)) {
return nullptr;
}
const Element *e = const_cast<Element *>(get_element(p_key));
if (e)
if (e) {
return &e->pair.data;
}
return NULL;
return nullptr;
}
/**
@@ -343,9 +330,9 @@ public:
template <class C>
_FORCE_INLINE_ TData *custom_getptr(C p_custom_key, uint32_t p_custom_hash) {
if (unlikely(!hash_table))
return NULL;
if (unlikely(!hash_table)) {
return nullptr;
}
uint32_t hash = p_custom_hash;
uint32_t index = hash & ((1 << hash_table_power) - 1);
@@ -353,10 +340,8 @@ public:
Element *e = hash_table[index];
while (e) {
/* checking hash first avoids comparing key, which may take longer */
if (e->hash == hash && Comparator::compare(e->pair.key, p_custom_key)) {
/* the pair exists in this hashtable, so just update data */
return &e->pair.data;
}
@@ -364,14 +349,14 @@ public:
e = e->next;
}
return NULL;
return nullptr;
}
template <class C>
_FORCE_INLINE_ const TData *custom_getptr(C p_custom_key, uint32_t p_custom_hash) const {
if (unlikely(!hash_table))
if (unlikely(!hash_table)) {
return NULL;
}
uint32_t hash = p_custom_hash;
uint32_t index = hash & ((1 << hash_table_power) - 1);
@@ -379,10 +364,8 @@ public:
const Element *e = hash_table[index];
while (e) {
/* checking hash first avoids comparing key, which may take longer */
if (e->hash == hash && Comparator::compare(e->pair.key, p_custom_key)) {
/* the pair exists in this hashtable, so just update data */
return &e->pair.data;
}
@@ -398,22 +381,19 @@ public:
*/
bool erase(const TKey &p_key) {
if (unlikely(!hash_table))
if (unlikely(!hash_table)) {
return false;
}
uint32_t hash = Hasher::hash(p_key);
uint32_t index = hash & ((1 << hash_table_power) - 1);
Element *e = hash_table[index];
Element *p = NULL;
Element *p = nullptr;
while (e) {
/* checking hash first avoids comparing key, which may take longer */
if (e->hash == hash && Comparator::compare(e->pair.key, p_key)) {
if (p) {
p->next = e->next;
} else {
//begin of list
@@ -423,10 +403,11 @@ public:
memdelete(e);
elements--;
if (elements == 0)
if (elements == 0) {
erase_hash_table();
else
} else {
check_hash_table();
}
return true;
}
@@ -443,15 +424,15 @@ public:
}
inline TData &operator[](const TKey &p_key) { //assignment
Element *e = NULL;
if (!hash_table)
Element *e = nullptr;
if (!hash_table) {
make_hash_table(); // if no table, make one
else
} else {
e = const_cast<Element *>(get_element(p_key));
}
/* if we made it up to here, the pair doesn't exist, create */
if (!e) {
e = create_element(p_key);
CRASH_COND(!e);
check_hash_table(); // perform mantenience routine
@@ -473,17 +454,16 @@ public:
*
* print( *k );
* }
*
*/
*
*/
const TKey *next(const TKey *p_key) const {
if (unlikely(!hash_table))
return NULL;
if (unlikely(!hash_table)) {
return nullptr;
}
if (!p_key) { /* get the first key */
for (int i = 0; i < (1 << hash_table_power); i++) {
if (hash_table[i]) {
return &hash_table[i]->pair.key;
}
@@ -492,7 +472,7 @@ public:
} else { /* get the next key */
const Element *e = get_element(*p_key);
ERR_FAIL_COND_V_MSG(!e, NULL, "Invalid key supplied.");
ERR_FAIL_COND_V_MSG(!e, nullptr, "Invalid key supplied.");
if (e->next) {
/* if there is a "next" in the list, return that */
return &e->next->pair.key;
@@ -501,7 +481,6 @@ public:
uint32_t index = e->hash & ((1 << hash_table_power) - 1);
index++;
for (int i = index; i < (1 << hash_table_power); i++) {
if (hash_table[i]) {
return &hash_table[i]->pair.key;
}
@@ -511,27 +490,22 @@ public:
/* nothing found, was at end */
}
return NULL; /* nothing found */
return nullptr; /* nothing found */
}
inline unsigned int size() const {
return elements;
}
inline bool empty() const {
return elements == 0;
}
void clear() {
/* clean up */
if (hash_table) {
for (int i = 0; i < (1 << hash_table_power); i++) {
while (hash_table[i]) {
Element *e = hash_table[i];
hash_table[i] = e->next;
memdelete(e);
@@ -541,27 +515,26 @@ public:
memdelete_arr(hash_table);
}
hash_table = 0;
hash_table = nullptr;
hash_table_power = 0;
elements = 0;
}
void operator=(const HashMap &p_table) {
copy_from(p_table);
}
HashMap() {
hash_table = NULL;
hash_table = nullptr;
elements = 0;
hash_table_power = 0;
}
void get_key_value_ptr_array(const Pair **p_pairs) const {
if (unlikely(!hash_table))
if (unlikely(!hash_table)) {
return;
}
for (int i = 0; i < (1 << hash_table_power); i++) {
Element *e = hash_table[i];
while (e) {
*p_pairs = &e->pair;
@@ -572,10 +545,10 @@ public:
}
void get_key_list(List<TKey> *p_keys) const {
if (unlikely(!hash_table))
if (unlikely(!hash_table)) {
return;
}
for (int i = 0; i < (1 << hash_table_power); i++) {
Element *e = hash_table[i];
while (e) {
p_keys->push_back(e->pair.key);
@@ -585,8 +558,7 @@ public:
}
HashMap(const HashMap &p_table) {
hash_table = NULL;
hash_table = nullptr;
elements = 0;
hash_table_power = 0;
@@ -594,7 +566,6 @@ public:
}
~HashMap() {
clear();
}
};

View File

@@ -48,29 +48,28 @@
* @return 32-bits hashcode
*/
static inline uint32_t hash_djb2(const char *p_cstr) {
const unsigned char *chr = (const unsigned char *)p_cstr;
uint32_t hash = 5381;
uint32_t c;
while ((c = *chr++))
while ((c = *chr++)) {
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
}
return hash;
}
static inline uint32_t hash_djb2_buffer(const uint8_t *p_buff, int p_len, uint32_t p_prev = 5381) {
uint32_t hash = p_prev;
for (int i = 0; i < p_len; i++)
for (int i = 0; i < p_len; i++) {
hash = ((hash << 5) + hash) + p_buff[i]; /* hash * 33 + c */
}
return hash;
}
static inline uint32_t hash_djb2_one_32(uint32_t p_in, uint32_t p_prev = 5381) {
return ((p_prev << 5) + p_prev) + p_in;
}
@@ -92,19 +91,19 @@ static inline uint32_t hash_djb2_one_float(double p_in, uint32_t p_prev = 5381)
} u;
// Normalize +/- 0.0 and NaN values so they hash the same.
if (p_in == 0.0f)
if (p_in == 0.0f) {
u.d = 0.0;
else if (Math::is_nan(p_in))
} else if (Math::is_nan(p_in)) {
u.d = Math_NAN;
else
} else {
u.d = p_in;
}
return ((p_prev << 5) + p_prev) + hash_one_uint64(u.i);
}
template <class T>
static inline uint32_t make_uint32_t(T p_in) {
union {
T t;
uint32_t _u32;
@@ -115,13 +114,11 @@ static inline uint32_t make_uint32_t(T p_in) {
}
static inline uint64_t hash_djb2_one_64(uint64_t p_in, uint64_t p_prev = 5381) {
return ((p_prev << 5) + p_prev) + p_in;
}
template <class T>
static inline uint64_t make_uint64_t(T p_in) {
union {
T t;
uint64_t _u64;
@@ -133,7 +130,6 @@ static inline uint64_t make_uint64_t(T p_in) {
}
struct HashMapHasherDefault {
static _FORCE_INLINE_ uint32_t hash(const String &p_string) { return p_string.hash(); }
static _FORCE_INLINE_ uint32_t hash(const char *p_cstr) { return hash_djb2(p_cstr); }
static _FORCE_INLINE_ uint32_t hash(const uint64_t p_int) { return hash_one_uint64(p_int); }

File diff suppressed because it is too large Load Diff

View File

@@ -42,7 +42,7 @@
* Image storage class. This is used to store an image in user memory, as well as
* providing some basic methods for image manipulation.
* Images can be loaded from a file, or registered into the Render object as textures.
*/
*/
class Image;
@@ -124,6 +124,7 @@ public:
COMPRESS_SOURCE_SRGB,
COMPRESS_SOURCE_NORMAL,
COMPRESS_SOURCE_LAYERED,
COMPRESS_SOURCE_MAX,
};
//some functions provided by something else
@@ -147,10 +148,11 @@ public:
static void (*_image_decompress_etc1)(Image *);
static void (*_image_decompress_etc2)(Image *);
static PoolVector<uint8_t> (*lossy_packer)(const Ref<Image> &p_image, float p_quality);
static Ref<Image> (*lossy_unpacker)(const PoolVector<uint8_t> &p_buffer);
static PoolVector<uint8_t> (*lossless_packer)(const Ref<Image> &p_image);
static Ref<Image> (*lossless_unpacker)(const PoolVector<uint8_t> &p_buffer);
static PoolVector<uint8_t> (*webp_lossy_packer)(const Ref<Image> &p_image, float p_quality);
static PoolVector<uint8_t> (*webp_lossless_packer)(const Ref<Image> &p_image);
static Ref<Image> (*webp_unpacker)(const PoolVector<uint8_t> &p_buffer);
static PoolVector<uint8_t> (*png_packer)(const Ref<Image> &p_image);
static Ref<Image> (*png_unpacker)(const PoolVector<uint8_t> &p_buffer);
PoolVector<uint8_t>::Write write_lock;
@@ -303,7 +305,8 @@ public:
COMPRESS_PVRTC4,
COMPRESS_ETC,
COMPRESS_ETC2,
COMPRESS_BPTC
COMPRESS_BPTC,
COMPRESS_MAX,
};
Error compress(CompressMode p_mode = COMPRESS_S3TC, CompressSource p_source = COMPRESS_SOURCE_GENERIC, float p_lossy_quality = 0.7);

View File

@@ -34,24 +34,24 @@
#include "core/os/keyboard.h"
#include "core/project_settings.h"
InputMap *InputMap::singleton = NULL;
InputMap *InputMap::singleton = nullptr;
int InputMap::ALL_DEVICES = -1;
void InputMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("has_action", "action"), &InputMap::has_action);
ClassDB::bind_method(D_METHOD("get_actions"), &InputMap::_get_actions);
ClassDB::bind_method(D_METHOD("add_action", "action", "deadzone"), &InputMap::add_action, DEFVAL(0.5f));
ClassDB::bind_method(D_METHOD("erase_action", "action"), &InputMap::erase_action);
ClassDB::bind_method(D_METHOD("action_set_deadzone", "action", "deadzone"), &InputMap::action_set_deadzone);
ClassDB::bind_method(D_METHOD("action_get_deadzone", "action"), &InputMap::action_get_deadzone);
ClassDB::bind_method(D_METHOD("action_add_event", "action", "event"), &InputMap::action_add_event);
ClassDB::bind_method(D_METHOD("action_has_event", "action", "event"), &InputMap::action_has_event);
ClassDB::bind_method(D_METHOD("action_erase_event", "action", "event"), &InputMap::action_erase_event);
ClassDB::bind_method(D_METHOD("action_erase_events", "action"), &InputMap::action_erase_events);
ClassDB::bind_method(D_METHOD("get_action_list", "action"), &InputMap::_get_action_list);
ClassDB::bind_method(D_METHOD("event_is_action", "event", "action"), &InputMap::event_is_action);
ClassDB::bind_method(D_METHOD("event_is_action", "event", "action", "exact_match"), &InputMap::event_is_action, DEFVAL(false));
ClassDB::bind_method(D_METHOD("load_from_globals"), &InputMap::load_from_globals);
}
@@ -59,8 +59,7 @@ void InputMap::_bind_methods() {
* Returns an nonexistent action error message with a suggestion of the closest
* matching action name (if possible).
*/
String InputMap::_suggest_actions(const StringName &p_action) const {
String InputMap::suggest_actions(const StringName &p_action) const {
List<StringName> actions = get_actions();
StringName closest_action;
float closest_similarity = 0.0;
@@ -85,7 +84,6 @@ String InputMap::_suggest_actions(const StringName &p_action) const {
}
void InputMap::add_action(const StringName &p_action, float p_deadzone) {
ERR_FAIL_COND_MSG(input_map.has(p_action), "InputMap already has action \"" + String(p_action) + "\".");
input_map[p_action] = Action();
static int last_id = 1;
@@ -95,21 +93,19 @@ void InputMap::add_action(const StringName &p_action, float p_deadzone) {
}
void InputMap::erase_action(const StringName &p_action) {
ERR_FAIL_COND_MSG(!input_map.has(p_action), _suggest_actions(p_action));
ERR_FAIL_COND_MSG(!input_map.has(p_action), suggest_actions(p_action));
input_map.erase(p_action);
}
Array InputMap::_get_actions() {
Array ret;
List<StringName> actions = get_actions();
if (actions.empty())
if (actions.empty()) {
return ret;
}
for (const List<StringName>::Element *E = actions.front(); E; E = E->next()) {
ret.push_back(E->get());
}
@@ -117,7 +113,6 @@ Array InputMap::_get_actions() {
}
List<StringName> InputMap::get_actions() const {
List<StringName> actions = List<StringName>();
if (input_map.empty()) {
return actions;
@@ -130,11 +125,10 @@ List<StringName> InputMap::get_actions() const {
return actions;
}
List<Ref<InputEvent> >::Element *InputMap::_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength) const {
ERR_FAIL_COND_V(!p_event.is_valid(), NULL);
for (List<Ref<InputEvent> >::Element *E = p_action.inputs.front(); E; E = E->next()) {
List<Ref<InputEvent>>::Element *InputMap::_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool p_exact_match, bool *p_pressed, float *p_strength, float *p_raw_strength) const {
ERR_FAIL_COND_V(!p_event.is_valid(), nullptr);
for (List<Ref<InputEvent>>::Element *E = p_action.inputs.front(); E; E = E->next()) {
const Ref<InputEvent> e = E->get();
//if (e.type != Ref<InputEvent>::KEY && e.device != p_event.device) -- unsure about the KEY comparison, why is this here?
@@ -142,50 +136,54 @@ List<Ref<InputEvent> >::Element *InputMap::_find_event(Action &p_action, const R
int device = e->get_device();
if (device == ALL_DEVICES || device == p_event->get_device()) {
if (e->action_match(p_event, p_pressed, p_strength, p_action.deadzone)) {
if (p_exact_match && e->shortcut_match(p_event)) {
return E;
} else if (!p_exact_match && e->action_match(p_event, p_pressed, p_strength, p_raw_strength, p_action.deadzone)) {
return E;
}
}
}
return NULL;
return nullptr;
}
bool InputMap::has_action(const StringName &p_action) const {
return input_map.has(p_action);
}
void InputMap::action_set_deadzone(const StringName &p_action, float p_deadzone) {
float InputMap::action_get_deadzone(const StringName &p_action) {
ERR_FAIL_COND_V_MSG(!input_map.has(p_action), 0.0f, suggest_actions(p_action));
ERR_FAIL_COND_MSG(!input_map.has(p_action), _suggest_actions(p_action));
return input_map[p_action].deadzone;
}
void InputMap::action_set_deadzone(const StringName &p_action, float p_deadzone) {
ERR_FAIL_COND_MSG(!input_map.has(p_action), suggest_actions(p_action));
input_map[p_action].deadzone = p_deadzone;
}
void InputMap::action_add_event(const StringName &p_action, const Ref<InputEvent> &p_event) {
ERR_FAIL_COND_MSG(p_event.is_null(), "It's not a reference to a valid InputEvent object.");
ERR_FAIL_COND_MSG(!input_map.has(p_action), _suggest_actions(p_action));
ERR_FAIL_COND_MSG(!input_map.has(p_action), suggest_actions(p_action));
if (_find_event(input_map[p_action], p_event))
return; //already gots
if (_find_event(input_map[p_action], p_event, true)) {
return; // Already added.
}
input_map[p_action].inputs.push_back(p_event);
}
bool InputMap::action_has_event(const StringName &p_action, const Ref<InputEvent> &p_event) {
ERR_FAIL_COND_V_MSG(!input_map.has(p_action), false, suggest_actions(p_action));
ERR_FAIL_COND_V_MSG(!input_map.has(p_action), false, _suggest_actions(p_action));
return (_find_event(input_map[p_action], p_event) != NULL);
return (_find_event(input_map[p_action], p_event, true) != nullptr);
}
void InputMap::action_erase_event(const StringName &p_action, const Ref<InputEvent> &p_event) {
ERR_FAIL_COND_MSG(!input_map.has(p_action), suggest_actions(p_action));
ERR_FAIL_COND_MSG(!input_map.has(p_action), _suggest_actions(p_action));
List<Ref<InputEvent> >::Element *E = _find_event(input_map[p_action], p_event);
List<Ref<InputEvent>>::Element *E = _find_event(input_map[p_action], p_event, true);
if (E) {
input_map[p_action].inputs.erase(E);
if (Input::get_singleton()->is_action_pressed(p_action)) {
@@ -195,19 +193,16 @@ void InputMap::action_erase_event(const StringName &p_action, const Ref<InputEve
}
void InputMap::action_erase_events(const StringName &p_action) {
ERR_FAIL_COND_MSG(!input_map.has(p_action), _suggest_actions(p_action));
ERR_FAIL_COND_MSG(!input_map.has(p_action), suggest_actions(p_action));
input_map[p_action].inputs.clear();
}
Array InputMap::_get_action_list(const StringName &p_action) {
Array ret;
const List<Ref<InputEvent> > *al = get_action_list(p_action);
const List<Ref<InputEvent>> *al = get_action_list(p_action);
if (al) {
for (const List<Ref<InputEvent> >::Element *E = al->front(); E; E = E->next()) {
for (const List<Ref<InputEvent>>::Element *E = al->front(); E; E = E->next()) {
ret.push_back(E->get());
}
}
@@ -215,40 +210,49 @@ Array InputMap::_get_action_list(const StringName &p_action) {
return ret;
}
const List<Ref<InputEvent> > *InputMap::get_action_list(const StringName &p_action) {
const List<Ref<InputEvent>> *InputMap::get_action_list(const StringName &p_action) {
const Map<StringName, Action>::Element *E = input_map.find(p_action);
if (!E)
return NULL;
if (!E) {
return nullptr;
}
return &E->get().inputs;
}
bool InputMap::event_is_action(const Ref<InputEvent> &p_event, const StringName &p_action) const {
return event_get_action_status(p_event, p_action);
bool InputMap::event_is_action(const Ref<InputEvent> &p_event, const StringName &p_action, bool p_exact_match) const {
return event_get_action_status(p_event, p_action, p_exact_match);
}
bool InputMap::event_get_action_status(const Ref<InputEvent> &p_event, const StringName &p_action, bool *p_pressed, float *p_strength) const {
bool InputMap::event_get_action_status(const Ref<InputEvent> &p_event, const StringName &p_action, bool p_exact_match, bool *p_pressed, float *p_strength, float *p_raw_strength) const {
Map<StringName, Action>::Element *E = input_map.find(p_action);
ERR_FAIL_COND_V_MSG(!E, false, _suggest_actions(p_action));
ERR_FAIL_COND_V_MSG(!E, false, suggest_actions(p_action));
Ref<InputEventAction> input_event_action = p_event;
if (input_event_action.is_valid()) {
if (p_pressed != NULL)
*p_pressed = input_event_action->is_pressed();
if (p_strength != NULL)
*p_strength = (p_pressed != NULL && *p_pressed) ? input_event_action->get_strength() : 0.0f;
bool pressed = input_event_action->is_pressed();
if (p_pressed != nullptr) {
*p_pressed = pressed;
}
if (p_strength != nullptr) {
*p_strength = pressed ? input_event_action->get_strength() : 0.0f;
}
return input_event_action->get_action() == p_action;
}
bool pressed;
float strength;
List<Ref<InputEvent> >::Element *event = _find_event(E->get(), p_event, &pressed, &strength);
if (event != NULL) {
if (p_pressed != NULL)
float raw_strength;
List<Ref<InputEvent>>::Element *event = _find_event(E->get(), p_event, p_exact_match, &pressed, &strength, &raw_strength);
if (event != nullptr) {
if (p_pressed != nullptr) {
*p_pressed = pressed;
if (p_strength != NULL)
}
if (p_strength != nullptr) {
*p_strength = strength;
}
if (p_raw_strength != nullptr) {
*p_raw_strength = raw_strength;
}
return true;
} else {
return false;
@@ -260,7 +264,6 @@ const Map<StringName, InputMap::Action> &InputMap::get_action_map() const {
}
void InputMap::load_from_globals() {
input_map.clear();
List<PropertyInfo> pinfo;
@@ -269,8 +272,9 @@ void InputMap::load_from_globals() {
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
const PropertyInfo &pi = E->get();
if (!pi.name.begins_with("input/"))
if (!pi.name.begins_with("input/")) {
continue;
}
String name = pi.name.substr(pi.name.find("/") + 1, pi.name.length());
@@ -281,15 +285,15 @@ void InputMap::load_from_globals() {
add_action(name, deadzone);
for (int i = 0; i < events.size(); i++) {
Ref<InputEvent> event = events[i];
if (event.is_null())
if (event.is_null()) {
continue;
}
action_add_event(name, event);
}
}
}
void InputMap::load_default() {
Ref<InputEventKey> key;
add_action("ui_accept");
@@ -368,7 +372,6 @@ void InputMap::load_default() {
}
InputMap::InputMap() {
ERR_FAIL_COND_MSG(singleton, "Singleton in InputMap already exist.");
singleton = this;
}

View File

@@ -35,19 +35,18 @@
#include "core/os/input_event.h"
class InputMap : public Object {
GDCLASS(InputMap, Object);
public:
/**
* A special value used to signify that a given Action can be triggered by any device
*/
* A special value used to signify that a given Action can be triggered by any device
*/
static int ALL_DEVICES;
struct Action {
int id;
float deadzone;
List<Ref<InputEvent> > inputs;
List<Ref<InputEvent>> inputs;
};
private:
@@ -55,11 +54,10 @@ private:
mutable Map<StringName, Action> input_map;
List<Ref<InputEvent> >::Element *_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool *p_pressed = NULL, float *p_strength = NULL) const;
List<Ref<InputEvent>>::Element *_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool p_exact_match = false, bool *p_pressed = nullptr, float *p_strength = nullptr, float *p_raw_strength = nullptr) const;
Array _get_action_list(const StringName &p_action);
Array _get_actions();
String _suggest_actions(const StringName &p_action) const;
protected:
static void _bind_methods();
@@ -72,20 +70,23 @@ public:
void add_action(const StringName &p_action, float p_deadzone = 0.5);
void erase_action(const StringName &p_action);
float action_get_deadzone(const StringName &p_action);
void action_set_deadzone(const StringName &p_action, float p_deadzone);
void action_add_event(const StringName &p_action, const Ref<InputEvent> &p_event);
bool action_has_event(const StringName &p_action, const Ref<InputEvent> &p_event);
void action_erase_event(const StringName &p_action, const Ref<InputEvent> &p_event);
void action_erase_events(const StringName &p_action);
const List<Ref<InputEvent> > *get_action_list(const StringName &p_action);
bool event_is_action(const Ref<InputEvent> &p_event, const StringName &p_action) const;
bool event_get_action_status(const Ref<InputEvent> &p_event, const StringName &p_action, bool *p_pressed = NULL, float *p_strength = NULL) const;
const List<Ref<InputEvent>> *get_action_list(const StringName &p_action);
bool event_is_action(const Ref<InputEvent> &p_event, const StringName &p_action, bool p_exact_match = false) const;
bool event_get_action_status(const Ref<InputEvent> &p_event, const StringName &p_action, bool p_exact_match = false, bool *p_pressed = nullptr, float *p_strength = nullptr, float *p_raw_strength = nullptr) const;
const Map<StringName, Action> &get_action_map() const;
void load_from_globals();
void load_default();
String suggest_actions(const StringName &p_action) const;
InputMap();
};

View File

@@ -31,7 +31,6 @@
#include "compression.h"
#include "core/io/zip_io.h"
#include "core/os/copymem.h"
#include "core/project_settings.h"
#include "thirdparty/misc/fastlz.h"
@@ -40,14 +39,12 @@
#include <zstd.h>
int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size, Mode p_mode) {
switch (p_mode) {
case MODE_FASTLZ: {
if (p_src_size < 16) {
uint8_t src[16];
zeromem(&src[p_src_size], 16 - p_src_size);
copymem(src, p_src, p_src_size);
memset(&src[p_src_size], 0, 16 - p_src_size);
memcpy(src, p_src, p_src_size);
return fastlz_compress(src, 16, p_dst);
} else {
return fastlz_compress(p_src, p_src_size, p_dst);
@@ -56,7 +53,6 @@ int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size,
} break;
case MODE_DEFLATE:
case MODE_GZIP: {
int window_bits = p_mode == MODE_DEFLATE ? 15 : 15 + 16;
z_stream strm;
@@ -65,8 +61,9 @@ int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size,
strm.opaque = Z_NULL;
int level = p_mode == MODE_DEFLATE ? zlib_level : gzip_level;
int err = deflateInit2(&strm, level, Z_DEFLATED, window_bits, 8, Z_DEFAULT_STRATEGY);
if (err != Z_OK)
if (err != Z_OK) {
return -1;
}
strm.avail_in = p_src_size;
int aout = deflateBound(&strm, p_src_size);
@@ -97,19 +94,17 @@ int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size,
}
int Compression::get_max_compressed_buffer_size(int p_src_size, Mode p_mode) {
switch (p_mode) {
case MODE_FASTLZ: {
int ss = p_src_size + p_src_size * 6 / 100;
if (ss < 66)
if (ss < 66) {
ss = 66;
}
return ss;
} break;
case MODE_DEFLATE:
case MODE_GZIP: {
int window_bits = p_mode == MODE_DEFLATE ? 15 : 15 + 16;
z_stream strm;
@@ -117,14 +112,14 @@ int Compression::get_max_compressed_buffer_size(int p_src_size, Mode p_mode) {
strm.zfree = zipio_free;
strm.opaque = Z_NULL;
int err = deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, window_bits, 8, Z_DEFAULT_STRATEGY);
if (err != Z_OK)
if (err != Z_OK) {
return -1;
}
int aout = deflateBound(&strm, p_src_size);
deflateEnd(&strm);
return aout;
} break;
case MODE_ZSTD: {
return ZSTD_compressBound(p_src_size);
} break;
}
@@ -133,16 +128,15 @@ int Compression::get_max_compressed_buffer_size(int p_src_size, Mode p_mode) {
}
int Compression::decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p_src, int p_src_size, Mode p_mode) {
switch (p_mode) {
case MODE_FASTLZ: {
int ret_size = 0;
if (p_dst_max_size < 16) {
uint8_t dst[16];
ret_size = fastlz_decompress(p_src, p_src_size, dst, 16);
copymem(p_dst, dst, p_dst_max_size);
fastlz_decompress(p_src, p_src_size, dst, 16);
memcpy(p_dst, dst, p_dst_max_size);
ret_size = p_dst_max_size;
} else {
ret_size = fastlz_decompress(p_src, p_src_size, p_dst, p_dst_max_size);
}
@@ -150,7 +144,6 @@ int Compression::decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p
} break;
case MODE_DEFLATE:
case MODE_GZIP: {
int window_bits = p_mode == MODE_DEFLATE ? 15 : 15 + 16;
z_stream strm;
@@ -187,8 +180,98 @@ int Compression::decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p
ERR_FAIL_V(-1);
}
/**
This will handle both Gzip and Deflat streams. It will automatically allocate the output buffer into the provided p_dst_vect Vector.
This is required for compressed data who's final uncompressed size is unknown, as is the case for HTTP response bodies.
This is much slower however than using Compression::decompress because it may result in multiple full copies of the output buffer.
*/
int Compression::decompress_dynamic(PoolVector<uint8_t> *p_dst, int p_max_dst_size, const uint8_t *p_src, int p_src_size, Mode p_mode) {
int ret;
uint8_t *dst = nullptr;
int out_mark = 0;
z_stream strm;
ERR_FAIL_COND_V(p_src_size <= 0, Z_DATA_ERROR);
// This function only supports GZip and Deflate
int window_bits = p_mode == MODE_DEFLATE ? 15 : 15 + 16;
ERR_FAIL_COND_V(p_mode != MODE_DEFLATE && p_mode != MODE_GZIP, Z_ERRNO);
// Initialize the stream
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
strm.avail_in = 0;
strm.next_in = Z_NULL;
int err = inflateInit2(&strm, window_bits);
ERR_FAIL_COND_V(err != Z_OK, -1);
// Setup the stream inputs
strm.next_in = (Bytef *)p_src;
strm.avail_in = p_src_size;
// Ensure the destination buffer is empty
p_dst->resize(0);
// decompress until deflate stream ends or end of file
do {
// Add another chunk size to the output buffer
// This forces a copy of the whole buffer
p_dst->resize(p_dst->size() + gzip_chunk);
// Get pointer to the actual output buffer
dst = p_dst->write().ptr();
// Set the stream to the new output stream
// Since it was copied, we need to reset the stream to the new buffer
strm.next_out = &(dst[out_mark]);
strm.avail_out = gzip_chunk;
// run inflate() on input until output buffer is full and needs to be resized
// or input runs out
do {
ret = inflate(&strm, Z_SYNC_FLUSH);
switch (ret) {
case Z_NEED_DICT:
ret = Z_DATA_ERROR;
FALLTHROUGH;
case Z_DATA_ERROR:
case Z_MEM_ERROR:
case Z_STREAM_ERROR:
case Z_BUF_ERROR:
if (strm.msg) {
WARN_PRINT(strm.msg);
}
(void)inflateEnd(&strm);
p_dst->resize(0);
return ret;
}
} while (strm.avail_out > 0 && strm.avail_in > 0);
out_mark += gzip_chunk;
// Encorce max output size
if (p_max_dst_size > -1 && strm.total_out > (uint64_t)p_max_dst_size) {
(void)inflateEnd(&strm);
p_dst->resize(0);
return Z_BUF_ERROR;
}
} while (ret != Z_STREAM_END);
// If all done successfully, resize the output if it's larger than the actual output
if (ret == Z_STREAM_END && (unsigned long)p_dst->size() > strm.total_out) {
p_dst->resize(strm.total_out);
}
// clean up and return
(void)inflateEnd(&strm);
return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
}
int Compression::zlib_level = Z_DEFAULT_COMPRESSION;
int Compression::gzip_level = Z_DEFAULT_COMPRESSION;
int Compression::zstd_level = 3;
bool Compression::zstd_long_distance_matching = false;
int Compression::zstd_window_log_size = 27; // ZSTD_WINDOWLOG_LIMIT_DEFAULT
int Compression::gzip_chunk = 16384;

View File

@@ -31,16 +31,17 @@
#ifndef COMPRESSION_H
#define COMPRESSION_H
#include "core/pool_vector.h"
#include "core/typedefs.h"
class Compression {
public:
static int zlib_level;
static int gzip_level;
static int zstd_level;
static bool zstd_long_distance_matching;
static int zstd_window_log_size;
static int gzip_chunk;
enum Mode {
MODE_FASTLZ,
@@ -52,6 +53,7 @@ public:
static int compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size, Mode p_mode = MODE_ZSTD);
static int get_max_compressed_buffer_size(int p_src_size, Mode p_mode = MODE_ZSTD);
static int decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p_src, int p_src_size, Mode p_mode = MODE_ZSTD);
static int decompress_dynamic(PoolVector<uint8_t> *p_dst, int p_max_dst_size, const uint8_t *p_src, int p_src_size, Mode p_mode);
Compression();
};

View File

@@ -35,14 +35,12 @@
#include "core/variant_parser.h"
PoolStringArray ConfigFile::_get_sections() const {
List<String> s;
get_sections(&s);
PoolStringArray arr;
arr.resize(s.size());
int idx = 0;
for (const List<String>::Element *E = s.front(); E; E = E->next()) {
arr.set(idx++, E->get());
}
@@ -50,14 +48,12 @@ PoolStringArray ConfigFile::_get_sections() const {
}
PoolStringArray ConfigFile::_get_section_keys(const String &p_section) const {
List<String> s;
get_section_keys(p_section, &s);
PoolStringArray arr;
arr.resize(s.size());
int idx = 0;
for (const List<String>::Element *E = s.front(); E; E = E->next()) {
arr.set(idx++, E->get());
}
@@ -65,11 +61,11 @@ PoolStringArray ConfigFile::_get_section_keys(const String &p_section) const {
}
void ConfigFile::set_value(const String &p_section, const String &p_key, const Variant &p_value) {
if (p_value.get_type() == Variant::NIL) {
//erase
if (!values.has(p_section))
if (!values.has(p_section)) {
return; // ?
}
values[p_section].erase(p_key);
if (values[p_section].empty()) {
values.erase(p_section);
@@ -84,7 +80,6 @@ void ConfigFile::set_value(const String &p_section, const String &p_key, const V
}
}
Variant ConfigFile::get_value(const String &p_section, const String &p_key, Variant p_default) const {
if (!values.has(p_section) || !values[p_section].has(p_key)) {
ERR_FAIL_COND_V_MSG(p_default.get_type() == Variant::NIL, Variant(),
vformat("Couldn't find the given section \"%s\" and key \"%s\", and no default was given.", p_section, p_key));
@@ -94,24 +89,21 @@ Variant ConfigFile::get_value(const String &p_section, const String &p_key, Vari
}
bool ConfigFile::has_section(const String &p_section) const {
return values.has(p_section);
}
bool ConfigFile::has_section_key(const String &p_section, const String &p_key) const {
if (!values.has(p_section))
if (!values.has(p_section)) {
return false;
}
return values[p_section].has(p_key);
}
void ConfigFile::get_sections(List<String> *r_sections) const {
for (OrderedHashMap<String, OrderedHashMap<String, Variant> >::ConstElement E = values.front(); E; E = E.next()) {
for (OrderedHashMap<String, OrderedHashMap<String, Variant>>::ConstElement E = values.front(); E; E = E.next()) {
r_sections->push_back(E.key());
}
}
void ConfigFile::get_section_keys(const String &p_section, List<String> *r_keys) const {
ERR_FAIL_COND_MSG(!values.has(p_section), vformat("Cannot get keys from nonexistent section \"%s\".", p_section));
for (OrderedHashMap<String, Variant>::ConstElement E = values[p_section].front(); E; E = E.next()) {
@@ -120,13 +112,11 @@ void ConfigFile::get_section_keys(const String &p_section, List<String> *r_keys)
}
void ConfigFile::erase_section(const String &p_section) {
ERR_FAIL_COND_MSG(!values.has(p_section), vformat("Cannot erase nonexistent section \"%s\".", p_section));
values.erase(p_section);
}
void ConfigFile::erase_section_key(const String &p_section, const String &p_key) {
ERR_FAIL_COND_MSG(!values.has(p_section), vformat("Cannot erase key \"%s\" from nonexistent section \"%s\".", p_key, p_section));
ERR_FAIL_COND_MSG(!values[p_section].has(p_key), vformat("Cannot erase nonexistent key \"%s\" from section \"%s\".", p_key, p_section));
@@ -134,13 +124,13 @@ void ConfigFile::erase_section_key(const String &p_section, const String &p_key)
}
Error ConfigFile::save(const String &p_path) {
Error err;
FileAccess *file = FileAccess::open(p_path, FileAccess::WRITE, &err);
if (err) {
if (file)
if (file) {
memdelete(file);
}
return err;
}
@@ -148,12 +138,12 @@ Error ConfigFile::save(const String &p_path) {
}
Error ConfigFile::save_encrypted(const String &p_path, const Vector<uint8_t> &p_key) {
Error err;
FileAccess *f = FileAccess::open(p_path, FileAccess::WRITE, &err);
if (err)
if (err) {
return err;
}
FileAccessEncrypted *fae = memnew(FileAccessEncrypted);
err = fae->open_and_parse(f, p_key, FileAccessEncrypted::MODE_WRITE_AES256);
@@ -166,12 +156,12 @@ Error ConfigFile::save_encrypted(const String &p_path, const Vector<uint8_t> &p_
}
Error ConfigFile::save_encrypted_pass(const String &p_path, const String &p_pass) {
Error err;
FileAccess *f = FileAccess::open(p_path, FileAccess::WRITE, &err);
if (err)
if (err) {
return err;
}
FileAccessEncrypted *fae = memnew(FileAccessEncrypted);
err = fae->open_and_parse_password(f, p_pass, FileAccessEncrypted::MODE_WRITE_AES256);
@@ -185,18 +175,16 @@ Error ConfigFile::save_encrypted_pass(const String &p_path, const String &p_pass
}
Error ConfigFile::_internal_save(FileAccess *file) {
for (OrderedHashMap<String, OrderedHashMap<String, Variant> >::Element E = values.front(); E; E = E.next()) {
if (E != values.front())
for (OrderedHashMap<String, OrderedHashMap<String, Variant>>::Element E = values.front(); E; E = E.next()) {
if (E != values.front()) {
file->store_string("\n");
}
file->store_string("[" + E.key() + "]\n\n");
for (OrderedHashMap<String, Variant>::Element F = E.get().front(); F; F = F.next()) {
String vstr;
VariantWriter::write_to_string(F.get(), vstr);
file->store_string(F.key() + "=" + vstr + "\n");
file->store_string(F.key().property_name_encode() + "=" + vstr + "\n");
}
}
@@ -206,23 +194,23 @@ Error ConfigFile::_internal_save(FileAccess *file) {
}
Error ConfigFile::load(const String &p_path) {
Error err;
FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
if (!f)
if (!f) {
return err;
}
return _internal_load(p_path, f);
}
Error ConfigFile::load_encrypted(const String &p_path, const Vector<uint8_t> &p_key) {
Error err;
FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
if (err)
if (err) {
return err;
}
FileAccessEncrypted *fae = memnew(FileAccessEncrypted);
err = fae->open_and_parse(f, p_key, FileAccessEncrypted::MODE_READ);
@@ -235,12 +223,12 @@ Error ConfigFile::load_encrypted(const String &p_path, const Vector<uint8_t> &p_
}
Error ConfigFile::load_encrypted_pass(const String &p_path, const String &p_pass) {
Error err;
FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
if (err)
if (err) {
return err;
}
FileAccessEncrypted *fae = memnew(FileAccessEncrypted);
err = fae->open_and_parse_password(f, p_pass, FileAccessEncrypted::MODE_READ);
@@ -254,7 +242,6 @@ Error ConfigFile::load_encrypted_pass(const String &p_path, const String &p_pass
}
Error ConfigFile::_internal_load(const String &p_path, FileAccess *f) {
VariantParser::StreamFile stream;
stream.f = f;
@@ -266,14 +253,12 @@ Error ConfigFile::_internal_load(const String &p_path, FileAccess *f) {
}
Error ConfigFile::parse(const String &p_data) {
VariantParser::StreamString stream;
stream.s = p_data;
return _parse("<string>", &stream);
}
Error ConfigFile::_parse(const String &p_path, VariantParser::Stream *p_stream) {
String assign;
Variant value;
VariantParser::Tag next_tag;
@@ -284,12 +269,11 @@ Error ConfigFile::_parse(const String &p_path, VariantParser::Stream *p_stream)
String section;
while (true) {
assign = Variant();
next_tag.fields.clear();
next_tag.name = String();
Error err = VariantParser::parse_tag_assign_eof(p_stream, lines, error_text, next_tag, assign, value, NULL, true);
Error err = VariantParser::parse_tag_assign_eof(p_stream, lines, error_text, next_tag, assign, value, nullptr, true);
if (err == ERR_FILE_EOF) {
return OK;
} else if (err != OK) {
@@ -311,7 +295,6 @@ void ConfigFile::clear() {
values.clear();
}
void ConfigFile::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_value", "section", "key", "value"), &ConfigFile::set_value);
ClassDB::bind_method(D_METHOD("get_value", "section", "key", "default"), &ConfigFile::get_value, DEFVAL(Variant()));

View File

@@ -37,10 +37,9 @@
#include "core/variant_parser.h"
class ConfigFile : public Reference {
GDCLASS(ConfigFile, Reference);
OrderedHashMap<String, OrderedHashMap<String, Variant> > values;
OrderedHashMap<String, OrderedHashMap<String, Variant>> values;
PoolStringArray _get_sections() const;
PoolStringArray _get_section_keys(const String &p_section) const;

View File

@@ -32,15 +32,14 @@
#include "core/os/file_access.h"
#include "core/project_settings.h"
DTLSServer *(*DTLSServer::_create)() = NULL;
DTLSServer *(*DTLSServer::_create)() = nullptr;
bool DTLSServer::available = false;
DTLSServer *DTLSServer::create() {
if (_create) {
return _create();
}
return NULL;
return nullptr;
}
bool DTLSServer::is_available() {
@@ -48,7 +47,6 @@ bool DTLSServer::is_available() {
}
void DTLSServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("setup", "key", "certificate", "chain"), &DTLSServer::setup, DEFVAL(Ref<X509Certificate>()));
ClassDB::bind_method(D_METHOD("take_connection", "udp_peer"), &DTLSServer::take_connection);
}

View File

@@ -32,14 +32,14 @@
#include "core/print_string.h"
void FileAccessCompressed::configure(const String &p_magic, Compression::Mode p_mode, int p_block_size) {
void FileAccessCompressed::configure(const String &p_magic, Compression::Mode p_mode, uint32_t p_block_size) {
magic = p_magic.ascii().get_data();
if (magic.length() > 4)
if (magic.length() > 4) {
magic = magic.substr(0, 4);
else {
while (magic.length() < 4)
} else {
while (magic.length() < 4) {
magic += " ";
}
}
cmode = p_mode;
@@ -59,20 +59,18 @@ void FileAccessCompressed::configure(const String &p_magic, Compression::Mode p_
}
Error FileAccessCompressed::open_after_magic(FileAccess *p_base) {
f = p_base;
cmode = (Compression::Mode)f->get_32();
block_size = f->get_32();
if (block_size == 0) {
f = NULL; // Let the caller to handle the FileAccess object if failed to open as compressed file.
f = nullptr; // Let the caller to handle the FileAccess object if failed to open as compressed file.
ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Can't open compressed file '" + p_base->get_path() + "' with block size 0, it is corrupted.");
}
read_total = f->get_32();
int bc = (read_total / block_size) + 1;
int acc_ofs = f->get_position() + bc * 4;
int max_bs = 0;
for (int i = 0; i < bc; i++) {
uint32_t bc = (read_total / block_size) + 1;
uint64_t acc_ofs = f->get_position() + bc * 4;
uint32_t max_bs = 0;
for (uint32_t i = 0; i < bc; i++) {
ReadBlock rb;
rb.offset = acc_ofs;
rb.csize = f->get_32();
@@ -98,23 +96,22 @@ Error FileAccessCompressed::open_after_magic(FileAccess *p_base) {
}
Error FileAccessCompressed::_open(const String &p_path, int p_mode_flags) {
ERR_FAIL_COND_V(p_mode_flags == READ_WRITE, ERR_UNAVAILABLE);
if (f)
if (f) {
close();
}
Error err;
f = FileAccess::open(p_path, p_mode_flags, &err);
if (err != OK) {
//not openable
f = NULL;
f = nullptr;
return err;
}
if (p_mode_flags & WRITE) {
buffer.clear();
writing = true;
write_pos = 0;
@@ -125,13 +122,12 @@ Error FileAccessCompressed::_open(const String &p_path, int p_mode_flags) {
//don't store anything else unless it's done saving!
} else {
char rmagic[5];
f->get_buffer((uint8_t *)rmagic, 4);
rmagic[4] = 0;
if (magic != rmagic || open_after_magic(f) != OK) {
memdelete(f);
f = NULL;
f = nullptr;
return ERR_FILE_UNRECOGNIZED;
}
}
@@ -139,9 +135,9 @@ Error FileAccessCompressed::_open(const String &p_path, int p_mode_flags) {
return OK;
}
void FileAccessCompressed::close() {
if (!f)
if (!f) {
return;
}
if (writing) {
//save block table and all compressed blocks
@@ -151,16 +147,15 @@ void FileAccessCompressed::close() {
f->store_32(cmode); //write compression mode 4
f->store_32(block_size); //write block size 4
f->store_32(write_max); //max amount of data written 4
int bc = (write_max / block_size) + 1;
uint32_t bc = (write_max / block_size) + 1;
for (int i = 0; i < bc; i++) {
for (uint32_t i = 0; i < bc; i++) {
f->store_32(0); //compressed sizes, will update later
}
Vector<int> block_sizes;
for (int i = 0; i < bc; i++) {
int bl = i == (bc - 1) ? write_max % block_size : block_size;
for (uint32_t i = 0; i < bc; i++) {
uint32_t bl = i == (bc - 1) ? write_max % block_size : block_size;
uint8_t *bp = &write_ptr[i * block_size];
Vector<uint8_t> cblock;
@@ -172,49 +167,45 @@ void FileAccessCompressed::close() {
}
f->seek(16); //ok write block sizes
for (int i = 0; i < bc; i++)
for (uint32_t i = 0; i < bc; i++) {
f->store_32(block_sizes[i]);
}
f->seek_end();
f->store_buffer((const uint8_t *)mgc.get_data(), mgc.length()); //magic at the end too
buffer.clear();
} else {
comp_buffer.clear();
buffer.clear();
read_blocks.clear();
}
memdelete(f);
f = NULL;
f = nullptr;
}
bool FileAccessCompressed::is_open() const {
return f != NULL;
return f != nullptr;
}
void FileAccessCompressed::seek(size_t p_position) {
void FileAccessCompressed::seek(uint64_t p_position) {
ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
if (writing) {
if (writing) {
ERR_FAIL_COND(p_position > write_max);
write_pos = p_position;
} else {
ERR_FAIL_COND(p_position > read_total);
if (p_position == read_total) {
at_end = true;
} else {
at_end = false;
read_eof = false;
int block_idx = p_position / block_size;
uint32_t block_idx = p_position / block_size;
if (block_idx != read_block) {
read_block = block_idx;
f->seek(read_blocks[read_block].offset);
f->get_buffer(comp_buffer.ptrw(), read_blocks[read_block].csize);
@@ -228,32 +219,26 @@ void FileAccessCompressed::seek(size_t p_position) {
}
void FileAccessCompressed::seek_end(int64_t p_position) {
ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
if (writing) {
seek(write_max + p_position);
} else {
seek(read_total + p_position);
}
}
size_t FileAccessCompressed::get_position() const {
uint64_t FileAccessCompressed::get_position() const {
ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use.");
if (writing) {
return write_pos;
} else {
return read_block * block_size + read_pos;
}
}
size_t FileAccessCompressed::get_len() const {
uint64_t FileAccessCompressed::get_len() const {
ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use.");
if (writing) {
return write_max;
} else {
return read_total;
@@ -261,7 +246,6 @@ size_t FileAccessCompressed::get_len() const {
}
bool FileAccessCompressed::eof_reached() const {
ERR_FAIL_COND_V_MSG(!f, false, "File must be opened before use.");
if (writing) {
return false;
@@ -271,7 +255,6 @@ bool FileAccessCompressed::eof_reached() const {
}
uint8_t FileAccessCompressed::get_8() const {
ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use.");
ERR_FAIL_COND_V_MSG(writing, 0, "File has not been opened in read mode.");
@@ -301,9 +284,9 @@ uint8_t FileAccessCompressed::get_8() const {
return ret;
}
int FileAccessCompressed::get_buffer(uint8_t *p_dst, int p_length) const {
uint64_t FileAccessCompressed::get_buffer(uint8_t *p_dst, uint64_t p_length) const {
ERR_FAIL_COND_V(!p_dst && p_length > 0, -1);
ERR_FAIL_COND_V(p_length < 0, -1);
ERR_FAIL_COND_V_MSG(!f, -1, "File must be opened before use.");
ERR_FAIL_COND_V_MSG(writing, -1, "File has not been opened in read mode.");
@@ -312,8 +295,7 @@ int FileAccessCompressed::get_buffer(uint8_t *p_dst, int p_length) const {
return 0;
}
for (int i = 0; i < p_length; i++) {
for (uint64_t i = 0; i < p_length; i++) {
p_dst[i] = read_ptr[read_pos];
read_pos++;
if (read_pos >= read_block_size) {
@@ -329,8 +311,9 @@ int FileAccessCompressed::get_buffer(uint8_t *p_dst, int p_length) const {
} else {
read_block--;
at_end = true;
if (i < p_length - 1)
if (i < p_length - 1) {
read_eof = true;
}
return i;
}
}
@@ -340,7 +323,6 @@ int FileAccessCompressed::get_buffer(uint8_t *p_dst, int p_length) const {
}
Error FileAccessCompressed::get_error() const {
return read_eof ? ERR_FILE_EOF : OK;
}
@@ -352,7 +334,6 @@ void FileAccessCompressed::flush() {
}
void FileAccessCompressed::store_8(uint8_t p_dest) {
ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
ERR_FAIL_COND_MSG(!writing, "File has not been opened in write mode.");
@@ -361,25 +342,26 @@ void FileAccessCompressed::store_8(uint8_t p_dest) {
}
bool FileAccessCompressed::file_exists(const String &p_name) {
FileAccess *fa = FileAccess::open(p_name, FileAccess::READ);
if (!fa)
if (!fa) {
return false;
}
memdelete(fa);
return true;
}
uint64_t FileAccessCompressed::_get_modified_time(const String &p_file) {
if (f)
if (f) {
return f->get_modified_time(p_file);
else
} else {
return 0;
}
}
uint32_t FileAccessCompressed::_get_unix_permissions(const String &p_file) {
if (f)
if (f) {
return f->_get_unix_permissions(p_file);
}
return 0;
}
@@ -393,24 +375,24 @@ Error FileAccessCompressed::_set_unix_permissions(const String &p_file, uint32_t
FileAccessCompressed::FileAccessCompressed() :
cmode(Compression::MODE_ZSTD),
writing(false),
write_ptr(0),
write_ptr(nullptr),
write_buffer_size(0),
write_max(0),
block_size(0),
read_eof(false),
at_end(false),
read_ptr(NULL),
read_ptr(nullptr),
read_block(0),
read_block_count(0),
read_block_size(0),
read_pos(0),
read_total(0),
magic("GCMP"),
f(NULL) {
f(nullptr) {
}
FileAccessCompressed::~FileAccessCompressed() {
if (f)
if (f) {
close();
}
}

View File

@@ -35,37 +35,36 @@
#include "core/os/file_access.h"
class FileAccessCompressed : public FileAccess {
Compression::Mode cmode;
bool writing;
uint32_t write_pos;
uint64_t write_pos;
uint8_t *write_ptr;
uint32_t write_buffer_size;
uint32_t write_max;
uint64_t write_max;
uint32_t block_size;
mutable bool read_eof;
mutable bool at_end;
struct ReadBlock {
int csize;
int offset;
uint32_t csize;
uint64_t offset;
};
mutable Vector<uint8_t> comp_buffer;
uint8_t *read_ptr;
mutable int read_block;
int read_block_count;
mutable int read_block_size;
mutable int read_pos;
mutable uint32_t read_block;
uint32_t read_block_count;
mutable uint32_t read_block_size;
mutable uint64_t read_pos;
Vector<ReadBlock> read_blocks;
uint32_t read_total;
uint64_t read_total;
String magic;
mutable Vector<uint8_t> buffer;
FileAccess *f;
public:
void configure(const String &p_magic, Compression::Mode p_mode = Compression::MODE_ZSTD, int p_block_size = 4096);
void configure(const String &p_magic, Compression::Mode p_mode = Compression::MODE_ZSTD, uint32_t p_block_size = 4096);
Error open_after_magic(FileAccess *p_base);
@@ -73,15 +72,15 @@ public:
virtual void close(); ///< close a file
virtual bool is_open() const; ///< true when file is open
virtual void seek(size_t p_position); ///< seek to a given position
virtual void seek(uint64_t p_position); ///< seek to a given position
virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file
virtual size_t get_position() const; ///< get position in the file
virtual size_t get_len() const; ///< get size of the file
virtual uint64_t get_position() const; ///< get position in the file
virtual uint64_t get_len() const; ///< get size of the file
virtual bool eof_reached() const; ///< reading passed EOF
virtual uint8_t get_8() const; ///< get a byte
virtual int get_buffer(uint8_t *p_dst, int p_length) const;
virtual uint64_t get_buffer(uint8_t *p_dst, uint64_t p_length) const;
virtual Error get_error() const; ///< get last error

View File

@@ -31,7 +31,6 @@
#include "file_access_encrypted.h"
#include "core/crypto/crypto_core.h"
#include "core/os/copymem.h"
#include "core/print_string.h"
#include "core/variant.h"
@@ -40,15 +39,13 @@
#define COMP_MAGIC 0x43454447
Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8_t> &p_key, Mode p_mode) {
ERR_FAIL_COND_V_MSG(file != NULL, ERR_ALREADY_IN_USE, "Can't open file while another file from path '" + file->get_path_absolute() + "' is open.");
ERR_FAIL_COND_V_MSG(file != nullptr, ERR_ALREADY_IN_USE, "Can't open file while another file from path '" + file->get_path_absolute() + "' is open.");
ERR_FAIL_COND_V(p_key.size() != 32, ERR_INVALID_PARAMETER);
pos = 0;
eofed = false;
if (p_mode == MODE_WRITE_AES256) {
data.clear();
writing = true;
file = p_base;
@@ -56,7 +53,6 @@ Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8
key = p_key;
} else if (p_mode == MODE_READ) {
writing = false;
key = p_key;
uint32_t magic = p_base->get_32();
@@ -71,21 +67,20 @@ Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8
length = p_base->get_64();
base = p_base->get_position();
ERR_FAIL_COND_V(p_base->get_len() < base + length, ERR_FILE_CORRUPT);
uint32_t ds = length;
uint64_t ds = length;
if (ds % 16) {
ds += 16 - (ds % 16);
}
data.resize(ds);
uint32_t blen = p_base->get_buffer(data.ptrw(), ds);
uint64_t blen = p_base->get_buffer(data.ptrw(), ds);
ERR_FAIL_COND_V(blen != ds, ERR_FILE_CORRUPT);
CryptoCore::AESContext ctx;
ctx.set_decode_key(key.ptrw(), 256);
for (size_t i = 0; i < ds; i += 16) {
for (uint64_t i = 0; i < ds; i += 16) {
ctx.decrypt_ecb(&data.write[i], &data.write[i]);
}
@@ -103,13 +98,11 @@ Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8
}
Error FileAccessEncrypted::open_and_parse_password(FileAccess *p_base, const String &p_key, Mode p_mode) {
String cs = p_key.md5_text();
ERR_FAIL_COND_V(cs.length() != 32, ERR_INVALID_PARAMETER);
Vector<uint8_t> key;
key.resize(32);
for (int i = 0; i < 32; i++) {
key.write[i] = cs[i];
}
@@ -117,18 +110,16 @@ Error FileAccessEncrypted::open_and_parse_password(FileAccess *p_base, const Str
}
Error FileAccessEncrypted::_open(const String &p_path, int p_mode_flags) {
return OK;
}
void FileAccessEncrypted::close() {
if (!file)
if (!file) {
return;
}
if (writing) {
Vector<uint8_t> compressed;
size_t len = data.size();
uint64_t len = data.size();
if (len % 16) {
len += 16 - (len % 16);
}
@@ -137,7 +128,7 @@ void FileAccessEncrypted::close() {
ERR_FAIL_COND(CryptoCore::md5(data.ptr(), data.size(), hash) != OK); // Bug?
compressed.resize(len);
zeromem(compressed.ptrw(), len);
memset(compressed.ptrw(), 0, len);
for (int i = 0; i < data.size(); i++) {
compressed.write[i] = data[i];
}
@@ -145,8 +136,7 @@ void FileAccessEncrypted::close() {
CryptoCore::AESContext ctx;
ctx.set_encode_key(key.ptrw(), 256);
for (size_t i = 0; i < len; i += 16) {
for (uint64_t i = 0; i < len; i += 16) {
ctx.encrypt_ecb(&compressed.write[i], &compressed.write[i]);
}
@@ -159,70 +149,65 @@ void FileAccessEncrypted::close() {
file->store_buffer(compressed.ptr(), compressed.size());
file->close();
memdelete(file);
file = NULL;
file = nullptr;
data.clear();
} else {
file->close();
memdelete(file);
data.clear();
file = NULL;
file = nullptr;
}
}
bool FileAccessEncrypted::is_open() const {
return file != NULL;
return file != nullptr;
}
String FileAccessEncrypted::get_path() const {
if (file)
if (file) {
return file->get_path();
else
} else {
return "";
}
}
String FileAccessEncrypted::get_path_absolute() const {
if (file)
if (file) {
return file->get_path_absolute();
else
} else {
return "";
}
}
void FileAccessEncrypted::seek(size_t p_position) {
if (p_position > (size_t)data.size())
p_position = data.size();
void FileAccessEncrypted::seek(uint64_t p_position) {
if (p_position > get_len()) {
p_position = get_len();
}
pos = p_position;
eofed = false;
}
void FileAccessEncrypted::seek_end(int64_t p_position) {
seek(data.size() + p_position);
seek(get_len() + p_position);
}
size_t FileAccessEncrypted::get_position() const {
uint64_t FileAccessEncrypted::get_position() const {
return pos;
}
size_t FileAccessEncrypted::get_len() const {
uint64_t FileAccessEncrypted::get_len() const {
return data.size();
}
bool FileAccessEncrypted::eof_reached() const {
return eofed;
}
uint8_t FileAccessEncrypted::get_8() const {
ERR_FAIL_COND_V_MSG(writing, 0, "File has not been opened in read mode.");
if (pos >= data.size()) {
if (pos >= get_len()) {
eofed = true;
return 0;
}
@@ -232,14 +217,12 @@ uint8_t FileAccessEncrypted::get_8() const {
return b;
}
int FileAccessEncrypted::get_buffer(uint8_t *p_dst, int p_length) const {
uint64_t FileAccessEncrypted::get_buffer(uint8_t *p_dst, uint64_t p_length) const {
ERR_FAIL_COND_V(!p_dst && p_length > 0, -1);
ERR_FAIL_COND_V(p_length < 0, -1);
ERR_FAIL_COND_V_MSG(writing, -1, "File has not been opened in read mode.");
int to_copy = MIN(p_length, data.size() - pos);
for (int i = 0; i < to_copy; i++) {
uint64_t to_copy = MIN(p_length, get_len() - pos);
for (uint64_t i = 0; i < to_copy; i++) {
p_dst[i] = data[pos++];
}
@@ -251,25 +234,20 @@ int FileAccessEncrypted::get_buffer(uint8_t *p_dst, int p_length) const {
}
Error FileAccessEncrypted::get_error() const {
return eofed ? ERR_FILE_EOF : OK;
}
void FileAccessEncrypted::store_buffer(const uint8_t *p_src, int p_length) {
void FileAccessEncrypted::store_buffer(const uint8_t *p_src, uint64_t p_length) {
ERR_FAIL_COND_MSG(!writing, "File has not been opened in write mode.");
ERR_FAIL_COND(!p_src && p_length > 0);
if (pos < data.size()) {
for (int i = 0; i < p_length; i++) {
if (pos < get_len()) {
for (uint64_t i = 0; i < p_length; i++) {
store_8(p_src[i]);
}
} else if (pos == data.size()) {
} else if (pos == get_len()) {
data.resize(pos + p_length);
for (int i = 0; i < p_length; i++) {
for (uint64_t i = 0; i < p_length; i++) {
data.write[pos + i] = p_src[i];
}
pos += p_length;
@@ -283,34 +261,31 @@ void FileAccessEncrypted::flush() {
}
void FileAccessEncrypted::store_8(uint8_t p_dest) {
ERR_FAIL_COND_MSG(!writing, "File has not been opened in write mode.");
if (pos < data.size()) {
if (pos < get_len()) {
data.write[pos] = p_dest;
pos++;
} else if (pos == data.size()) {
} else if (pos == get_len()) {
data.push_back(p_dest);
pos++;
}
}
bool FileAccessEncrypted::file_exists(const String &p_name) {
FileAccess *fa = FileAccess::open(p_name, FileAccess::READ);
if (!fa)
if (!fa) {
return false;
}
memdelete(fa);
return true;
}
uint64_t FileAccessEncrypted::_get_modified_time(const String &p_file) {
return 0;
}
uint32_t FileAccessEncrypted::_get_unix_permissions(const String &p_file) {
return 0;
}
@@ -320,8 +295,7 @@ Error FileAccessEncrypted::_set_unix_permissions(const String &p_file, uint32_t
}
FileAccessEncrypted::FileAccessEncrypted() {
file = NULL;
file = nullptr;
pos = 0;
eofed = false;
mode = MODE_MAX;
@@ -329,7 +303,7 @@ FileAccessEncrypted::FileAccessEncrypted() {
}
FileAccessEncrypted::~FileAccessEncrypted() {
if (file)
if (file) {
close();
}
}

View File

@@ -46,10 +46,10 @@ private:
Vector<uint8_t> key;
bool writing;
FileAccess *file;
size_t base;
size_t length;
uint64_t base;
uint64_t length;
Vector<uint8_t> data;
mutable int pos;
mutable uint64_t pos;
mutable bool eofed;
public:
@@ -63,21 +63,21 @@ public:
virtual String get_path() const; /// returns the path for the current open file
virtual String get_path_absolute() const; /// returns the absolute path for the current open file
virtual void seek(size_t p_position); ///< seek to a given position
virtual void seek(uint64_t p_position); ///< seek to a given position
virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file
virtual size_t get_position() const; ///< get position in the file
virtual size_t get_len() const; ///< get size of the file
virtual uint64_t get_position() const; ///< get position in the file
virtual uint64_t get_len() const; ///< get size of the file
virtual bool eof_reached() const; ///< reading passed EOF
virtual uint8_t get_8() const; ///< get a byte
virtual int get_buffer(uint8_t *p_dst, int p_length) const;
virtual uint64_t get_buffer(uint8_t *p_dst, uint64_t p_length) const;
virtual Error get_error() const; ///< get last error
virtual void flush();
virtual void store_8(uint8_t p_dest); ///< store a byte
virtual void store_buffer(const uint8_t *p_src, int p_length); ///< store an array of bytes
virtual void store_buffer(const uint8_t *p_src, uint64_t p_length); ///< store an array of bytes
virtual bool file_exists(const String &p_name); ///< return true if a file exists

View File

@@ -31,51 +31,47 @@
#include "file_access_memory.h"
#include "core/map.h"
#include "core/os/copymem.h"
#include "core/os/dir_access.h"
#include "core/project_settings.h"
static Map<String, Vector<uint8_t> > *files = NULL;
static Map<String, Vector<uint8_t>> *files = nullptr;
void FileAccessMemory::register_file(String p_name, Vector<uint8_t> p_data) {
if (!files) {
files = memnew((Map<String, Vector<uint8_t> >));
files = memnew((Map<String, Vector<uint8_t>>));
}
String name;
if (ProjectSettings::get_singleton())
if (ProjectSettings::get_singleton()) {
name = ProjectSettings::get_singleton()->globalize_path(p_name);
else
} else {
name = p_name;
}
//name = DirAccess::normalize_path(name);
(*files)[name] = p_data;
}
void FileAccessMemory::cleanup() {
if (!files)
if (!files) {
return;
}
memdelete(files);
}
FileAccess *FileAccessMemory::create() {
return memnew(FileAccessMemory);
}
bool FileAccessMemory::file_exists(const String &p_name) {
String name = fix_path(p_name);
//name = DirAccess::normalize_path(name);
return files && (files->find(name) != NULL);
return files && (files->find(name) != nullptr);
}
Error FileAccessMemory::open_custom(const uint8_t *p_data, int p_len) {
Error FileAccessMemory::open_custom(const uint8_t *p_data, uint64_t p_len) {
data = (uint8_t *)p_data;
length = p_len;
pos = 0;
@@ -83,13 +79,12 @@ Error FileAccessMemory::open_custom(const uint8_t *p_data, int p_len) {
}
Error FileAccessMemory::_open(const String &p_path, int p_mode_flags) {
ERR_FAIL_COND_V(!files, ERR_FILE_NOT_FOUND);
String name = fix_path(p_path);
//name = DirAccess::normalize_path(name);
Map<String, Vector<uint8_t> >::Element *E = files->find(name);
Map<String, Vector<uint8_t>>::Element *E = files->find(name);
ERR_FAIL_COND_V_MSG(!E, ERR_FILE_NOT_FOUND, "Can't find file '" + p_path + "'.");
data = E->get().ptrw();
@@ -100,46 +95,38 @@ Error FileAccessMemory::_open(const String &p_path, int p_mode_flags) {
}
void FileAccessMemory::close() {
data = NULL;
data = nullptr;
}
bool FileAccessMemory::is_open() const {
return data != NULL;
return data != nullptr;
}
void FileAccessMemory::seek(size_t p_position) {
void FileAccessMemory::seek(uint64_t p_position) {
ERR_FAIL_COND(!data);
pos = p_position;
}
void FileAccessMemory::seek_end(int64_t p_position) {
ERR_FAIL_COND(!data);
pos = length + p_position;
}
size_t FileAccessMemory::get_position() const {
uint64_t FileAccessMemory::get_position() const {
ERR_FAIL_COND_V(!data, 0);
return pos;
}
size_t FileAccessMemory::get_len() const {
uint64_t FileAccessMemory::get_len() const {
ERR_FAIL_COND_V(!data, 0);
return length;
}
bool FileAccessMemory::eof_reached() const {
return pos > length;
}
uint8_t FileAccessMemory::get_8() const {
uint8_t ret = 0;
if (pos < length) {
ret = data[pos];
@@ -149,26 +136,24 @@ uint8_t FileAccessMemory::get_8() const {
return ret;
}
int FileAccessMemory::get_buffer(uint8_t *p_dst, int p_length) const {
uint64_t FileAccessMemory::get_buffer(uint8_t *p_dst, uint64_t p_length) const {
ERR_FAIL_COND_V(!p_dst && p_length > 0, -1);
ERR_FAIL_COND_V(p_length < 0, -1);
ERR_FAIL_COND_V(!data, -1);
int left = length - pos;
int read = MIN(p_length, left);
uint64_t left = length - pos;
uint64_t read = MIN(p_length, left);
if (read < p_length) {
WARN_PRINT("Reading less data than requested");
};
}
copymem(p_dst, &data[pos], read);
memcpy(p_dst, &data[pos], read);
pos += p_length;
return read;
}
Error FileAccessMemory::get_error() const {
return pos >= length ? ERR_FILE_EOF : OK;
}
@@ -177,25 +162,23 @@ void FileAccessMemory::flush() {
}
void FileAccessMemory::store_8(uint8_t p_byte) {
ERR_FAIL_COND(!data);
ERR_FAIL_COND(pos >= length);
data[pos++] = p_byte;
}
void FileAccessMemory::store_buffer(const uint8_t *p_src, int p_length) {
int left = length - pos;
int write = MIN(p_length, left);
void FileAccessMemory::store_buffer(const uint8_t *p_src, uint64_t p_length) {
ERR_FAIL_COND(!p_src && p_length > 0);
uint64_t left = length - pos;
uint64_t write = MIN(p_length, left);
if (write < p_length) {
WARN_PRINT("Writing less data than requested");
}
copymem(&data[pos], p_src, write);
memcpy(&data[pos], p_src, write);
pos += p_length;
}
FileAccessMemory::FileAccessMemory() {
data = NULL;
data = nullptr;
}

View File

@@ -34,10 +34,9 @@
#include "core/os/file_access.h"
class FileAccessMemory : public FileAccess {
uint8_t *data;
int length;
mutable int pos;
uint64_t length;
mutable uint64_t pos;
static FileAccess *create();
@@ -45,27 +44,27 @@ public:
static void register_file(String p_name, Vector<uint8_t> p_data);
static void cleanup();
virtual Error open_custom(const uint8_t *p_data, int p_len); ///< open a file
virtual Error open_custom(const uint8_t *p_data, uint64_t p_len); ///< open a file
virtual Error _open(const String &p_path, int p_mode_flags); ///< open a file
virtual void close(); ///< close a file
virtual bool is_open() const; ///< true when file is open
virtual void seek(size_t p_position); ///< seek to a given position
virtual void seek(uint64_t p_position); ///< seek to a given position
virtual void seek_end(int64_t p_position); ///< seek from the end of file
virtual size_t get_position() const; ///< get position in the file
virtual size_t get_len() const; ///< get size of the file
virtual uint64_t get_position() const; ///< get position in the file
virtual uint64_t get_len() const; ///< get size of the file
virtual bool eof_reached() const; ///< reading passed EOF
virtual uint8_t get_8() const; ///< get a byte
virtual int get_buffer(uint8_t *p_dst, int p_length) const; ///< get an array of bytes
virtual uint64_t get_buffer(uint8_t *p_dst, uint64_t p_length) const; ///< get an array of bytes
virtual Error get_error() const; ///< get last error
virtual void flush();
virtual void store_8(uint8_t p_byte); ///< store a byte
virtual void store_buffer(const uint8_t *p_src, int p_length); ///< store an array of bytes
virtual void store_buffer(const uint8_t *p_src, uint64_t p_length); ///< store an array of bytes
virtual bool file_exists(const String &p_name); ///< return true if a file exists

View File

@@ -41,19 +41,16 @@
#define DEBUG_TIME(m_what)
void FileAccessNetworkClient::lock_mutex() {
mutex.lock();
lockcount++;
}
void FileAccessNetworkClient::unlock_mutex() {
lockcount--;
mutex.unlock();
}
void FileAccessNetworkClient::put_32(int p_32) {
uint8_t buf[4];
encode_uint32(p_32, buf);
client->put_data(buf, 4);
@@ -61,7 +58,6 @@ void FileAccessNetworkClient::put_32(int p_32) {
}
void FileAccessNetworkClient::put_64(int64_t p_64) {
uint8_t buf[8];
encode_uint64(p_64, buf);
client->put_data(buf, 8);
@@ -69,24 +65,20 @@ void FileAccessNetworkClient::put_64(int64_t p_64) {
}
int FileAccessNetworkClient::get_32() {
uint8_t buf[4];
client->get_data(buf, 4);
return decode_uint32(buf);
}
int64_t FileAccessNetworkClient::get_64() {
uint8_t buf[8];
client->get_data(buf, 8);
return decode_uint64(buf);
}
void FileAccessNetworkClient::_thread_func() {
client->set_no_delay(true);
while (!quit) {
DEBUG_PRINT("SEM WAIT - " + itos(sem->get()));
sem.wait();
DEBUG_TIME("sem_unlock");
@@ -113,7 +105,7 @@ void FileAccessNetworkClient::_thread_func() {
int response = get_32();
DEBUG_PRINT("GET RESPONSE: " + itos(response));
FileAccessNetwork *fa = NULL;
FileAccessNetwork *fa = nullptr;
if (response != FileAccessNetwork::RESPONSE_DATA) {
if (!accesses.has(id)) {
@@ -122,19 +114,18 @@ void FileAccessNetworkClient::_thread_func() {
}
}
if (accesses.has(id))
if (accesses.has(id)) {
fa = accesses[id];
}
switch (response) {
case FileAccessNetwork::RESPONSE_OPEN: {
DEBUG_TIME("sem_open");
int status = get_32();
if (status != OK) {
fa->_respond(0, Error(status));
} else {
uint64_t len = get_64();
int64_t len = get_64();
fa->_respond(len, Error(status));
}
@@ -142,27 +133,25 @@ void FileAccessNetworkClient::_thread_func() {
} break;
case FileAccessNetwork::RESPONSE_DATA: {
int64_t offset = get_64();
uint32_t len = get_32();
int32_t len = get_32();
Vector<uint8_t> block;
block.resize(len);
client->get_data(block.ptrw(), len);
if (fa) //may have been queued
if (fa) { //may have been queued
fa->_set_block(offset, block);
}
} break;
case FileAccessNetwork::RESPONSE_FILE_EXISTS: {
int status = get_32();
fa->exists_modtime = status != 0;
fa->sem.post();
} break;
case FileAccessNetwork::RESPONSE_GET_MODTIME: {
uint64_t status = get_64();
fa->exists_modtime = status;
fa->sem.post();
@@ -175,14 +164,12 @@ void FileAccessNetworkClient::_thread_func() {
}
void FileAccessNetworkClient::_thread_func(void *s) {
FileAccessNetworkClient *self = (FileAccessNetworkClient *)s;
self->_thread_func();
}
Error FileAccessNetworkClient::connect(const String &p_host, int p_port, const String &p_password) {
IP_Address ip;
if (p_host.is_valid_ip_address()) {
@@ -218,10 +205,9 @@ Error FileAccessNetworkClient::connect(const String &p_host, int p_port, const S
return OK;
}
FileAccessNetworkClient *FileAccessNetworkClient::singleton = NULL;
FileAccessNetworkClient *FileAccessNetworkClient::singleton = nullptr;
FileAccessNetworkClient::FileAccessNetworkClient() {
quit = false;
singleton = this;
last_id = 0;
@@ -230,7 +216,6 @@ FileAccessNetworkClient::FileAccessNetworkClient() {
}
FileAccessNetworkClient::~FileAccessNetworkClient() {
if (thread.is_started()) {
quit = true;
sem.post();
@@ -238,14 +223,13 @@ FileAccessNetworkClient::~FileAccessNetworkClient() {
}
}
void FileAccessNetwork::_set_block(int p_offset, const Vector<uint8_t> &p_block) {
int page = p_offset / page_size;
void FileAccessNetwork::_set_block(uint64_t p_offset, const Vector<uint8_t> &p_block) {
int32_t page = p_offset / page_size;
ERR_FAIL_INDEX(page, pages.size());
if (page < pages.size() - 1) {
ERR_FAIL_COND(p_block.size() != page_size);
} else {
ERR_FAIL_COND((p_block.size() != (int)(total_size % page_size)));
ERR_FAIL_COND((uint64_t)p_block.size() != total_size % page_size);
}
buffer_mutex.lock();
@@ -259,23 +243,23 @@ void FileAccessNetwork::_set_block(int p_offset, const Vector<uint8_t> &p_block)
}
}
void FileAccessNetwork::_respond(size_t p_len, Error p_status) {
void FileAccessNetwork::_respond(uint64_t p_len, Error p_status) {
DEBUG_PRINT("GOT RESPONSE - len: " + itos(p_len) + " status: " + itos(p_status));
response = p_status;
if (response != OK)
if (response != OK) {
return;
}
opened = true;
total_size = p_len;
int pc = ((total_size - 1) / page_size) + 1;
int32_t pc = ((total_size - 1) / page_size) + 1;
pages.resize(pc);
}
Error FileAccessNetwork::_open(const String &p_path, int p_mode_flags) {
ERR_FAIL_COND_V(p_mode_flags != READ, ERR_UNAVAILABLE);
if (opened)
if (opened) {
close();
}
FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
DEBUG_PRINT("open: " + p_path);
@@ -291,7 +275,7 @@ Error FileAccessNetwork::_open(const String &p_path, int p_mode_flags) {
pos = 0;
eof_flag = false;
last_page = -1;
last_page_buff = NULL;
last_page_buff = nullptr;
//buffers.clear();
nc->unlock_mutex();
@@ -307,9 +291,9 @@ Error FileAccessNetwork::_open(const String &p_path, int p_mode_flags) {
}
void FileAccessNetwork::close() {
if (!opened)
if (!opened) {
return;
}
FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
@@ -322,13 +306,12 @@ void FileAccessNetwork::close() {
nc->unlock_mutex();
}
bool FileAccessNetwork::is_open() const {
return opened;
}
void FileAccessNetwork::seek(size_t p_position) {
void FileAccessNetwork::seek(uint64_t p_position) {
ERR_FAIL_COND_MSG(!opened, "File must be opened before use.");
eof_flag = p_position > total_size;
if (p_position >= total_size) {
@@ -339,45 +322,41 @@ void FileAccessNetwork::seek(size_t p_position) {
}
void FileAccessNetwork::seek_end(int64_t p_position) {
seek(total_size + p_position);
}
size_t FileAccessNetwork::get_position() const {
uint64_t FileAccessNetwork::get_position() const {
ERR_FAIL_COND_V_MSG(!opened, 0, "File must be opened before use.");
return pos;
}
size_t FileAccessNetwork::get_len() const {
uint64_t FileAccessNetwork::get_len() const {
ERR_FAIL_COND_V_MSG(!opened, 0, "File must be opened before use.");
return total_size;
}
bool FileAccessNetwork::eof_reached() const {
ERR_FAIL_COND_V_MSG(!opened, false, "File must be opened before use.");
return eof_flag;
}
uint8_t FileAccessNetwork::get_8() const {
uint8_t v;
get_buffer(&v, 1);
return v;
}
void FileAccessNetwork::_queue_page(int p_page) const {
if (p_page >= pages.size())
void FileAccessNetwork::_queue_page(int32_t p_page) const {
if (p_page >= pages.size()) {
return;
}
if (pages[p_page].buffer.empty() && !pages[p_page].queued) {
FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
nc->blockrequest_mutex.lock();
FileAccessNetworkClient::BlockRequest br;
br.id = id;
br.offset = size_t(p_page) * page_size;
br.offset = (uint64_t)p_page * page_size;
br.size = page_size;
nc->block_requests.push_back(br);
pages.write[p_page].queued = true;
@@ -388,11 +367,9 @@ void FileAccessNetwork::_queue_page(int p_page) const {
}
}
int FileAccessNetwork::get_buffer(uint8_t *p_dst, int p_length) const {
uint64_t FileAccessNetwork::get_buffer(uint8_t *p_dst, uint64_t p_length) const {
ERR_FAIL_COND_V(!p_dst && p_length > 0, -1);
ERR_FAIL_COND_V(p_length < 0, -1);
//bool eof=false;
if (pos + p_length > total_size) {
eof_flag = true;
}
@@ -400,20 +377,16 @@ int FileAccessNetwork::get_buffer(uint8_t *p_dst, int p_length) const {
p_length = total_size - pos;
}
//FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
uint8_t *buff = last_page_buff;
for (int i = 0; i < p_length; i++) {
int page = pos / page_size;
for (uint64_t i = 0; i < p_length; i++) {
int32_t page = pos / page_size;
if (page != last_page) {
buffer_mutex.lock();
if (pages[page].buffer.empty()) {
waiting_on_page = page;
for (int j = 0; j < read_ahead; j++) {
for (int32_t j = 0; j < read_ahead; j++) {
_queue_page(page + j);
}
buffer_mutex.unlock();
@@ -421,12 +394,9 @@ int FileAccessNetwork::get_buffer(uint8_t *p_dst, int p_length) const {
page_sem.wait();
DEBUG_PRINT("done");
} else {
for (int j = 0; j < read_ahead; j++) {
for (int32_t j = 0; j < read_ahead; j++) {
_queue_page(page + j);
}
//queue pages
buffer_mutex.unlock();
}
@@ -443,7 +413,6 @@ int FileAccessNetwork::get_buffer(uint8_t *p_dst, int p_length) const {
}
Error FileAccessNetwork::get_error() const {
return pos == total_size ? ERR_FILE_EOF : OK;
}
@@ -452,12 +421,10 @@ void FileAccessNetwork::flush() {
}
void FileAccessNetwork::store_8(uint8_t p_dest) {
ERR_FAIL();
}
bool FileAccessNetwork::file_exists(const String &p_path) {
FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
nc->lock_mutex();
nc->put_32(id);
@@ -474,7 +441,6 @@ bool FileAccessNetwork::file_exists(const String &p_path) {
}
uint64_t FileAccessNetwork::_get_modified_time(const String &p_file) {
FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
nc->lock_mutex();
nc->put_32(id);
@@ -501,7 +467,6 @@ Error FileAccessNetwork::_set_unix_permissions(const String &p_file, uint32_t p_
}
void FileAccessNetwork::configure() {
GLOBAL_DEF("network/remote_fs/page_size", 65536);
ProjectSettings::get_singleton()->set_custom_property_info("network/remote_fs/page_size", PropertyInfo(Variant::INT, "network/remote_fs/page_size", PROPERTY_HINT_RANGE, "1,65536,1,or_greater")); //is used as denominator and can't be zero
GLOBAL_DEF("network/remote_fs/page_read_ahead", 4);
@@ -509,7 +474,6 @@ void FileAccessNetwork::configure() {
}
FileAccessNetwork::FileAccessNetwork() {
eof_flag = false;
opened = false;
pos = 0;
@@ -520,13 +484,11 @@ FileAccessNetwork::FileAccessNetwork() {
nc->unlock_mutex();
page_size = GLOBAL_GET("network/remote_fs/page_size");
read_ahead = GLOBAL_GET("network/remote_fs/page_read_ahead");
last_activity_val = 0;
waiting_on_page = -1;
last_page = -1;
}
FileAccessNetwork::~FileAccessNetwork() {
close();
FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;

View File

@@ -39,12 +39,10 @@
class FileAccessNetwork;
class FileAccessNetworkClient {
struct BlockRequest {
int id;
int32_t id;
uint64_t offset;
int size;
int32_t size;
};
List<BlockRequest> block_requests;
@@ -56,16 +54,16 @@ class FileAccessNetworkClient {
Mutex blockrequest_mutex;
Map<int, FileAccessNetwork *> accesses;
Ref<StreamPeerTCP> client;
int last_id;
int32_t last_id;
Vector<uint8_t> block;
void _thread_func();
static void _thread_func(void *s);
void put_32(int p_32);
void put_32(int32_t p_32);
void put_64(int64_t p_64);
int get_32();
int32_t get_32();
int64_t get_64();
int lockcount;
void lock_mutex();
@@ -84,23 +82,21 @@ public:
};
class FileAccessNetwork : public FileAccess {
Semaphore sem;
Semaphore page_sem;
Mutex buffer_mutex;
bool opened;
size_t total_size;
mutable size_t pos;
int id;
uint64_t total_size;
mutable uint64_t pos;
int32_t id;
mutable bool eof_flag;
mutable int last_page;
mutable int32_t last_page;
mutable uint8_t *last_page_buff;
int page_size;
int read_ahead;
int32_t page_size;
int32_t read_ahead;
mutable int waiting_on_page;
mutable int last_activity_val;
struct Page {
int activity;
bool queued;
@@ -117,9 +113,9 @@ class FileAccessNetwork : public FileAccess {
uint64_t exists_modtime;
friend class FileAccessNetworkClient;
void _queue_page(int p_page) const;
void _respond(size_t p_len, Error p_status);
void _set_block(int p_offset, const Vector<uint8_t> &p_block);
void _queue_page(int32_t p_page) const;
void _respond(uint64_t p_len, Error p_status);
void _set_block(uint64_t p_offset, const Vector<uint8_t> &p_block);
public:
enum Command {
@@ -141,15 +137,15 @@ public:
virtual void close(); ///< close a file
virtual bool is_open() const; ///< true when file is open
virtual void seek(size_t p_position); ///< seek to a given position
virtual void seek(uint64_t p_position); ///< seek to a given position
virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file
virtual size_t get_position() const; ///< get position in the file
virtual size_t get_len() const; ///< get size of the file
virtual uint64_t get_position() const; ///< get position in the file
virtual uint64_t get_len() const; ///< get size of the file
virtual bool eof_reached() const; ///< reading passed EOF
virtual uint8_t get_8() const; ///< get a byte
virtual int get_buffer(uint8_t *p_dst, int p_length) const;
virtual uint64_t get_buffer(uint8_t *p_dst, uint64_t p_length) const;
virtual Error get_error() const; ///< get last error

View File

@@ -34,12 +34,9 @@
#include <stdio.h>
Error PackedData::add_pack(const String &p_path, bool p_replace_files, size_t p_offset) {
Error PackedData::add_pack(const String &p_path, bool p_replace_files, uint64_t p_offset) {
for (int i = 0; i < sources.size(); i++) {
if (sources[i]->try_open_pack(p_path, p_replace_files, p_offset)) {
return OK;
};
};
@@ -47,27 +44,27 @@ Error PackedData::add_pack(const String &p_path, bool p_replace_files, size_t p_
return ERR_FILE_UNRECOGNIZED;
};
void PackedData::add_path(const String &pkg_path, const String &path, uint64_t ofs, uint64_t size, const uint8_t *p_md5, PackSource *p_src, bool p_replace_files) {
PathMD5 pmd5(path.md5_buffer());
//printf("adding path %ls, %lli, %lli\n", path.c_str(), pmd5.a, pmd5.b);
void PackedData::add_path(const String &p_pkg_path, const String &p_path, uint64_t p_ofs, uint64_t p_size, const uint8_t *p_md5, PackSource *p_src, bool p_replace_files) {
PathMD5 pmd5(p_path.md5_buffer());
bool exists = files.has(pmd5);
PackedFile pf;
pf.pack = pkg_path;
pf.offset = ofs;
pf.size = size;
for (int i = 0; i < 16; i++)
pf.pack = p_pkg_path;
pf.offset = p_ofs;
pf.size = p_size;
for (int i = 0; i < 16; i++) {
pf.md5[i] = p_md5[i];
}
pf.src = p_src;
if (!exists || p_replace_files)
if (!exists || p_replace_files) {
files[pmd5] = pf;
}
if (!exists) {
//search for dir
String p = path.replace_first("res://", "");
String p = p_path.replace_first("res://", "");
PackedDir *cd = root;
if (p.find("/") != -1) { //in a subdir
@@ -75,9 +72,7 @@ void PackedData::add_path(const String &pkg_path, const String &path, uint64_t o
Vector<String> ds = p.get_base_dir().split("/");
for (int j = 0; j < ds.size(); j++) {
if (!cd->subdirs.has(ds[j])) {
PackedDir *pd = memnew(PackedDir);
pd->name = ds[j];
pd->parent = cd;
@@ -88,7 +83,7 @@ void PackedData::add_path(const String &pkg_path, const String &path, uint64_t o
}
}
}
String filename = path.get_file();
String filename = p_path.get_file();
// Don't add as a file if the path points to a directory
if (!filename.empty()) {
cd->files.insert(filename);
@@ -97,33 +92,30 @@ void PackedData::add_path(const String &pkg_path, const String &path, uint64_t o
}
void PackedData::add_pack_source(PackSource *p_source) {
if (p_source != NULL) {
if (p_source != nullptr) {
sources.push_back(p_source);
}
};
PackedData *PackedData::singleton = NULL;
PackedData *PackedData::singleton = nullptr;
PackedData::PackedData() {
singleton = this;
root = memnew(PackedDir);
root->parent = NULL;
root->parent = nullptr;
disabled = false;
add_pack_source(memnew(PackedSourcePCK));
}
void PackedData::_free_packed_dirs(PackedDir *p_dir) {
for (Map<String, PackedDir *>::Element *E = p_dir->subdirs.front(); E; E = E->next())
for (Map<String, PackedDir *>::Element *E = p_dir->subdirs.front(); E; E = E->next()) {
_free_packed_dirs(E->get());
}
memdelete(p_dir);
}
PackedData::~PackedData() {
for (int i = 0; i < sources.size(); i++) {
memdelete(sources[i]);
}
@@ -132,11 +124,11 @@ PackedData::~PackedData() {
//////////////////////////////////////////////////////////////////
bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files, size_t p_offset) {
bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files, uint64_t p_offset) {
FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
if (!f)
if (!f) {
return false;
}
f->seek(p_offset);
@@ -155,7 +147,6 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files,
f->seek(f->get_position() - 4);
magic = f->get_32();
if (magic != PACK_HEADER_MAGIC) {
f->close();
memdelete(f);
return false;
@@ -167,7 +158,6 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files,
magic = f->get_32();
if (magic != PACK_HEADER_MAGIC) {
f->close();
memdelete(f);
return false;
@@ -198,7 +188,6 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files,
int file_count = f->get_32();
for (int i = 0; i < file_count; i++) {
uint32_t sl = f->get_32();
CharString cs;
cs.resize(sl + 1);
@@ -221,30 +210,25 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files,
};
FileAccess *PackedSourcePCK::get_file(const String &p_path, PackedData::PackedFile *p_file) {
return memnew(FileAccessPack(p_path, *p_file));
};
//////////////////////////////////////////////////////////////////
Error FileAccessPack::_open(const String &p_path, int p_mode_flags) {
ERR_FAIL_V(ERR_UNAVAILABLE);
return ERR_UNAVAILABLE;
}
void FileAccessPack::close() {
f->close();
}
bool FileAccessPack::is_open() const {
return f->is_open();
}
void FileAccessPack::seek(size_t p_position) {
void FileAccessPack::seek(uint64_t p_position) {
if (p_position > pf.size) {
eof = true;
} else {
@@ -254,26 +238,24 @@ void FileAccessPack::seek(size_t p_position) {
f->seek(pf.offset + p_position);
pos = p_position;
}
void FileAccessPack::seek_end(int64_t p_position) {
void FileAccessPack::seek_end(int64_t p_position) {
seek(pf.size + p_position);
}
size_t FileAccessPack::get_position() const {
uint64_t FileAccessPack::get_position() const {
return pos;
}
size_t FileAccessPack::get_len() const {
uint64_t FileAccessPack::get_len() const {
return pf.size;
}
bool FileAccessPack::eof_reached() const {
return eof;
}
uint8_t FileAccessPack::get_8() const {
if (pos >= pf.size) {
eof = true;
return 0;
@@ -283,23 +265,24 @@ uint8_t FileAccessPack::get_8() const {
return f->get_8();
}
int FileAccessPack::get_buffer(uint8_t *p_dst, int p_length) const {
uint64_t FileAccessPack::get_buffer(uint8_t *p_dst, uint64_t p_length) const {
ERR_FAIL_COND_V(!p_dst && p_length > 0, -1);
ERR_FAIL_COND_V(p_length < 0, -1);
if (eof)
if (eof) {
return 0;
}
uint64_t to_read = p_length;
int64_t to_read = p_length;
if (to_read + pos > pf.size) {
eof = true;
to_read = int64_t(pf.size) - int64_t(pos);
to_read = (int64_t)pf.size - (int64_t)pos;
}
pos += p_length;
if (to_read <= 0)
if (to_read <= 0) {
return 0;
}
f->get_buffer(p_dst, to_read);
return to_read;
@@ -311,36 +294,31 @@ void FileAccessPack::set_endian_swap(bool p_swap) {
}
Error FileAccessPack::get_error() const {
if (eof)
if (eof) {
return ERR_FILE_EOF;
}
return OK;
}
void FileAccessPack::flush() {
ERR_FAIL();
}
void FileAccessPack::store_8(uint8_t p_dest) {
ERR_FAIL();
}
void FileAccessPack::store_buffer(const uint8_t *p_src, int p_length) {
void FileAccessPack::store_buffer(const uint8_t *p_src, uint64_t p_length) {
ERR_FAIL();
}
bool FileAccessPack::file_exists(const String &p_name) {
return false;
}
FileAccessPack::FileAccessPack(const String &p_path, const PackedData::PackedFile &p_file) :
pf(p_file),
f(FileAccess::open(pf.pack, FileAccess::READ)) {
ERR_FAIL_COND_MSG(!f, "Can't open pack-referenced file '" + String(pf.pack) + "'.");
f->seek(pf.offset);
@@ -349,8 +327,9 @@ FileAccessPack::FileAccessPack(const String &p_path, const PackedData::PackedFil
}
FileAccessPack::~FileAccessPack() {
if (f)
if (f) {
memdelete(f);
}
}
//////////////////////////////////////////////////////////////////////////////////
@@ -358,17 +337,14 @@ FileAccessPack::~FileAccessPack() {
//////////////////////////////////////////////////////////////////////////////////
Error DirAccessPack::list_dir_begin() {
list_dirs.clear();
list_files.clear();
for (Map<String, PackedData::PackedDir *>::Element *E = current->subdirs.front(); E; E = E->next()) {
list_dirs.push_back(E->key());
}
for (Set<String>::Element *E = current->files.front(); E; E = E->next()) {
list_files.push_back(E->get());
}
@@ -376,7 +352,6 @@ Error DirAccessPack::list_dir_begin() {
}
String DirAccessPack::get_next() {
if (list_dirs.size()) {
cdir = true;
String d = list_dirs.front()->get();
@@ -392,30 +367,24 @@ String DirAccessPack::get_next() {
}
}
bool DirAccessPack::current_is_dir() const {
return cdir;
}
bool DirAccessPack::current_is_hidden() const {
return false;
}
void DirAccessPack::list_dir_end() {
list_dirs.clear();
list_files.clear();
}
int DirAccessPack::get_drive_count() {
return 0;
}
String DirAccessPack::get_drive(int p_drive) {
return "";
}
PackedData::PackedDir *DirAccessPack::_find_dir(String p_dir) {
String nd = p_dir.replace("\\", "/");
// Special handling since simplify_path() will forbid it
@@ -431,7 +400,9 @@ PackedData::PackedDir *DirAccessPack::_find_dir(String p_dir) {
nd = nd.simplify_path();
if (nd == "") nd = ".";
if (nd == "") {
nd = ".";
}
if (nd.begins_with("/")) {
nd = nd.replace_first("/", "");
@@ -442,13 +413,13 @@ PackedData::PackedDir *DirAccessPack::_find_dir(String p_dir) {
PackedData::PackedDir *pd;
if (absolute)
if (absolute) {
pd = PackedData::get_singleton()->root;
else
} else {
pd = current;
}
for (int i = 0; i < paths.size(); i++) {
String p = paths[i];
if (p == ".") {
continue;
@@ -457,12 +428,10 @@ PackedData::PackedDir *DirAccessPack::_find_dir(String p_dir) {
pd = pd->parent;
}
} else if (pd->subdirs.has(p)) {
pd = pd->subdirs[p];
} else {
return NULL;
return nullptr;
}
}
@@ -470,7 +439,6 @@ PackedData::PackedDir *DirAccessPack::_find_dir(String p_dir) {
}
Error DirAccessPack::change_dir(String p_dir) {
PackedData::PackedDir *pd = _find_dir(p_dir);
if (pd) {
current = pd;
@@ -481,7 +449,6 @@ Error DirAccessPack::change_dir(String p_dir) {
}
String DirAccessPack::get_current_dir() {
PackedData::PackedDir *pd = current;
String p = current->name;
@@ -494,7 +461,6 @@ String DirAccessPack::get_current_dir() {
}
bool DirAccessPack::file_exists(String p_file) {
p_file = fix_path(p_file);
PackedData::PackedDir *pd = _find_dir(p_file.get_base_dir());
@@ -505,28 +471,23 @@ bool DirAccessPack::file_exists(String p_file) {
}
bool DirAccessPack::dir_exists(String p_dir) {
p_dir = fix_path(p_dir);
return _find_dir(p_dir) != NULL;
return _find_dir(p_dir) != nullptr;
}
Error DirAccessPack::make_dir(String p_dir) {
return ERR_UNAVAILABLE;
}
Error DirAccessPack::rename(String p_from, String p_to) {
return ERR_UNAVAILABLE;
}
Error DirAccessPack::remove(String p_name) {
return ERR_UNAVAILABLE;
}
size_t DirAccessPack::get_space_left() {
uint64_t DirAccessPack::get_space_left() {
return 0;
}
@@ -535,7 +496,6 @@ String DirAccessPack::get_filesystem_type() const {
}
DirAccessPack::DirAccessPack() {
current = PackedData::get_singleton()->root;
cdir = false;
}

View File

@@ -36,6 +36,7 @@
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/print_string.h"
#include "core/set.h"
// Godot's packed file magic header ("GDPC" in ASCII).
#define PACK_HEADER_MAGIC 0x43504447
@@ -51,7 +52,6 @@ class PackedData {
public:
struct PackedFile {
String pack;
uint64_t offset; //if offset is ZERO, the file was ERASED
uint64_t size;
@@ -71,7 +71,6 @@ private:
uint64_t a;
uint64_t b;
bool operator<(const PathMD5 &p_md5) const {
if (p_md5.a == a) {
return b < p_md5.b;
} else {
@@ -98,7 +97,6 @@ private:
Vector<PackSource *> sources;
PackedDir *root;
//Map<String,PackedDir*> dirs;
static PackedData *singleton;
bool disabled;
@@ -107,13 +105,13 @@ private:
public:
void add_pack_source(PackSource *p_source);
void add_path(const String &pkg_path, const String &path, uint64_t ofs, uint64_t size, const uint8_t *p_md5, PackSource *p_src, bool p_replace_files); // for PackSource
void add_path(const String &p_pkg_path, const String &p_path, uint64_t p_ofs, uint64_t p_size, const uint8_t *p_md5, PackSource *p_src, bool p_replace_files); // for PackSource
void set_disabled(bool p_disabled) { disabled = p_disabled; }
_FORCE_INLINE_ bool is_disabled() const { return disabled; }
static PackedData *get_singleton() { return singleton; }
Error add_pack(const String &p_path, bool p_replace_files, size_t p_offset);
Error add_pack(const String &p_path, bool p_replace_files, uint64_t p_offset);
_FORCE_INLINE_ FileAccess *try_open_path(const String &p_path);
_FORCE_INLINE_ bool has_path(const String &p_path);
@@ -126,25 +124,22 @@ public:
};
class PackSource {
public:
virtual bool try_open_pack(const String &p_path, bool p_replace_files, size_t p_offset) = 0;
virtual bool try_open_pack(const String &p_path, bool p_replace_files, uint64_t p_offset) = 0;
virtual FileAccess *get_file(const String &p_path, PackedData::PackedFile *p_file) = 0;
virtual ~PackSource() {}
};
class PackedSourcePCK : public PackSource {
public:
virtual bool try_open_pack(const String &p_path, bool p_replace_files, size_t p_offset);
virtual bool try_open_pack(const String &p_path, bool p_replace_files, uint64_t p_offset);
virtual FileAccess *get_file(const String &p_path, PackedData::PackedFile *p_file);
};
class FileAccessPack : public FileAccess {
PackedData::PackedFile pf;
mutable size_t pos;
mutable uint64_t pos;
mutable bool eof;
FileAccess *f;
@@ -157,16 +152,16 @@ public:
virtual void close();
virtual bool is_open() const;
virtual void seek(size_t p_position);
virtual void seek(uint64_t p_position);
virtual void seek_end(int64_t p_position = 0);
virtual size_t get_position() const;
virtual size_t get_len() const;
virtual uint64_t get_position() const;
virtual uint64_t get_len() const;
virtual bool eof_reached() const;
virtual uint8_t get_8() const;
virtual int get_buffer(uint8_t *p_dst, int p_length) const;
virtual uint64_t get_buffer(uint8_t *p_dst, uint64_t p_length) const;
virtual void set_endian_swap(bool p_swap);
@@ -175,7 +170,7 @@ public:
virtual void flush();
virtual void store_8(uint8_t p_dest);
virtual void store_buffer(const uint8_t *p_src, int p_length);
virtual void store_buffer(const uint8_t *p_src, uint64_t p_length);
virtual bool file_exists(const String &p_name);
@@ -184,24 +179,23 @@ public:
};
FileAccess *PackedData::try_open_path(const String &p_path) {
PathMD5 pmd5(p_path.md5_buffer());
Map<PathMD5, PackedFile>::Element *E = files.find(pmd5);
if (!E)
return NULL; //not found
if (E->get().offset == 0)
return NULL; //was erased
if (!E) {
return nullptr; //not found
}
if (E->get().offset == 0) {
return nullptr; //was erased
}
return E->get().src->get_file(p_path, &E->get());
}
bool PackedData::has_path(const String &p_path) {
return files.has(PathMD5(p_path.md5_buffer()));
}
bool PackedData::has_directory(const String &p_path) {
DirAccess *da = try_open_directory(p_path);
if (da) {
memdelete(da);
@@ -212,7 +206,6 @@ bool PackedData::has_directory(const String &p_path) {
}
class DirAccessPack : public DirAccess {
PackedData::PackedDir *current;
List<String> list_dirs;
@@ -242,7 +235,11 @@ public:
virtual Error rename(String p_from, String p_to);
virtual Error remove(String p_name);
size_t get_space_left();
virtual bool is_link(String p_file) { return false; }
virtual String read_link(String p_file) { return p_file; }
virtual Error create_link(String p_source, String p_target) { return FAILED; }
uint64_t get_space_left();
virtual String get_filesystem_type() const;
@@ -251,11 +248,10 @@ public:
};
DirAccess *PackedData::try_open_directory(const String &p_path) {
DirAccess *da = memnew(DirAccessPack());
if (da->change_dir(p_path) != OK) {
memdelete(da);
da = NULL;
da = nullptr;
}
return da;
}

View File

@@ -32,50 +32,43 @@
#include "file_access_zip.h"
#include "core/os/copymem.h"
#include "core/os/file_access.h"
ZipArchive *ZipArchive::instance = NULL;
ZipArchive *ZipArchive::instance = nullptr;
extern "C" {
static void *godot_open(void *data, const char *p_fname, int mode) {
if (mode & ZLIB_FILEFUNC_MODE_WRITE) {
return NULL;
return nullptr;
}
FileAccess *f = (FileAccess *)data;
f->open(p_fname, FileAccess::READ);
FileAccess *f = FileAccess::open(p_fname, FileAccess::READ);
ERR_FAIL_COND_V(!f, nullptr);
return f->is_open() ? data : NULL;
return f;
}
static uLong godot_read(void *data, void *fdata, void *buf, uLong size) {
FileAccess *f = (FileAccess *)data;
FileAccess *f = (FileAccess *)fdata;
f->get_buffer((uint8_t *)buf, size);
return size;
}
static uLong godot_write(voidpf opaque, voidpf stream, const void *buf, uLong size) {
return 0;
}
static long godot_tell(voidpf opaque, voidpf stream) {
FileAccess *f = (FileAccess *)opaque;
FileAccess *f = (FileAccess *)stream;
return f->get_position();
}
static long godot_seek(voidpf opaque, voidpf stream, uLong offset, int origin) {
FileAccess *f = (FileAccess *)stream;
FileAccess *f = (FileAccess *)opaque;
int pos = offset;
uint64_t pos = offset;
switch (origin) {
case ZLIB_FILEFUNC_SEEK_CUR:
pos = f->get_position() + offset;
break;
@@ -91,51 +84,44 @@ static long godot_seek(voidpf opaque, voidpf stream, uLong offset, int origin) {
}
static int godot_close(voidpf opaque, voidpf stream) {
FileAccess *f = (FileAccess *)opaque;
f->close();
FileAccess *f = (FileAccess *)stream;
if (f) {
f->close();
memdelete(f);
f = nullptr;
}
return 0;
}
static int godot_testerror(voidpf opaque, voidpf stream) {
FileAccess *f = (FileAccess *)opaque;
FileAccess *f = (FileAccess *)stream;
return f->get_error() != OK ? 1 : 0;
}
static voidpf godot_alloc(voidpf opaque, uInt items, uInt size) {
return memalloc(items * size);
}
static void godot_free(voidpf opaque, voidpf address) {
memfree(address);
}
} // extern "C"
void ZipArchive::close_handle(unzFile p_file) const {
ERR_FAIL_COND_MSG(!p_file, "Cannot close a file if none is open.");
FileAccess *f = (FileAccess *)unzGetOpaque(p_file);
unzCloseCurrentFile(p_file);
unzClose(p_file);
memdelete(f);
}
unzFile ZipArchive::get_file_handle(String p_file) const {
ERR_FAIL_COND_V_MSG(!file_exists(p_file), NULL, "File '" + p_file + " doesn't exist.");
ERR_FAIL_COND_V_MSG(!file_exists(p_file), nullptr, "File '" + p_file + " doesn't exist.");
File file = files[p_file];
FileAccess *f = FileAccess::open(packages[file.package].filename, FileAccess::READ);
ERR_FAIL_COND_V_MSG(!f, NULL, "Cannot open file '" + packages[file.package].filename + "'.");
zlib_filefunc_def io;
zeromem(&io, sizeof(io));
memset(&io, 0, sizeof(io));
io.opaque = f;
io.opaque = nullptr;
io.zopen_file = godot_open;
io.zread_file = godot_read;
io.zwrite_file = godot_write;
@@ -149,32 +135,29 @@ unzFile ZipArchive::get_file_handle(String p_file) const {
io.free_mem = godot_free;
unzFile pkg = unzOpen2(packages[file.package].filename.utf8().get_data(), &io);
ERR_FAIL_COND_V(!pkg, NULL);
ERR_FAIL_COND_V_MSG(!pkg, nullptr, "Cannot open file '" + packages[file.package].filename + "'.");
int unz_err = unzGoToFilePos(pkg, &file.file_pos);
if (unz_err != UNZ_OK || unzOpenCurrentFile(pkg) != UNZ_OK) {
unzClose(pkg);
ERR_FAIL_V(NULL);
ERR_FAIL_V(nullptr);
}
return pkg;
}
bool ZipArchive::try_open_pack(const String &p_path, bool p_replace_files, size_t p_offset = 0) {
bool ZipArchive::try_open_pack(const String &p_path, bool p_replace_files, uint64_t p_offset = 0) {
//printf("opening zip pack %ls, %i, %i\n", p_name.c_str(), p_name.extension().nocasecmp_to("zip"), p_name.extension().nocasecmp_to("pcz"));
// load with offset feature only supported for PCK files
ERR_FAIL_COND_V_MSG(p_offset != 0, false, "Invalid PCK data. Note that loading files with a non-zero offset isn't supported with ZIP archives.");
if (p_path.get_extension().nocasecmp_to("zip") != 0 && p_path.get_extension().nocasecmp_to("pcz") != 0)
if (p_path.get_extension().nocasecmp_to("zip") != 0 && p_path.get_extension().nocasecmp_to("pcz") != 0) {
return false;
}
zlib_filefunc_def io;
memset(&io, 0, sizeof(io));
FileAccess *fa = FileAccess::open(p_path, FileAccess::READ);
if (!fa)
return false;
io.opaque = fa;
io.opaque = nullptr;
io.zopen_file = godot_open;
io.zread_file = godot_read;
io.zwrite_file = godot_write;
@@ -198,11 +181,10 @@ bool ZipArchive::try_open_pack(const String &p_path, bool p_replace_files, size_
int pkg_num = packages.size() - 1;
for (uint64_t i = 0; i < gi.number_entry; i++) {
char filename_inzip[256];
unz_file_info64 file_info;
err = unzGetCurrentFileInfo64(zfile, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0);
err = unzGetCurrentFileInfo64(zfile, &file_info, filename_inzip, sizeof(filename_inzip), nullptr, 0, nullptr, 0);
ERR_CONTINUE(err != UNZ_OK);
File f;
@@ -225,18 +207,15 @@ bool ZipArchive::try_open_pack(const String &p_path, bool p_replace_files, size_
}
bool ZipArchive::file_exists(String p_name) const {
return files.has(p_name);
}
FileAccess *ZipArchive::get_file(const String &p_path, PackedData::PackedFile *p_file) {
return memnew(FileAccessZip(p_path, *p_file));
}
ZipArchive *ZipArchive::get_singleton() {
if (instance == NULL) {
if (instance == nullptr) {
instance = memnew(ZipArchive);
}
@@ -244,25 +223,19 @@ ZipArchive *ZipArchive::get_singleton() {
}
ZipArchive::ZipArchive() {
instance = this;
//fa_create_func = FileAccess::get_create_func();
}
ZipArchive::~ZipArchive() {
for (int i = 0; i < packages.size(); i++) {
FileAccess *f = (FileAccess *)unzGetOpaque(packages[i].zfile);
unzClose(packages[i].zfile);
memdelete(f);
}
packages.clear();
}
Error FileAccessZip::_open(const String &p_path, int p_mode_flags) {
close();
ERR_FAIL_COND_V(p_mode_flags & FileAccess::WRITE, FAILED);
@@ -271,84 +244,78 @@ Error FileAccessZip::_open(const String &p_path, int p_mode_flags) {
zfile = arch->get_file_handle(p_path);
ERR_FAIL_COND_V(!zfile, FAILED);
int err = unzGetCurrentFileInfo64(zfile, &file_info, NULL, 0, NULL, 0, NULL, 0);
int err = unzGetCurrentFileInfo64(zfile, &file_info, nullptr, 0, nullptr, 0, nullptr, 0);
ERR_FAIL_COND_V(err != UNZ_OK, FAILED);
return OK;
}
void FileAccessZip::close() {
if (!zfile)
if (!zfile) {
return;
}
ZipArchive *arch = ZipArchive::get_singleton();
ERR_FAIL_COND(!arch);
arch->close_handle(zfile);
zfile = NULL;
zfile = nullptr;
}
bool FileAccessZip::is_open() const {
return zfile != NULL;
return zfile != nullptr;
}
void FileAccessZip::seek(size_t p_position) {
void FileAccessZip::seek(uint64_t p_position) {
ERR_FAIL_COND(!zfile);
unzSeekCurrentFile(zfile, p_position);
}
void FileAccessZip::seek_end(int64_t p_position) {
ERR_FAIL_COND(!zfile);
unzSeekCurrentFile(zfile, get_len() + p_position);
}
size_t FileAccessZip::get_position() const {
uint64_t FileAccessZip::get_position() const {
ERR_FAIL_COND_V(!zfile, 0);
return unztell(zfile);
}
size_t FileAccessZip::get_len() const {
uint64_t FileAccessZip::get_len() const {
ERR_FAIL_COND_V(!zfile, 0);
return file_info.uncompressed_size;
}
bool FileAccessZip::eof_reached() const {
ERR_FAIL_COND_V(!zfile, true);
return at_eof;
}
uint8_t FileAccessZip::get_8() const {
uint8_t ret = 0;
get_buffer(&ret, 1);
return ret;
}
int FileAccessZip::get_buffer(uint8_t *p_dst, int p_length) const {
uint64_t FileAccessZip::get_buffer(uint8_t *p_dst, uint64_t p_length) const {
ERR_FAIL_COND_V(!p_dst && p_length > 0, -1);
ERR_FAIL_COND_V(p_length < 0, -1);
ERR_FAIL_COND_V(!zfile, -1);
at_eof = unzeof(zfile);
if (at_eof)
if (at_eof) {
return 0;
int read = unzReadCurrentFile(zfile, p_dst, p_length);
}
int64_t read = unzReadCurrentFile(zfile, p_dst, p_length);
ERR_FAIL_COND_V(read < 0, read);
if (read < p_length)
if ((uint64_t)read < p_length) {
at_eof = true;
}
return read;
}
Error FileAccessZip::get_error() const {
if (!zfile) {
return ERR_UNCONFIGURED;
}
if (eof_reached()) {
@@ -359,27 +326,23 @@ Error FileAccessZip::get_error() const {
}
void FileAccessZip::flush() {
ERR_FAIL();
}
void FileAccessZip::store_8(uint8_t p_dest) {
ERR_FAIL();
}
bool FileAccessZip::file_exists(const String &p_name) {
return false;
}
FileAccessZip::FileAccessZip(const String &p_path, const PackedData::PackedFile &p_file) :
zfile(NULL) {
zfile(nullptr) {
_open(p_path, FileAccess::READ);
}
FileAccessZip::~FileAccessZip() {
close();
}

View File

@@ -41,14 +41,11 @@
#include <stdlib.h>
class ZipArchive : public PackSource {
public:
struct File {
int package;
unz_file_pos file_pos;
File() {
package = -1;
};
};
@@ -74,7 +71,7 @@ public:
bool file_exists(String p_name) const;
virtual bool try_open_pack(const String &p_path, bool p_replace_files, size_t p_offset);
virtual bool try_open_pack(const String &p_path, bool p_replace_files, uint64_t p_offset);
FileAccess *get_file(const String &p_path, PackedData::PackedFile *p_file);
static ZipArchive *get_singleton();
@@ -94,20 +91,21 @@ public:
virtual void close(); ///< close a file
virtual bool is_open() const; ///< true when file is open
virtual void seek(size_t p_position); ///< seek to a given position
virtual void seek(uint64_t p_position); ///< seek to a given position
virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file
virtual size_t get_position() const; ///< get position in the file
virtual size_t get_len() const; ///< get size of the file
virtual uint64_t get_position() const; ///< get position in the file
virtual uint64_t get_len() const; ///< get size of the file
virtual bool eof_reached() const; ///< reading passed EOF
virtual uint8_t get_8() const; ///< get a byte
virtual int get_buffer(uint8_t *p_dst, int p_length) const;
virtual uint64_t get_buffer(uint8_t *p_dst, uint64_t p_length) const;
virtual Error get_error() const; ///< get last error
virtual void flush();
virtual void store_8(uint8_t p_dest); ///< store a byte
virtual bool file_exists(const String &p_name); ///< return true if a file exists
virtual uint64_t _get_modified_time(const String &p_file) { return 0; } // todo

View File

@@ -47,21 +47,20 @@ const char *HTTPClient::_methods[METHOD_MAX] = {
#ifndef JAVASCRIPT_ENABLED
Error HTTPClient::connect_to_host(const String &p_host, int p_port, bool p_ssl, bool p_verify_host) {
close();
conn_port = p_port;
conn_host = p_host;
ip_candidates.clear();
ssl = p_ssl;
ssl_verify_host = p_verify_host;
String host_lower = conn_host.to_lower();
if (host_lower.begins_with("http://")) {
conn_host = conn_host.substr(7, conn_host.length() - 7);
} else if (host_lower.begins_with("https://")) {
ssl = true;
conn_host = conn_host.substr(8, conn_host.length() - 8);
}
@@ -97,7 +96,6 @@ Error HTTPClient::connect_to_host(const String &p_host, int p_port, bool p_ssl,
}
void HTTPClient::set_connection(const Ref<StreamPeer> &p_connection) {
ERR_FAIL_COND_MSG(p_connection.is_null(), "Connection is not a reference to a valid StreamPeer object.");
if (ssl) {
@@ -115,7 +113,6 @@ void HTTPClient::set_connection(const Ref<StreamPeer> &p_connection) {
}
Ref<StreamPeer> HTTPClient::get_connection() const {
return connection;
}
@@ -212,7 +209,6 @@ Error HTTPClient::request_raw(Method p_method, const String &p_url, const Vector
}
Error HTTPClient::request(Method p_method, const String &p_url, const Vector<String> &p_headers, const String &p_body) {
ERR_FAIL_INDEX_V(p_method, METHOD_MAX, ERR_INVALID_PARAMETER);
ERR_FAIL_COND_V(!_check_request_url(p_method, p_url), ERR_INVALID_PARAMETER);
ERR_FAIL_COND_V(status != STATUS_CONNECTED, ERR_INVALID_PARAMETER);
@@ -274,27 +270,23 @@ Error HTTPClient::request(Method p_method, const String &p_url, const Vector<Str
}
bool HTTPClient::has_response() const {
return response_headers.size() != 0;
}
bool HTTPClient::is_response_chunked() const {
return chunked;
}
int HTTPClient::get_response_code() const {
return response_num;
}
Error HTTPClient::get_response_headers(List<String> *r_response) {
if (!response_headers.size())
if (!response_headers.size()) {
return ERR_INVALID_PARAMETER;
}
for (int i = 0; i < response_headers.size(); i++) {
r_response->push_back(response_headers[i]);
}
@@ -304,34 +296,32 @@ Error HTTPClient::get_response_headers(List<String> *r_response) {
}
void HTTPClient::close() {
if (tcp_connection->get_status() != StreamPeerTCP::STATUS_NONE)
if (tcp_connection->get_status() != StreamPeerTCP::STATUS_NONE) {
tcp_connection->disconnect_from_host();
}
connection.unref();
status = STATUS_DISCONNECTED;
head_request = false;
if (resolving != IP::RESOLVER_INVALID_ID) {
IP::get_singleton()->erase_resolve_item(resolving);
resolving = IP::RESOLVER_INVALID_ID;
}
ip_candidates.clear();
response_headers.clear();
response_str.clear();
body_size = -1;
body_left = 0;
chunk_left = 0;
chunk_trailer_part = 0;
chunk_trailer_part = false;
read_until_eof = false;
response_num = 0;
handshaking = false;
}
Error HTTPClient::poll() {
switch (status) {
case STATUS_RESOLVING: {
ERR_FAIL_COND_V(resolving == IP::RESOLVER_INVALID_ID, ERR_BUG);
@@ -341,11 +331,17 @@ Error HTTPClient::poll() {
return OK; // Still resolving
case IP::RESOLVER_STATUS_DONE: {
IP_Address host = IP::get_singleton()->get_resolve_item_address(resolving);
Error err = tcp_connection->connect_to_host(host, conn_port);
ip_candidates = IP::get_singleton()->get_resolve_item_addresses(resolving);
IP::get_singleton()->erase_resolve_item(resolving);
resolving = IP::RESOLVER_INVALID_ID;
Error err = ERR_BUG; // Should be at least one entry.
while (ip_candidates.size() > 0) {
err = tcp_connection->connect_to_host(ip_candidates.pop_front(), conn_port);
if (err == OK) {
break;
}
}
if (err) {
status = STATUS_CANT_CONNECT;
return err;
@@ -355,7 +351,6 @@ Error HTTPClient::poll() {
} break;
case IP::RESOLVER_STATUS_NONE:
case IP::RESOLVER_STATUS_ERROR: {
IP::get_singleton()->erase_resolve_item(resolving);
resolving = IP::RESOLVER_INVALID_ID;
close();
@@ -365,10 +360,8 @@ Error HTTPClient::poll() {
}
} break;
case STATUS_CONNECTING: {
StreamPeerTCP::Status s = tcp_connection->get_status();
switch (s) {
case StreamPeerTCP::STATUS_CONNECTING: {
return OK;
} break;
@@ -389,7 +382,7 @@ Error HTTPClient::poll() {
handshaking = true;
} else {
// We are already handshaking, which means we can use your already active SSL connection
ssl = static_cast<Ref<StreamPeerSSL> >(connection);
ssl = static_cast<Ref<StreamPeerSSL>>(connection);
if (ssl.is_null()) {
close();
status = STATUS_SSL_HANDSHAKE_ERROR;
@@ -402,6 +395,7 @@ Error HTTPClient::poll() {
if (ssl->get_status() == StreamPeerSSL::STATUS_CONNECTED) {
// Handshake has been successful
handshaking = false;
ip_candidates.clear();
status = STATUS_CONNECTED;
return OK;
} else if (ssl->get_status() != StreamPeerSSL::STATUS_HANDSHAKING) {
@@ -412,16 +406,24 @@ Error HTTPClient::poll() {
}
// ... we will need to poll more for handshake to finish
} else {
ip_candidates.clear();
status = STATUS_CONNECTED;
}
return OK;
} break;
case StreamPeerTCP::STATUS_ERROR:
case StreamPeerTCP::STATUS_NONE: {
Error err = ERR_CANT_CONNECT;
while (ip_candidates.size() > 0) {
tcp_connection->disconnect_from_host();
err = tcp_connection->connect_to_host(ip_candidates.pop_front(), conn_port);
if (err == OK) {
return OK;
}
}
close();
status = STATUS_CANT_CONNECT;
return ERR_CANT_CONNECT;
return err;
} break;
}
} break;
@@ -443,7 +445,6 @@ Error HTTPClient::poll() {
return OK;
} break;
case STATUS_REQUESTING: {
while (true) {
uint8_t byte;
int rec = 0;
@@ -454,15 +455,15 @@ Error HTTPClient::poll() {
return ERR_CONNECTION_ERROR;
}
if (rec == 0)
if (rec == 0) {
return OK; // Still requesting, keep trying!
}
response_str.push_back(byte);
int rs = response_str.size();
if (
(rs >= 2 && response_str[rs - 2] == '\n' && response_str[rs - 1] == '\n') ||
(rs >= 4 && response_str[rs - 4] == '\r' && response_str[rs - 3] == '\n' && response_str[rs - 2] == '\r' && response_str[rs - 1] == '\n')) {
// End of response, parse.
response_str.push_back(0);
String response;
@@ -484,11 +485,11 @@ Error HTTPClient::poll() {
bool keep_alive = true;
for (int i = 0; i < responses.size(); i++) {
String header = responses[i].strip_edges();
String s = header.to_lower();
if (s.length() == 0)
if (s.length() == 0) {
continue;
}
if (s.begins_with("content-length:")) {
body_size = s.substr(s.find(":") + 1, s.length()).strip_edges().to_int();
body_left = body_size;
@@ -503,11 +504,9 @@ Error HTTPClient::poll() {
}
if (i == 0 && responses[i].begins_with("HTTP")) {
String num = responses[i].get_slicec(' ', 1);
response_num = num.to_int();
} else {
response_headers.push_back(header);
}
}
@@ -519,14 +518,11 @@ Error HTTPClient::poll() {
}
if (body_size != -1 || chunked) {
status = STATUS_BODY;
} else if (!keep_alive) {
read_until_eof = true;
status = STATUS_BODY;
} else {
status = STATUS_CONNECTED;
}
return OK;
@@ -552,29 +548,26 @@ Error HTTPClient::poll() {
}
int HTTPClient::get_response_body_length() const {
return body_size;
}
PoolByteArray HTTPClient::read_response_body_chunk() {
ERR_FAIL_COND_V(status != STATUS_BODY, PoolByteArray());
PoolByteArray ret;
Error err = OK;
if (chunked) {
while (true) {
if (chunk_trailer_part) {
// We need to consume the trailer part too or keep-alive will break
uint8_t b;
int rec = 0;
err = _get_http_data(&b, 1, rec);
if (rec == 0)
if (rec == 0) {
break;
}
chunk.push_back(b);
int cs = chunk.size();
@@ -596,8 +589,9 @@ PoolByteArray HTTPClient::read_response_body_chunk() {
int rec = 0;
err = _get_http_data(&b, 1, rec);
if (rec == 0)
if (rec == 0) {
break;
}
chunk.push_back(b);
@@ -608,18 +602,17 @@ PoolByteArray HTTPClient::read_response_body_chunk() {
}
if (chunk.size() > 2 && chunk[chunk.size() - 2] == '\r' && chunk[chunk.size() - 1] == '\n') {
int len = 0;
for (int i = 0; i < chunk.size() - 2; i++) {
char c = chunk[i];
int v = 0;
if (c >= '0' && c <= '9')
if (c >= '0' && c <= '9') {
v = c - '0';
else if (c >= 'a' && c <= 'f')
} else if (c >= 'a' && c <= 'f') {
v = c - 'a' + 10;
else if (c >= 'A' && c <= 'F')
} else if (c >= 'A' && c <= 'F') {
v = c - 'A' + 10;
else {
} else {
ERR_PRINT("HTTP Chunk len not in hex!!");
status = STATUS_CONNECTION_ERROR;
break;
@@ -644,7 +637,6 @@ PoolByteArray HTTPClient::read_response_body_chunk() {
chunk.resize(chunk_left);
}
} else {
int rec = 0;
err = _get_http_data(&chunk.write[chunk.size() - chunk_left], chunk_left, rec);
if (rec == 0) {
@@ -653,7 +645,6 @@ PoolByteArray HTTPClient::read_response_body_chunk() {
chunk_left -= rec;
if (chunk_left == 0) {
if (chunk[chunk.size() - 2] != '\r' || chunk[chunk.size() - 1] != '\n') {
ERR_PRINT("HTTP Invalid chunk terminator (not \\r\\n)");
status = STATUS_CONNECTION_ERROR;
@@ -662,7 +653,7 @@ PoolByteArray HTTPClient::read_response_body_chunk() {
ret.resize(chunk.size() - 2);
PoolByteArray::Write w = ret.write();
copymem(w.ptr(), chunk.ptr(), chunk.size() - 2);
memcpy(w.ptr(), chunk.ptr(), chunk.size() - 2);
chunk.clear();
}
@@ -671,7 +662,6 @@ PoolByteArray HTTPClient::read_response_body_chunk() {
}
} else {
int to_read = !read_until_eof ? MIN(body_left, read_chunk_size) : read_chunk_size;
ret.resize(to_read);
int _offset = 0;
@@ -691,24 +681,22 @@ PoolByteArray HTTPClient::read_response_body_chunk() {
body_left -= rec;
}
}
if (err != OK)
if (err != OK) {
ret.resize(_offset);
break;
}
}
}
if (err != OK) {
close();
if (err == ERR_FILE_EOF) {
status = STATUS_DISCONNECTED; // Server disconnected
} else {
status = STATUS_CONNECTION_ERROR;
}
} else if (body_left == 0 && !chunked && !read_until_eof) {
status = STATUS_CONNECTED;
}
@@ -716,24 +704,19 @@ PoolByteArray HTTPClient::read_response_body_chunk() {
}
HTTPClient::Status HTTPClient::get_status() const {
return status;
}
void HTTPClient::set_blocking_mode(bool p_enable) {
blocking = p_enable;
}
bool HTTPClient::is_blocking_mode_enabled() const {
return blocking;
}
Error HTTPClient::_get_http_data(uint8_t *p_buffer, int p_bytes, int &r_received) {
if (blocking) {
// We can't use StreamPeer.get_data, since when reaching EOF we will get an
// error without knowing how many bytes we received.
Error err = ERR_FILE_EOF;
@@ -768,7 +751,6 @@ int HTTPClient::get_read_chunk_size() const {
}
HTTPClient::HTTPClient() {
tcp_connection.instance();
resolving = IP::RESOLVER_INVALID_ID;
status = STATUS_DISCONNECTED;
@@ -824,15 +806,15 @@ String HTTPClient::query_string_from_dict(const Dictionary &p_dict) {
}
Dictionary HTTPClient::_get_response_headers_as_dictionary() {
List<String> rh;
get_response_headers(&rh);
Dictionary ret;
for (const List<String>::Element *E = rh.front(); E; E = E->next()) {
const String &s = E->get();
int sp = s.find(":");
if (sp == -1)
if (sp == -1) {
continue;
}
String key = s.substr(0, sp).strip_edges();
String value = s.substr(sp + 1, s.length()).strip_edges();
ret[key] = value;
@@ -842,7 +824,6 @@ Dictionary HTTPClient::_get_response_headers_as_dictionary() {
}
PoolStringArray HTTPClient::_get_response_headers() {
List<String> rh;
get_response_headers(&rh);
PoolStringArray ret;
@@ -856,7 +837,6 @@ PoolStringArray HTTPClient::_get_response_headers() {
}
void HTTPClient::_bind_methods() {
ClassDB::bind_method(D_METHOD("connect_to_host", "host", "port", "use_ssl", "verify_host"), &HTTPClient::connect_to_host, DEFVAL(-1), DEFVAL(false), DEFVAL(true));
ClassDB::bind_method(D_METHOD("set_connection", "connection"), &HTTPClient::set_connection);
ClassDB::bind_method(D_METHOD("get_connection"), &HTTPClient::get_connection);

View File

@@ -37,7 +37,6 @@
#include "core/reference.h"
class HTTPClient : public Reference {
GDCLASS(HTTPClient, Reference);
public:
@@ -160,6 +159,7 @@ private:
#ifndef JAVASCRIPT_ENABLED
Status status;
IP::ResolverID resolving;
Array ip_candidates;
int conn_port;
String conn_host;
bool ssl;

View File

@@ -33,13 +33,12 @@
#include "core/print_string.h"
bool ImageFormatLoader::recognize(const String &p_extension) const {
List<String> extensions;
get_recognized_extensions(&extensions);
for (List<String>::Element *E = extensions.front(); E; E = E->next()) {
if (E->get().nocasecmp_to(p_extension) == 0)
if (E->get().nocasecmp_to(p_extension) == 0) {
return true;
}
}
return false;
@@ -53,7 +52,7 @@ Error ImageLoader::load_image(String p_file, Ref<Image> p_image, FileAccess *p_c
Error err;
f = FileAccess::open(p_file, FileAccess::READ, &err);
if (!f) {
ERR_PRINTS("Error opening file '" + p_file + "'.");
ERR_PRINT("Error opening file '" + p_file + "'.");
return err;
}
}
@@ -61,67 +60,61 @@ Error ImageLoader::load_image(String p_file, Ref<Image> p_image, FileAccess *p_c
String extension = p_file.get_extension();
for (int i = 0; i < loader.size(); i++) {
if (!loader[i]->recognize(extension))
if (!loader[i]->recognize(extension)) {
continue;
}
Error err = loader[i]->load_image(p_image, f, p_force_linear, p_scale);
if (err != OK) {
ERR_PRINTS("Error loading image: " + p_file);
ERR_PRINT("Error loading image: " + p_file);
}
if (err != ERR_FILE_UNRECOGNIZED) {
if (!p_custom)
if (!p_custom) {
memdelete(f);
}
return err;
}
}
if (!p_custom)
if (!p_custom) {
memdelete(f);
}
return ERR_FILE_UNRECOGNIZED;
}
void ImageLoader::get_recognized_extensions(List<String> *p_extensions) {
for (int i = 0; i < loader.size(); i++) {
loader[i]->get_recognized_extensions(p_extensions);
}
}
ImageFormatLoader *ImageLoader::recognize(const String &p_extension) {
for (int i = 0; i < loader.size(); i++) {
if (loader[i]->recognize(p_extension))
if (loader[i]->recognize(p_extension)) {
return loader[i];
}
}
return NULL;
return nullptr;
}
Vector<ImageFormatLoader *> ImageLoader::loader;
void ImageLoader::add_image_format_loader(ImageFormatLoader *p_loader) {
loader.push_back(p_loader);
}
void ImageLoader::remove_image_format_loader(ImageFormatLoader *p_loader) {
loader.erase(p_loader);
}
const Vector<ImageFormatLoader *> &ImageLoader::get_image_format_loaders() {
return loader;
}
void ImageLoader::cleanup() {
while (loader.size()) {
remove_image_format_loader(loader[0]);
}
@@ -130,7 +123,6 @@ void ImageLoader::cleanup() {
/////////////////
RES ResourceFormatLoaderImage::load(const String &p_path, const String &p_original_path, Error *r_error) {
FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
if (!f) {
if (r_error) {
@@ -192,16 +184,13 @@ RES ResourceFormatLoaderImage::load(const String &p_path, const String &p_origin
}
void ResourceFormatLoaderImage::get_recognized_extensions(List<String> *p_extensions) const {
p_extensions->push_back("image");
}
bool ResourceFormatLoaderImage::handles_type(const String &p_type) const {
return p_type == "Image";
}
String ResourceFormatLoaderImage::get_resource_type(const String &p_path) const {
return p_path.get_extension().to_lower() == "image" ? "Image" : String();
}

View File

@@ -53,13 +53,12 @@ public:
};
class ImageLoader {
static Vector<ImageFormatLoader *> loader;
friend class ResourceFormatLoaderImage;
protected:
public:
static Error load_image(String p_file, Ref<Image> p_image, FileAccess *p_custom = NULL, bool p_force_linear = false, float p_scale = 1.0);
static Error load_image(String p_file, Ref<Image> p_image, FileAccess *p_custom = nullptr, bool p_force_linear = false, float p_scale = 1.0);
static void get_recognized_extensions(List<String> *p_extensions);
static ImageFormatLoader *recognize(const String &p_extension);
@@ -73,7 +72,7 @@ public:
class ResourceFormatLoaderImage : public ResourceFormatLoader {
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;
virtual String get_resource_type(const String &p_path) const;

View File

@@ -39,17 +39,15 @@ VARIANT_ENUM_CAST(IP::ResolverStatus);
/************* RESOLVER ******************/
struct _IP_ResolverPrivate {
struct QueueItem {
SafeNumeric<IP::ResolverStatus> status;
IP_Address response;
List<IP_Address> response;
String hostname;
IP::Type type;
void clear() {
status.set(IP::RESOLVER_STATUS_NONE);
response = IP_Address();
response.clear();
type = IP::TYPE_NONE;
hostname = "";
};
@@ -62,10 +60,10 @@ struct _IP_ResolverPrivate {
QueueItem queue[IP::RESOLVER_MAX_QUERIES];
IP::ResolverID find_empty_id() const {
for (int i = 0; i < IP::RESOLVER_MAX_QUERIES; i++) {
if (queue[i].status.get() == IP::RESOLVER_STATUS_NONE)
if (queue[i].status.get() == IP::RESOLVER_STATUS_NONE) {
return i;
}
}
return IP::RESOLVER_INVALID_ID;
}
@@ -78,35 +76,41 @@ struct _IP_ResolverPrivate {
bool thread_abort;
void resolve_queues() {
for (int i = 0; i < IP::RESOLVER_MAX_QUERIES; i++) {
if (queue[i].status.get() != IP::RESOLVER_STATUS_WAITING)
if (queue[i].status.get() != IP::RESOLVER_STATUS_WAITING) {
continue;
queue[i].response = IP::get_singleton()->resolve_hostname(queue[i].hostname, queue[i].type);
}
if (!queue[i].response.is_valid())
queue[i].status.set(IP::RESOLVER_STATUS_ERROR);
else
queue[i].status.set(IP::RESOLVER_STATUS_DONE);
mutex.lock();
List<IP_Address> response;
String hostname = queue[i].hostname;
IP::Type type = queue[i].type;
mutex.unlock();
// We should not lock while resolving the hostname,
// only when modifying the queue.
IP::get_singleton()->_resolve_hostname(response, hostname, type);
MutexLock lock(mutex);
// Could have been completed by another function, or deleted.
if (queue[i].status.get() != IP::RESOLVER_STATUS_WAITING) {
continue;
}
queue[i].response = response;
queue[i].status.set(response.empty() ? IP::RESOLVER_STATUS_ERROR : IP::RESOLVER_STATUS_DONE);
}
}
static void _thread_function(void *self) {
_IP_ResolverPrivate *ipr = (_IP_ResolverPrivate *)self;
while (!ipr->thread_abort) {
ipr->sem.wait();
ipr->mutex.lock();
ipr->resolve_queues();
ipr->mutex.unlock();
}
}
HashMap<String, IP_Address> cache;
HashMap<String, List<IP_Address>> cache;
static String get_cache_key(String p_hostname, IP::Type p_type) {
return itos(p_type) + p_hostname;
@@ -114,101 +118,149 @@ struct _IP_ResolverPrivate {
};
IP_Address IP::resolve_hostname(const String &p_hostname, IP::Type p_type) {
List<IP_Address> res;
String key = _IP_ResolverPrivate::get_cache_key(p_hostname, p_type);
resolver->mutex.lock();
String key = _IP_ResolverPrivate::get_cache_key(p_hostname, p_type);
if (resolver->cache.has(key) && resolver->cache[key].is_valid()) {
IP_Address res = resolver->cache[key];
if (resolver->cache.has(key)) {
res = resolver->cache[key];
} else {
// This should be run unlocked so the resolver thread can keep
// resolving other requests.
resolver->mutex.unlock();
return res;
_resolve_hostname(res, p_hostname, p_type);
resolver->mutex.lock();
// We might be overriding another result, but we don't care (they are the
// same hostname).
resolver->cache[key] = res;
}
IP_Address res = _resolve_hostname(p_hostname, p_type);
resolver->cache[key] = res;
resolver->mutex.unlock();
return res;
for (int i = 0; i < res.size(); ++i) {
if (res[i].is_valid()) {
return res[i];
}
}
return IP_Address();
}
Array IP::resolve_hostname_addresses(const String &p_hostname, Type p_type) {
List<IP_Address> res;
String key = _IP_ResolverPrivate::get_cache_key(p_hostname, p_type);
resolver->mutex.lock();
if (resolver->cache.has(key)) {
res = resolver->cache[key];
} else {
// This should be run unlocked so the resolver thread can keep resolving
// other requests.
resolver->mutex.unlock();
_resolve_hostname(res, p_hostname, p_type);
resolver->mutex.lock();
// We might be overriding another result, but we don't care (they are the
// same hostname).
resolver->cache[key] = res;
}
resolver->mutex.unlock();
Array result;
for (int i = 0; i < res.size(); ++i) {
if (res[i].is_valid()) {
result.push_back(String(res[i]));
}
}
return result;
}
IP::ResolverID IP::resolve_hostname_queue_item(const String &p_hostname, IP::Type p_type) {
resolver->mutex.lock();
MutexLock lock(resolver->mutex);
ResolverID id = resolver->find_empty_id();
if (id == RESOLVER_INVALID_ID) {
WARN_PRINT("Out of resolver queries");
resolver->mutex.unlock();
return id;
}
String key = _IP_ResolverPrivate::get_cache_key(p_hostname, p_type);
resolver->queue[id].hostname = p_hostname;
resolver->queue[id].type = p_type;
if (resolver->cache.has(key) && resolver->cache[key].is_valid()) {
if (resolver->cache.has(key)) {
resolver->queue[id].response = resolver->cache[key];
resolver->queue[id].status.set(IP::RESOLVER_STATUS_DONE);
} else {
resolver->queue[id].response = IP_Address();
resolver->queue[id].response = List<IP_Address>();
resolver->queue[id].status.set(IP::RESOLVER_STATUS_WAITING);
if (resolver->thread.is_started())
if (resolver->thread.is_started()) {
resolver->sem.post();
else
} else {
resolver->resolve_queues();
}
}
resolver->mutex.unlock();
return id;
}
IP::ResolverStatus IP::get_resolve_item_status(ResolverID p_id) const {
ERR_FAIL_INDEX_V(p_id, IP::RESOLVER_MAX_QUERIES, IP::RESOLVER_STATUS_NONE);
resolver->mutex.lock();
if (resolver->queue[p_id].status.get() == IP::RESOLVER_STATUS_NONE) {
IP::ResolverStatus res = resolver->queue[p_id].status.get();
if (res == IP::RESOLVER_STATUS_NONE) {
ERR_PRINT("Condition status == IP::RESOLVER_STATUS_NONE");
resolver->mutex.unlock();
return IP::RESOLVER_STATUS_NONE;
}
IP::ResolverStatus res = resolver->queue[p_id].status.get();
resolver->mutex.unlock();
return res;
}
IP_Address IP::get_resolve_item_address(ResolverID p_id) const {
ERR_FAIL_INDEX_V(p_id, IP::RESOLVER_MAX_QUERIES, IP_Address());
resolver->mutex.lock();
MutexLock lock(resolver->mutex);
if (resolver->queue[p_id].status.get() != IP::RESOLVER_STATUS_DONE) {
ERR_PRINTS("Resolve of '" + resolver->queue[p_id].hostname + "'' didn't complete yet.");
resolver->mutex.unlock();
ERR_PRINT("Resolve of '" + resolver->queue[p_id].hostname + "'' didn't complete yet.");
return IP_Address();
}
IP_Address res = resolver->queue[p_id].response;
List<IP_Address> res = resolver->queue[p_id].response;
resolver->mutex.unlock();
return res;
for (int i = 0; i < res.size(); ++i) {
if (res[i].is_valid()) {
return res[i];
}
}
return IP_Address();
}
Array IP::get_resolve_item_addresses(ResolverID p_id) const {
ERR_FAIL_INDEX_V(p_id, IP::RESOLVER_MAX_QUERIES, Array());
MutexLock lock(resolver->mutex);
if (resolver->queue[p_id].status.get() != IP::RESOLVER_STATUS_DONE) {
ERR_PRINT("Resolve of '" + resolver->queue[p_id].hostname + "'' didn't complete yet.");
return Array();
}
List<IP_Address> res = resolver->queue[p_id].response;
Array result;
for (int i = 0; i < res.size(); ++i) {
if (res[i].is_valid()) {
result.push_back(String(res[i]));
}
}
return result;
}
void IP::erase_resolve_item(ResolverID p_id) {
ERR_FAIL_INDEX(p_id, IP::RESOLVER_MAX_QUERIES);
resolver->mutex.lock();
resolver->queue[p_id].status.set(IP::RESOLVER_STATUS_NONE);
resolver->mutex.unlock();
}
void IP::clear_cache(const String &p_hostname) {
resolver->mutex.lock();
MutexLock lock(resolver->mutex);
if (p_hostname.empty()) {
resolver->cache.clear();
@@ -218,12 +270,9 @@ void IP::clear_cache(const String &p_hostname) {
resolver->cache.erase(_IP_ResolverPrivate::get_cache_key(p_hostname, IP::TYPE_IPV6));
resolver->cache.erase(_IP_ResolverPrivate::get_cache_key(p_hostname, IP::TYPE_ANY));
}
resolver->mutex.unlock();
}
Array IP::_get_local_addresses() const {
Array addresses;
List<IP_Address> ip_addresses;
get_local_addresses(&ip_addresses);
@@ -235,7 +284,6 @@ Array IP::_get_local_addresses() const {
}
Array IP::_get_local_interfaces() const {
Array results;
Map<String, Interface_Info> interfaces;
get_local_interfaces(&interfaces);
@@ -259,7 +307,6 @@ Array IP::_get_local_interfaces() const {
}
void IP::get_local_addresses(List<IP_Address> *r_addresses) const {
Map<String, Interface_Info> interfaces;
get_local_interfaces(&interfaces);
for (Map<String, Interface_Info>::Element *E = interfaces.front(); E; E = E->next()) {
@@ -270,11 +317,12 @@ void IP::get_local_addresses(List<IP_Address> *r_addresses) const {
}
void IP::_bind_methods() {
ClassDB::bind_method(D_METHOD("resolve_hostname", "host", "ip_type"), &IP::resolve_hostname, DEFVAL(IP::TYPE_ANY));
ClassDB::bind_method(D_METHOD("resolve_hostname_addresses", "host", "ip_type"), &IP::resolve_hostname_addresses, DEFVAL(IP::TYPE_ANY));
ClassDB::bind_method(D_METHOD("resolve_hostname_queue_item", "host", "ip_type"), &IP::resolve_hostname_queue_item, DEFVAL(IP::TYPE_ANY));
ClassDB::bind_method(D_METHOD("get_resolve_item_status", "id"), &IP::get_resolve_item_status);
ClassDB::bind_method(D_METHOD("get_resolve_item_address", "id"), &IP::get_resolve_item_address);
ClassDB::bind_method(D_METHOD("get_resolve_item_addresses", "id"), &IP::get_resolve_item_addresses);
ClassDB::bind_method(D_METHOD("erase_resolve_item", "id"), &IP::erase_resolve_item);
ClassDB::bind_method(D_METHOD("get_local_addresses"), &IP::_get_local_addresses);
ClassDB::bind_method(D_METHOD("get_local_interfaces"), &IP::_get_local_interfaces);
@@ -294,24 +342,21 @@ void IP::_bind_methods() {
BIND_ENUM_CONSTANT(TYPE_ANY);
}
IP *IP::singleton = NULL;
IP *IP::singleton = nullptr;
IP *IP::get_singleton() {
return singleton;
}
IP *(*IP::_create)() = NULL;
IP *(*IP::_create)() = nullptr;
IP *IP::create() {
ERR_FAIL_COND_V_MSG(singleton, NULL, "IP singleton already exist.");
ERR_FAIL_COND_V(!_create, NULL);
ERR_FAIL_COND_V_MSG(singleton, nullptr, "IP singleton already exist.");
ERR_FAIL_COND_V(!_create, nullptr);
return _create();
}
IP::IP() {
singleton = this;
resolver = memnew(_IP_ResolverPrivate);
@@ -320,7 +365,6 @@ IP::IP() {
}
IP::~IP() {
resolver->thread_abort = true;
resolver->sem.post();
resolver->thread.wait_to_finish();

View File

@@ -71,7 +71,6 @@ protected:
static IP *singleton;
static void _bind_methods();
virtual IP_Address _resolve_hostname(const String &p_hostname, Type p_type = TYPE_ANY) = 0;
Array _get_local_addresses() const;
Array _get_local_interfaces() const;
@@ -86,11 +85,15 @@ public:
};
IP_Address resolve_hostname(const String &p_hostname, Type p_type = TYPE_ANY);
Array resolve_hostname_addresses(const String &p_hostname, Type p_type = TYPE_ANY);
// async resolver hostname
ResolverID resolve_hostname_queue_item(const String &p_hostname, Type p_type = TYPE_ANY);
ResolverStatus get_resolve_item_status(ResolverID p_id) const;
IP_Address get_resolve_item_address(ResolverID p_id) const;
virtual void get_local_addresses(List<IP_Address> *r_addresses) const;
virtual void _resolve_hostname(List<IP_Address> &r_addresses, const String &p_hostname, Type p_type = TYPE_ANY) const = 0;
Array get_resolve_item_addresses(ResolverID p_id) const;
virtual void get_local_interfaces(Map<String, Interface_Info> *r_interfaces) const = 0;
void erase_resolve_item(ResolverID p_id);

View File

@@ -39,20 +39,23 @@ IP_Address::operator Variant() const {
#include <string.h>
IP_Address::operator String() const {
if (wildcard)
if (wildcard) {
return "*";
}
if (!valid)
if (!valid) {
return "";
}
if (is_ipv4())
if (is_ipv4()) {
// IPv4 address mapped to IPv6
return itos(field8[12]) + "." + itos(field8[13]) + "." + itos(field8[14]) + "." + itos(field8[15]);
}
String ret;
for (int i = 0; i < 8; i++) {
if (i > 0)
if (i > 0) {
ret = ret + ":";
}
uint16_t num = (field8[i * 2] << 8) + field8[i * 2 + 1];
ret = ret + String::num_int64(num, 16);
};
@@ -61,10 +64,8 @@ IP_Address::operator String() const {
}
static void _parse_hex(const String &p_string, int p_start, uint8_t *p_dst) {
uint16_t ret = 0;
for (int i = p_start; i < p_start + 4; i++) {
if (i >= p_string.length()) {
break;
};
@@ -72,7 +73,6 @@ static void _parse_hex(const String &p_string, int p_start, uint8_t *p_dst) {
int n = 0;
CharType c = p_string[i];
if (c >= '0' && c <= '9') {
n = c - '0';
} else if (c >= 'a' && c <= 'f') {
n = 10 + (c - 'a');
@@ -92,7 +92,6 @@ static void _parse_hex(const String &p_string, int p_start, uint8_t *p_dst) {
};
void IP_Address::_parse_ipv6(const String &p_string) {
static const int parts_total = 8;
int parts[parts_total] = { 0 };
int parts_count = 0;
@@ -102,10 +101,8 @@ void IP_Address::_parse_ipv6(const String &p_string) {
int parts_idx = 0;
for (int i = 0; i < p_string.length(); i++) {
CharType c = p_string[i];
if (c == ':') {
if (i == 0) {
continue; // next must be a ":"
};
@@ -115,7 +112,6 @@ void IP_Address::_parse_ipv6(const String &p_string) {
};
part_found = false;
} else if (c == '.') {
part_ipv4 = true;
} else if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')) {
@@ -136,9 +132,7 @@ void IP_Address::_parse_ipv6(const String &p_string) {
int idx = 0;
for (int i = 0; i < parts_idx; i++) {
if (parts[i] == -1) {
for (int j = 0; j < parts_extra; j++) {
field16[idx++] = 0;
};
@@ -154,7 +148,6 @@ void IP_Address::_parse_ipv6(const String &p_string) {
};
void IP_Address::_parse_ipv4(const String &p_string, int p_start, uint8_t *p_ret) {
String ip;
if (p_start != 0) {
ip = p_string.substr(p_start, p_string.length() - p_start);
@@ -170,7 +163,6 @@ void IP_Address::_parse_ipv4(const String &p_string, int p_start, uint8_t *p_ret
};
void IP_Address::clear() {
memset(&field8[0], 0, sizeof(field8));
valid = false;
wildcard = false;
@@ -199,12 +191,12 @@ const uint8_t *IP_Address::get_ipv6() const {
void IP_Address::set_ipv6(const uint8_t *p_buf) {
clear();
valid = true;
for (int i = 0; i < 16; i++)
for (int i = 0; i < 16; i++) {
field8[i] = p_buf[i];
}
}
IP_Address::IP_Address(const String &p_string) {
clear();
if (p_string == "*") {
@@ -228,7 +220,6 @@ IP_Address::IP_Address(const String &p_string) {
}
_FORCE_INLINE_ static void _32_to_buf(uint8_t *p_dst, uint32_t p_n) {
p_dst[0] = (p_n >> 24) & 0xff;
p_dst[1] = (p_n >> 16) & 0xff;
p_dst[2] = (p_n >> 8) & 0xff;
@@ -236,7 +227,6 @@ _FORCE_INLINE_ static void _32_to_buf(uint8_t *p_dst, uint32_t p_n) {
};
IP_Address::IP_Address(uint32_t p_a, uint32_t p_b, uint32_t p_c, uint32_t p_d, bool is_v6) {
clear();
valid = true;
if (!is_v6) {
@@ -247,7 +237,6 @@ IP_Address::IP_Address(uint32_t p_a, uint32_t p_b, uint32_t p_c, uint32_t p_d, b
field8[14] = p_c;
field8[15] = p_d;
} else {
_32_to_buf(&field8[0], p_a);
_32_to_buf(&field8[4], p_b);
_32_to_buf(&field8[8], p_c);

View File

@@ -34,7 +34,6 @@
#include "core/ustring.h"
struct IP_Address {
private:
union {
uint8_t field8[16];
@@ -52,19 +51,31 @@ protected:
public:
//operator Variant() const;
bool operator==(const IP_Address &p_ip) const {
if (p_ip.valid != valid) return false;
if (!valid) return false;
for (int i = 0; i < 4; i++)
if (field32[i] != p_ip.field32[i])
if (p_ip.valid != valid) {
return false;
}
if (!valid) {
return false;
}
for (int i = 0; i < 4; i++) {
if (field32[i] != p_ip.field32[i]) {
return false;
}
}
return true;
}
bool operator!=(const IP_Address &p_ip) const {
if (p_ip.valid != valid) return true;
if (!valid) return true;
for (int i = 0; i < 4; i++)
if (field32[i] != p_ip.field32[i])
if (p_ip.valid != valid) {
return true;
}
if (!valid) {
return true;
}
for (int i = 0; i < 4; i++) {
if (field32[i] != p_ip.field32[i]) {
return true;
}
}
return false;
}

View File

@@ -46,17 +46,16 @@ const char *JSON::tk_name[TK_MAX] = {
};
static String _make_indent(const String &p_indent, int p_size) {
String indent_text = "";
if (!p_indent.empty()) {
for (int i = 0; i < p_size; i++)
for (int i = 0; i < p_size; i++) {
indent_text += p_indent;
}
}
return indent_text;
}
String JSON::_print_var(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys) {
String JSON::_print_var(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys, Set<const void *> &p_markers) {
String colon = ":";
String end_statement = "";
@@ -66,70 +65,79 @@ String JSON::_print_var(const Variant &p_var, const String &p_indent, int p_cur_
}
switch (p_var.get_type()) {
case Variant::NIL: return "null";
case Variant::BOOL: return p_var.operator bool() ? "true" : "false";
case Variant::INT: return itos(p_var);
case Variant::REAL: return rtos(p_var);
case Variant::NIL:
return "null";
case Variant::BOOL:
return p_var.operator bool() ? "true" : "false";
case Variant::INT:
return itos(p_var);
case Variant::REAL:
return rtos(p_var);
case Variant::POOL_INT_ARRAY:
case Variant::POOL_REAL_ARRAY:
case Variant::POOL_STRING_ARRAY:
case Variant::ARRAY: {
String s = "[";
s += end_statement;
Array a = p_var;
ERR_FAIL_COND_V_MSG(p_markers.has(a.id()), "\"[...]\"", "Converting circular structure to JSON.");
p_markers.insert(a.id());
for (int i = 0; i < a.size(); i++) {
if (i > 0) {
s += ",";
s += end_statement;
}
s += _make_indent(p_indent, p_cur_indent + 1) + _print_var(a[i], p_indent, p_cur_indent + 1, p_sort_keys);
s += _make_indent(p_indent, p_cur_indent + 1) + _print_var(a[i], p_indent, p_cur_indent + 1, p_sort_keys, p_markers);
}
s += end_statement + _make_indent(p_indent, p_cur_indent) + "]";
p_markers.erase(a.id());
return s;
};
case Variant::DICTIONARY: {
String s = "{";
s += end_statement;
Dictionary d = p_var;
ERR_FAIL_COND_V_MSG(p_markers.has(d.id()), "\"{...}\"", "Converting circular structure to JSON.");
p_markers.insert(d.id());
List<Variant> keys;
d.get_key_list(&keys);
if (p_sort_keys)
if (p_sort_keys) {
keys.sort();
}
for (List<Variant>::Element *E = keys.front(); E; E = E->next()) {
if (E != keys.front()) {
s += ",";
s += end_statement;
}
s += _make_indent(p_indent, p_cur_indent + 1) + _print_var(String(E->get()), p_indent, p_cur_indent + 1, p_sort_keys);
s += _make_indent(p_indent, p_cur_indent + 1) + _print_var(String(E->get()), p_indent, p_cur_indent + 1, p_sort_keys, p_markers);
s += colon;
s += _print_var(d[E->get()], p_indent, p_cur_indent + 1, p_sort_keys);
s += _print_var(d[E->get()], p_indent, p_cur_indent + 1, p_sort_keys, p_markers);
}
s += end_statement + _make_indent(p_indent, p_cur_indent) + "}";
p_markers.erase(d.id());
return s;
};
default: return "\"" + String(p_var).json_escape() + "\"";
default:
return "\"" + String(p_var).json_escape() + "\"";
}
}
String JSON::print(const Variant &p_var, const String &p_indent, bool p_sort_keys) {
return _print_var(p_var, p_indent, 0, p_sort_keys);
Set<const void *> markers;
return _print_var(p_var, p_indent, 0, p_sort_keys, markers);
}
Error JSON::_get_token(const CharType *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str) {
while (p_len > 0) {
switch (p_str[index]) {
case '\n': {
line++;
index++;
break;
@@ -139,43 +147,36 @@ Error JSON::_get_token(const CharType *p_str, int &index, int p_len, Token &r_to
return OK;
} break;
case '{': {
r_token.type = TK_CURLY_BRACKET_OPEN;
index++;
return OK;
};
case '}': {
r_token.type = TK_CURLY_BRACKET_CLOSE;
index++;
return OK;
};
case '[': {
r_token.type = TK_BRACKET_OPEN;
index++;
return OK;
};
case ']': {
r_token.type = TK_BRACKET_CLOSE;
index++;
return OK;
};
case ':': {
r_token.type = TK_COLON;
index++;
return OK;
};
case ',': {
r_token.type = TK_COMMA;
index++;
return OK;
};
case '"': {
index++;
String str;
while (true) {
@@ -196,12 +197,21 @@ Error JSON::_get_token(const CharType *p_str, int &index, int p_len, Token &r_to
CharType res = 0;
switch (next) {
case 'b': res = 8; break;
case 't': res = 9; break;
case 'n': res = 10; break;
case 'f': res = 12; break;
case 'r': res = 13; break;
case 'b':
res = 8;
break;
case 't':
res = 9;
break;
case 'n':
res = 10;
break;
case 'f':
res = 12;
break;
case 'r':
res = 13;
break;
case 'u': {
//hexnumbarh - oct is deprecated
@@ -212,7 +222,6 @@ Error JSON::_get_token(const CharType *p_str, int &index, int p_len, Token &r_to
return ERR_PARSE_ERROR;
}
if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'))) {
r_err_str = "Malformed hex constant in string";
return ERR_PARSE_ERROR;
}
@@ -249,8 +258,9 @@ Error JSON::_get_token(const CharType *p_str, int &index, int p_len, Token &r_to
str += res;
} else {
if (p_str[index] == '\n')
if (p_str[index] == '\n') {
line++;
}
str += p_str[index];
}
index++;
@@ -262,7 +272,6 @@ Error JSON::_get_token(const CharType *p_str, int &index, int p_len, Token &r_to
} break;
default: {
if (p_str[index] <= 32) {
index++;
break;
@@ -278,11 +287,9 @@ Error JSON::_get_token(const CharType *p_str, int &index, int p_len, Token &r_to
return OK;
} else if ((p_str[index] >= 'A' && p_str[index] <= 'Z') || (p_str[index] >= 'a' && p_str[index] <= 'z')) {
String id;
while ((p_str[index] >= 'A' && p_str[index] <= 'Z') || (p_str[index] >= 'a' && p_str[index] <= 'z')) {
id += p_str[index];
index++;
}
@@ -302,73 +309,60 @@ Error JSON::_get_token(const CharType *p_str, int &index, int p_len, Token &r_to
}
Error JSON::_parse_value(Variant &value, Token &token, const CharType *p_str, int &index, int p_len, int &line, String &r_err_str) {
if (token.type == TK_CURLY_BRACKET_OPEN) {
Dictionary d;
Error err = _parse_object(d, p_str, index, p_len, line, r_err_str);
if (err)
if (err) {
return err;
}
value = d;
return OK;
} else if (token.type == TK_BRACKET_OPEN) {
Array a;
Error err = _parse_array(a, p_str, index, p_len, line, r_err_str);
if (err)
if (err) {
return err;
}
value = a;
return OK;
} else if (token.type == TK_IDENTIFIER) {
String id = token.value;
if (id == "true")
if (id == "true") {
value = true;
else if (id == "false")
} else if (id == "false") {
value = false;
else if (id == "null")
} else if (id == "null") {
value = Variant();
else {
} else {
r_err_str = "Expected 'true','false' or 'null', got '" + id + "'.";
return ERR_PARSE_ERROR;
}
return OK;
} else if (token.type == TK_NUMBER) {
value = token.value;
return OK;
} else if (token.type == TK_STRING) {
value = token.value;
return OK;
} else {
r_err_str = "Expected value, got " + String(tk_name[token.type]) + ".";
return ERR_PARSE_ERROR;
}
return OK;
}
Error JSON::_parse_array(Array &array, const CharType *p_str, int &index, int p_len, int &line, String &r_err_str) {
Token token;
bool need_comma = false;
while (index < p_len) {
Error err = _get_token(p_str, index, p_len, token, line, r_err_str);
if (err != OK)
if (err != OK) {
return err;
}
if (token.type == TK_BRACKET_CLOSE) {
return OK;
}
if (need_comma) {
if (token.type != TK_COMMA) {
r_err_str = "Expected ','";
return ERR_PARSE_ERROR;
} else {
@@ -379,8 +373,9 @@ Error JSON::_parse_array(Array &array, const CharType *p_str, int &index, int p_
Variant v;
err = _parse_value(v, token, p_str, index, p_len, line, r_err_str);
if (err)
if (err) {
return err;
}
array.push_back(v);
need_comma = true;
@@ -391,29 +386,24 @@ Error JSON::_parse_array(Array &array, const CharType *p_str, int &index, int p_
}
Error JSON::_parse_object(Dictionary &object, const CharType *p_str, int &index, int p_len, int &line, String &r_err_str) {
bool at_key = true;
String key;
Token token;
bool need_comma = false;
while (index < p_len) {
if (at_key) {
Error err = _get_token(p_str, index, p_len, token, line, r_err_str);
if (err != OK)
if (err != OK) {
return err;
}
if (token.type == TK_CURLY_BRACKET_CLOSE) {
return OK;
}
if (need_comma) {
if (token.type != TK_COMMA) {
r_err_str = "Expected '}' or ','";
return ERR_PARSE_ERROR;
} else {
@@ -423,31 +413,31 @@ Error JSON::_parse_object(Dictionary &object, const CharType *p_str, int &index,
}
if (token.type != TK_STRING) {
r_err_str = "Expected key";
return ERR_PARSE_ERROR;
}
key = token.value;
err = _get_token(p_str, index, p_len, token, line, r_err_str);
if (err != OK)
if (err != OK) {
return err;
}
if (token.type != TK_COLON) {
r_err_str = "Expected ':'";
return ERR_PARSE_ERROR;
}
at_key = false;
} else {
Error err = _get_token(p_str, index, p_len, token, line, r_err_str);
if (err != OK)
if (err != OK) {
return err;
}
Variant v;
err = _parse_value(v, token, p_str, index, p_len, line, r_err_str);
if (err)
if (err) {
return err;
}
object[key] = v;
need_comma = true;
at_key = true;
@@ -459,7 +449,6 @@ Error JSON::_parse_object(Dictionary &object, const CharType *p_str, int &index,
}
Error JSON::parse(const String &p_json, Variant &r_ret, String &r_err_str, int &r_err_line) {
const CharType *str = p_json.ptr();
int idx = 0;
int len = p_json.length();
@@ -468,10 +457,24 @@ Error JSON::parse(const String &p_json, Variant &r_ret, String &r_err_str, int &
String aux_key;
Error err = _get_token(str, idx, len, token, r_err_line, r_err_str);
if (err)
if (err) {
return err;
}
err = _parse_value(r_ret, token, str, idx, len, r_err_line, r_err_str);
// Check if EOF is reached
// or it's a type of the next token.
if (err == OK && idx < len) {
err = _get_token(str, idx, len, token, r_err_line, r_err_str);
if (err || token.type != TK_EOF) {
r_err_str = "Expected 'EOF'";
// Reset return value to empty `Variant`
r_ret = Variant();
return ERR_PARSE_ERROR;
}
}
return err;
}

View File

@@ -34,7 +34,6 @@
#include "core/variant.h"
class JSON {
enum TokenType {
TK_CURLY_BRACKET_OPEN,
TK_CURLY_BRACKET_CLOSE,
@@ -58,14 +57,13 @@ class JSON {
};
struct Token {
TokenType type;
Variant value;
};
static const char *tk_name[TK_MAX];
static String _print_var(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys);
static String _print_var(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys, Set<const void *> &p_markers);
static Error _get_token(const CharType *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str);
static Error _parse_value(Variant &value, Token &token, const CharType *p_str, int &index, int p_len, int &line, String &r_err_str);

View File

@@ -65,23 +65,34 @@ void Logger::log_error(const char *p_function, const char *p_file, int p_line, c
return;
}
const char *err_type = "**ERROR**";
const char *err_type = "ERROR";
switch (p_type) {
case ERR_ERROR: err_type = "**ERROR**"; break;
case ERR_WARNING: err_type = "**WARNING**"; break;
case ERR_SCRIPT: err_type = "**SCRIPT ERROR**"; break;
case ERR_SHADER: err_type = "**SHADER ERROR**"; break;
default: ERR_PRINT("Unknown error type"); break;
case ERR_ERROR:
err_type = "ERROR";
break;
case ERR_WARNING:
err_type = "WARNING";
break;
case ERR_SCRIPT:
err_type = "SCRIPT ERROR";
break;
case ERR_SHADER:
err_type = "SHADER ERROR";
break;
default:
ERR_PRINT("Unknown error type");
break;
}
const char *err_details;
if (p_rationale && *p_rationale)
if (p_rationale && *p_rationale) {
err_details = p_rationale;
else
} else {
err_details = p_code;
}
logf_error("%s: %s\n", err_type, err_details);
logf_error(" At: %s:%i:%s() - %s\n", p_file, p_line, p_function, p_code);
logf_error(" at: %s (%s:%i) - %s\n", p_function, p_file, p_line, p_code);
}
void Logger::logf(const char *p_format, ...) {
@@ -115,7 +126,7 @@ Logger::~Logger() {}
void RotatedFileLogger::close_file() {
if (file) {
memdelete(file);
file = NULL;
file = nullptr;
}
}
@@ -189,7 +200,7 @@ void RotatedFileLogger::rotate_file() {
RotatedFileLogger::RotatedFileLogger(const String &p_base_path, int p_max_files) :
base_path(p_base_path.simplify_path()),
max_files(p_max_files > 0 ? p_max_files : 1),
file(NULL) {
file(nullptr) {
rotate_file();
}

View File

@@ -66,7 +66,6 @@ public:
* Writes messages to stdout/stderr.
*/
class StdLogger : public Logger {
public:
virtual void logv(const char *p_format, va_list p_list, bool p_err) _PRINTF_FORMAT_ATTRIBUTE_2_0;
virtual ~StdLogger();

File diff suppressed because it is too large Load Diff

View File

@@ -36,26 +36,22 @@
#include "core/variant.h"
/**
* Miscellaneous helpers for marshalling data types, and encoding
* in an endian independent way
*/
* Miscellaneous helpers for marshalling data types, and encoding
* in an endian independent way
*/
union MarshallFloat {
uint32_t i; ///< int
float f; ///< float
};
union MarshallDouble {
uint64_t l; ///< long long
double d; ///< double
};
static inline unsigned int encode_uint16(uint16_t p_uint, uint8_t *p_arr) {
for (int i = 0; i < 2; i++) {
*p_arr = p_uint & 0xFF;
p_arr++;
p_uint >>= 8;
@@ -65,9 +61,7 @@ static inline unsigned int encode_uint16(uint16_t p_uint, uint8_t *p_arr) {
}
static inline unsigned int encode_uint32(uint32_t p_uint, uint8_t *p_arr) {
for (int i = 0; i < 4; i++) {
*p_arr = p_uint & 0xFF;
p_arr++;
p_uint >>= 8;
@@ -77,7 +71,6 @@ static inline unsigned int encode_uint32(uint32_t p_uint, uint8_t *p_arr) {
}
static inline unsigned int encode_float(float p_float, uint8_t *p_arr) {
MarshallFloat mf;
mf.f = p_float;
encode_uint32(mf.i, p_arr);
@@ -86,9 +79,7 @@ static inline unsigned int encode_float(float p_float, uint8_t *p_arr) {
}
static inline unsigned int encode_uint64(uint64_t p_uint, uint8_t *p_arr) {
for (int i = 0; i < 8; i++) {
*p_arr = p_uint & 0xFF;
p_arr++;
p_uint >>= 8;
@@ -98,7 +89,6 @@ static inline unsigned int encode_uint64(uint64_t p_uint, uint8_t *p_arr) {
}
static inline unsigned int encode_double(double p_double, uint8_t *p_arr) {
MarshallDouble md;
md.d = p_double;
encode_uint64(md.l, p_arr);
@@ -107,13 +97,10 @@ static inline unsigned int encode_double(double p_double, uint8_t *p_arr) {
}
static inline int encode_cstring(const char *p_string, uint8_t *p_data) {
int len = 0;
while (*p_string) {
if (p_data) {
*p_data = (uint8_t)*p_string;
p_data++;
}
@@ -121,16 +108,16 @@ static inline int encode_cstring(const char *p_string, uint8_t *p_data) {
len++;
};
if (p_data) *p_data = 0;
if (p_data) {
*p_data = 0;
}
return len + 1;
}
static inline uint16_t decode_uint16(const uint8_t *p_arr) {
uint16_t u = 0;
for (int i = 0; i < 2; i++) {
uint16_t b = *p_arr;
b <<= (i * 8);
u |= b;
@@ -141,11 +128,9 @@ static inline uint16_t decode_uint16(const uint8_t *p_arr) {
}
static inline uint32_t decode_uint32(const uint8_t *p_arr) {
uint32_t u = 0;
for (int i = 0; i < 4; i++) {
uint32_t b = *p_arr;
b <<= (i * 8);
u |= b;
@@ -156,18 +141,15 @@ static inline uint32_t decode_uint32(const uint8_t *p_arr) {
}
static inline float decode_float(const uint8_t *p_arr) {
MarshallFloat mf;
mf.i = decode_uint32(p_arr);
return mf.f;
}
static inline uint64_t decode_uint64(const uint8_t *p_arr) {
uint64_t u = 0;
for (int i = 0; i < 8; i++) {
uint64_t b = (*p_arr) & 0xFF;
b <<= (i * 8);
u |= b;
@@ -178,7 +160,6 @@ static inline uint64_t decode_uint64(const uint8_t *p_arr) {
}
static inline double decode_double(const uint8_t *p_arr) {
MarshallDouble md;
md.l = decode_uint64(p_arr);
return md.d;
@@ -199,7 +180,7 @@ public:
EncodedObjectAsID();
};
Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = NULL, bool p_allow_objects = false);
Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_full_objects = false);
Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = nullptr, bool p_allow_objects = false);
Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_full_objects = false, int p_depth = 0);
#endif

View File

@@ -38,9 +38,7 @@
#endif
_FORCE_INLINE_ bool _should_call_local(MultiplayerAPI::RPCMode mode, bool is_master, bool &r_skip_rpc) {
switch (mode) {
case MultiplayerAPI::RPC_MODE_DISABLED: {
// Do nothing.
} break;
@@ -48,8 +46,9 @@ _FORCE_INLINE_ bool _should_call_local(MultiplayerAPI::RPCMode mode, bool is_mas
// Do nothing also. Remote cannot produce a local call.
} break;
case MultiplayerAPI::RPC_MODE_MASTERSYNC: {
if (is_master)
if (is_master) {
r_skip_rpc = true; // I am the master, so skip remote call.
}
FALLTHROUGH;
}
case MultiplayerAPI::RPC_MODE_REMOTESYNC:
@@ -58,8 +57,9 @@ _FORCE_INLINE_ bool _should_call_local(MultiplayerAPI::RPCMode mode, bool is_mas
return true;
} break;
case MultiplayerAPI::RPC_MODE_MASTER: {
if (is_master)
if (is_master) {
r_skip_rpc = true; // I am the master, so skip remote call.
}
return is_master;
} break;
case MultiplayerAPI::RPC_MODE_PUPPET: {
@@ -71,7 +71,6 @@ _FORCE_INLINE_ bool _should_call_local(MultiplayerAPI::RPCMode mode, bool is_mas
_FORCE_INLINE_ bool _can_call_mode(Node *p_node, MultiplayerAPI::RPCMode mode, int p_remote_id) {
switch (mode) {
case MultiplayerAPI::RPC_MODE_DISABLED: {
return false;
} break;
@@ -93,17 +92,17 @@ _FORCE_INLINE_ bool _can_call_mode(Node *p_node, MultiplayerAPI::RPCMode mode, i
}
void MultiplayerAPI::poll() {
if (!network_peer.is_valid() || network_peer->get_connection_status() == NetworkedMultiplayerPeer::CONNECTION_DISCONNECTED)
if (!network_peer.is_valid() || network_peer->get_connection_status() == NetworkedMultiplayerPeer::CONNECTION_DISCONNECTED) {
return;
}
network_peer->poll();
if (!network_peer.is_valid()) // It's possible that polling might have resulted in a disconnection, so check here.
if (!network_peer.is_valid()) { // It's possible that polling might have resulted in a disconnection, so check here.
return;
}
while (network_peer->get_available_packet_count()) {
int sender = network_peer->get_packet_peer();
const uint8_t *packet;
int len;
@@ -141,8 +140,9 @@ Node *MultiplayerAPI::get_root_node() {
}
void MultiplayerAPI::set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_peer) {
if (p_peer == network_peer) return; // Nothing to do
if (p_peer == network_peer) {
return; // Nothing to do
}
ERR_FAIL_COND_MSG(p_peer.is_valid() && p_peer->get_connection_status() == NetworkedMultiplayerPeer::CONNECTION_DISCONNECTED,
"Supplied NetworkedMultiplayerPeer must be connecting or connected.");
@@ -172,8 +172,7 @@ Ref<NetworkedMultiplayerPeer> MultiplayerAPI::get_network_peer() const {
}
void MultiplayerAPI::_process_packet(int p_from, const uint8_t *p_packet, int p_packet_len) {
ERR_FAIL_COND_MSG(root_node == NULL, "Multiplayer root node was not initialized. If you are using custom multiplayer, remember to set the root node via MultiplayerAPI.set_root_node before using it.");
ERR_FAIL_COND_MSG(root_node == nullptr, "Multiplayer root node was not initialized. If you are using custom multiplayer, remember to set the root node via MultiplayerAPI.set_root_node before using it.");
ERR_FAIL_COND_MSG(p_packet_len < 1, "Invalid packet received. Size too small.");
#ifdef DEBUG_ENABLED
@@ -187,25 +186,21 @@ void MultiplayerAPI::_process_packet(int p_from, const uint8_t *p_packet, int p_
uint8_t packet_type = p_packet[0];
switch (packet_type) {
case NETWORK_COMMAND_SIMPLIFY_PATH: {
_process_simplify_path(p_from, p_packet, p_packet_len);
} break;
case NETWORK_COMMAND_CONFIRM_PATH: {
_process_confirm_path(p_from, p_packet, p_packet_len);
} break;
case NETWORK_COMMAND_REMOTE_CALL:
case NETWORK_COMMAND_REMOTE_SET: {
ERR_FAIL_COND_MSG(p_packet_len < 6, "Invalid packet received. Size too small.");
Node *node = _process_get_node(p_from, p_packet, p_packet_len);
ERR_FAIL_COND_MSG(node == NULL, "Invalid packet received. Requested node was not found.");
ERR_FAIL_COND_MSG(node == nullptr, "Invalid packet received. Requested node was not found.");
// Detect cstring end.
int len_end = 5;
@@ -220,34 +215,30 @@ void MultiplayerAPI::_process_packet(int p_from, const uint8_t *p_packet, int p_
StringName name = String::utf8((const char *)&p_packet[5]);
if (packet_type == NETWORK_COMMAND_REMOTE_CALL) {
_process_rpc(node, name, p_from, p_packet, p_packet_len, len_end + 1);
} else {
_process_rset(node, name, p_from, p_packet, p_packet_len, len_end + 1);
}
} break;
case NETWORK_COMMAND_RAW: {
_process_raw(p_from, p_packet, p_packet_len);
} break;
}
}
Node *MultiplayerAPI::_process_get_node(int p_from, const uint8_t *p_packet, int p_packet_len) {
uint32_t target = decode_uint32(&p_packet[1]);
Node *node = NULL;
Node *node = nullptr;
if (target & 0x80000000) {
// Use full path (not cached yet).
int ofs = target & 0x7FFFFFFF;
ERR_FAIL_COND_V_MSG(ofs >= p_packet_len, NULL, "Invalid packet received. Size smaller than declared.");
ERR_FAIL_COND_V_MSG(ofs >= p_packet_len, nullptr, "Invalid packet received. Size smaller than declared.");
String paths;
paths.parse_utf8((const char *)&p_packet[ofs], p_packet_len - ofs);
@@ -257,29 +248,28 @@ Node *MultiplayerAPI::_process_get_node(int p_from, const uint8_t *p_packet, int
node = root_node->get_node(np);
if (!node)
ERR_PRINTS("Failed to get path from RPC: " + String(np) + ".");
ERR_PRINT("Failed to get path from RPC: " + String(np) + ".");
} else {
// Use cached path.
int id = target;
Map<int, PathGetCache>::Element *E = path_get_cache.find(p_from);
ERR_FAIL_COND_V_MSG(!E, NULL, "Invalid packet received. Requests invalid peer cache.");
ERR_FAIL_COND_V_MSG(!E, nullptr, "Invalid packet received. Requests invalid peer cache.");
Map<int, PathGetCache::NodeInfo>::Element *F = E->get().nodes.find(id);
ERR_FAIL_COND_V_MSG(!F, NULL, "Invalid packet received. Unabled to find requested cached node.");
ERR_FAIL_COND_V_MSG(!F, nullptr, "Invalid packet received. Unabled to find requested cached node.");
PathGetCache::NodeInfo *ni = &F->get();
// Do proper caching later.
node = root_node->get_node(ni->path);
if (!node)
ERR_PRINTS("Failed to get cached path from RPC: " + String(ni->path) + ".");
ERR_PRINT("Failed to get cached path from RPC: " + String(ni->path) + ".");
}
return node;
}
void MultiplayerAPI::_process_rpc(Node *p_node, const StringName &p_name, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset) {
ERR_FAIL_COND_MSG(p_offset >= p_packet_len, "Invalid packet received. Size too small.");
// Check that remote can call the RPC on this node.
@@ -311,7 +301,6 @@ void MultiplayerAPI::_process_rpc(Node *p_node, const StringName &p_name, int p_
#endif
for (int i = 0; i < argc; i++) {
ERR_FAIL_COND_MSG(p_offset >= p_packet_len, "Invalid packet received. Size too small.");
int vlen;
@@ -328,12 +317,11 @@ void MultiplayerAPI::_process_rpc(Node *p_node, const StringName &p_name, int p_
if (ce.error != Variant::CallError::CALL_OK) {
String error = Variant::get_call_error_text(p_node, p_name, (const Variant **)argp.ptr(), argc, ce);
error = "RPC - " + error;
ERR_PRINTS(error);
ERR_PRINT(error);
}
}
void MultiplayerAPI::_process_rset(Node *p_node, const StringName &p_name, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset) {
ERR_FAIL_COND_MSG(p_offset >= p_packet_len, "Invalid packet received. Size too small.");
// Check that remote can call the RSET on this node.
@@ -357,7 +345,7 @@ void MultiplayerAPI::_process_rset(Node *p_node, const StringName &p_name, int p
#endif
Variant value;
Error err = decode_variant(value, &p_packet[p_offset], p_packet_len - p_offset, NULL, allow_object_decoding || network_peer->is_object_decoding_allowed());
Error err = decode_variant(value, &p_packet[p_offset], p_packet_len - p_offset, nullptr, allow_object_decoding || network_peer->is_object_decoding_allowed());
ERR_FAIL_COND_MSG(err != OK, "Invalid packet received. Unable to decode RSET value.");
@@ -366,12 +354,11 @@ void MultiplayerAPI::_process_rset(Node *p_node, const StringName &p_name, int p
p_node->set(p_name, value, &valid);
if (!valid) {
String error = "Error setting remote property '" + String(p_name) + "', not found in object of type " + p_node->get_class() + ".";
ERR_PRINTS(error);
ERR_PRINT(error);
}
}
void MultiplayerAPI::_process_simplify_path(int p_from, const uint8_t *p_packet, int p_packet_len) {
ERR_FAIL_COND_MSG(p_packet_len < 5, "Invalid packet received. Size too small.");
int id = decode_uint32(&p_packet[1]);
@@ -392,7 +379,7 @@ void MultiplayerAPI::_process_simplify_path(int p_from, const uint8_t *p_packet,
// Encode path to send ack.
CharString pname = String(path).utf8();
int len = encode_cstring(pname.get_data(), NULL);
int len = encode_cstring(pname.get_data(), nullptr);
Vector<uint8_t> packet;
@@ -406,7 +393,6 @@ void MultiplayerAPI::_process_simplify_path(int p_from, const uint8_t *p_packet,
}
void MultiplayerAPI::_process_confirm_path(int p_from, const uint8_t *p_packet, int p_packet_len) {
ERR_FAIL_COND_MSG(p_packet_len < 2, "Invalid packet received. Size too small.");
String paths;
@@ -427,12 +413,13 @@ bool MultiplayerAPI::_send_confirm_path(NodePath p_path, PathSentCache *psc, int
List<int> peers_to_add; // If one is missing, take note to add it.
for (Set<int>::Element *E = connected_peers.front(); E; E = E->next()) {
if (p_target < 0 && E->get() == -p_target)
if (p_target < 0 && E->get() == -p_target) {
continue; // Continue, excluded.
}
if (p_target > 0 && E->get() != p_target)
if (p_target > 0 && E->get() != p_target) {
continue; // Continue, not for this peer.
}
Map<int, bool>::Element *F = psc->confirmed_peers.find(E->get());
@@ -450,10 +437,9 @@ bool MultiplayerAPI::_send_confirm_path(NodePath p_path, PathSentCache *psc, int
// Those that need to be added, send a message for this.
for (List<int>::Element *E = peers_to_add.front(); E; E = E->next()) {
// Encode function name.
CharString pname = String(p_path).utf8();
int len = encode_cstring(pname.get_data(), NULL);
int len = encode_cstring(pname.get_data(), nullptr);
Vector<uint8_t> packet;
@@ -473,7 +459,6 @@ bool MultiplayerAPI::_send_confirm_path(NodePath p_path, PathSentCache *psc, int
}
void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p_set, const StringName &p_name, const Variant **p_arg, int p_argcount) {
ERR_FAIL_COND_MSG(network_peer.is_null(), "Attempt to remote call/set when networking is not active in SceneTree.");
ERR_FAIL_COND_MSG(network_peer->get_connection_status() == NetworkedMultiplayerPeer::CONNECTION_CONNECTING, "Attempt to remote call/set when networking is not connected yet in SceneTree.");
@@ -504,8 +489,9 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p
int ofs = 0;
#define MAKE_ROOM(m_amount) \
if (packet_cache.size() < m_amount) packet_cache.resize(m_amount);
#define MAKE_ROOM(m_amount) \
if (packet_cache.size() < m_amount) \
packet_cache.resize(m_amount);
// Encode type.
MAKE_ROOM(1);
@@ -519,14 +505,14 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p
// Encode function name.
CharString name = String(p_name).utf8();
int len = encode_cstring(name.get_data(), NULL);
int len = encode_cstring(name.get_data(), nullptr);
MAKE_ROOM(ofs + len);
encode_cstring(name.get_data(), &(packet_cache.write[ofs]));
ofs += len;
if (p_set) {
// Set argument.
Error err = encode_variant(*p_arg[0], NULL, len, allow_object_decoding || network_peer->is_object_decoding_allowed());
Error err = encode_variant(*p_arg[0], nullptr, len, allow_object_decoding || network_peer->is_object_decoding_allowed());
ERR_FAIL_COND_MSG(err != OK, "Unable to encode RSET value. THIS IS LIKELY A BUG IN THE ENGINE!");
MAKE_ROOM(ofs + len);
encode_variant(*p_arg[0], &(packet_cache.write[ofs]), len, allow_object_decoding || network_peer->is_object_decoding_allowed());
@@ -538,7 +524,7 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p
packet_cache.write[ofs] = p_argcount;
ofs += 1;
for (int i = 0; i < p_argcount; i++) {
Error err = encode_variant(*p_arg[i], NULL, len, allow_object_decoding || network_peer->is_object_decoding_allowed());
Error err = encode_variant(*p_arg[i], nullptr, len, allow_object_decoding || network_peer->is_object_decoding_allowed());
ERR_FAIL_COND_MSG(err != OK, "Unable to encode RPC argument. THIS IS LIKELY A BUG IN THE ENGINE!");
MAKE_ROOM(ofs + len);
encode_variant(*p_arg[i], &(packet_cache.write[ofs]), len, allow_object_decoding || network_peer->is_object_decoding_allowed());
@@ -561,7 +547,6 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p
network_peer->set_transfer_mode(p_unreliable ? NetworkedMultiplayerPeer::TRANSFER_MODE_UNRELIABLE : NetworkedMultiplayerPeer::TRANSFER_MODE_RELIABLE);
if (has_all_peers) {
// They all have verified paths, so send fast.
network_peer->set_target_peer(p_to); // To all of you.
network_peer->put_packet(packet_cache.ptr(), ofs); // A message with love.
@@ -570,17 +555,18 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p
// Append path at the end, since we will need it for some packets.
CharString pname = String(from_path).utf8();
int path_len = encode_cstring(pname.get_data(), NULL);
int path_len = encode_cstring(pname.get_data(), nullptr);
MAKE_ROOM(ofs + path_len);
encode_cstring(pname.get_data(), &(packet_cache.write[ofs]));
for (Set<int>::Element *E = connected_peers.front(); E; E = E->next()) {
if (p_to < 0 && E->get() == -p_to)
if (p_to < 0 && E->get() == -p_to) {
continue; // Continue, excluded.
}
if (p_to > 0 && E->get() != p_to)
if (p_to > 0 && E->get() != p_to) {
continue; // Continue, not for this peer.
}
Map<int, bool>::Element *F = psc->confirmed_peers.find(E->get());
ERR_CONTINUE(!F); // Should never happen.
@@ -622,22 +608,18 @@ void MultiplayerAPI::_del_peer(int p_id) {
}
void MultiplayerAPI::_connected_to_server() {
emit_signal("connected_to_server");
}
void MultiplayerAPI::_connection_failed() {
emit_signal("connection_failed");
}
void MultiplayerAPI::_server_disconnected() {
emit_signal("server_disconnected");
}
void MultiplayerAPI::rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const StringName &p_method, const Variant **p_arg, int p_argcount) {
ERR_FAIL_COND_MSG(!network_peer.is_valid(), "Trying to call an RPC while no network peer is active.");
ERR_FAIL_COND_MSG(!p_node->is_inside_tree(), "Trying to call an RPC on a node which is not inside SceneTree.");
ERR_FAIL_COND_MSG(network_peer->get_connection_status() != NetworkedMultiplayerPeer::CONNECTION_CONNECTED, "Trying to call an RPC via a network peer which is not connected.");
@@ -666,7 +648,6 @@ void MultiplayerAPI::rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const
}
if (!skip_rpc) {
#ifdef DEBUG_ENABLED
if (profiling) {
ObjectID id = p_node->get_instance_id();
@@ -687,7 +668,7 @@ void MultiplayerAPI::rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const
if (ce.error != Variant::CallError::CALL_OK) {
String error = Variant::get_call_error_text(p_node, p_method, p_arg, p_argcount, ce);
error = "rpc() aborted in local call: - " + error + ".";
ERR_PRINTS(error);
ERR_PRINT(error);
return;
}
}
@@ -702,7 +683,7 @@ void MultiplayerAPI::rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const
if (ce.error != Variant::CallError::CALL_OK) {
String error = Variant::get_call_error_text(p_node, p_method, p_arg, p_argcount, ce);
error = "rpc() aborted in script local call: - " + error + ".";
ERR_PRINTS(error);
ERR_PRINT(error);
return;
}
}
@@ -711,7 +692,6 @@ void MultiplayerAPI::rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const
}
void MultiplayerAPI::rsetp(Node *p_node, int p_peer_id, bool p_unreliable, const StringName &p_property, const Variant &p_value) {
ERR_FAIL_COND_MSG(!network_peer.is_valid(), "Trying to RSET while no network peer is active.");
ERR_FAIL_COND_MSG(!p_node->is_inside_tree(), "Trying to RSET on a node which is not inside SceneTree.");
ERR_FAIL_COND_MSG(network_peer->get_connection_status() != NetworkedMultiplayerPeer::CONNECTION_CONNECTED, "Trying to send an RSET via a network peer which is not connected.");
@@ -725,7 +705,6 @@ void MultiplayerAPI::rsetp(Node *p_node, int p_peer_id, bool p_unreliable, const
// Check that send mode can use local call.
const Map<StringName, RPCMode>::Element *E = p_node->get_node_rset_mode(p_property);
if (E) {
set_local = _should_call_local(E->get(), is_master, skip_rset);
}
@@ -739,7 +718,7 @@ void MultiplayerAPI::rsetp(Node *p_node, int p_peer_id, bool p_unreliable, const
if (!valid) {
String error = "rset() aborted in local set, property not found: - " + String(p_property) + ".";
ERR_PRINTS(error);
ERR_PRINT(error);
return;
}
} else if (p_node->get_script_instance()) {
@@ -757,7 +736,7 @@ void MultiplayerAPI::rsetp(Node *p_node, int p_peer_id, bool p_unreliable, const
if (!valid) {
String error = "rset() aborted in local script set, property not found: - " + String(p_property) + ".";
ERR_PRINTS(error);
ERR_PRINT(error);
return;
}
}
@@ -783,7 +762,6 @@ void MultiplayerAPI::rsetp(Node *p_node, int p_peer_id, bool p_unreliable, const
}
Error MultiplayerAPI::send_bytes(PoolVector<uint8_t> p_data, int p_to, NetworkedMultiplayerPeer::TransferMode p_mode) {
ERR_FAIL_COND_V_MSG(p_data.size() < 1, ERR_INVALID_DATA, "Trying to send an empty raw packet.");
ERR_FAIL_COND_V_MSG(!network_peer.is_valid(), ERR_UNCONFIGURED, "Trying to send a raw packet while no network peer is active.");
ERR_FAIL_COND_V_MSG(network_peer->get_connection_status() != NetworkedMultiplayerPeer::CONNECTION_CONNECTED, ERR_UNCONFIGURED, "Trying to send a raw packet via a network peer which is not connected.");
@@ -800,7 +778,6 @@ Error MultiplayerAPI::send_bytes(PoolVector<uint8_t> p_data, int p_to, Networked
}
void MultiplayerAPI::_process_raw(int p_from, const uint8_t *p_packet, int p_packet_len) {
ERR_FAIL_COND_MSG(p_packet_len < 2, "Invalid packet received. Size too small.");
PoolVector<uint8_t> out;
@@ -814,32 +791,25 @@ void MultiplayerAPI::_process_raw(int p_from, const uint8_t *p_packet, int p_pac
}
int MultiplayerAPI::get_network_unique_id() const {
ERR_FAIL_COND_V_MSG(!network_peer.is_valid(), 0, "No network peer is assigned. Unable to get unique network ID.");
return network_peer->get_unique_id();
}
bool MultiplayerAPI::is_network_server() const {
// XXX Maybe fail silently? Maybe should actually return true to make development of both local and online multiplayer easier?
ERR_FAIL_COND_V_MSG(!network_peer.is_valid(), false, "No network peer is assigned. I can't be a server.");
return network_peer->is_server();
return network_peer.is_valid() && network_peer->is_server();
}
void MultiplayerAPI::set_refuse_new_network_connections(bool p_refuse) {
ERR_FAIL_COND_MSG(!network_peer.is_valid(), "No network peer is assigned. Unable to set 'refuse_new_connections'.");
network_peer->set_refuse_new_connections(p_refuse);
}
bool MultiplayerAPI::is_refusing_new_network_connections() const {
ERR_FAIL_COND_V_MSG(!network_peer.is_valid(), false, "No network peer is assigned. Unable to get 'refuse_new_connections'.");
return network_peer->is_refusing_new_connections();
}
Vector<int> MultiplayerAPI::get_network_connected_peers() const {
ERR_FAIL_COND_V_MSG(!network_peer.is_valid(), Vector<int>(), "No network peer is assigned. Assume no peers are connected.");
Vector<int> ret;
@@ -851,12 +821,10 @@ Vector<int> MultiplayerAPI::get_network_connected_peers() const {
}
void MultiplayerAPI::set_allow_object_decoding(bool p_enable) {
allow_object_decoding = p_enable;
}
bool MultiplayerAPI::is_object_decoding_allowed() const {
return allow_object_decoding;
}
@@ -919,8 +887,8 @@ int MultiplayerAPI::get_outgoing_bandwidth_usage() {
int MultiplayerAPI::_get_bandwidth_usage(const Vector<BandwidthFrame> &p_buffer, int p_pointer) {
int total_bandwidth = 0;
uint32_t timestamp = OS::get_singleton()->get_ticks_msec();
uint32_t final_timestamp = timestamp - 1000;
uint64_t timestamp = OS::get_singleton()->get_ticks_msec();
uint64_t final_timestamp = timestamp - 1000;
int i = (p_pointer + p_buffer.size() - 1) % p_buffer.size();
@@ -937,8 +905,9 @@ int MultiplayerAPI::_get_bandwidth_usage(const Vector<BandwidthFrame> &p_buffer,
}
void MultiplayerAPI::_init_node_profile(ObjectID p_node) {
if (profiler_frame_data.has(p_node))
if (profiler_frame_data.has(p_node)) {
return;
}
profiler_frame_data.insert(p_node, ProfilingInfo());
profiler_frame_data[p_node].node = p_node;
profiler_frame_data[p_node].node_path = Object::cast_to<Node>(ObjectDB::get_instance(p_node))->get_path();
@@ -1000,7 +969,7 @@ void MultiplayerAPI::_bind_methods() {
MultiplayerAPI::MultiplayerAPI() :
allow_object_decoding(false) {
rpc_sender_id = 0;
root_node = NULL;
root_node = nullptr;
#ifdef DEBUG_ENABLED
profiling = false;
#endif

View File

@@ -35,7 +35,6 @@
#include "core/reference.h"
class MultiplayerAPI : public Reference {
GDCLASS(MultiplayerAPI, Reference);
public:
@@ -67,7 +66,7 @@ private:
#ifdef DEBUG_ENABLED
struct BandwidthFrame {
uint32_t timestamp;
uint64_t timestamp;
int packet_size;
};

Some files were not shown because too many files have changed in this diff Show More