Skip to content

Commit

Permalink
Merge branch 'godotengine:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
NohbdyAhtall authored Feb 17, 2025
2 parents 9ad1abf + f42e612 commit e4c3dc7
Show file tree
Hide file tree
Showing 649 changed files with 496,874 additions and 148,733 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/android_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,27 @@ jobs:
cd ../../..
ls -l bin/android_editor_builds/
# Separate different editors for multiple artifacts
mkdir horizonos
mv bin/android_editor_builds/*-horizonos-* horizonos
mkdir picoos
mv bin/android_editor_builds/*-picoos-* picoos
- name: Upload artifact
uses: ./.github/actions/upload-artifact
with:
name: ${{ matrix.cache-name }}

- name: Upload artifact (Horizon OS)
if: matrix.target == 'editor'
uses: ./.github/actions/upload-artifact
with:
name: ${{ matrix.cache-name }}-horizonos
path: horizonos

- name: Upload artifact (PICO OS)
if: matrix.target == 'editor'
uses: ./.github/actions/upload-artifact
with:
name: ${{ matrix.cache-name }}-picoos
path: picoos
14 changes: 12 additions & 2 deletions .github/workflows/linux_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
artifact: false
cache-limit: 5

- name: Template w/ Mono (target=template_release, tests=yes)
- name: Template w/ Mono, release (target=template_release, tests=yes)
cache-name: linux-template-mono
target: template_release
sconsflags: module_mono_enabled=yes
Expand All @@ -84,6 +84,16 @@ jobs:
artifact: true
cache-limit: 1

- name: Template w/ Mono, debug (target=template_debug, tests=yes)
cache-name: linux-template-mono-debug
target: template_debug
sconsflags: module_mono_enabled=yes
bin: ./bin/godot.linuxbsd.template_debug.x86_64.mono
build-mono: false
tests: true
artifact: true
cache-limit: 1

- name: Minimal template (target=template_release, tests=yes, everything disabled)
cache-name: linux-template-minimal
target: template_release
Expand All @@ -105,7 +115,7 @@ jobs:
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EB8B81E14DA65431D7504EA8F63F0F2B90935439
sudo add-apt-repository "deb https://ppa.launchpadcontent.net/kisak/turtle/ubuntu ${{ matrix.os == 'ubuntu-20.04' && 'focal' || 'jammy' }} main"
sudo add-apt-repository "deb https://ppa.launchpadcontent.net/kisak/turtle/ubuntu jammy main"
sudo apt-get install -qq mesa-vulkan-drivers
# TODO: Figure out somehow how to embed this one.
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ cpp.hint
# macOS
.DS_Store
__MACOSX
Godot.app

# Windows
# https://github.com/github/gitignore/blob/main/Global/Windows.gitignore
Expand Down
34 changes: 19 additions & 15 deletions COPYRIGHT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ Copyright: 2011, Ole Kniemeyer, MAXON, www.maxon.net
2007-2014, Juan Linietsky, Ariel Manzur
License: Expat and Zlib

Files: modules/betsy/alpha_stitch.glsl
modules/betsy/bc1.glsl
modules/betsy/bc4.glsl
modules/betsy/bc6h.glsl
modules/betsy/CrossPlatformSettings_piece_all.glsl
Comment: Betsy
Copyright: 2020-2022, Matias N. Goldberg
License: Expat

Files: modules/godot_physics_2d/godot_joints_2d.cpp
Comment: Chipmunk2D Joint Constraints
Copyright: 2007, Scott Lembcke
Expand Down Expand Up @@ -179,11 +188,6 @@ Comment: Basis Universal
Copyright: 2019-2024, Binomial LLC.
License: Apache-2.0

Files: thirdparty/betsy/*
Comment: Betsy
Copyright: 2020-2022, Matias N. Goldberg
License: Expat

Files: thirdparty/brotli/*
Comment: Brotli
Copyright: 2009, 2010, 2013-2016 by the Brotli Authors.
Expand Down Expand Up @@ -407,6 +411,11 @@ Comment: FastLZ
Copyright: 2005-2020, Ariya Hidayat
License: Expat

Files: thirdparty/misc/FastNoiseLite.h
Comment: FastNoise Lite
Copyright: 2023, Jordan Peck and contributors
License: Expat

Files: thirdparty/misc/ifaddrs-android.cc
thirdparty/misc/ifaddrs-android.h
Comment: libjingle
Expand All @@ -419,17 +428,17 @@ Comment: Tangent Space Normal Maps implementation
Copyright: 2011, Morten S. Mikkelsen
License: Zlib

Files: thirdparty/misc/nvapi_minimal.h
Comment: NVIDIA NVAPI (minimal excerpt)
Copyright: 2019-2022, NVIDIA Corporation
License: Expat

Files: thirdparty/misc/ok_color.h
thirdparty/misc/ok_color_shader.h
Comment: OK Lab color space
Copyright: 2021, Björn Ottosson
License: Expat

Files: thirdparty/noise/FastNoiseLite.h
Comment: FastNoise Lite
Copyright: 2023, Jordan Peck and contributors
License: Expat

Files: thirdparty/misc/pcg.cpp
thirdparty/misc/pcg.h
Comment: Minimal PCG32 implementation
Expand Down Expand Up @@ -480,11 +489,6 @@ Comment: Multi-channel signed distance field generator
Copyright: 2014-2024, Viktor Chlumsky
License: Expat

Files: thirdparty/nvapi/nvapi_minimal.h
Comment: Stripped down version of "nvapi.h" from the NVIDIA NVAPI SDK
Copyright: 2019-2022, NVIDIA Corporation
License: Expat

Files: thirdparty/openxr/*
Comment: OpenXR Loader
Copyright: 2020-2023, The Khronos Group Inc.
Expand Down
11 changes: 7 additions & 4 deletions core/io/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "core/core_globals.h"
#include "core/io/dir_access.h"
#include "core/os/time.h"
#include "core/templates/rb_set.h"

#include "modules/modules_enabled.gen.h" // For regex.
#ifdef MODULE_REGEX_ENABLED
Expand Down Expand Up @@ -129,7 +130,9 @@ void RotatedFileLogger::clear_old_backups() {

da->list_dir_begin();
String f = da->get_next();
HashSet<String> backups;
// backups is a RBSet because it guarantees that iterating on it is done in sorted order.
// RotatedFileLogger depends on this behavior to delete the oldest log file first.
RBSet<String> backups;
while (!f.is_empty()) {
if (!da->current_is_dir() && f.begins_with(basename) && f.get_extension() == extension && f != base_path.get_file()) {
backups.insert(f);
Expand All @@ -138,12 +141,12 @@ void RotatedFileLogger::clear_old_backups() {
}
da->list_dir_end();

if (backups.size() > (uint32_t)max_backups) {
if (backups.size() > max_backups) {
// since backups are appended with timestamp and Set iterates them in sorted order,
// first backups are the oldest
int to_delete = backups.size() - max_backups;
for (HashSet<String>::Iterator E = backups.begin(); E && to_delete > 0; ++E, --to_delete) {
da->remove(*E);
for (RBSet<String>::Element *E = backups.front(); E && to_delete > 0; E = E->next(), --to_delete) {
da->remove(E->get());
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions core/io/resource_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,20 @@ bool ResourceLoader::has_custom_uid_support(const String &p_path) {
return false;
}

bool ResourceLoader::should_create_uid_file(const String &p_path) {
const String local_path = _validate_local_path(p_path);
if (FileAccess::exists(local_path + ".uid")) {
return false;
}

for (int i = 0; i < loader_count; i++) {
if (loader[i]->recognize_path(local_path)) {
return !loader[i]->has_custom_uid_support();
}
}
return false;
}

String ResourceLoader::_path_remap(const String &p_path, bool *r_translation_remapped) {
String new_path = p_path;

Expand Down
1 change: 1 addition & 0 deletions core/io/resource_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ class ResourceLoader {
static String get_resource_script_class(const String &p_path);
static ResourceUID::ID get_resource_uid(const String &p_path);
static bool has_custom_uid_support(const String &p_path);
static bool should_create_uid_file(const String &p_path);
static void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
static Error rename_dependencies(const String &p_path, const HashMap<String, String> &p_map);
static bool is_import_valid(const String &p_path);
Expand Down
13 changes: 13 additions & 0 deletions core/io/resource_uid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,19 @@ String ResourceUID::get_id_path(ID p_id) const {
ERR_FAIL_COND_V_MSG(p_id == INVALID_ID, String(), "Invalid UID.");
MutexLock l(mutex);
const ResourceUID::Cache *cache = unique_ids.getptr(p_id);

#if TOOLS_ENABLED
// On startup, the scan_for_uid_on_startup callback should be set and will
// execute EditorFileSystem::scan_for_uid, which scans all project files
// to reload the UID cache before the first scan.
// Note: EditorFileSystem::scan_for_uid sets scan_for_uid_on_startup to nullptr
// once the first scan_for_uid is complete.
if (!cache && scan_for_uid_on_startup) {
scan_for_uid_on_startup();
cache = unique_ids.getptr(p_id);
}
#endif

ERR_FAIL_COND_V_MSG(!cache, String(), vformat("Unrecognized UID: \"%s\".", id_to_text(p_id)));
const CharString &cs = cache->cs;
return String::utf8(cs.ptr());
Expand Down
4 changes: 4 additions & 0 deletions core/io/resource_uid.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

class FileAccess;

typedef void (*ResourceUIDScanForUIDOnStartup)();

class ResourceUID : public Object {
GDCLASS(ResourceUID, Object)
public:
Expand All @@ -63,6 +65,8 @@ class ResourceUID : public Object {
static void _bind_methods();

public:
inline static ResourceUIDScanForUIDOnStartup scan_for_uid_on_startup = nullptr;

String id_to_text(ID p_id) const;
ID text_to_id(const String &p_text) const;

Expand Down
12 changes: 6 additions & 6 deletions core/math/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,16 +350,16 @@ Error Expression::_get_token(Token &r_token) {
case READING_INT: {
if (is_digit(c)) {
if (is_first_char && c == '0') {
if (next_char == 'b') {
if (next_char == 'b' || next_char == 'B') {
reading = READING_BIN;
} else if (next_char == 'x') {
} else if (next_char == 'x' || next_char == 'X') {
reading = READING_HEX;
}
}
} else if (c == '.') {
reading = READING_DEC;
is_float = true;
} else if (c == 'e') {
} else if (c == 'e' || c == 'E') {
reading = READING_EXP;
is_float = true;
} else {
Expand All @@ -370,22 +370,22 @@ Error Expression::_get_token(Token &r_token) {
case READING_BIN: {
if (bin_beg && !is_binary_digit(c)) {
reading = READING_DONE;
} else if (c == 'b') {
} else if (c == 'b' || c == 'B') {
bin_beg = true;
}

} break;
case READING_HEX: {
if (hex_beg && !is_hex_digit(c)) {
reading = READING_DONE;
} else if (c == 'x') {
} else if (c == 'x' || c == 'X') {
hex_beg = true;
}

} break;
case READING_DEC: {
if (is_digit(c)) {
} else if (c == 'e') {
} else if (c == 'e' || c == 'E') {
reading = READING_EXP;
} else {
reading = READING_DONE;
Expand Down
17 changes: 17 additions & 0 deletions core/os/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,23 @@ uint64_t OS::get_embedded_pck_offset() const {
return 0;
}

// Default boot screen rect scale mode is "Keep Aspect Centered"
Rect2 OS::calculate_boot_screen_rect(const Size2 &p_window_size, const Size2 &p_imgrect_size) const {
Rect2 screenrect;
if (p_window_size.width > p_window_size.height) {
// Scale horizontally.
screenrect.size.y = p_window_size.height;
screenrect.size.x = p_imgrect_size.x * p_window_size.height / p_imgrect_size.y;
screenrect.position.x = (p_window_size.width - screenrect.size.x) / 2;
} else {
// Scale vertically.
screenrect.size.x = p_window_size.width;
screenrect.size.y = p_imgrect_size.y * p_window_size.width / p_imgrect_size.x;
screenrect.position.y = (p_window_size.height - screenrect.size.y) / 2;
}
return screenrect;
}

// Helper function to ensure that a dir name/path will be valid on the OS
String OS::get_safe_dir_name(const String &p_dir_name, bool p_allow_paths) const {
String safe_dir_name = p_dir_name;
Expand Down
2 changes: 2 additions & 0 deletions core/os/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ class OS {
virtual void open_midi_inputs();
virtual void close_midi_inputs();

virtual Rect2 calculate_boot_screen_rect(const Size2 &p_window_size, const Size2 &p_imgrect_size) const;

virtual void alert(const String &p_alert, const String &p_title = "ALERT!");

struct GDExtensionData {
Expand Down
2 changes: 1 addition & 1 deletion core/string/char_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ constexpr bool is_control(char32_t p_char) {
}

constexpr bool is_whitespace(char32_t p_char) {
return (p_char == ' ') || (p_char == 0x00a0) || (p_char == 0x1680) || (p_char >= 0x2000 && p_char <= 0x200a) || (p_char == 0x202f) || (p_char == 0x205f) || (p_char == 0x3000) || (p_char == 0x2028) || (p_char == 0x2029) || (p_char >= 0x0009 && p_char <= 0x000d) || (p_char == 0x0085);
return (p_char == ' ') || (p_char == 0x00a0) || (p_char == 0x1680) || (p_char >= 0x2000 && p_char <= 0x200b) || (p_char == 0x202f) || (p_char == 0x205f) || (p_char == 0x3000) || (p_char == 0x2028) || (p_char == 0x2029) || (p_char >= 0x0009 && p_char <= 0x000d) || (p_char == 0x0085);
}

constexpr bool is_linebreak(char32_t p_char) {
Expand Down
26 changes: 19 additions & 7 deletions core/string/translation_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,12 @@ String TranslationServer::get_locale_name(const String &p_locale) const {
}
}

String name = language_map[lang_name];
String name = get_language_name(lang_name);
if (!script_name.is_empty()) {
name = name + " (" + script_map[script_name] + ")";
name = name + " (" + get_script_name(script_name) + ")";
}
if (!country_name.is_empty()) {
name = name + ", " + country_name_map[country_name];
name = name + ", " + get_country_name(country_name);
}
return name;
}
Expand All @@ -320,7 +320,11 @@ Vector<String> TranslationServer::get_all_languages() const {
}

String TranslationServer::get_language_name(const String &p_language) const {
return language_map[p_language];
if (language_map.has(p_language)) {
return language_map[p_language];
} else {
return p_language;
}
}

Vector<String> TranslationServer::get_all_scripts() const {
Expand All @@ -334,7 +338,11 @@ Vector<String> TranslationServer::get_all_scripts() const {
}

String TranslationServer::get_script_name(const String &p_script) const {
return script_map[p_script];
if (script_map.has(p_script)) {
return script_map[p_script];
} else {
return p_script;
}
}

Vector<String> TranslationServer::get_all_countries() const {
Expand All @@ -348,7 +356,11 @@ Vector<String> TranslationServer::get_all_countries() const {
}

String TranslationServer::get_country_name(const String &p_country) const {
return country_name_map[p_country];
if (country_name_map.has(p_country)) {
return country_name_map[p_country];
} else {
return p_country;
}
}

void TranslationServer::set_locale(const String &p_locale) {
Expand Down Expand Up @@ -503,7 +515,7 @@ String TranslationServer::get_tool_locale() {
// Look for best matching loaded translation.
Ref<Translation> t = main_domain->get_translation_object(locale);
if (t.is_null()) {
return "en";
return fallback;
}
return t->get_locale();
}
Expand Down
Loading

0 comments on commit e4c3dc7

Please sign in to comment.