Age | Commit message (Collapse) | Author |
|
|
|
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.
|
|
Add ability to export Node pointers as NodePaths
|
|
This PR implements:
* A new hint: PROPERTY_HINT_NODE_TYPE for variant type OBJECT, which can take specific node types as hint string.
* The editor will show it as a node path, but will set it as a pointer to a node from the current scene if you select a path.
* When scene is saved, the node path is saved, then restored as a pointer.
NOTE: This is a proof of concept and this approach will most likely not work. The reason if that, if the node referenced is deleted, then when trying to edit this the node will become invalid.
Potential workarounds: Since this uses the Variant API, it should obtain the pointer from the Variant object ID. Yet, this would either only really work in GDScript or it would need to be implemented with workarounds in every language.
Alternative ways to make this work: Nodes could export an additional property with a node path (like for which_node, it could be which_node_path).
Another alternative: Path editing could happen as a hidden metadata (ignoring the pointer).
|
|
Remake ResourceCache thread safety code and API
|
|
Fix ResourceLoaderText::save_as_binary()
|
|
* 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
|
|
These spaces are not needed for the file to be successfully parsed.
Other types such as Vector3 are no longer serialized with spaces
after the opening parenthesis and before the closing parenthesis,
so this is also more consistent.
|
|
Using codespell 2.2-dev from current git.
|
|
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
|
|
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
(order matters) but use is discouraged.
There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
|
|
Implemented by request of @neikeq to advance in the GDExtension version of Mono.
* If a Resource type is missing upon load, it will be remembered together with its data (Unless manually overriden).
* If a Node type is missing upon load, it will be also be remembered together with its data (unless deleted).
This feature makes working with GDExtension much easier, as it ensures that missing types no longer cause data loss.
|
|
These typedefs don't save much typing compared to the full `Ref<Resource>`
and `Ref<RefCounted>`, yet they sometimes introduce confusion among
new contributors.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`DirAccess *` needs to be deleted manually, and this is often forgotten
especially when doing early returns with `ERR_FAIL_COND`.
`DirAccessRef` is deleted automatically when it goes out of scope.
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
|
|
|
|
Less stringly typed logic, and less String allocations and comparisons.
|
|
|
|
|
|
Happy new year to the wonderful Godot community!
|
|
Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
|
|
|
|
|
|
|
|
|
|
This makes `.tscn` files more readable by ensuring sections are always
written on a single line.
|
|
|
|
|
|
Fix binary resource loading and saving
|
|
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.
|
|
|
|
|
|
|
|
|
|
Found via `codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,fave,findn,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint`
|
|
Implement Resource UIDs
|
|
* Most resource types now have unique identifiers.
* Applies to text, binary and imported resources.
* File formats reference both by text and UID (when available). UID always has priority.
* Resource UIDs are 64 bits for better compatibility with the engine.
* Can be represented and used textually, example `uuid://dapwmgsmnl28u`.
* A special binary cache file is used and exported, containing the mappings.
Example of how it looks:
```GDScript
[gd_scene load_steps=2 format=3 uid="uid://dw86wq31afig2"]
[ext_resource type="PackedScene" uid="uid://bt36ojelx8q6c" path="res://subscene.scn" id="1_t56hs"]
```
GDScript, shaders and other special resource files can't currently provide UIDs, but this should be doable with special keywords on the files.
This will be reserved for future PRs.
|
|
|
|
* Friendlier with version control.
* Generates pseudo unique IDs, to minimize conflicts when merging, but still
user readable (so, not UUID).
* Eventually will also allow to have more precisely named sub-resources in
imported files.
* This will allow better reloading on changes (including resources already
loaded) as well as better keeping track of changes on the DCC.
* Keeps backward compatibility with the old formats.
* Binary and text format version incremented to mark breakage in forward
compatibility.
|
|
|
|
Fix sub-resource storing the wrong index in cache
|
|
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>
|
|
File handling APIs are typically considered part of I/O, and we did have most
`FileAccess` implementations in `core/io` already.
|
|
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>
|