No description
Find a file
Pedro J. Estébanez 342266cfd9 Overhaul Variant::duplicate() for resources
This in the scope of a duplication triggered via any type in the `Variant` realm. that is, the following: `Variant` itself, `Array` and `Dictionary`. That includes invoking `duplicate()` from scripts.

A `duplicate_deep(deep_subresources_mode)` method is added to `Variant`, `Array` and `Dictionary` (for compatibility reasons, simply adding an extra parameter was not possible). The default value for it is `RESOURCE_DEEP_DUPLICATE_NONE`, which is like calling `duplicate(true)`.

Remarks:
- The results of copying resources via those `Variant` types are exactly the same as if the copy were initiated from the `Resource` type at C++.
- In order to keep some separation between `Variant` and the higher-level animal which is `Resource`, `Variant` still contains the original code for that, so it's self-sufficient unless there's a `Resource` involved. Once the deep copy finds a `Resource` that has to be copied according to the duplication parameters, the algorithm invokes the `Resource` duplication machinery. When the stack is unwind back to a nesting level `Variant` can handle, `Variant` duplication logic keeps functioning.

While that is good from a responsibility separation standpoint, that would have a caveat: `Variant` would not be aware of the mapping between original and duplicate subresources and so wouldn't be able to keep preventing multiple duplicates.

To avoid that, this commit also introduces a wormwhole, a sharing mechanism by which `Variant` and `Resource` can collaborate in managing the lifetime of the original-to-duplicates map. The user-visible benefit is that the overduplicate prevention works as broadly as the whole `Variant` entity being copied, including all nesting levels, regardless how disconnected the data members containing resources may be across al the nesting levels. In other words, despite the aforementioned division of duties between `Variant` and `Resource` duplication logic, the duplicates map is shared among them. It's created when first finding a `Resource` and, however how deep the copy was working at that point, the map kept alive unitl the stack is unwind to the root user call, until the first step of the recursion.

Thanks to that common map of duplicates, this commit is able to fix the issue that `Resource::duplicate_for_local_scene()` used to ignore overridden duplicate logic.
2025-05-26 10:06:40 +02:00
.github Merge pull request #99938 from Repiteo/ci/scons-flag-formatting 2025-05-16 10:28:59 -05:00
core Overhaul Variant::duplicate() for resources 2025-05-26 10:06:40 +02:00
doc Overhaul Variant::duplicate() for resources 2025-05-26 10:06:40 +02:00
drivers Merge pull request #106407 from DarioSamo/present-validation-error 2025-05-15 10:22:18 -05:00
editor Merge pull request #106437 from BlueCube3310/ch-remap-grow 2025-05-16 10:29:00 -05:00
main Merge pull request #105302 from KoBeWi/scenic 2025-05-13 16:22:20 -05:00
misc Allow undoredo actions to not make history unsaved 2025-05-13 02:40:31 +02:00
modules Fix GridMap scenario crash when outside tree 2025-05-15 23:49:42 +02:00
platform Merge pull request #106251 from ArchercatNEO/wayland-cursor-shape 2025-05-16 10:29:02 -05:00
scene Overhaul Variant::duplicate() for resources 2025-05-26 10:06:40 +02:00
servers Merge pull request #106399 from DarioSamo/fix-canvas-validation-error 2025-05-15 14:53:26 -05:00
tests Revert "Fix #100536: Control set_position resizes offsets/anchors" 2025-05-16 14:21:18 +03:00
thirdparty Merge pull request #106251 from ArchercatNEO/wayland-cursor-shape 2025-05-16 10:29:02 -05:00
.clang-format Style: Declare inline macros as attributes 2025-04-18 12:04:40 -05:00
.clang-tidy Core: Modernize C headers with C++ equivalents 2025-05-02 08:23:01 -05:00
.clangd Style: Begin integrating simple .clangd fixes 2025-03-22 13:24:35 -05:00
.editorconfig Fix .sln project generation logic for Rider to support all OS and all C++ toolchains 2025-04-08 15:40:05 +02:00
.git-blame-ignore-revs Ignore #pragma once commit 2025-03-07 17:34:15 -06:00
.gitattributes Preserve CRLF line terminators for MSVS project template 2025-05-12 13:24:23 +02:00
.gitignore Annual versions bump for the Android platform 2025-05-07 13:14:49 -04:00
.mailmap Update AUTHORS and DONORS list 2025-02-26 12:54:25 +01:00
.pre-commit-config.yaml AccessKit integration for macOS, Linux, and Windows. 2025-04-08 20:25:47 +03:00
AUTHORS.md Update AUTHORS and DONORS list 2025-02-26 12:54:25 +01:00
CHANGELOG.md Add changelog for Godot 4.4 2025-03-03 00:31:10 +01:00
CONTRIBUTING.md
COPYRIGHT.txt Merge pull request #104462 from solidpixel/astcenc_5.3.0 2025-05-13 16:22:10 -05:00
DONORS.md Update donation link to fund.godotengine.org 2025-04-11 18:59:40 +02:00
gles3_builders.py Avoid unnecessary version_get_uniform() calls 2025-04-28 15:05:59 +02:00
glsl_builders.py SCons: Modernize shader builders 2025-03-29 11:51:54 -05:00
godot.manifest
icon.png
icon.svg Style: Enforce trailing newlines on svgs 2025-02-18 11:02:45 -06:00
icon_outlined.png
icon_outlined.svg Style: Enforce trailing newlines on svgs 2025-02-18 11:02:45 -06:00
LICENSE.txt
logo.png
logo.svg Style: Enforce trailing newlines on svgs 2025-02-18 11:02:45 -06:00
LOGO_LICENSE.txt
logo_outlined.png
logo_outlined.svg Style: Enforce trailing newlines on svgs 2025-02-18 11:02:45 -06:00
methods.py SCU - hide SCU folders by adding "." to foldername 2025-05-11 07:02:36 +01:00
platform_methods.py Add loongarch64 support 2024-12-06 00:18:26 +08:00
pyproject.toml Pre-commit: Fix applying ruff to SCsub files 2024-12-28 10:19:46 +01:00
README.md
SConstruct SCons: Don't enable -Wenum-conversion for GCC < 11 2025-05-06 10:06:01 +02:00
scu_builders.py SCU - hide SCU folders by adding "." to foldername 2025-05-11 07:02:36 +01:00
version.py Bump version to 4.5-dev 2025-03-03 17:27:40 +01:00

Godot Engine

Godot Engine logo

2D and 3D cross-platform game engine

Godot Engine is a feature-packed, cross-platform game engine to create 2D and 3D games from a unified interface. It provides a comprehensive set of common tools, so that users can focus on making games without having to reinvent the wheel. Games can be exported with one click to a number of platforms, including the major desktop platforms (Linux, macOS, Windows), mobile platforms (Android, iOS), as well as Web-based platforms and consoles.

Free, open source and community-driven

Godot is completely free and open source under the very permissive MIT license. No strings attached, no royalties, nothing. The users' games are theirs, down to the last line of engine code. Godot's development is fully independent and community-driven, empowering users to help shape their engine to match their expectations. It is supported by the Godot Foundation not-for-profit.

Before being open sourced in February 2014, Godot had been developed by Juan Linietsky and Ariel Manzur (both still maintaining the project) for several years as an in-house engine, used to publish several work-for-hire titles.

Screenshot of a 3D scene in the Godot Engine editor

Getting the engine

Binary downloads

Official binaries for the Godot editor and the export templates can be found on the Godot website.

Compiling from source

See the official docs for compilation instructions for every supported platform.

Community and contributing

Godot is not only an engine but an ever-growing community of users and engine developers. The main community channels are listed on the homepage.

The best way to get in touch with the core engine developers is to join the Godot Contributors Chat.

To get started contributing to the project, see the contributing guide. This document also includes guidelines for reporting bugs.

Documentation and demos

The official documentation is hosted on Read the Docs. It is maintained by the Godot community in its own GitHub repository.

The class reference is also accessible from the Godot editor.

We also maintain official demos in their own GitHub repository as well as a list of awesome Godot community resources.

There are also a number of other learning resources provided by the community, such as text and video tutorials, demos, etc. Consult the community channels for more information.

Code Triagers Badge Translate on Weblate TODOs