Commit graph

3201 commits

Author SHA1 Message Date
Marcel Admiraal 5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
Rémi Verschelde 719e4b1156
Merge pull request #44619 from bruvzg/m1_dragdrop_4
[4.0] Fix file drag-drop on M1 Macs.
2020-12-23 17:37:42 +01:00
bruvzg 39bcc77d6a
[4.0] Fix file drag-drop on M1 Macs. 2020-12-23 18:00:50 +02:00
Fredia Huya-Kouadio 2d492ff8ba Fix invalid invocation of get_class_loader.
The call was made on a `Godot` instance instead of an `Activity` instance.
2020-12-23 02:08:27 -08:00
Marcel Admiraal d9e9eb8d04 Rename MainLoop methods to match Node methods 2020-12-22 12:34:57 +00:00
Marcel Admiraal 2df9a8ccad Rename Rect2 and Rect2i clip() to intersection() 2020-12-19 12:59:08 +00:00
Rémi Verschelde 214a22b98e
Merge pull request #44457 from akien-mga/scons-thirdparty-lib-depends
SCons: Add explicit dependencies on thirdparty code in cloned env
2020-12-18 13:40:33 +01:00
Marcel Admiraal b56a2f34ce Add missing override keywords in os_windows.h 2020-12-18 09:38:09 +00:00
Rémi Verschelde c7b53c03ae
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.
2020-12-18 10:29:34 +01:00
Rémi Verschelde 5332d212f9
Merge pull request #44467 from madmiraal/add-override-keywords
Add missing override keywords to core/os.h derived classes
2020-12-17 23:02:58 +01:00
Marcel Admiraal fa435a550a Add override keywords to core/os.h derived classes. 2020-12-17 18:02:31 +00:00
Marcel Admiraal 60ddca2545 Remove OS::can_draw() remnants 2020-12-17 16:35:48 +00:00
Rémi Verschelde ae0399382a
Merge pull request #44433 from akien-mga/scons-fix-platform-opts
SCons: Add only selected platform's opts to env
2020-12-17 09:56:07 +01:00
Rémi Verschelde fb2465b3c8
Merge pull request #44410 from KoBeWi/project--tools--thisPR
Make tool menu plugins use Callables for callback
2020-12-16 22:04:39 +01:00
kobewi 889f5e44ef Make tool menu plugins use Callables for callback 2020-12-16 20:23:51 +01:00
Rémi Verschelde 0f84d8dc49
SCons: Add only selected platform's opts to env
Otherwise we can get situations where platform-specific opts with the same name
can override each other depending on the order at which platforms are parsed,
as was the case with `use_static_cpp` in Linux/Windows.

Fixes #44304.

This also has the added benefit that the `scons --help` output will now only
include the options which are relevant for the selected (or detected) platform.
2020-12-16 16:31:19 +01:00
Marcel Admiraal f9b83e90b2 Fix named anonymous struct warning 2020-12-16 07:42:16 +00:00
Rémi Verschelde 2760f5d0b4
Merge pull request #44315 from madmiraal/fix-handles-baseexception
Don't handle BaseException in build scripts
2020-12-12 12:23:07 +01:00
Marcel Admiraal 8ef5e3201c Don't handle BaseException in build scripts 2020-12-12 10:05:42 +00:00
Rémi Verschelde 8020515717
HTML5: Code style cleanup for export code 2020-12-10 13:57:46 +01:00
Rémi Verschelde 37d0d757d6
Merge pull request #40708 from bruvzg/improve_os_locale
Improve `OS::get_locale()` and documentation.
2020-12-10 11:49:00 +01:00
Fabio Alessandrelli eb2152538c [HTML5] Fix errors when Mic is not allowed. 2020-12-09 17:54:50 +01:00
Fabio Alessandrelli a28d5e2be7 [HTML5] Improve platform buildsystem.
Check emcc version requirements when building GDNative.
Add more build options (sanitizers, initial memory).
2020-12-09 17:54:50 +01:00
Fabio Alessandrelli 6bc07cf777 [HTML5] Add logo and favicon to editor html. 2020-12-09 17:54:50 +01:00
Rémi Verschelde 114f97ff11
Merge pull request #44128 from KoBeWi/🧹
Cleanup unused engine code
2020-12-09 13:01:50 +01:00
Tomasz Chabora 2c048ea164 Cleanup unused engine code 2020-12-09 12:12:36 +01:00
Fabio Alessandrelli 09a9712a6a Remove unused FileAccessJAndroid. 2020-12-09 10:58:36 +01:00
Rémi Verschelde e5e1277ecd
Merge pull request #44161 from Faless/fix/fa_buffered_remove
Remove unused FileAccessBuffered
2020-12-09 09:14:14 +01:00
thebestnom d543917c03 Android: fix mouse capture relative wrong 2020-12-08 23:51:45 +02:00
thebestnom e7f259c366 Android: Allow Mouse Capture 2020-12-08 22:14:08 +02:00
Rémi Verschelde 90bdba576a
Merge pull request #43742 from qarmin/editor_modules_default_values
Initialize class/struct variables with default values in platform/ and editor/
2020-12-08 15:53:42 +01:00
Rémi Verschelde efc2104096
Merge pull request #44021 from dakennedyd/personal
Fix implementation of move_to_trash() on Linux
2020-12-07 21:06:10 +01:00
David Kennedy 8b68c6808d Fixes move_to_trash() on Linux
Fixes #42840 OS move_to_trash() on Linux is not compliant with the Freedesktop specification
2020-12-07 16:40:56 -03:00
Rémi Verschelde e20011b0da
Merge pull request #44076 from Faless/js/4.x_gdnative
[HTML5] Optional GDNative Support
2020-12-07 15:34:33 +01:00
Fabio Alessandrelli 781efc26e0 Remove now unused FileAccessBuffered. 2020-12-06 19:37:11 +01:00
Fabio Alessandrelli 1396c74734 [HTML5] Use regular unix FileAccess implementation. 2020-12-06 19:25:31 +01:00
Fabio Alessandrelli dd9503dc19 [HTML5] Make GDNative support feature-based.
This is suboptimal as it requires adding an extra compile flag, but
rewriting how feature tags work is beyond the scope of this work.
2020-12-05 01:12:52 +01:00
Fabio Alessandrelli 1e7bd3d08b [HTML5] Allow selecting the export type.
Available types:
- Regular
- GDNative (support dynamic linking and thus GDNative WASM files)
- Threads (uses WebAssembly Threads)
2020-12-05 00:55:11 +01:00
Fabio Alessandrelli 611c4998e8 [HTML5] EditorRunNative works with GDNative.
This "breaks" our loading bar logic (libraries are not counted).
Fixing it is non trivial and probably deserves investigating a different
strategy.
2020-12-05 00:55:07 +01:00
Fabio Alessandrelli ca34b5e57a [HTML5] GDNative support via SIDE_MODULE.
Working with emscripten >= 2.0.10
2020-12-05 00:52:43 +01:00
Fabio Alessandrelli 1167ab96e9 [HTML5] Add function signatures to JS libraries. 2020-12-04 23:21:33 +01:00
reduz 2787ad65be RenderingServer reorganization 2020-12-04 18:39:46 -03:00
Rémi Verschelde 02d228554b
OSX: Fix tmp .app folder name after #44060 2020-12-04 14:16:49 +01:00
Bastiaan Olij cf5737acbe Added driving joystick type to windows joystick handling 2020-12-04 23:31:19 +11:00
Rémi Verschelde 328af1db75
Merge pull request #44074 from reduz/reorganize-3d
Reorganize rendering server.
2020-12-04 08:36:31 +01:00
Rémi Verschelde 586a20875d
Merge pull request #44018 from lyubomirv/mingw_use_static_cpp_option
Add 'use_static_cpp' option for MinGW builds
2020-12-03 23:58:57 +01:00
reduz e93b2242c2 Reorganize rendering server.
-Made RenderingServerScene abstract, allowing reimplementation
-RenderingServerRaster -> RenderingServerDefault, but this class is going away soon.
2020-12-03 19:01:01 -03:00
Lyubomir Vasilev e52c9c26fc Add 'use_static_cpp' option for MinGW and MSVC builds 2020-12-03 23:46:16 +02:00
alan-w-255 7fa803fa2c
fix android wrong multi-touch pointerid
Fixes #43519.
2020-12-03 13:34:04 +01:00
Rémi Verschelde 707a62783b
OSX: Remove tmp .app folder instead of moving to trash
Fixes #42232.

And fixes memory leak with use of DirAccess, and harmonize the use of
the sanitized pkg name.
2020-12-03 10:07:40 +01:00
Rafał Mikrut e1811b689b Initialize class/struct variables with default values in platform/ and editor/ 2020-12-02 16:09:11 +01:00
Rémi Verschelde f1a9de9c59
X11: Include limits.h for LONG_MAX
Fixes #44030.
2020-12-02 15:43:29 +01:00
Fabio Alessandrelli 178546ac3e [HTML5] Fix broken layout on load in HiDPI screens
This was caused by the devicePixelRatio being applied twice, once by the
HTML code, once by the OS code.
More specifically, OS.get_window_size() would return the canvas element
size, while OS.set_window_size() would set the element size to the
specified value times the devicePixelRatio.
Calling OS.set_window_size(OS.get_window_size()) would reapply the
devicePixelRatio every time.
This commit changes the behaviour so that OS.set_window_size() do not
apply the devicePixelRatio to the canvas element size, by it divides the
CSS size instead.
2020-11-30 12:07:20 +01:00
Fabio Alessandrelli 742729ccfe [HTML5] Remove file flags from writeFile in setup.
Flags where deprecated and partly in removed in emscripten 2.0.9.
2020-11-30 12:07:20 +01:00
Rémi Verschelde a6751e6c58
Merge pull request #41100 from bruvzg/ctl_text_server_interface
[Complex Text Layouts] Implement TextServer interface.
2020-11-28 09:03:15 +01:00
PouleyKetchoupp 6b97901d4d Implement INCR mechanism for Linux clipboard
Allows pasting from x11 clipboard to receive data incrementally, which
is required when handling data size > 256KB.
2020-11-27 10:00:09 -07:00
bruvzg 99666de00f
[Complex Text Layouts] Refactor Font class, default themes and controls to use Text Server interface.
Implement interface mirroring.
Add TextLine and TextParagraph classes.
Handle UTF-16 input on macOS and Windows.
2020-11-26 14:25:48 +02:00
bruvzg b9f441e81e
[Complex Text Layouts] Add third-party TextServer dependencies (ICU, HarfBuzz, Graphite). 2020-11-26 13:55:27 +02:00
Rémi Verschelde a4e04cdd47
Merge pull request #42652 from nekomatata/x11-clipboard-save-targets
Implement SAVE_TARGETS mechanism for Linux clipboard
2020-11-26 09:34:18 +01:00
Rémi Verschelde 09f3053450
SCons: Do not define TYPED_METHOD_BIND on Linux/clang
It's now only needed for MSVC.
2020-11-25 19:27:30 +01:00
Rémi Verschelde 4159baff6c
Merge pull request #42648 from naithar/fix/native_video_view
[iOS] Native video fixes
2020-11-24 10:41:01 +01:00
Rémi Verschelde 617031434f
Merge pull request #43803 from m4gr3d/update_signing_and_zipalign_logic_master
Update gradle build files to automatically perform signing and zipalign tasks for custom builds
2020-11-24 08:39:06 +01:00
Fabio Alessandrelli 4617a7fa9c [HTML5] Run eslint --fix.
Should I write a poem about this whole new world? ;)
2020-11-23 12:15:18 +01:00
Fabio Alessandrelli c38984d286 [HTML5] Enforce JavaScript style with eslint.
Applies to javascript files inside the platform library folder, the
exposed Engine code, and any javascript files in modules.

Files ending with ".externs.js" will be ignored, you can create a
".eslintignore" file to specify extra files to be ignored.
2020-11-23 12:15:18 +01:00
Fredia Huya-Kouadio 918b218b55 Update gradle build files to automatically perform signing and zipalign tasks for custom builds. 2020-11-22 18:11:54 -08:00
Fabio Alessandrelli a82f70ea9f [HTML5] Libraries refactor for linting.
Initial work to make liniting easier.

This includes:
- Rename http_request.js to library_godot_http_request.js.
- Rename externs.js to engine.externs.js.
- New library_godot_runtime.js (GodotRuntime) wraps around emscripten
  functions.
- Refactor of XMLHttpRequest handler in engine/preloader.js.
- Few fixes to bugs spotted by early stage linting.
2020-11-21 14:22:40 +01:00
Rémi Verschelde 504efc5f9b
Export: Reorder options for consistency across platforms 2020-11-20 11:17:50 +01:00
Rémi Verschelde f69339c2c2
Merge pull request #43692 from akien-mga/scons-leave-link-alone
SCons: Remove unnecessary $LINK overrides
2020-11-19 20:43:25 +01:00
Rémi Verschelde 2e4bff1cfe
SCons: Remove unnecessary $LINK overrides
As of SCons 4.0.1, the default value for $LINK is $SMARTLINK, which itself
is a function that will use $CXX as linker for C++:

https://github.com/SCons/scons/blob/4.0.1/SCons/Tool/link.py#L327-L328
https://github.com/SCons/scons/blob/4.0.1/SCons/Tool/link.py#L54-L76

So we don't need to manually specify the same value as $CXX for $LINK.
2020-11-19 16:48:03 +01:00
Rémi Verschelde dbbbb53927
OSX: Fix linking with osxcross for arm64
For some reason the `-target` option on the `LINKFLAGS` was causing a weird
issue where osxcross' clang wrapper would attempt using the system `/bin/ld`
instead of the osxcross version (which is Apple's `ld64`).

The error message would be:
```
/bin/ld: unrecognized option '-dynamic'
```

Also removed from `CCFLAGS` for consistency, it seems to work fine with only
`-mmacosx-version-min`.
2020-11-19 16:32:32 +01:00
Fredia Huya-Kouadio c4f2d87747 Fix zipalign command name on Windows machines. 2020-11-18 23:30:45 -08:00
Marcel Admiraal f42284ed07 Add missing javascript semi-colons. 2020-11-17 18:18:46 +00:00
Aaron Franke 02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
Rémi Verschelde 900e5ffdd8
Merge pull request #43595 from mbrlabs/windows-execute-fix
Fixed exit code retrieval of spawned processes on Windows
2020-11-16 22:16:25 +01:00
Rémi Verschelde 484c3d5e27
Merge pull request #43248 from HEAVYPOLY/master
Change android orientations from sensor to user
2020-11-16 22:12:53 +01:00
Marcus Brummer f0f4220b05 Fixed exit code retrieval of spawned processes on Windows
Use GetExitCodeProcess() on Windows to retrieve the exit code of a process in
OS:excute()
2020-11-16 18:30:33 +01:00
Rémi Verschelde e5dfb9b25e
Merge pull request #43556 from naithar/feature/pluggable_app_delegates
[4.0] [iOS] Pluggable application delegate
2020-11-16 17:02:16 +01:00
Rémi Verschelde 7610945b4a
Merge pull request #43461 from ccl2of4/fix-linux-joypad-dpad-zeroing
Fix for linux joypad D-pad zeroing
2020-11-16 14:46:43 +01:00
Rémi Verschelde 8d92135091
Merge pull request #43545 from bruvzg/xchangeprop_atoms_check
Add XChangeProperty atoms validity checks.
2020-11-16 08:01:54 +01:00
bruvzg 319bc5ffda
Add XChangeProperty Atoms validity checks. 2020-11-15 22:20:14 +02:00
Sergey Minakov 2d8c311c01 iOS: fix keyboard display 2020-11-15 16:22:57 +03:00
Sergey Minakov 3f7ca1db70 iOS: Implement pluggable application delegate. 2020-11-15 14:26:44 +03:00
Fredia Huya-Kouadio 46cc3233d8 Update the logic to query for the 'scons' command executable path. 2020-11-14 14:36:53 -08:00
Rémi Verschelde 9e7348f788
Merge pull request #43526 from m4gr3d/address_new_custom_build_logic_issues
Address new custom build logic issues
2020-11-14 22:58:16 +01:00
Fredia Huya-Kouadio 5f6a44f0bb Add missing zip alignment step for generated apks. 2020-11-14 13:10:38 -08:00
Fredia Huya-Kouadio 3de720c11d Fix issue causing Export all to fail. 2020-11-14 13:10:38 -08:00
Fredia Huya-Kouadio 3c1a1a760e Clear unneeded assets when generating an apk expansion.
Clean up export wording to account for the different export formats.
2020-11-14 13:07:32 -08:00
bruvzg f09a37a8d5
Fixes crash if Vulkan presentation surface is not available. 2020-11-14 13:41:13 +02:00
Marcus Brummer e1b9be4a6b Added the .jks file extension as valid preset for Android keystore files 2020-11-14 00:29:23 +01:00
Fredia Huya-Kouadio 597d9409f3 Remove duplicate Android orientation settings. 2020-11-13 12:20:06 -08:00
bruvzg fed776c64c
Add X11 Atom validity checks. 2020-11-12 16:10:17 +02:00
Connor Lirot dd021099ff Fix for linux joypad D-pad zeroing
Some controllers (notably those made by 8bitdo) do not always emit an event to zero out a D-pad axis before flipping direction. For example, when rolling around aggressively the D-pad of an 8bitdo SN30 Pro/Pro+, the following may be observed:

```
ABS_HAT0X : -1
ABS_HAT0Y : -1
ABS_HAT0Y : 0
ABS_HAT0Y : 1
ABS_HAT0X : 1
```

Notable here is that no event for `ABS_HAT0X: 0` is emitted between the events for `ABS_HAT0X: -1` and `ABS_HAT0X: 1`. Consequently, the game engine believes that both the negative _and_ positive x-axis directions of the D-pad are activated simultaneously (i.e `is_joy_button_pressed()` returns `true` for both `JOY_BUTTON_DPAD_LEFT` and `JOY_BUTTON_DPAD_RIGHT`), which should be impossible.

This issue is _not_ reproducible on all controllers. The Xbox One controller in particular will not exhibit this problem (it always emits zeroing out events for an axis before flipping direction).

The fix is to always zero out the opposite direction on the D-pad axis in question when processing an event with a nonzero value. This unfortunately wastes a small number of CPU cycles on controllers that behave nicely.

**I have verified this issue is also reproducible in the stable 3.2 branch**
2020-11-11 13:54:46 -06:00
Rémi Verschelde 10fd107599
Merge pull request #43443 from Faless/js/4.0_audio_worklet
[HTML5] Port inline JS code to libraries, AudioWorklet support.
2020-11-11 10:07:28 +01:00
Fabio Alessandrelli 179ec3ca0e [HTML5] AudioWorklet API implementation.
Rewrote AudioDriverJavaScript to support multiple processor nodes.
The old (and deprecated) ScriptProcessorNode when threads are not
available, and the new AudioWorklet API when threads are enabled.

The new implementation uses two ring buffers and a shared state to
communicated with the AudioWorklet thread.

The audio.worklet.js JavaScript file is always added to the export
template, but only really used (and downloaded) in the thread build.
2020-11-10 18:56:21 +01:00
Sergey Minakov 1f2f477e1e iOS Export: support multi-target plugin
Plugins can use 'binary_name.a' or 'binary_name.release.a' and 'binary_name.debug.a' for plugin library.
2020-11-10 16:40:06 +03:00
Sergey Minakov 1f94a59859 iOS Export: export modification to support plugins
Added plugin configuration.
Export options now use plugins that could be enabled/disabled.
Plugin changes are observed at runtime.
2020-11-10 16:40:01 +03:00
Sergey Minakov 70f492082e iOS: change platform code to support plugins 2020-11-10 16:28:36 +03:00
Sergey Minakov 30783d57cc iOS Modules: separate main platform code from modules
Moved previously builtin modules 'GameCenter', 'AppStore', 'iCloud' to separate modules to be represented as plugin.
Modified 'ARKit' and 'Camera' to not be builtin into engine and work as plugin.
Changed platform code so it's not affected by the move.
Modified Xcode project file to remove parameters that doesn't make any effect.
Added basic '.gdip' plugin config file.
2020-11-10 16:28:29 +03:00
Fabio Alessandrelli e2083871eb [HTML5] Port JavaScript inline code to libraries.
The API is implemented in javascript, and generates C functions that can
be called from godot.
This allows much cleaner code replacing all `EM_ASM` calls in our C++
code with plain C function calls.
This also gets rid of few hacks and comes with few optimizations (e.g.
custom cursor shapes should be much faster now).
2020-11-10 11:42:51 +01:00
Fabio Alessandrelli 54cda5c3b8 [HTML5] Update syntax for lto. 2020-11-10 11:42:51 +01:00