Commit graph

3946 commits

Author SHA1 Message Date
Haoyu Qiu 549ad70760 Fix XMLParser behavior for comments and premature endings 2021-05-18 15:01:21 +08:00
Rémi Verschelde 6c367f8e0d
Merge pull request #48168 from LightningAA/control-to-ctrl-4.0 2021-05-17 17:38:02 +02:00
Rémi Verschelde 7c72185917
Merge pull request #48792 from foxydevloper/fix-inputeventmidi-typo
Fix typo in InputEventMIDI string
2021-05-17 16:20:12 +02:00
fox df52f5de75 Fix typo in InputEventMIDI string 2021-05-17 09:54:28 -04:00
Pedro J. Estébanez 469fa47e06
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-17 15:06:19 +02:00
Marcel Admiraal 5cdf167dcc Make printing of InputEvents consistent
- Removes the undesired spaces before the colon
- Adds missing commas between parameters
- Adds quotes or brackets to strings
- Removes brackets around single values
2021-05-15 13:55:22 +01:00
Marcus Brummer 7e8e40a38e Fixed build with SCRIPT_AES256_ENCRYPTION_KEY set 2021-05-14 14:53:13 +02:00
Rémi Verschelde fcbf7145fe
Merge pull request #42337 from zaevi/fix-zip-open-twice
Fix zip file opening twice
2021-05-14 12:56:33 +02:00
Rémi Verschelde 08b4383e3f
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.
2021-05-14 11:46:10 +02:00
Zae f403e62df1 Fix zip file opening twice 2021-05-14 13:53:43 +08:00
Rémi Verschelde ed11756d26
GDNative: Fix size mismatch on 32-bit platforms for Signal and Callable
Fixes #48645.
2021-05-11 20:25:01 +02:00
PouleyKetchoupp 3877ed73d0 Dynamic BVH broadphase in 2D & 3D Godot Physics
Port lawnjelly's dynamic BVH implementation from 3.x to be used in
both 2D and 3D broadphases.

Removed alternative broadphase implementations which are not meant to be
used anymore since they are much slower.

Includes changes in Rect2, Vector2, Vector3 that help with the template
implementation of the dynamic BVH by uniformizing the interface between
2D and 3D math.

Co-authored-by: lawnjelly <lawnjelly@gmail.com>
2021-05-10 16:28:55 -07:00
Lightning_A 97fecd1b69 Rename "Control" key to "Ctrl" and add "_pressed" suffix to all InputEventWithModifiers properties/methods 2021-05-07 14:00:50 -06:00
Rémi Verschelde c3f7465b7e
Merge pull request #48535 from groud/tiles_squashed
TileSet and TileMap rework (squashed)
2021-05-07 20:46:06 +02:00
Gilles Roudière a3dda2df85 Rework the TileSet resource and TileMap nodes:
- Move most properties from TileMap to TileSet,
- Make TileSet more flexible, supporting more feature (several
  collision layers, etc...),
- Fusion both the TileMap and TileSet editor,
- Implement TileSetSources, and thus a new way to index tiles in the TileSet,
- Rework the TileSet and TileMap editors completely,
- Implement an editor zoom widget (and use it in several places)
2021-05-07 18:06:17 +02:00
Rémi Verschelde bcbd480c32
Merge pull request #45144 from dalexeev/color-consts
Rename color constants (alternative)
2021-05-07 12:22:49 +02:00
Rémi Verschelde 8962d36bb1
Merge pull request #33577 from Calinou/highlight-control-flow-keywords
Highlight control flow keywords with a different color
2021-05-07 00:52:50 +02:00
Hugo Locurcio ce4aa07276
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.
2021-05-07 00:05:02 +02:00
Rémi Verschelde 01f80201bf
Merge pull request #38645 from KoBeWi/FMR
Add filter, map and reduce to Array
2021-05-06 20:44:01 +02:00
Hugo Locurcio 3f078c99f6
Rename IP_Unix, IP_Address and TCP_Server to remove underscores 2021-05-06 02:52:01 +02:00
Hugo Locurcio e905e8f145
Highlight control flow keywords with a different color
This makes them easier to distinguish from other keywords.
2021-05-05 22:38:12 +02:00
MaxStgs d89d7ecd08 Add PackedDataContainer data pointer check for non nullable 2021-05-05 21:17:49 +05:00
Tomasz Chabora c50acc7339 Add filter, map and reduce to Array 2021-05-05 15:54:57 +02:00
Rémi Verschelde 02e96d9748
Fix error handling for user-defined ResourceFormatLoader.load
See #48463.
2021-05-05 15:43:49 +02:00
Rémi Verschelde c9e874b62d
Merge pull request #48442 from akien-mga/posmod-int64_t
Re-bind posmod, use int64_t instead of int
2021-05-04 15:15:52 +02:00
Rémi Verschelde ea9cab3e76
Merge pull request #48430 from reduz/add-rpc-to-callable
Add RPC support to Callable
2021-05-04 14:07:21 +02:00
Rémi Verschelde e196733e88
Re-bind posmod, use int64_t instead of int
Fixes #48420, fixes #48421.
The binding was missed when moving GDScript built-in to Global Scope it seems.

Co-authored-by: kleonc <9283098+kleonc@users.noreply.github.com>
2021-05-04 13:25:08 +02:00
Aaron Franke 0de9a7d803
Rename doubleclick to double_click 2021-05-04 04:38:08 -04:00
Rémi Verschelde 6653ec7cfe
Merge pull request #48418 from KoBeWi/press_enter_to_complete
Add Enter as alternate key to complete code
2021-05-04 09:25:33 +02:00
reduz c76acf6890 Add RPC to Callable
-Up to each scripting language to implement this
-If not supported for the function, it will just error when you try to call
2021-05-03 19:21:37 -03:00
kobewi 76903d2c44 Add Enter as alternate key to complete code 2021-05-03 19:28:59 +02:00
MaxStgs 74bdd611bb Check PHashTranslation generate p_from is valid 2021-05-03 20:40:21 +05:00
George Marques 7610fc02a0
Cast Unix time to uint in the randomize function
This returns a double while the other values are all uint64_t. The
clang compiler gives a warning since converting the constant to double
loses precision.
2021-05-03 11:08:39 -03:00
Rémi Verschelde f9b9992c25
Merge pull request #35245 from qarmin/unsigned_bit_shift
Don't allow to use in bit shift negative operands
2021-05-03 15:48:49 +02:00
Fabio Alessandrelli 015fc2ad4f
Merge pull request #48205 from Faless/net/4.x_url_parsing
[Net] Implement String::parse_url for parsing URLs.
2021-05-03 13:55:57 +02:00
Rémi Verschelde 4a7679e4dd
Merge pull request #48242 from reduz/particle-trails
Implement Particle Trails
2021-04-30 23:52:15 +02:00
reduz 90056460ad Implement Particle Trails
-Enable the trails and set the length in seconds
-Provide a mesh with a skeleton and a skin
-Or, alternatively use one of the built-in TubeTrailMesh/RibbonTrailMesh
-Works deterministically
-Fixed particle collisions (were broken)
-Not working in 2D yet (that will happen next)
2021-04-30 17:38:02 -03:00
bruvzg b6a21f85a7
Fix url_decode with mixed percent-encoding/Unicode strings. Treat Unix drive names as UTF-8 encoded. 2021-04-30 21:22:39 +03:00
Rémi Verschelde 9e9ac9f6ad
Merge pull request #46476 from DarknessCatt/master
Add fill method to Arrays and PackedArrays
2021-04-28 16:52:31 +02:00
Pasi Nuutinmaki a165eed73b
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
2021-04-28 11:09:41 +02:00
Rémi Verschelde 305b2a15bf
Merge pull request #48239 from akien-mga/goodbye-copymem
Core: Drop custom `copymem`/`zeromem` defines
2021-04-28 11:04:05 +02:00
Florian Kothmeier a2c419bdc9
Raise error if Resource is of wrong type as function argument 2021-04-27 21:24:08 +02:00
Rémi Verschelde 95cfce661b
Merge pull request #48050 from JFonS/occlusion_culling 2021-04-27 19:07:12 +02:00
Rémi Verschelde 8247667a3e
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.
2021-04-27 16:26:27 +02:00
Rémi Verschelde 72bd64c1d5
Merge pull request #47398 from Faless/feature/network-local-port-salvaged 2021-04-27 15:04:30 +02:00
Hugo Locurcio 5d124c4a8f
Remove uses of auto for better readability and online code reviews
The current code style guidelines forbid the use of `auto`.

Some uses of `auto` are still present, such as in UWP code (which
can't be currently tested) and macros (where removing `auto` isn't
easy).
2021-04-26 14:59:28 +02:00
Fabio Alessandrelli 3bb40669d5 [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.
2021-04-26 09:55:24 +02:00
jfons 4d9d99bb82 Implement occlusion culling
Added an occlusion culling system with support for static occluder meshes.
It can be enabled via `Project Settings > Rendering > Occlusion Culling > Use Occlusion Culling`.

Occluders are defined via the new `Occluder3D` resource and instanced using the new
`OccluderInstance3D` node. The occluders can also be automatically baked from a
scene using the built-in editor plugin.
2021-04-23 21:45:23 +02:00
Rémi Verschelde 12f826da7d
NodePath: Remove unimplemented get_parent() method
Fixes #48100.
2021-04-23 12:37:53 +02:00
kobewi 22efa850bd Make randomize() use unix time too 2021-04-22 21:08:33 +02:00
Rémi Verschelde 3d46f28558
Add type_traits include for std::is_trivially_destructible 2021-04-22 16:23:55 +02:00
Matheus Lima Cunha efd27a63c1 Add fill method to Arrays and PackedArrays 2021-04-21 11:33:53 -03:00
Rémi Verschelde a9ecf66342
Merge pull request #47956 from vnen/gdscript-double-stack
GDScript: Use special stack space for temporaries to reduce type changes
2021-04-20 17:39:09 +02:00
Juan Linietsky 2b730cad90 Use multiple threads to import.
- For now everything imports multithreaded by default (should work I guess, let's test).
- Controllable per importer

Early test benchmark. 64 large textures (importing as lossless, _not_ as vram) on a mobile i7, 12 threads:
Importing goes down from 46 to 7 seconds.

For VRAM I will change the logic to use a compressing thread in a subsequent PR, as well as implementing Betsy.
2021-04-19 14:12:22 -03:00
Rémi Verschelde 7e215a4b54
Merge pull request #35666 from Calinou/inputmap-nonexistent-suggestions
Print suggestions when requesting a nonexistent InputMap action
2021-04-18 11:39:12 +02:00
Hugo Locurcio 71b254f68e
Print suggestions when requesting a nonexistent InputMap action
Co-authored-by: Marc Gilleron <marc.gilleron@gmail.com>
2021-04-18 02:38:42 +02:00
Marcel Admiraal 0fb4dbf1bd Avoid creating joy_names map entries when using Map operator[] 2021-04-17 20:29:04 +01:00
George Marques a6c5938909
Remove return value type adjust of builtin method calls
Make calls faster with the caveat that the caller needs to make sure
that the return value type is already correct.
2021-04-16 12:04:34 -03:00
Rémi Verschelde 200d9a734c
Merge pull request #47701 from vnen/gdscript-test-runner 2021-04-16 10:34:39 +02:00
Rémi Verschelde a3ca7844b3
Merge pull request #47726 from dalexeev/patch-1
Fix `Color::get_{r,g,b,a}8`
2021-04-16 10:30:53 +02:00
Bartłomiej T. Listwon 1eaaf2f9a2 Separate set.h from map.h 2021-04-14 11:43:45 +02:00
Julien Nguyen 026b8497d1 Fix PackedFloat32Array get index not working 2021-04-12 23:33:06 +02:00
Fabio Alessandrelli 4d5c8e0b18 This renames PacketPeerUDP.listen to bind. 2021-04-12 21:05:33 +02:00
dam da8c2310b5 Allow local port control on net_socket connections 2021-04-12 21:05:33 +02:00
Johannes 33d6eccdec
Fix _File::get_buffer length always set to p_length 2021-04-11 23:11:13 +02:00
Rémi Verschelde c1b4755aa1
Merge pull request #47761 from reduz/packedbytearray-marshalling
Add marshalling to PackedByteArray
2021-04-10 19:17:31 +02:00
Fabio Alessandrelli 6138396e00
Merge pull request #47512 from DanielKriz/bugfix/uri_encode
fix wrong encoding format in uri_encode
2021-04-10 18:58:40 +02:00
reduz e67c63108b Add marshalling to PackedByteArray
-Decode/Encode functions for u8,s8,u16,s16,u32,s32,u64,s64,half,float,double,variant
-Improved binder template to allow this

Given in Godot 4.0 PackedByteArray is passed as reference, it is now possible to have these functions there, which makes the most sense.
2021-04-10 13:09:22 -03:00
Daniel Kříž 13c999d9d7 fix wrong encoding in uri_encode 2021-04-10 17:54:18 +02:00
Danil Alexeev e63976d4b2
Fix Color::get_{r,g,b,a}8
Closes #47022.
2021-04-09 16:11:02 +03:00
George Marques b25ab27d4a
Set resource path earlier on ProjectSettings setup
Since loading the config might use the resource path, it needs to be
set before that happens.
2021-04-08 09:35:06 -03:00
Rémi Verschelde f83486b430
Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@01dce71403.
2021-04-06 22:39:35 +02:00
George Marques f8dd7917ec
Add flag to stop printing to stdout/stderr
This allows the terminal output to be suppressed but still be captured
by print/error handlers.
2021-04-06 07:36:41 -03:00
Rémi Verschelde d83761ba80
Style: Apply clang-tidy's readability-braces-around-statements 2021-04-05 14:09:59 +02:00
Rémi Verschelde 9bbe51dc27
Style: Apply clang-tidy's modernize-use-nullptr 2021-04-05 14:05:07 +02:00
jmb462 400843c172 fix crash on null class in ClassDB.get_property() and set_property() 2021-04-02 20:05:01 +02:00
Rémi Verschelde 4b6e9f3157
Merge pull request #46991 from madmiraal/rename-invert-reverse
Rename Array.invert() to Array.reverse()
2021-04-01 13:32:22 +02:00
rafallus 9196722935 Fix Quat multiplication
x, y, z values were updated too early
2021-03-29 13:57:34 -06:00
Rémi Verschelde aba03110ba
Merge pull request #46830 from vnen/gdscript-typed-arrays
GDScript typed arrays
2021-03-29 16:47:38 +02:00
Juan Linietsky 4763835c11 Optimize image channel detection
Speeds up compression
2021-03-26 15:44:00 -03:00
Rémi Verschelde c6b9ceadf2
Merge pull request #47163 from bruvzg/macos_sandbox_file_dialog
FileDialog: add Back/Forward buttons, add message for inaccessible folders.
2021-03-26 00:00:25 +01:00
Rémi Verschelde cde67f0315
Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@807ac1fbf9.
2021-03-23 13:18:43 +01:00
Rémi Verschelde 6610289fdd
Merge pull request #40804 from naithar/fix/json-parse
JSON parser fix
2021-03-23 13:07:04 +01:00
Aaron Franke a5324787c8
Rename some more global enums (Key, Joy, MIDI) 2021-03-23 07:13:23 -04:00
Aaron Franke 10d7fccb54
Rename ButtonList enum and members to MouseButton 2021-03-23 07:13:23 -04:00
Rémi Verschelde 12f7c1cb25
Merge pull request #47231 from Faless/js/4.x_gamepad_db_dualsense
[HTML5] Logitech Dual Action Gamepad FF/Linux
2021-03-23 11:54:20 +01:00
bruvzg b202a0dd2a
FileDialog: add Back/Forward buttons, add message for inaccessible folders. 2021-03-23 08:03:41 +02:00
Rémi Verschelde 6a84ade316
Merge pull request #45234 from madmiraal/rename-phashtranslation
Rename PHashTranslation to OptimizedTranslation
2021-03-23 00:12:12 +01:00
Rémi Verschelde 11718dbef9 Merge pull request #45562 from aaronfranke/core-modules-real_t
Use real_t in GridMap and VariantParser
2021-03-23 00:10:04 +01:00
Rémi Verschelde 8fb382afb8
Merge pull request #34587 from YeldhamDev/translation_resource_notification_removal
Remove translation change notification when setting the locale of a Translation resource
2021-03-22 23:30:20 +01:00
Juan Linietsky 8d64f3bd76 Add a "keep" import mode to keep files as-is and export them. 2021-03-22 17:19:19 -03:00
Juan Linietsky 97a3a66220 Improved 3D Scene Importer
* Added option for importers to show an Advanced settings dialog
* Created advanced settings dialog for Scene Importer
* Cleaned up importers (remove many old/unused options)
* Added the ability to customize every node, material, mesh and animation individually
* Saving to animations and meshes to files is now a manual process, making it more predictable
* Added the ability for materials to be replaced by external files (or to be made external, up to you).
* When doubleclicking an impoted scene in the filesystem dock, it automatically shows the import settings instead of asking to open it.

WARNING: Lightmap UV unwrap is not working, it needs to be re-made.
2021-03-22 12:16:40 -03:00
Fabio Alessandrelli 70d5f652a2 [HTML5] Logitech Dual Action Gamepad FF/Linux 2021-03-21 15:59:31 +01:00
Marcel Admiraal 755c70b871 Rename Array.invert() to Array.reverse()
Does the same internally for List and Vector<>, which includes all
PackedArray types.
2021-03-21 10:20:08 +00:00
Marcel Admiraal 07f1cd5ff8 Rename PHashTranslation to OptimizedTranslation 2021-03-20 10:02:47 +00:00
Aaron Franke affe3c817a
Use real_t in GridMap and VariantParser 2021-03-19 00:56:34 -04:00
George Marques 997a8ae9e8
Make Variant setget use set() method of Array
This ensure that typed arrays are properly checked when setting an
element.

Moved the macro to a straight declaration since the macro was only used
for Array and it now is quite specific to the Array class.
2021-03-18 10:18:59 -03:00
George Marques fbfdd5e110
Add functions to retrieve type of a typed Array 2021-03-18 10:18:58 -03:00
George Marques 497dab94be
Don't check type when assigning Array
The array should just assimilate the type of the other one since
assignment in this case means a change in the reference.

This also adds a `typed_assign` function for the cases where type
validation is wanted.
2021-03-18 10:18:58 -03:00
Alex Hirsch c28428fe4d Allow nullptr with zero length in FileAccess get_buffer
fix #47071
2021-03-16 22:55:11 +01:00