feat: updated engine version to 4.4-rc1

This commit is contained in:
Sara 2025-02-23 14:38:14 +01:00
parent ee00efde1f
commit 21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions

View file

@ -38,7 +38,6 @@
#include "editor/filesystem_dock.h"
#include "editor/gui/editor_file_dialog.h"
#include "editor/project_settings_editor.h"
#include "editor/themes/editor_scale.h"
#include "scene/main/window.h"
#include "scene/resources/packed_scene.h"
@ -55,12 +54,12 @@ void EditorAutoloadSettings::_notification(int p_what) {
file_dialog->add_filter("*." + E);
}
browse_button->set_icon(get_editor_theme_icon(SNAME("Folder")));
browse_button->set_button_icon(get_editor_theme_icon(SNAME("Folder")));
} break;
case NOTIFICATION_THEME_CHANGED: {
browse_button->set_icon(get_editor_theme_icon(SNAME("Folder")));
add_autoload->set_icon(get_editor_theme_icon(SNAME("Add")));
browse_button->set_button_icon(get_editor_theme_icon(SNAME("Folder")));
add_autoload->set_button_icon(get_editor_theme_icon(SNAME("Add")));
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
@ -88,14 +87,9 @@ void EditorAutoloadSettings::_notification(int p_what) {
}
bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, String *r_error) {
if (!p_name.is_valid_identifier()) {
if (!p_name.is_valid_unicode_identifier()) {
if (r_error) {
*r_error = TTR("Invalid name.") + " ";
if (p_name.size() > 0 && p_name.left(1).is_numeric()) {
*r_error += TTR("Cannot begin with a digit.");
} else {
*r_error += TTR("Valid characters:") + " a-z, A-Z, 0-9 or _";
}
*r_error = TTR("Invalid name.") + " " + TTR("Must be a valid Unicode identifier.");
}
return false;
@ -117,14 +111,12 @@ bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, Strin
return false;
}
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
if (Variant::get_type_name(Variant::Type(i)) == p_name) {
if (r_error) {
*r_error = TTR("Invalid name.") + " " + TTR("Must not collide with an existing built-in type name.");
}
return false;
if (Variant::get_type_by_name(p_name) < Variant::VARIANT_MAX) {
if (r_error) {
*r_error = TTR("Invalid name.") + " " + TTR("Must not collide with an existing built-in type name.");
}
return false;
}
for (int i = 0; i < CoreConstants::get_global_constant_count(); i++) {
@ -403,7 +395,7 @@ Node *EditorAutoloadSettings::_create_autoload(const String &p_path) {
scn.instantiate();
scn->set_path(p_path);
scn->reload_from_file();
ERR_FAIL_COND_V_MSG(!scn.is_valid(), nullptr, vformat("Failed to create an autoload, can't load from path: %s.", p_path));
ERR_FAIL_COND_V_MSG(scn.is_null(), nullptr, vformat("Failed to create an autoload, can't load from path: %s.", p_path));
if (scn.is_valid()) {
n = scn->instantiate();
@ -457,7 +449,9 @@ void EditorAutoloadSettings::init_autoloads() {
for (const AutoloadInfo &info : autoload_cache) {
if (info.node && info.in_editor) {
callable_mp((Node *)get_tree()->get_root(), &Node::add_child).call_deferred(info.node, false, Node::INTERNAL_MODE_DISABLED);
// It's important to add the node without deferring because code in plugins or tool scripts
// could use the autoload node when they are enabled.
get_tree()->get_root()->add_child(info.node);
}
}
}
@ -642,6 +636,7 @@ Variant EditorAutoloadSettings::get_drag_data_fw(const Point2 &p_point, Control
for (int i = 0; i < max_size; i++) {
Label *label = memnew(Label(autoloads[i]));
label->set_self_modulate(Color(1, 1, 1, Math::lerp(1, 0, float(i) / PREVIEW_LIST_MAX_SIZE)));
label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
preview->add_child(label);
}
@ -720,6 +715,15 @@ void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant &
Dictionary drop_data = p_data;
PackedStringArray autoloads = drop_data["autoloads"];
// Store the initial order of the autoloads for comparison.
Vector<int> initial_orders;
initial_orders.resize(autoload_cache.size());
int idx = 0;
for (const AutoloadInfo &F : autoload_cache) {
initial_orders.write[idx++] = F.order;
}
// Perform the drag-and-drop operation.
Vector<int> orders;
orders.resize(autoload_cache.size());
@ -739,10 +743,14 @@ void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant &
}
}
int i = 0;
idx = 0;
for (const AutoloadInfo &F : autoload_cache) {
orders.write[i++] = F.order;
orders.write[idx++] = F.order;
}
// If the order didn't change, we shouldn't create undo/redo actions.
if (orders == initial_orders) {
return;
}
orders.sort();
@ -751,10 +759,9 @@ void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant &
undo_redo->create_action(TTR("Rearrange Autoloads"));
i = 0;
idx = 0;
for (const AutoloadInfo &F : autoload_cache) {
undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", "autoload/" + F.name, orders[i++]);
undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", "autoload/" + F.name, orders[idx++]);
undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", "autoload/" + F.name, F.order);
}
@ -923,7 +930,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
autoload_add_name = memnew(LineEdit);
autoload_add_name->set_h_size_flags(SIZE_EXPAND_FILL);
autoload_add_name->connect("text_submitted", callable_mp(this, &EditorAutoloadSettings::_autoload_text_submitted));
autoload_add_name->connect(SceneStringName(text_submitted), callable_mp(this, &EditorAutoloadSettings::_autoload_text_submitted));
autoload_add_name->connect(SceneStringName(text_changed), callable_mp(this, &EditorAutoloadSettings::_autoload_text_changed));
hbc->add_child(autoload_add_name);
@ -977,7 +984,7 @@ EditorAutoloadSettings::~EditorAutoloadSettings() {
void EditorAutoloadSettings::_set_autoload_add_path(const String &p_text) {
autoload_add_path->set_text(p_text);
autoload_add_path->emit_signal(SNAME("text_submitted"), p_text);
autoload_add_path->emit_signal(SceneStringName(text_submitted), p_text);
}
void EditorAutoloadSettings::_browse_autoload_add_path() {