Commit graph

1055 commits

Author SHA1 Message Date
Rémi Verschelde
c7e4c802ff
Merge pull request #65031 from akien-mga/os-drop-obsolete-resource-debugging 2022-08-29 15:04:17 +02:00
Rémi Verschelde
eb56d1d1eb Drop obsolete resource usage debug methods from OS class
These methods exist since the dawn of (open source) Godot and have hardly
been updated over time, so they barely work and I'm fairly sure nobody is
using them. (See #46505 for details.)

While some of the functionality they aimed to provide might be useful for
optimization work and introspection, this should likely be redesigned from
scratch with a cleaner and more modern interface (e.g. exposed via the
Performance singleton, or ResourceLoader, and a better API overall).
2022-08-29 12:57:37 +02:00
Fabio Alessandrelli
d20b32186f [Web] Rename JavaScript platform to Web.
Also rename export name from "HTML5" to "Web".
2022-08-29 11:52:00 +02:00
Rémi Verschelde
0cf0e96038
Merge pull request #64776 from YuriSizov/import-images-moar-flags 2022-08-25 16:51:26 +02:00
Rémi Verschelde
9d0b3d7aaa
Merge pull request #64844 from RandomShaper/fa_access_type
Add `FileAccess::get_access_type()`
2022-08-25 00:24:28 +02:00
Pedro J. Estébanez
8c6b2fbb90 Add FileAccess::get_access_type() 2022-08-24 20:06:34 +02:00
derammo
672fa94fb8 fix arg naming in ResourceFormatLoader extension 2022-08-24 06:49:03 -04:00
kobewi
1abdffe7a0 Replace Array return types with TypedArray 2 2022-08-23 23:21:32 +02:00
Yuri Sizov
672e9d6868 Make ImageLoader take bit field flags 2022-08-23 14:39:01 +03:00
kobewi
5947f688fb Make JSON methods static 2022-08-16 14:29:38 +02:00
Rémi Verschelde
9b19a02f31
Merge pull request #63632 from dsnopek/fix-locale-remap-with-binary-resources-4.x
[4.x] Fix locale resource remapping with binary conversion on export
2022-08-08 20:03:23 +02:00
David Snopek
6bbc126c34 Fix locale resource remapping with binary conversion on export 2022-08-08 09:31:35 -05:00
Yuri Sizov
1362bc22bd Add tests for empty/unnamed arguments to ClassDB, Variant, GDScript 2022-08-08 16:36:01 +03:00
Rémi Verschelde
c8cdc10902
Merge pull request #62861 from samdze/image-size-vector2i
Make Image.get_size() return a Vector2i instead of a Vector2
2022-08-08 12:55:07 +02:00
Rémi Verschelde
10f9f20849
Merge pull request #63887 from qarmin/more_renames
Various converter enhancements and bugfixes
2022-08-06 00:21:24 +02:00
Rafał Mikrut
3d3fce0d3c Various converter enhancements and bugfixes 2022-08-03 22:28:51 +02:00
Rémi Verschelde
2d372d9e10
Merge pull request #56442 from PucklaMotzer09/remap_files_moved 2022-08-03 16:57:26 +02:00
PucklaMotzer09
b32b570d7a Show dependency warning when removing remaps and fallback if translation
remap does not exist
2022-08-03 12:31:29 +02:00
Rémi Verschelde
9daffa12be
Merge pull request #49058 from madmiraal/add-override-fileaccess
Add override keywords to FileAccess and DirAccess derived classes
2022-08-02 20:03:24 +02:00
Marcel Admiraal
c06025fa13 Add override keywords to DirAccess derived classes 2022-08-02 16:39:44 +01:00
Marcel Admiraal
cafb19e608 Add override keywords to FileAccess derived classes 2022-08-02 16:35:15 +01:00
Rémi Verschelde
33258d850c
Merge pull request #61315 from lawnjelly/variant_bucket_pools
Variant memory pools
2022-08-02 15:54:18 +02:00
Rémi Verschelde
1418f97c70 File: Re-add support to skip CR (\r) in File::get_as_text
This was removed in #63481, and we confirmed that it's better like this,
but we add back the possibility to strip CR as an option, to optionally
restore the previous behavior.

For performance this is done directly in `String::parse_utf8`.

Also fixes Android `FileAccess::get_line()` as this one _should_ strip CR.

Supersedes #63717.
2022-08-01 00:40:35 +02:00
Rindbee
279e5e90f2 Fix using wrong variable when checking in ResourceSaver::save 2022-07-30 17:11:18 +08:00
kobewi
c3606cb5f3 Swap arguments of ResourceSaver.save() 2022-07-29 19:53:09 +02:00
Rémi Verschelde
90019676b0 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +02:00
reduz
455c06ecd4 Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.

* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.

These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.

**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
2022-07-23 14:00:01 +02:00
Rémi Verschelde
653f95282c
Merge pull request #62996 from reduz/feature-build-profiles 2022-07-22 12:50:20 +02:00
reduz
6236a688b7 Implement Feature Build Profiles
This PR is a continuation of #50381 (which was implemented exactly a year ago!)

* Add a visual interface to select which classes should not be built into Godot (well, they are built if something else uses them, but if not used the optimizer will remove them out).
* Add a detection system to scan the project and figure out the actual classes used.
* Added the ability for SCons to load build profiles.

Obligatory Screen:

A simple test with a couple of nodes in the scene resulted in a 25% reduction for the final binary size

TODO:

* Script languages need to implement used class detection (left for another PR).
* Options to disable servers or server functionalities (like 2D or 3D physics, navigation, etc). Are missing, that should also greatly aid in reducing binary size.
* Options to disable some modules would be desired.
* More options to disable drivers (OpenGL, Vulkan, etc) would be desired.

In general this PR is a starting point for more contributors to improve and enhance this functionality.
2022-07-22 10:53:23 +02:00
Fredia Huya-Kouadio
31712cc9e7 Address slow copy performance when using the FileAccessFilesystemJAndroid implementation.
Read/write ops for this implementation are done through the java layer via jni, and so for good performance, it's key to avoid numerous repeated small read/write ops due the jni overhead.

The alternative is to allocate a (conversatively-sized) large buffer to reduce the number of read/write ops over the jni boundary.
2022-07-21 09:06:29 -07:00
Rémi Verschelde
eea14a0edc
Merge pull request #63005 from Chaosus/image_rotate
Implement `rotate_90/rotate_180` functions to `Image`
2022-07-19 15:21:16 +02:00
FireForge
84431bd782 Use integer types in Image and ImageTexture methods
- Image.blit_rect()
- Image.blit_rect_mask()
- Image.blend_rect()
- Image.blend_rect_mask()
- Image.fill_rect()
- Image.get_used_rect()
- Image.get_rect()
- ImageTexture.set_size_override()
2022-07-18 19:43:32 -05:00
Yuri Rubinsky
7e66903d56 Implement rotate_90/rotate_180 functions to Image 2022-07-15 11:50:42 +03:00
Samuele Zolfanelli
e27c5acedd Make Image.get_size() return a Vector2i instead of a Vector2 2022-07-09 22:05:58 +02:00
kobewi
d2900429e8 Add static methods for creating Image and ImageTexture 2022-07-08 13:40:47 +02:00
bruvzg
0c5431644d
Allows parsing of invalid UTF-16 surrogates (can be encountered in Windows filenames) and some non-standard UTF-8 variants, makes Unicode parse errors more verbose. 2022-07-07 11:07:18 +03:00
Rémi Verschelde
4e7223ce49
Merge pull request #62459 from m4gr3d/refactor_android_storage_handling_main 2022-07-05 12:44:55 +02:00
Fredia Huya-Kouadio
f9c19298ce Add full support for Android scoped storage.
This was done by refactoring directory and file access handling for the Android platform so that any general filesystem access type go through the Android layer.
This allows us to validate whether the access is unrestricted, or whether it falls under scoped storage and thus act appropriately.
2022-07-05 03:00:37 -07:00
kobewi
415c7dda37 Implement XMLParser.get_current_line() 2022-07-05 01:23:04 +02:00
lawnjelly
b221eab426 Variant memory pools
Memory pools via PagedAllocator for Transform2D, Transform3D, Basis and AABB.
2022-07-04 12:01:46 +01:00
MinusKube
f67891fcd1 Add serialization for RID and Signal 2022-06-30 17:39:01 +02:00
Rémi Verschelde
b192073001
Merge pull request #62309 from reduz/remake-resource-thread-safety
Remake ResourceCache thread safety code and API
2022-06-25 14:09:28 +02:00
K. S. Ernest (iFire) Lee
42f7f0894e Restore the openexr grayscale property. 2022-06-23 21:10:59 -07:00
K. S. Ernest (iFire) Lee
ce42ee790c For in-engine processing allow saving openexr to a buffer. 2022-06-23 08:53:15 -07:00
reduz
e772b65d92 Remake resource thread safety and API
* Ensures thread safety when resources are destroyed.
* Simplified API by always forcing `ResourceCache::get_ref`, which needs less hacks and is fully thread safe.
* Removed RWLock for resources because its not possible to use for the new logic. Should not be a problem.

Supersedes #57533
2022-06-22 13:46:46 +02:00
Aaron Franke
8f05bd97b5
Add support for saving WebP images 2022-06-21 08:27:51 -05:00
Rémi Verschelde
40c360b870
Merge pull request #62122 from reduz/implement-movie-writer
Implement a Movie Maker mode
2022-06-21 14:24:14 +02:00
reduz
5786516d4d Implement Running Godot as Movie Writer
* Allows running the game in "movie writer" mode.
* It ensures entirely stable framerate, so your run can be saved stable and with proper sound (which is impossible if your CPU/GPU can't sustain doing this in real-time).
* If disabling vsync, it can save movies faster than the game is run, but if you want to control the interaction it can get difficult.
* Implements a simple, default MJPEG writer.

This new features has two main use cases, which have high demand:
* Saving game videos in high quality and ensuring the frame rate is *completely* stable, always.
* Using Godot as a tool to make movies and animations (which is ideal if you want interaction, or creating them procedurally. No other software is as good for this).

**Note**: This feature **IS NOT** for capturing real-time footage. Use something like OBS, SimpleScreenRecorder or FRAPS to achieve that, as they do a much better job at intercepting the compositor than Godot can probably do using Vulkan or OpenGL natively. If your game runs near real-time when capturing, you can still use this feature but it will play no sound (sound will be saved directly).

Usage:

$ godot --write-movie movie.avi [scene_file.tscn]

Missing:

* Options for configuring video writing via GLOBAL_DEF
* UI Menu for launching with this mode from the editor.
* Add to list of command line options.
* Add a feature tag to override configurations when movie writing (fantastic for saving videos with highest quality settings).
2022-06-21 11:28:47 +02:00
reduz
141c375581 Clean up Hash Functions
Clean up and do fixes to hash functions and newly introduced murmur3 hashes in #61934
* Clean up usage of murmur3
* Fixed usages of binary murmur3 on floats (this is invalid)
* Changed DJB2 to use xor (which seems to be better)
2022-06-20 12:54:19 +02:00
xutaxkamay
bcdfa89ca5 Fix (again) loading binary resources with float=64
I had an error while importing my GLB file from 32-bit precision
floating point,
I guess this was forgotten while implementing 64-bit precision floating
point.
I'm not sure if there's any other left to do though.
2022-06-08 15:02:12 +02:00