Compare commits

...

24 commits

Author SHA1 Message Date
Thaddeus Crews
9a5d6d1049
Merge pull request #111389 from nikitalita/gltf-fix-export-prop
Fix segfault in GLTFDocument::export_object_model_property
2025-10-08 13:56:42 -05:00
Thaddeus Crews
4ad9114c54
Merge pull request #111386 from YeldhamDev/scrcon_focus_fix
Fix incorrect margins in `ScrollContainer` with focus border enabled
2025-10-08 13:56:41 -05:00
Thaddeus Crews
1cf0bc2c6c
Merge pull request #111321 from blueskythlikesclouds/d3d12-region-fix
Fix D3D12 not checking for fullscreen clear region correctly.
2025-10-08 13:56:40 -05:00
Thaddeus Crews
52d32cee8d
Merge pull request #111383 from Ivorforce/core-types-update-2
Register core singleton types before instantiating them.
2025-10-08 13:56:39 -05:00
Thaddeus Crews
8f4d8dfd2d
Merge pull request #111411 from akien-mga/scons-disable-fast_unsafe-on-dev_build
SCons: Don't activate `fast_unsafe` automatically on `dev_build`
2025-10-08 13:56:37 -05:00
Thaddeus Crews
e20acd3fe3
Merge pull request #111289 from HolonProduction/rm-has-named-classes
Move deprecated `has_named_classes` from `ScriptLanguage` to `ScriptLanguageExtension`
2025-10-08 13:56:37 -05:00
Thaddeus Crews
0091d30e3e
Merge pull request #108818 from bruvzg/no_cli_over
Add project setting and build option to disable `override.cfg` and related CLI arguments.
2025-10-08 13:56:35 -05:00
Thaddeus Crews
7c033002b0
Merge pull request #110863 from kisg/libgodot_migeran_core
LibGodot: Core - Build Godot Engine as a Library
2025-10-08 13:56:34 -05:00
Thaddeus Crews
4bb612126e
Merge pull request #111402 from Ivorforce/world-3d-no-compositor
Remove `compositor.h` include from `world_3d.h`.
2025-10-08 13:56:33 -05:00
Thaddeus Crews
e5ee1911a9
Merge pull request #110853 from Kaleb-Reid/compat-fix-reflections
Ensure reflection atlas is valid before rendering
2025-10-08 13:56:32 -05:00
Thaddeus Crews
7093ca3dbe
Merge pull request #111396 from bruvzg/steam_tr_bld
Fix Steam time tracker build.
2025-10-08 13:56:31 -05:00
Thaddeus Crews
d3c5141e2e
Merge pull request #111298 from Onebit5/fix-filedialog-translation-parser
Fix GDScript translation parser for FileDialog.add_filter() two-parameter format
2025-10-08 13:56:30 -05:00
Onebit
d223b0ccbc Fix GDScript translation parser for FileDialog.add_filter() two-parameter format
The parser only handled the single-parameter semicolon format and thew
an error with two-parameter format. This fix supports both formats.

Co-authored-by: Danil Alexeev <dalexeev12@yandex.ru>
2025-10-08 19:45:21 +02:00
Rémi Verschelde
fa57282a1e
SCons: Don't activate fast_unsafe automatically on dev_build
We experienced first hand why it's called unsafe, and so we should leave it
as an explicit choice for contributors, informing themselves of the caveats.

See #111408.
2025-10-08 15:48:12 +02:00
Lukas Tenbrink
207e8c1b92 Remove compositor.h include from world_3d.h. 2025-10-08 11:25:23 +02:00
Pāvels Nadtočajevs
71443372fa
Fix Steam time tracker build. 2025-10-08 09:13:11 +03:00
Kaleb Reid
f2d0ea6d40 Ensure reflection atlas is valid before rendering 2025-10-07 22:05:22 -07:00
nikitalita
bca701f0eb fix segfault in GLTFDocument::export_object_model_property 2025-10-07 18:42:54 -07:00
Michael Alexsander
e9a5208c8b
Fix incorrect margins in ScrollContainer with focus border enabled 2025-10-07 20:49:33 -03:00
Lukas Tenbrink
b3ec2edc04 Register core singleton types before instantiating them. 2025-10-07 23:10:00 +02:00
Gergely Kis
6c44c80c62 LibGodot: Core - Build Godot Engine as a Library
* Add a new GodotInstance GDCLASS that provides startup and iteration commands to control a Godot instance.
* Adds a libgodot_create_godot_instance entry point that creates a new Godot instance and returns a GodotInstance object.
* Adds a libgodot_destroy_godot_instance entry point that destroys the Godot instance.

Sample Apps: https://github.com/migeran/libgodot_project

Developed by [Migeran](https://migeran.com)

Sponsors & Acknowledgements:

* Initial development sponsored by [Smirk Software](https://www.smirk.gg/)
* Rebasing to Godot 4.3 and further development sponsored by [Xibbon Inc.](https://xibbon.com)
* The GDExtension registration of the host process & build system changes were based
  on @Faolan-Rad's LibGodot PR: https://github.com/godotengine/godot/pull/72883
* Thanks to Ben Rog-Wilhelm (Zorbathut) for creating a smaller, minimal version for easier review.
* Thanks to Ernest Lee (iFire) for his support

Co-Authored-By: Gabor Koncz <gabor.koncz@migeran.com>
Co-Authored-By: Ben Rog-Wilhelm <zorba-github@pavlovian.net>
2025-10-07 02:15:41 +02:00
Skyth
b568b06970 Fix D3D12 not checking for fullscreen clear region correctly. 2025-10-06 16:56:05 +03:00
Pāvels Nadtočajevs
1211cd827e
Add project setting and build option to disable override.cfg and related CLI arguments. 2025-10-05 21:47:57 +03:00
HolonProduction
abeb9c654e Move deprecated has_named_classes from ScriptLanguage to ScriptLanguageExtension 2025-10-05 16:55:06 +02:00
41 changed files with 923 additions and 140 deletions

View file

@ -210,7 +210,7 @@ opts.Add(
)
)
opts.Add(BoolVariable("tests", "Build the unit tests", False))
opts.Add(BoolVariable("fast_unsafe", "Enable unsafe options for faster rebuilds", False))
opts.Add(BoolVariable("fast_unsafe", "Enable unsafe options for faster incremental builds", False))
opts.Add(BoolVariable("ninja", "Use the ninja backend for faster rebuilds", False))
opts.Add(BoolVariable("ninja_auto_run", "Run ninja automatically after generating the ninja file", True))
opts.Add("ninja_file", "Path to the generated ninja file", "build.ninja")
@ -239,6 +239,7 @@ opts.Add(BoolVariable("disable_physics_3d", "Disable 3D physics nodes and server
opts.Add(BoolVariable("disable_navigation_2d", "Disable 2D navigation features", False))
opts.Add(BoolVariable("disable_navigation_3d", "Disable 3D navigation features", False))
opts.Add(BoolVariable("disable_xr", "Disable XR nodes and server", False))
opts.Add(BoolVariable("disable_overrides", "Disable project settings overrides and related CLI arguments", False))
opts.Add("build_profile", "Path to a file containing a feature build profile", "")
opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "")
opts.Add(BoolVariable("custom_modules_recursive", "Detect custom modules recursively for each specified path.", True))
@ -264,6 +265,14 @@ opts.Add(
True,
)
)
opts.Add(
EnumVariable(
"library_type",
"Build library type",
"executable",
("executable", "static_library", "shared_library"),
)
)
# Thirdparty libraries
opts.Add(BoolVariable("builtin_brotli", "Use the built-in Brotli library", True))
@ -520,10 +529,10 @@ env.Decider("MD5-timestamp")
# SCons speed optimization controlled by the `fast_unsafe` option, which provide
# more than 10 s speed up for incremental rebuilds.
# Unsafe as they reduce the certainty of rebuilding all changed files, so it's
# enabled by default for `debug` builds, and can be overridden from command line.
# Unsafe as they reduce the certainty of rebuilding all changed files.
# If you use it and run into corrupted incremental builds, try to turn it off.
# Ref: https://github.com/SCons/scons/wiki/GoFastButton
if methods.get_cmdline_bool("fast_unsafe", env.dev_build):
if env["fast_unsafe"]:
env.SetOption("implicit_cache", 1)
env.SetOption("max_drift", 60)
@ -546,6 +555,13 @@ if not env["deprecated"]:
if env["precision"] == "double":
env.Append(CPPDEFINES=["REAL_T_IS_DOUBLE"])
# Library Support
if env["library_type"] != "executable":
if "library" not in env.get("supported", []):
print_error(f"Library builds unsupported for {env['platform']}")
Exit(255)
env.Append(CPPDEFINES=["LIBGODOT_ENABLED"])
# Default num_jobs to local cpu count if not user specified.
# SCons has a peculiarity where user-specified options won't be overridden
# by SetOption, so we can rely on this to know if we should use our default.
@ -1020,6 +1036,9 @@ if env["minizip"]:
if env["brotli"]:
env.Append(CPPDEFINES=["BROTLI_ENABLED"])
if not env["disable_overrides"]:
env.Append(CPPDEFINES=["OVERRIDE_ENABLED"])
if not env["verbose"]:
methods.no_verbose(env)

View file

@ -83,6 +83,11 @@ const PackedStringArray ProjectSettings::get_required_features() {
// Returns the features supported by this build of Godot. Includes all required features.
const PackedStringArray ProjectSettings::_get_supported_features() {
PackedStringArray features = get_required_features();
#ifdef LIBGODOT_ENABLED
features.append("LibGodot");
#endif
#ifdef MODULE_MONO_ENABLED
features.append("C#");
#endif
@ -643,11 +648,16 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
ERR_FAIL_COND_V_MSG(!ok, ERR_CANT_OPEN, vformat("Cannot open resource pack '%s'.", p_main_pack));
Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary");
#ifdef OVERRIDE_ENABLED
if (err == OK && !p_ignore_override) {
// Load override from location of the main pack
// Optional, we don't mind if it fails
_load_settings_text(p_main_pack.get_base_dir().path_join("override.cfg"));
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
if (!disable_override) {
_load_settings_text(p_main_pack.get_base_dir().path_join("override.cfg"));
}
}
#endif // OVERRIDE_ENABLED
return err;
}
@ -693,12 +703,17 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
// If we opened our package, try and load our project.
if (found) {
Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary");
#ifdef OVERRIDE_ENABLED
if (err == OK && !p_ignore_override) {
// Load overrides from the PCK and the executable location.
// Optional, we don't mind if either fails.
_load_settings_text("res://override.cfg");
_load_settings_text(exec_path.get_base_dir().path_join("override.cfg"));
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
if (!disable_override) {
_load_settings_text("res://override.cfg");
_load_settings_text(exec_path.get_base_dir().path_join("override.cfg"));
}
}
#endif // OVERRIDE_ENABLED
return err;
}
}
@ -713,10 +728,15 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
if (!OS::get_singleton()->get_resource_dir().is_empty()) {
Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary");
#ifdef OVERRIDE_ENABLED
if (err == OK && !p_ignore_override) {
// Optional, we don't mind if it fails.
_load_settings_text("res://override.cfg");
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
if (!disable_override) {
_load_settings_text("res://override.cfg");
}
}
#endif // OVERRIDE_ENABLED
return err;
}
@ -736,11 +756,16 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
err = _load_settings_text_or_binary(resource_path.path_join("project.godot"), resource_path.path_join("project.binary"));
if (err == OK && !p_ignore_override) {
// Optional, we don't mind if it fails.
_load_settings_text(resource_path.path_join("override.cfg"));
#ifdef OVERRIDE_ENABLED
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
if (!disable_override) {
_load_settings_text(resource_path.path_join("override.cfg"));
}
#endif // OVERRIDE_ENABLED
return err;
}
}
#endif
#endif // MACOS_ENABLED
// Nothing was found, try to find a project file in provided path (`p_path`)
// or, if requested (`p_upwards`) in parent directories.
@ -760,7 +785,12 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
err = _load_settings_text_or_binary(current_dir.path_join("project.godot"), current_dir.path_join("project.binary"));
if (err == OK && !p_ignore_override) {
// Optional, we don't mind if it fails.
_load_settings_text(current_dir.path_join("override.cfg"));
#ifdef OVERRIDE_ENABLED
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
if (!disable_override) {
_load_settings_text(current_dir.path_join("override.cfg"));
}
#endif // OVERRIDE_ENABLED
found = true;
break;
}
@ -1569,6 +1599,7 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF("application/config/use_custom_user_dir", false);
GLOBAL_DEF("application/config/custom_user_dir_name", "");
GLOBAL_DEF("application/config/project_settings_override", "");
GLOBAL_DEF("application/config/disable_project_settings_override", false);
GLOBAL_DEF("application/run/main_loop_type", "SceneTree");
GLOBAL_DEF("application/config/auto_accept_quit", true);

View file

@ -0,0 +1,74 @@
/**************************************************************************/
/* gdextension_function_loader.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "gdextension_function_loader.h"
#include "gdextension.h"
Error GDExtensionFunctionLoader::open_library(const String &p_path) {
ERR_FAIL_COND_V_MSG(!p_path.begins_with("libgodot://"), ERR_FILE_NOT_FOUND, "Function based GDExtensions should have a path starting with libgodot://");
ERR_FAIL_COND_V_MSG(!initialization_function, ERR_DOES_NOT_EXIST, "Initialization function is required for function based GDExtensions.");
library_path = p_path;
return OK;
}
Error GDExtensionFunctionLoader::initialize(GDExtensionInterfaceGetProcAddress p_get_proc_address, const Ref<GDExtension> &p_extension, GDExtensionInitialization *r_initialization) {
ERR_FAIL_COND_V_MSG(!initialization_function, ERR_DOES_NOT_EXIST, "Initialization function is required for function based GDExtensions.");
GDExtensionBool ret = initialization_function(p_get_proc_address, p_extension.ptr(), r_initialization);
if (ret) {
return OK;
} else {
ERR_FAIL_V_MSG(FAILED, "GDExtension initialization function for '" + library_path + "' returned an error.");
}
}
void GDExtensionFunctionLoader::close_library() {
initialization_function = nullptr;
library_path.clear();
}
bool GDExtensionFunctionLoader::is_library_open() const {
return !library_path.is_empty();
}
bool GDExtensionFunctionLoader::has_library_changed() const {
return false;
}
bool GDExtensionFunctionLoader::library_exists() const {
return true;
}
void GDExtensionFunctionLoader::set_initialization_function(GDExtensionInitializationFunction p_initialization_function) {
initialization_function = p_initialization_function;
}

View file

@ -0,0 +1,54 @@
/**************************************************************************/
/* gdextension_function_loader.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#pragma once
#include "core/extension/gdextension_loader.h"
#include "core/os/shared_object.h"
class GDExtension;
class GDExtensionFunctionLoader : public GDExtensionLoader {
friend class GDExtensionManager;
friend class GDExtension;
String library_path;
GDExtensionInitializationFunction initialization_function = nullptr;
public:
virtual Error open_library(const String &p_path) override;
virtual Error initialize(GDExtensionInterfaceGetProcAddress p_get_proc_address, const Ref<GDExtension> &p_extension, GDExtensionInitialization *r_initialization) override;
virtual void close_library() override;
virtual bool is_library_open() const override;
virtual bool has_library_changed() const override;
virtual bool library_exists() const override;
void set_initialization_function(GDExtensionInitializationFunction p_initialization_function);
};

View file

@ -30,6 +30,7 @@
#include "gdextension_manager.h"
#include "core/extension/gdextension_function_loader.h"
#include "core/extension/gdextension_library_loader.h"
#include "core/extension/gdextension_special_compat_hashes.h"
#include "core/io/dir_access.h"
@ -114,7 +115,14 @@ GDExtensionManager::LoadStatus GDExtensionManager::load_extension(const String &
Ref<GDExtensionLibraryLoader> loader;
loader.instantiate();
return GDExtensionManager::get_singleton()->load_extension_with_loader(p_path, loader);
return load_extension_with_loader(p_path, loader);
}
GDExtensionManager::LoadStatus GDExtensionManager::load_extension_from_function(const String &p_path, GDExtensionConstPtr<const GDExtensionInitializationFunction> p_init_func) {
Ref<GDExtensionFunctionLoader> func_loader;
func_loader.instantiate();
func_loader->set_initialization_function((GDExtensionInitializationFunction)*p_init_func.data);
return load_extension_with_loader(p_path, func_loader);
}
GDExtensionManager::LoadStatus GDExtensionManager::load_extension_with_loader(const String &p_path, const Ref<GDExtensionLoader> &p_loader) {
@ -454,6 +462,7 @@ GDExtensionManager *GDExtensionManager::get_singleton() {
void GDExtensionManager::_bind_methods() {
ClassDB::bind_method(D_METHOD("load_extension", "path"), &GDExtensionManager::load_extension);
ClassDB::bind_method(D_METHOD("load_extension_from_function", "path", "init_func"), &GDExtensionManager::load_extension_from_function);
ClassDB::bind_method(D_METHOD("reload_extension", "path"), &GDExtensionManager::reload_extension);
ClassDB::bind_method(D_METHOD("unload_extension", "path"), &GDExtensionManager::unload_extension);
ClassDB::bind_method(D_METHOD("is_extension_loaded", "path"), &GDExtensionManager::is_extension_loaded);

View file

@ -31,6 +31,9 @@
#pragma once
#include "core/extension/gdextension.h"
#include "core/variant/native_ptr.h"
GDVIRTUAL_NATIVE_PTR(GDExtensionInitializationFunction)
class GDExtensionManager : public Object {
GDCLASS(GDExtensionManager, Object);
@ -66,6 +69,7 @@ private:
public:
LoadStatus load_extension(const String &p_path);
LoadStatus load_extension_from_function(const String &p_path, GDExtensionConstPtr<const GDExtensionInitializationFunction> p_init_func);
LoadStatus load_extension_with_loader(const String &p_path, const Ref<GDExtensionLoader> &p_loader);
LoadStatus reload_extension(const String &p_path);
LoadStatus unload_extension(const String &p_path);

View file

@ -0,0 +1,126 @@
/**************************************************************************/
/* godot_instance.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "godot_instance.h"
#include "core/extension/gdextension_manager.h"
#include "core/os/main_loop.h"
#include "main/main.h"
#include "servers/display/display_server.h"
void GodotInstance::_bind_methods() {
ClassDB::bind_method(D_METHOD("start"), &GodotInstance::start);
ClassDB::bind_method(D_METHOD("is_started"), &GodotInstance::is_started);
ClassDB::bind_method(D_METHOD("iteration"), &GodotInstance::iteration);
ClassDB::bind_method(D_METHOD("focus_in"), &GodotInstance::focus_in);
ClassDB::bind_method(D_METHOD("focus_out"), &GodotInstance::focus_out);
ClassDB::bind_method(D_METHOD("pause"), &GodotInstance::pause);
ClassDB::bind_method(D_METHOD("resume"), &GodotInstance::resume);
}
GodotInstance::GodotInstance() {
}
GodotInstance::~GodotInstance() {
}
bool GodotInstance::initialize(GDExtensionInitializationFunction p_init_func) {
print_verbose("Godot Instance initialization");
GDExtensionManager *gdextension_manager = GDExtensionManager::get_singleton();
GDExtensionConstPtr<const GDExtensionInitializationFunction> ptr((const GDExtensionInitializationFunction *)&p_init_func);
GDExtensionManager::LoadStatus status = gdextension_manager->load_extension_from_function("libgodot://main", ptr);
return status == GDExtensionManager::LoadStatus::LOAD_STATUS_OK;
}
bool GodotInstance::start() {
print_verbose("GodotInstance::start()");
Error err = Main::setup2();
if (err != OK) {
return false;
}
started = Main::start() == EXIT_SUCCESS;
if (started) {
OS::get_singleton()->get_main_loop()->initialize();
}
return started;
}
bool GodotInstance::is_started() {
return started;
}
bool GodotInstance::iteration() {
DisplayServer::get_singleton()->process_events();
return Main::iteration();
}
void GodotInstance::stop() {
print_verbose("GodotInstance::stop()");
if (started) {
OS::get_singleton()->get_main_loop()->finalize();
}
started = false;
}
void GodotInstance::focus_out() {
print_verbose("GodotInstance::focus_out()");
if (started) {
if (OS::get_singleton()->get_main_loop()) {
OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_APPLICATION_FOCUS_OUT);
}
}
}
void GodotInstance::focus_in() {
print_verbose("GodotInstance::focus_in()");
if (started) {
if (OS::get_singleton()->get_main_loop()) {
OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_APPLICATION_FOCUS_IN);
}
}
}
void GodotInstance::pause() {
print_verbose("GodotInstance::pause()");
if (started) {
if (OS::get_singleton()->get_main_loop()) {
OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_APPLICATION_PAUSED);
}
}
}
void GodotInstance::resume() {
print_verbose("GodotInstance::resume()");
if (started) {
if (OS::get_singleton()->get_main_loop()) {
OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_APPLICATION_RESUMED);
}
}
}

View file

@ -0,0 +1,59 @@
/**************************************************************************/
/* godot_instance.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#pragma once
#include "core/extension/gdextension_interface.h"
#include "core/object/class_db.h"
class GodotInstance : public Object {
GDCLASS(GodotInstance, Object);
bool started = false;
protected:
static void _bind_methods();
public:
GodotInstance();
~GodotInstance();
bool initialize(GDExtensionInitializationFunction p_init_func);
bool start();
bool is_started();
bool iteration();
void stop();
void focus_out();
void focus_in();
void pause();
void resume();
};

73
core/extension/libgodot.h Normal file
View file

@ -0,0 +1,73 @@
/**************************************************************************/
/* libgodot.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#pragma once
#include "gdextension_interface.h"
#ifdef __cplusplus
extern "C" {
#endif
// Export macros for DLL visibility
#if defined(_MSC_VER) || defined(__MINGW32__)
#define LIBGODOT_API __declspec(dllexport)
#elif defined(__GNUC__) || defined(__clang__)
#define LIBGODOT_API __attribute__((visibility("default")))
#endif // if defined(_MSC_VER)
/**
* @name libgodot_create_godot_instance
* @since 4.6
*
* Creates a new Godot instance.
*
* @param p_argc The number of command line arguments.
* @param p_argv The C-style array of command line arguments.
* @param p_init_func GDExtension initialization function of the host application.
*
* @return A pointer to created \ref GodotInstance GDExtension object or nullptr if there was an error.
*/
LIBGODOT_API GDExtensionObjectPtr libgodot_create_godot_instance(int p_argc, char *p_argv[], GDExtensionInitializationFunction p_init_func);
/**
* @name libgodot_destroy_godot_instance
* @since 4.6
*
* Destroys an existing Godot instance.
*
* @param p_godot_instance The reference to the GodotInstance object to destroy.
*
*/
LIBGODOT_API void libgodot_destroy_godot_instance(GDExtensionObjectPtr p_godot_instance);
#ifdef __cplusplus
}
#endif

View file

@ -273,9 +273,6 @@ public:
virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptError> *r_errors = nullptr, List<Warning> *r_warnings = nullptr, HashSet<int> *r_safe_lines = nullptr) const = 0;
virtual String validate_path(const String &p_path) const { return ""; }
virtual Script *create_script() const = 0;
#ifndef DISABLE_DEPRECATED
virtual bool has_named_classes() const = 0;
#endif
virtual bool supports_builtin_mode() const = 0;
virtual bool supports_documentation() const { return false; }
virtual bool can_inherit_from_file() const { return false; }

View file

@ -370,7 +370,7 @@ public:
return Object::cast_to<Script>(ret);
}
#ifndef DISABLE_DEPRECATED
EXBIND0RC(bool, has_named_classes)
GDVIRTUAL0RC(bool, _has_named_classes)
#endif
EXBIND0RC(bool, supports_builtin_mode)
EXBIND0RC(bool, supports_documentation)

View file

@ -39,6 +39,7 @@
#include "core/debugger/engine_profiler.h"
#include "core/extension/gdextension.h"
#include "core/extension/gdextension_manager.h"
#include "core/extension/godot_instance.h"
#include "core/input/input.h"
#include "core/input/input_map.h"
#include "core/input/shortcut.h"
@ -198,8 +199,6 @@ void register_core_types() {
GDREGISTER_CLASS(InputEventMIDI);
// Network
GDREGISTER_ABSTRACT_CLASS(IP);
GDREGISTER_ABSTRACT_CLASS(StreamPeer);
GDREGISTER_ABSTRACT_CLASS(StreamPeerSocket);
GDREGISTER_ABSTRACT_CLASS(SocketServer);
@ -288,6 +287,8 @@ void register_core_types() {
GDREGISTER_CLASS(GDExtension);
GDREGISTER_ABSTRACT_CLASS(GodotInstance);
GDREGISTER_ABSTRACT_CLASS(GDExtensionManager);
GDREGISTER_ABSTRACT_CLASS(ResourceUID);
@ -303,6 +304,23 @@ void register_core_types() {
ResourceLoader::add_resource_format_loader(resource_loader_gdextension);
}
GDREGISTER_ABSTRACT_CLASS(IP);
GDREGISTER_CLASS(CoreBind::Geometry2D);
GDREGISTER_CLASS(CoreBind::Geometry3D);
GDREGISTER_CLASS(CoreBind::ResourceLoader);
GDREGISTER_CLASS(CoreBind::ResourceSaver);
GDREGISTER_CLASS(CoreBind::OS);
GDREGISTER_CLASS(CoreBind::Engine);
GDREGISTER_CLASS(CoreBind::Special::ClassDB);
GDREGISTER_CLASS(CoreBind::Marshalls);
GDREGISTER_CLASS(CoreBind::EngineDebugger);
GDREGISTER_CLASS(TranslationServer);
GDREGISTER_ABSTRACT_CLASS(Input);
GDREGISTER_CLASS(InputMap);
GDREGISTER_CLASS(Expression);
GDREGISTER_CLASS(ProjectSettings);
ip = IP::create();
_geometry_2d = memnew(CoreBind::Geometry2D);
@ -337,34 +355,15 @@ void register_core_settings() {
}
void register_early_core_singletons() {
GDREGISTER_CLASS(CoreBind::Engine);
Engine::get_singleton()->add_singleton(Engine::Singleton("Engine", CoreBind::Engine::get_singleton()));
GDREGISTER_CLASS(ProjectSettings);
Engine::get_singleton()->add_singleton(Engine::Singleton("ProjectSettings", ProjectSettings::get_singleton()));
GDREGISTER_CLASS(CoreBind::OS);
Engine::get_singleton()->add_singleton(Engine::Singleton("OS", CoreBind::OS::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("Time", Time::get_singleton()));
}
void register_core_singletons() {
OS::get_singleton()->benchmark_begin_measure("Core", "Register Singletons");
GDREGISTER_ABSTRACT_CLASS(IP);
GDREGISTER_CLASS(CoreBind::Geometry2D);
GDREGISTER_CLASS(CoreBind::Geometry3D);
GDREGISTER_CLASS(CoreBind::ResourceLoader);
GDREGISTER_CLASS(CoreBind::ResourceSaver);
GDREGISTER_CLASS(CoreBind::Special::ClassDB);
GDREGISTER_CLASS(CoreBind::Marshalls);
GDREGISTER_CLASS(TranslationServer);
GDREGISTER_ABSTRACT_CLASS(Input);
GDREGISTER_CLASS(InputMap);
GDREGISTER_CLASS(Expression);
GDREGISTER_CLASS(CoreBind::EngineDebugger);
Engine::get_singleton()->add_singleton(Engine::Singleton("IP", IP::get_singleton(), "IP"));
Engine::get_singleton()->add_singleton(Engine::Singleton("Geometry2D", CoreBind::Geometry2D::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("Geometry3D", CoreBind::Geometry3D::get_singleton()));

View file

@ -31,6 +31,7 @@
#pragma once
#include "core/math/audio_frame.h"
#include "core/variant/binder_common.h"
#include "core/variant/method_ptrcall.h"
#include "core/variant/type_info.h"

View file

@ -39,6 +39,14 @@
Loads an extension by absolute file path. The [param path] needs to point to a valid [GDExtension]. Returns [constant LOAD_STATUS_OK] if successful.
</description>
</method>
<method name="load_extension_from_function">
<return type="int" enum="GDExtensionManager.LoadStatus" />
<param index="0" name="path" type="String" />
<param index="1" name="init_func" type="const GDExtensionInitializationFunction*" />
<description>
Loads the extension already in address space via the given path and initialization function. The [param path] needs to be unique and start with [code]"libgodot://"[/code]. Returns [constant LOAD_STATUS_OK] if successful.
</description>
</method>
<method name="reload_extension">
<return type="int" enum="GDExtensionManager.LoadStatus" />
<param index="0" name="path" type="String" />

View file

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="GodotInstance" inherits="Object" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Provides access to an embedded Godot instance.
</brief_description>
<description>
GodotInstance represents a running Godot instance that is controlled from an outside codebase, without a perpetual main loop. It is created by the C API [code]libgodot_create_godot_instance[/code]. Only one may be created per process.
</description>
<tutorials>
</tutorials>
<methods>
<method name="focus_in">
<return type="void" />
<description>
Notifies the instance that it is now in focus.
</description>
</method>
<method name="focus_out">
<return type="void" />
<description>
Notifies the instance that it is now not in focus.
</description>
</method>
<method name="is_started">
<return type="bool" />
<description>
Returns [code]true[/code] if this instance has been fully started.
</description>
</method>
<method name="iteration">
<return type="bool" />
<description>
Runs a single iteration of the main loop. Returns [code]true[/code] if the engine is attempting to quit.
</description>
</method>
<method name="pause">
<return type="void" />
<description>
Notifies the instance that it is going to be paused.
</description>
</method>
<method name="resume">
<return type="void" />
<description>
Notifies the instance that it is being resumed.
</description>
</method>
<method name="start">
<return type="bool" />
<description>
Finishes this instance's startup sequence. Returns [code]true[/code] on success.
</description>
</method>
</methods>
</class>

View file

@ -307,6 +307,9 @@
<member name="application/config/description" type="String" setter="" getter="" default="&quot;&quot;">
The project's description, displayed as a tooltip in the Project Manager when hovering the project.
</member>
<member name="application/config/disable_project_settings_override" type="bool" setter="" getter="" default="false">
If [code]true[/code], disables loading of project settings overrides (file defined in [member application/config/project_settings_override] and [code]res://override.cfg[/code]) and related CLI arguments.
</member>
<member name="application/config/icon" type="String" setter="" getter="" default="&quot;&quot;">
Icon used for the project, set when project loads. Exporters will also use this icon as a fallback if necessary.
</member>

View file

@ -215,7 +215,7 @@
<description>
</description>
</method>
<method name="_has_named_classes" qualifiers="virtual required const" deprecated="This method is not called by the engine.">
<method name="_has_named_classes" qualifiers="virtual const" deprecated="This method is not called by the engine.">
<return type="bool" />
<description>
</description>

View file

@ -4571,8 +4571,7 @@ void RenderingDeviceDriverD3D12::command_begin_render_pass(CommandBufferID p_cmd
p_rect.position.y,
p_rect.position.x + p_rect.size.x,
p_rect.position.y + p_rect.size.y);
cmd_buf_info->render_pass_state.region_is_all = !(
cmd_buf_info->render_pass_state.region_rect.left == 0 &&
cmd_buf_info->render_pass_state.region_is_all = (cmd_buf_info->render_pass_state.region_rect.left == 0 &&
cmd_buf_info->render_pass_state.region_rect.top == 0 &&
cmd_buf_info->render_pass_state.region_rect.right == fb_info->size.x &&
cmd_buf_info->render_pass_state.region_rect.bottom == fb_info->size.y);

View file

@ -811,6 +811,9 @@ bool LightStorage::reflection_probe_instance_begin_render(RID p_instance, RID p_
ERR_FAIL_NULL_V(atlas, false);
ERR_FAIL_COND_V_MSG(atlas->size < 4, false, "Attempted to render to a reflection atlas of invalid resolution.");
ERR_FAIL_COND_V_MSG(atlas->count < 1, false, "Attempted to render to a reflection atlas of size < 1.");
ReflectionProbeInstance *rpi = reflection_probe_instance_owner.get_or_null(p_instance);
ERR_FAIL_NULL_V(rpi, false);

View file

@ -556,16 +556,20 @@ void Main::print_help(const char *p_binary) {
print_help_option("--quit-after <int>", "Quit after the given number of iterations. Set to 0 to disable.\n");
print_help_option("-l, --language <locale>", "Use a specific locale (<locale> being a two-letter code).\n");
print_help_option("--path <directory>", "Path to a project (<directory> must contain a \"project.godot\" file).\n");
#ifdef OVERRIDE_ENABLED
print_help_option("--scene <path>", "Path or UID of a scene in the project that should be started.\n");
print_help_option("-u, --upwards", "Scan folders upwards for project.godot file.\n");
print_help_option("--main-pack <file>", "Path to a pack (.pck) file to load.\n");
#endif // OVERRIDE_ENABLED
#ifdef DISABLE_DEPRECATED
print_help_option("--render-thread <mode>", "Render thread mode (\"safe\", \"separate\").\n");
#else
print_help_option("--render-thread <mode>", "Render thread mode (\"unsafe\" [deprecated], \"safe\", \"separate\").\n");
#endif
#endif // DISABLE_DEPRECATED
#ifdef OVERRIDE_ENABLED
print_help_option("--remote-fs <address>", "Remote filesystem (<host/IP>[:<port>] address).\n");
print_help_option("--remote-fs-password <password>", "Password for remote filesystem.\n");
#endif // OVERRIDE_ENABLED
print_help_option("--audio-driver <driver>", "Audio driver [");
for (int i = 0; i < AudioDriverManager::get_driver_count(); i++) {
@ -662,10 +666,12 @@ void Main::print_help(const char *p_binary) {
print_help_option("--editor-pseudolocalization", "Enable pseudolocalization for the editor and the project manager.\n", CLI_OPTION_AVAILABILITY_EDITOR);
#endif
#ifdef OVERRIDE_ENABLED
print_help_title("Standalone tools");
print_help_option("-s, --script <script>", "Run a script.\n");
print_help_option("--main-loop <main_loop_name>", "Run a MainLoop specified by its global class name.\n");
print_help_option("--check-only", "Only parse for errors and quit (use with --script).\n");
#endif // OVERRIDE_ENABLED
#ifdef TOOLS_ENABLED
print_help_option("--import", "Starts the editor, waits for any resources to be imported, and then quits.\n", CLI_OPTION_AVAILABILITY_EDITOR);
print_help_option("--export-release <preset> <path>", "Export the project in release mode using the given preset and output path. The preset name should match one defined in \"export_presets.cfg\".\n", CLI_OPTION_AVAILABILITY_EDITOR);
@ -1432,7 +1438,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing language argument, aborting.\n");
goto error;
}
#ifdef OVERRIDE_ENABLED
} else if (arg == "--remote-fs") { // remote filesystem
if (N) {
@ -1451,6 +1457,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing remote filesystem password, aborting.\n");
goto error;
}
#endif // OVERRIDE_ENABLED
} else if (arg == "--render-thread") { // render thread mode
if (N) {
@ -1651,8 +1658,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing relative or absolute path, aborting.\n");
goto error;
}
#ifdef OVERRIDE_ENABLED
} else if (arg == "-u" || arg == "--upwards") { // scan folders upwards
upwards = true;
#endif // OVERRIDE_ENABLED
} else if (arg == "--quit") { // Auto quit at the end of the first main loop iteration
quit_after = 1;
#ifdef TOOLS_ENABLED
@ -1723,7 +1732,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing time scale argument, aborting.\n");
goto error;
}
#ifdef OVERRIDE_ENABLED
} else if (arg == "--main-pack") {
if (N) {
main_pack = N->get();
@ -1732,7 +1741,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing path to main pack file, aborting.\n");
goto error;
}
#endif // OVERRIDE_ENABLED
} else if (arg == "-d" || arg == "--debug") {
debug_uri = "local://";
OS::get_singleton()->_debug_stdout = true;
@ -1913,6 +1922,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
#endif
#ifdef OVERRIDE_ENABLED
// Network file system needs to be configured before globals, since globals are based on the
// 'project.godot' file which will only be available through the network if this is enabled
if (!remotefs.is_empty()) {
@ -1930,6 +1940,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
goto error;
}
}
#endif // OVERRIDE_ENABLED
OS::get_singleton()->_in_editor = editor;
if (globals->setup(project_path, main_pack, upwards, editor) == OK) {
@ -3815,6 +3826,7 @@ int Main::start() {
} else if (E->get() == "--install-android-build-template") {
install_android_build_template = true;
#endif // TOOLS_ENABLED
#ifdef OVERRIDE_ENABLED
} else if (E->get() == "--scene") {
E = E->next();
if (E) {
@ -3839,6 +3851,7 @@ int Main::start() {
// for non-game applications.
game_path = scene_path;
}
#endif // OVERRIDE_ENABLED
}
// Then parameters that have an argument to the right.
else if (E->next()) {
@ -4043,6 +4056,19 @@ int Main::start() {
#endif // TOOLS_ENABLED
#ifdef OVERRIDE_ENABLED
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
if (disable_override) {
script = String();
game_path = String();
main_loop_type = String();
}
#else
script = String();
game_path = String();
main_loop_type = String();
#endif // OVERRIDE_ENABLED
if (script.is_empty() && game_path.is_empty()) {
const String main_scene = GLOBAL_GET("application/run/main_scene");
if (main_scene.begins_with("uid://")) {

View file

@ -32,6 +32,8 @@
#include "steam_tracker.h"
#include "core/io/file_access.h"
// https://partner.steamgames.com/doc/sdk/api#initialization_and_shutdown
SteamTracker::SteamTracker() {

View file

@ -88,15 +88,19 @@ def redirect_emitter(target, source, env):
Emitter to automatically redirect object/library build files to the `bin/obj` directory,
retaining subfolder structure. External build files will attempt to retain subfolder
structure relative to their environment's parent directory, sorted under `bin/obj/external`.
If `redirect_build_objects` is `False`, or an external build file isn't relative to the
passed environment, this emitter does nothing.
If `redirect_build_objects` is `False`, an external build file isn't relative to the passed
environment, or a file is being written directly into `bin`, this emitter does nothing.
"""
if not env["redirect_build_objects"]:
return target, source
redirected_targets = []
for item in target:
if base_folder in (path := Path(item.get_abspath()).resolve()).parents:
path = Path(item.get_abspath()).resolve()
if path.parent == base_folder / "bin":
pass
elif base_folder in path.parents:
item = env.File(f"#bin/obj/{path.relative_to(base_folder)}")
elif (alt_base := Path(env.Dir(".").get_abspath()).resolve().parent) in path.parents:
item = env.File(f"#bin/obj/external/{path.relative_to(alt_base)}")

View file

@ -383,9 +383,14 @@ void GDScriptEditorTranslationParserPlugin::_assess_call(const GDScriptParser::C
_add_id(p_call->arguments[1]->reduced_value, p_call->arguments[1]->start_line);
}
} else if (function_name == fd_add_filter) {
// Extract the 'JPE Images' in this example - get_node("FileDialog").add_filter("*.jpg; JPE Images").
if (!p_call->arguments.is_empty()) {
if (p_call->arguments.size() == 1) {
// The first parameter may contain a description, like `"*.jpg; JPEG Images"`.
_extract_fd_filter_string(p_call->arguments[0], p_call->arguments[0]->start_line);
} else if (p_call->arguments.size() >= 2) {
// The second optional parameter can be a description.
if (_is_constant_string(p_call->arguments[1])) {
_add_id(p_call->arguments[1]->reduced_value, p_call->arguments[1]->start_line);
}
}
} else if (function_name == fd_set_filter) {
// Extract from `get_node("FileDialog").set_filters(<filter array>)`.
@ -396,11 +401,16 @@ void GDScriptEditorTranslationParserPlugin::_assess_call(const GDScriptParser::C
}
void GDScriptEditorTranslationParserPlugin::_extract_fd_filter_string(const GDScriptParser::ExpressionNode *p_expression, int p_line) {
// Extract the name in "extension ; name".
// Extract the description from `"filter; Description"` format.
// The description part is optional, so we skip if it's missing or empty.
if (_is_constant_string(p_expression)) {
PackedStringArray arr = p_expression->reduced_value.operator String().split(";", true);
ERR_FAIL_COND_MSG(arr.size() != 2, "Argument for setting FileDialog has bad format.");
_add_id(arr[1].strip_edges(), p_line);
const PackedStringArray arr = p_expression->reduced_value.operator String().split(";", true, 1);
if (arr.size() >= 2) {
const String description = arr[1].strip_edges();
if (!description.is_empty()) {
_add_id(description, p_line);
}
}
}
}

View file

@ -608,9 +608,6 @@ public:
virtual Vector<ScriptTemplate> get_built_in_templates(const StringName &p_object) override;
virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptLanguage::ScriptError> *r_errors = nullptr, List<ScriptLanguage::Warning> *r_warnings = nullptr, HashSet<int> *r_safe_lines = nullptr) const override;
virtual Script *create_script() const override;
#ifndef DISABLE_DEPRECATED
virtual bool has_named_classes() const override { return false; }
#endif
virtual bool supports_builtin_mode() const override;
virtual bool supports_documentation() const override;
virtual bool can_inherit_from_file() const override { return true; }

View file

@ -7066,7 +7066,8 @@ Ref<GLTFObjectModelProperty> GLTFDocument::export_object_model_property(Ref<GLTF
const Vector<StringName> subpath = p_node_path.get_subnames();
ERR_FAIL_COND_V_MSG(subpath.is_empty(), ret, "glTF: Cannot export empty property. No property was specified in the NodePath: " + String(p_node_path));
int target_prop_depth = 0;
for (StringName subname : subpath) {
for (int64_t i = 0; i < subpath.size() - 1; i++) {
const StringName &subname = subpath[i];
Variant target_property = target_object->get(subname);
if (target_property.get_type() == Variant::OBJECT) {
target_object = target_property;

View file

@ -514,9 +514,6 @@ public:
}
String validate_path(const String &p_path) const override;
Script *create_script() const override;
#ifndef DISABLE_DEPRECATED
virtual bool has_named_classes() const override { return false; }
#endif
bool supports_builtin_mode() const override;
/* TODO? */ int find_function(const String &p_function, const String &p_code) const override {
return -1;

View file

@ -13,6 +13,11 @@ common_linuxbsd = [
"freedesktop_at_spi_monitor.cpp",
]
if env["library_type"] == "executable":
common_linuxbsd += ["godot_linuxbsd.cpp"]
else:
common_linuxbsd += ["libgodot_linuxbsd.cpp"]
if env["use_sowrap"]:
common_linuxbsd.append("xkbcommon-so_wrap.c")
@ -35,7 +40,13 @@ if env["dbus"]:
if env["use_sowrap"]:
common_linuxbsd.append("dbus-so_wrap.c")
prog = env.add_program("#bin/godot", ["godot_linuxbsd.cpp"] + common_linuxbsd)
if env["library_type"] == "static_library":
prog = env.add_library("#bin/godot", common_linuxbsd)
elif env["library_type"] == "shared_library":
env.Append(CCFLAGS=["-fPIC"])
prog = env.add_shared_library("#bin/godot", common_linuxbsd)
else:
prog = env.add_program("#bin/godot", common_linuxbsd)
if env["debug_symbols"] and env["separate_debug_symbols"]:
env.AddPostAction(prog, env.Run(platform_linuxbsd_builders.make_debug_linuxbsd))

View file

@ -67,7 +67,7 @@ def get_doc_path():
def get_flags():
return {
"arch": detect_arch(),
"supported": ["mono"],
"supported": ["library", "mono"],
}

View file

@ -0,0 +1,71 @@
/**************************************************************************/
/* libgodot_linuxbsd.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "core/extension/libgodot.h"
#include "core/extension/godot_instance.h"
#include "main/main.h"
#include "os_linuxbsd.h"
static OS_LinuxBSD *os = nullptr;
static GodotInstance *instance = nullptr;
GDExtensionObjectPtr libgodot_create_godot_instance(int p_argc, char *p_argv[], GDExtensionInitializationFunction p_init_func) {
ERR_FAIL_COND_V_MSG(instance != nullptr, nullptr, "Only one Godot Instance may be created.");
os = new OS_LinuxBSD();
Error err = Main::setup(p_argv[0], p_argc - 1, &p_argv[1], false);
if (err != OK) {
return nullptr;
}
instance = memnew(GodotInstance);
if (!instance->initialize(p_init_func)) {
memdelete(instance);
// Note: When Godot Engine supports reinitialization, clear the instance pointer here.
//instance = nullptr;
return nullptr;
}
return (GDExtensionObjectPtr)instance;
}
void libgodot_destroy_godot_instance(GDExtensionObjectPtr p_godot_instance) {
GodotInstance *godot_instance = (GodotInstance *)p_godot_instance;
if (instance == godot_instance) {
godot_instance->stop();
memdelete(godot_instance);
instance = nullptr;
Main::cleanup();
}
}

View file

@ -21,7 +21,6 @@ files = [
"godot_window_delegate.mm",
"godot_window.mm",
"key_mapping_macos.mm",
"godot_main_macos.mm",
"godot_menu_delegate.mm",
"godot_menu_item.mm",
"godot_open_save_delegate.mm",
@ -39,7 +38,17 @@ if env.editor_build:
"editor/embedded_process_macos.mm",
]
prog = env.add_program("#bin/godot", files)
if env["library_type"] == "executable":
files += ["godot_main_macos.mm"]
else:
files += ["libgodot_macos.mm"]
if env["library_type"] == "static_library":
prog = env.add_library("#bin/godot", files)
elif env["library_type"] == "shared_library":
prog = env.add_shared_library("#bin/godot", files)
else:
prog = env.add_program("#bin/godot", files)
if env["debug_symbols"] and env["separate_debug_symbols"]:
env.AddPostAction(prog, env.Run(platform_macos_builders.make_debug_macos))

View file

@ -61,7 +61,7 @@ def get_flags():
"arch": detect_arch(),
"use_volk": False,
"metal": True,
"supported": ["metal", "mono"],
"supported": ["library", "metal", "mono"],
}
@ -172,8 +172,9 @@ def configure(env: "SConsEnvironment"):
env.Append(CCFLAGS=["-fsanitize=thread"])
env.Append(LINKFLAGS=["-fsanitize=thread"])
env.Append(LINKFLAGS=["-Wl,-stack_size," + hex(STACK_SIZE_SANITIZERS)])
else:
if env["library_type"] == "executable":
env.Append(LINKFLAGS=["-Wl,-stack_size," + hex(STACK_SIZE_SANITIZERS)])
elif env["library_type"] == "executable":
env.Append(LINKFLAGS=["-Wl,-stack_size," + hex(STACK_SIZE)])
if env["use_coverage"]:

View file

@ -0,0 +1,74 @@
/**************************************************************************/
/* libgodot_macos.mm */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "core/extension/libgodot.h"
#include "core/extension/godot_instance.h"
#include "main/main.h"
#include "os_macos.h"
static OS_MacOS *os = nullptr;
static GodotInstance *instance = nullptr;
GDExtensionObjectPtr libgodot_create_godot_instance(int p_argc, char *p_argv[], GDExtensionInitializationFunction p_init_func) {
ERR_FAIL_COND_V_MSG(instance != nullptr, nullptr, "Only one Godot Instance may be created.");
uint32_t remaining_args = p_argc - 1;
os = new OS_MacOS_NSApp(p_argv[0], remaining_args, remaining_args > 0 ? &p_argv[1] : nullptr);
@autoreleasepool {
Error err = Main::setup(p_argv[0], remaining_args, remaining_args > 0 ? &p_argv[1] : nullptr, false);
if (err != OK) {
return nullptr;
}
instance = memnew(GodotInstance);
if (!instance->initialize(p_init_func)) {
memdelete(instance);
instance = nullptr;
return nullptr;
}
return (GDExtensionObjectPtr)instance;
}
}
void libgodot_destroy_godot_instance(GDExtensionObjectPtr p_godot_instance) {
GodotInstance *godot_instance = (GodotInstance *)p_godot_instance;
if (instance == godot_instance) {
godot_instance->stop();
memdelete(godot_instance);
// Note: When Godot Engine supports reinitialization, clear the instance pointer here.
//instance = nullptr;
Main::cleanup();
}
}

View file

@ -13,7 +13,6 @@ from methods import redirect_emitter
sources = []
common_win = [
"godot_windows.cpp",
"os_windows.cpp",
"display_server_windows.cpp",
"key_mapping_windows.cpp",
@ -28,6 +27,11 @@ common_win = [
"drop_target_windows.cpp",
]
if env["library_type"] == "executable":
common_win += ["godot_windows.cpp"]
else:
common_win += ["libgodot_windows.cpp"]
if env.msvc:
common_win += ["crash_handler_windows_seh.cpp"]
else:
@ -39,7 +43,7 @@ common_win_wrap = [
env_wrap = env.Clone()
if env["arch"] == "x86_64":
if env["arch"] == "x86_64" and env["library_type"] == "executable":
env_cpp_check = env.Clone()
env_cpp_check.add_source_files(sources, ["cpu_feature_validation.c"])
if env.msvc:
@ -76,7 +80,12 @@ sources += res_obj
if env["accesskit"] and not env.msvc:
sources += env.DEFLIB("uiautomationcore")
prog = env.add_program("#bin/godot", sources, PROGSUFFIX=env["PROGSUFFIX"])
if env["library_type"] == "static_library":
prog = env.add_library("#bin/godot", sources, PROGSUFFIX=env["PROGSUFFIX"])
elif env["library_type"] == "shared_library":
prog = env.add_shared_library("#bin/godot", sources, PROGSUFFIX=env["PROGSUFFIX"])
else:
prog = env.add_program("#bin/godot", sources, PROGSUFFIX=env["PROGSUFFIX"])
arrange_program_clean(prog)
env.Depends(prog, "godot.manifest")

View file

@ -233,7 +233,7 @@ def get_flags():
return {
"arch": arch,
"supported": ["d3d12", "dcomp", "mono", "xaudio2"],
"supported": ["d3d12", "dcomp", "library", "mono", "xaudio2"],
}
@ -243,7 +243,7 @@ def configure_msvc(env: "SConsEnvironment"):
## Build type
# TODO: Re-evaluate the need for this / streamline with common config.
if env["target"] == "template_release":
if env["target"] == "template_release" and env["library_type"] == "executable":
env.Append(LINKFLAGS=["/ENTRY:mainCRTStartup"])
if env["windows_subsystem"] == "gui":

View file

@ -0,0 +1,71 @@
/**************************************************************************/
/* libgodot_windows.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "core/extension/libgodot.h"
#include "core/extension/godot_instance.h"
#include "main/main.h"
#include "os_windows.h"
static OS_Windows *os = nullptr;
static GodotInstance *instance = nullptr;
GDExtensionObjectPtr libgodot_create_godot_instance(int p_argc, char *p_argv[], GDExtensionInitializationFunction p_init_func) {
ERR_FAIL_COND_V_MSG(instance != nullptr, nullptr, "Only one Godot Instance may be created at a time.");
os = new OS_Windows(GetModuleHandle(nullptr));
Error err = Main::setup(p_argv[0], p_argc - 1, &p_argv[1], false);
if (err != OK) {
return nullptr;
}
instance = memnew(GodotInstance);
if (!instance->initialize(p_init_func)) {
memdelete(instance);
instance = nullptr;
return nullptr;
}
return (GDExtensionObjectPtr)instance;
}
void libgodot_destroy_godot_instance(GDExtensionObjectPtr p_godot_instance) {
GodotInstance *godot_instance = (GodotInstance *)p_godot_instance;
if (instance == godot_instance) {
godot_instance->stop();
memdelete(godot_instance);
// Note: When Godot Engine supports reinitialization, clear the instance pointer here.
//instance = nullptr;
Main::cleanup();
}
}

View file

@ -73,15 +73,8 @@ Size2 ScrollContainer::get_minimum_size() const {
}
}
Size2 panel_size = theme_cache.panel_style->get_minimum_size();
min_size += panel_size;
if (draw_focus_border) {
Size2 focus_size = theme_cache.focus_style->get_minimum_size();
// Only update the minimum size if the focus style's minimum size doesn't fit into the panel style's minimum size.
if (focus_size > panel_size) {
min_size += focus_size - panel_size;
}
}
Rect2 margins = _get_margins();
min_size += margins.position + margins.size;
return min_size;
}
@ -111,6 +104,34 @@ bool ScrollContainer::_is_v_scroll_visible() const {
return v_scroll->is_visible() && v_scroll->get_parent() == this;
}
Rect2 ScrollContainer::_get_margins() const {
float right_margin = theme_cache.panel_style->get_margin(SIDE_RIGHT);
float left_margin = theme_cache.panel_style->get_margin(SIDE_LEFT);
float top_margin = theme_cache.panel_style->get_margin(SIDE_TOP);
float bottom_margin = theme_cache.panel_style->get_margin(SIDE_BOTTOM);
if (draw_focus_border) {
// Only update margins if the focus style's margins don't fit into the panel style's margins.
float focus_margin = theme_cache.focus_style->get_margin(SIDE_RIGHT);
if (focus_margin > right_margin) {
right_margin = focus_margin;
}
focus_margin = theme_cache.focus_style->get_margin(SIDE_LEFT);
if (focus_margin > left_margin) {
left_margin = focus_margin;
}
focus_margin = theme_cache.focus_style->get_margin(SIDE_TOP);
if (focus_margin > top_margin) {
top_margin = focus_margin;
}
focus_margin = theme_cache.focus_style->get_margin(SIDE_BOTTOM);
if (focus_margin > bottom_margin) {
bottom_margin = focus_margin;
}
}
return Rect2(left_margin, top_margin, right_margin, bottom_margin);
}
void ScrollContainer::gui_input(const Ref<InputEvent> &p_gui_input) {
ERR_FAIL_COND(p_gui_input.is_null());
@ -268,45 +289,23 @@ void ScrollContainer::_update_scrollbar_position() {
return;
}
float right_margin = theme_cache.panel_style->get_margin(SIDE_RIGHT);
float left_margin = theme_cache.panel_style->get_margin(SIDE_LEFT);
float top_margin = theme_cache.panel_style->get_margin(SIDE_TOP);
float bottom_margin = theme_cache.panel_style->get_margin(SIDE_BOTTOM);
if (draw_focus_border) {
// Only update margins if the focus style's margins don't fit into the panel style's margins.
float focus_margin = theme_cache.focus_style->get_margin(SIDE_RIGHT);
if (focus_margin > right_margin) {
right_margin += focus_margin;
}
focus_margin = theme_cache.focus_style->get_margin(SIDE_LEFT);
if (focus_margin > left_margin) {
left_margin += focus_margin;
}
focus_margin = theme_cache.focus_style->get_margin(SIDE_TOP);
if (focus_margin > top_margin) {
top_margin += focus_margin;
}
focus_margin = theme_cache.focus_style->get_margin(SIDE_BOTTOM);
if (focus_margin > bottom_margin) {
bottom_margin += focus_margin;
}
}
Rect2 margins = _get_margins();
Size2 hmin = h_scroll->is_visible() ? h_scroll->get_combined_minimum_size() : Size2();
Size2 vmin = v_scroll->is_visible() ? v_scroll->get_combined_minimum_size() : Size2();
int lmar = is_layout_rtl() ? right_margin : left_margin;
int rmar = is_layout_rtl() ? left_margin : right_margin;
int lmar = is_layout_rtl() ? margins.size.x : margins.position.x;
int rmar = is_layout_rtl() ? margins.position.x : margins.size.x;
h_scroll->set_anchor_and_offset(SIDE_LEFT, ANCHOR_BEGIN, lmar);
h_scroll->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, -rmar - vmin.width);
h_scroll->set_anchor_and_offset(SIDE_TOP, ANCHOR_END, -hmin.height - bottom_margin);
h_scroll->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, -bottom_margin);
h_scroll->set_anchor_and_offset(SIDE_TOP, ANCHOR_END, -hmin.height - margins.size.y);
h_scroll->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, -margins.size.y);
v_scroll->set_anchor_and_offset(SIDE_LEFT, ANCHOR_END, -vmin.width - rmar);
v_scroll->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, -rmar);
v_scroll->set_anchor_and_offset(SIDE_TOP, ANCHOR_BEGIN, top_margin);
v_scroll->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, -hmin.height - bottom_margin);
v_scroll->set_anchor_and_offset(SIDE_TOP, ANCHOR_BEGIN, margins.position.y);
v_scroll->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, -hmin.height - margins.size.y);
_updating_scrollbars = false;
}
@ -344,24 +343,11 @@ void ScrollContainer::ensure_control_visible(Control *p_control) {
void ScrollContainer::_reposition_children() {
update_scrollbars();
Size2 size = get_size();
Point2 ofs;
Size2 panel_size = theme_cache.panel_style->get_minimum_size();
Point2 panel_offset = theme_cache.panel_style->get_offset();
size -= panel_size;
ofs += panel_offset;
if (draw_focus_border) {
// Only update the size and offset if focus style's doesn't fit into the panel style's.
Size2 focus_size = theme_cache.focus_style->get_minimum_size();
if (focus_size > panel_size) {
size -= focus_size - panel_size;
}
Point2 focus_offset = theme_cache.focus_style->get_offset();
if (focus_offset > panel_offset) {
ofs += focus_offset - panel_offset;
}
}
Rect2 margins = _get_margins();
Size2 size = get_size();
size -= margins.position + margins.size;
Point2 ofs = margins.position;
bool rtl = is_layout_rtl();
bool reserve_vscroll = _is_v_scroll_visible() || vertical_scroll_mode == SCROLL_MODE_RESERVE;
@ -594,16 +580,10 @@ void ScrollContainer::_notification(int p_what) {
}
void ScrollContainer::update_scrollbars() {
Rect2 margins = _get_margins();
Size2 size = get_size();
Size2 panel_size = theme_cache.panel_style->get_minimum_size();
size -= panel_size;
if (draw_focus_border) {
Size2 focus_size = theme_cache.focus_style->get_minimum_size();
// Only update the size if the focus style's minimum size doesn't fit into the panel style's minimum size.
if (focus_size > panel_size) {
size -= focus_size - panel_size;
}
}
size -= margins.position + margins.size;
Size2 hmin = h_scroll->get_combined_minimum_size();
Size2 vmin = v_scroll->get_combined_minimum_size();

View file

@ -85,6 +85,8 @@ private:
bool _is_h_scroll_visible() const;
bool _is_v_scroll_visible() const;
Rect2 _get_margins() const;
bool draw_focus_border = false;
bool focus_border_is_drawn = false;
bool child_has_focus();

View file

@ -31,7 +31,6 @@
#pragma once
#include "core/io/resource.h"
#include "scene/resources/compositor.h"
#include "scene/resources/environment.h"
#ifndef PHYSICS_3D_DISABLED
@ -40,6 +39,7 @@
class CameraAttributes;
class Camera3D;
class Compositor;
class VisibleOnScreenNotifier3D;
struct SpatialIndexer;

View file

@ -34,6 +34,7 @@
#include "core/io/file_access.h"
#include "core/io/missing_resource.h"
#include "core/io/resource_loader.h"
#include "core/object/script_language.h"
#include "core/templates/local_vector.h"
#include "scene/2d/node_2d.h"
#include "scene/gui/control.h"

View file

@ -1482,6 +1482,9 @@ bool LightStorage::reflection_probe_instance_begin_render(RID p_instance, RID p_
ERR_FAIL_NULL_V(atlas, false);
ERR_FAIL_COND_V_MSG(atlas->size < 2, false, "Attempted to render to a reflection atlas of invalid resolution.");
ERR_FAIL_COND_V_MSG(atlas->count < 1, false, "Attempted to render to a reflection atlas of size < 1.");
ReflectionProbeInstance *rpi = reflection_probe_instance_owner.get_or_null(p_instance);
ERR_FAIL_NULL_V(rpi, false);

View file

@ -3649,9 +3649,9 @@ void RenderingServer::init() {
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/reflections/sky_reflections/ggx_samples", PROPERTY_HINT_RANGE, "0,256,1"), 32);
GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/reflections/sky_reflections/ggx_samples.mobile", PROPERTY_HINT_RANGE, "0,128,1"), 16);
GLOBAL_DEF("rendering/reflections/sky_reflections/fast_filter_high_quality", false);
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/reflections/reflection_atlas/reflection_size", PROPERTY_HINT_RANGE, "0,4096,1"), 256);
GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/reflections/reflection_atlas/reflection_size.mobile", PROPERTY_HINT_RANGE, "0,2048,1"), 128);
GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/reflections/reflection_atlas/reflection_count", PROPERTY_HINT_RANGE, "0,256,1"), 64);
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/reflections/reflection_atlas/reflection_size", PROPERTY_HINT_RANGE, "4,4096,1"), 256);
GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/reflections/reflection_atlas/reflection_size.mobile", PROPERTY_HINT_RANGE, "4,2048,1"), 128);
GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/reflections/reflection_atlas/reflection_count", PROPERTY_HINT_RANGE, "1,256,1"), 64);
GLOBAL_DEF_RST("rendering/reflections/specular_occlusion/enabled", true);
GLOBAL_DEF("rendering/global_illumination/gi/use_half_resolution", false);