Commit graph

774 commits

Author SHA1 Message Date
Haoyu Qiu 549ad70760 Fix XMLParser behavior for comments and premature endings 2021-05-18 15:01:21 +08: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
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
Zae f403e62df1 Fix zip file opening twice 2021-05-14 13:53:43 +08:00
Hugo Locurcio 3f078c99f6
Rename IP_Unix, IP_Address and TCP_Server to remove underscores 2021-05-06 02:52:01 +02:00
MaxStgs d89d7ecd08 Add PackedDataContainer data pointer check for non nullable 2021-05-05 21:17:49 +05:00
Rémi Verschelde 02e96d9748
Fix error handling for user-defined ResourceFormatLoader.load
See #48463.
2021-05-05 15:43:49 +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
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
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
Bartłomiej T. Listwon 1eaaf2f9a2 Separate set.h from map.h 2021-04-14 11:43:45 +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
Juan Linietsky 4763835c11 Optimize image channel detection
Speeds up compression
2021-03-26 15:44:00 -03: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
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
Alex Hirsch c28428fe4d Allow nullptr with zero length in FileAccess get_buffer
fix #47071
2021-03-16 22:55:11 +01:00
Rémi Verschelde 8051307efe
Merge pull request #46810 from W4RH4WK/file-access-get-buffer-parameter-checks
Add parameter checks to FileAccess get_buffer functions
2021-03-14 01:11:55 +01:00
Anshul7sp1 91181c2086 Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30
Alex Hirsch cdf3099c68 Add parameter checkes to FileAccess get_buffer functions
fix #46540
2021-03-09 13:55:20 +01:00
Pedro Rodrigues a3a731ed92 Fix crash on HTTPClient::poll method
The problem happened because `poll` assumed that when the SSL flag was
true, the `connection` would be a subclass of StreamPeerSSL. However
that invariant could be broken by calling HTTPClient::set_connection
with a `connection` that is not a subclass of StreamPeerSSL.

Fixes #46138
2021-03-03 21:00:30 +00:00
bruvzg 76b653528d
JSON parser: add UTF-16 surrogate pairs support. 2021-03-01 13:23:12 +02:00
Mateo Kuruk Miccino 89283b7b53 Logger: Cache 'flush_stdout_on_print' to improve performance, and works before ProjectSettings starts.
ProjectSetting: Now 'application/run/flush_stdout_on_print' requires a restart of the Editor to take effect
2021-02-28 19:36:10 -03:00
Mateo Kuruk Miccino 472673b38d ResourceLoader: Fix inverse 'if' on the cache mode 2021-02-27 21:53:27 -03:00
Rémi Verschelde 5d8025ec66
Merge pull request #38844 from hbina/patch-5
Avoid copying vector in constructor of PathMD5
2021-02-25 17:49:47 +01:00
Rémi Verschelde 049d654c49
Merge pull request #46354 from reduz/importer-defaults-editor
Added Import Defaults Editor in Project Settings
2021-02-24 13:19:05 +01:00
Rémi Verschelde 5a10f52ee8
Merge pull request #45914 from HenryWConklin/45841-xml-entities
Add support for numeric XML entities to XMLParser
2021-02-24 13:03:46 +01:00
reduz b6fce5d750 Added Import Defaults Editor in Project Settings
-Change importer defaults in project settings.
-Ability to change them or reset them.
2021-02-23 14:18:02 -03:00
Rémi Verschelde 0d1d719178 doc: Sync classref with current source
And fix various bogus bindings following previous PRs.
2021-02-19 14:39:14 +01:00
Rémi Verschelde 310496a89f
Merge pull request #45617 from RandomShaper/modernize_atomics
Modernize atomics (and fix `volatile`)
2021-02-18 19:40:31 +01:00
Pedro J. Estébanez 8e128726f0 Modernize atomics
- Based on C++11's `atomic`
- Reworked `SafeRefCount` (based on the rewrite by @hpvb)
- Replaced free atomic functions by the new `SafeNumeric<T>`
- Replaced wrong cases of `volatile bool` by the new `SafeFlag`
- Platform-specific implementations no longer needed

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-18 17:12:46 +01:00
reduz 64140eaf42 Reorganize Project Settings
-Advanced Settings toggle also hides advanced properties when disabled
-Simplified Advanced Bar (errors were just plain redundant)
-Reorganized rendering quality settings.
-Reorganized miscelaneous settings for clean up.
2021-02-18 11:23:34 -03:00
Henry Conklin c6a911f037 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-02-14 11:00:25 -06:00
reduz 5ae9051771 Add ability to change Icon Saturation
-Allows for more theme freedom
-Allows for entirely B&W themes.
2021-02-12 12:16:37 -03:00
reduz f8d03b98e7 Improve resource load cache
-Added a new method in Resource: reset_state , used for reloading the same resource from disk
-Added a new cache mode "replace" in ResourceLoader, which reuses existing loaded sub-resources but resets their data from disk (or replaces them if they chaged type)
-Because the correct sub-resource paths are always loaded now, this fixes bugs with subresource folding or subresource ordering when saving.
2021-02-11 15:44:28 -03:00
reduz 1aa2823fa3 Removed _change_notify
-For inspector refresh, the inspector now detects if a property change by polling a few times per second and then does update the control if so. This process is very cheap.
-For property list refresh, a new signal (property_list_changed) was added to Object. _change_notify() is replaced by notify_property_list_changed()
-Changed all objects using the old method to the signal, or just deleted the calls to _change_notify(<property>) since they are unnecesary now.
2021-02-10 19:31:24 -03:00
Gilles Roudière 25c4dacb88 Fixes crash when exiting with --verbose with leaked resources 2021-02-09 17:34:49 +01:00
Sergey Minakov a2676ff810 Core: add EOF check for json parser
Additionally reset parse result if error was found.
2021-02-03 21:10:54 +03:00
Rémi Verschelde 5525cd85c6
Merge pull request #45315 from RandomShaper/modernize_thread
Modernize Thread
2021-01-31 15:24:56 +01:00
Pedro J. Estébanez 99fe462452 Modernize Thread
- Based on C++11's `thread` and `thread_local`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed (except for the few cases of non-portable functions)
- Simpler for `NO_THREADS`
- Thread ids are now the same across platforms (main is 1; others follow)
2021-01-29 12:02:13 +01:00
Aaron Franke e829b7aee4
Unify URI encoding/decoding and add to C#
http_escape and percent_encode have been unified into uri_encode, and http_unescape and percent_decode have been unified into uri_decode.
2021-01-28 07:45:01 -05:00
Aaron Franke 1be0d6b30e
Type consistencies in core 2021-01-26 13:04:22 -05:00
Pedro J. Estébanez 8ed259b792 Modernize RWLock
- Based on C++14's `shared_time_mutex`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
2021-01-19 11:53:10 +01:00
Andrii Doroshenko (Xrayez) e94f46dcdb Expose Resource.emit_changed() to script
Also known as `emit_signal("changed")`.
2021-01-13 16:27:58 +02:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Marcel Admiraal b4a190e0bc Consistently use normal_map 2020-12-29 08:04:19 +00:00
Marcel Admiraal 5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
Marcel Admiraal 2df9a8ccad Rename Rect2 and Rect2i clip() to intersection() 2020-12-19 12:59:08 +00:00