feat: modules moved and engine moved to submodule

This commit is contained in:
Jan van der Weide 2025-04-12 18:40:44 +02:00
parent dfb5e645cd
commit c33d2130cc
5136 changed files with 225275 additions and 64485 deletions

View file

@ -216,7 +216,7 @@ bool ScriptCreateDialog::_validate_parent(const String &p_string) {
if (can_inherit_from_file && p_string.is_quoted()) {
String p = p_string.substr(1, p_string.length() - 2);
if (_validate_path(p, true) == "") {
if (_validate_path(p, true).is_empty()) {
return true;
}
}
@ -224,8 +224,11 @@ bool ScriptCreateDialog::_validate_parent(const String &p_string) {
return EditorNode::get_editor_data().is_type_recognized(p_string);
}
String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must_exist) {
String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must_exist, bool *r_path_valid) {
String p = p_path.strip_edges();
if (r_path_valid) {
*r_path_valid = false;
}
if (p.is_empty()) {
return TTR("Path is empty.");
@ -263,6 +266,10 @@ String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must
}
}
if (r_path_valid) {
*r_path_valid = true;
}
// Check file extension.
String extension = p.get_extension();
List<String> extensions;
@ -491,10 +498,9 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
return;
}
is_path_valid = false;
is_new_script_created = true;
path_error = _validate_path(p_path, false);
path_error = _validate_path(p_path, false, &is_path_valid);
if (!path_error.is_empty()) {
validation_panel->update();
return;
@ -506,8 +512,6 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
if (da->file_exists(p)) {
is_new_script_created = false;
}
is_path_valid = true;
validation_panel->update();
}
@ -562,6 +566,7 @@ void ScriptCreateDialog::_update_template_menu() {
if (!separator) {
template_menu->add_separator();
template_menu->set_item_text(-1, display_name);
template_menu->set_item_auto_translate_mode(-1, AUTO_TRANSLATE_MODE_ALWAYS);
separator = true;
}
for (ScriptLanguage::ScriptTemplate &t : templates_found) {
@ -666,7 +671,7 @@ void ScriptCreateDialog::_update_dialog() {
validation_panel->set_message(MSG_ID_PATH, TTR("Built-in script (into scene file)."), EditorValidationPanel::MSG_OK);
}
} else {
template_inactive_message = TTR("Using existing script file.");
template_inactive_message = TTRC("Using existing script file.");
if (load_enabled) {
if (is_path_valid) {
validation_panel->set_message(MSG_ID_PATH, TTR("Will load an existing script file."), EditorValidationPanel::MSG_OK);
@ -680,16 +685,17 @@ void ScriptCreateDialog::_update_dialog() {
if (is_using_templates) {
// Check if at least one suitable template has been found.
if (template_menu->get_item_count() == 0 && template_inactive_message.is_empty()) {
template_inactive_message = TTR("No suitable template.");
template_inactive_message = TTRC("No suitable template.");
}
} else {
template_inactive_message = TTR("Empty");
template_inactive_message = TTRC("Empty");
}
if (!template_inactive_message.is_empty()) {
template_menu->set_disabled(true);
template_menu->clear();
template_menu->add_item(template_inactive_message);
template_menu->set_item_auto_translate_mode(-1, AUTO_TRANSLATE_MODE_ALWAYS);
validation_panel->set_message(MSG_ID_TEMPLATE, "", EditorValidationPanel::MSG_INFO);
}
}
@ -817,11 +823,11 @@ ScriptLanguage::ScriptTemplate ScriptCreateDialog::_parse_template(const ScriptL
String ScriptCreateDialog::_get_script_origin_label(const ScriptLanguage::TemplateLocation &p_origin) const {
switch (p_origin) {
case ScriptLanguage::TEMPLATE_BUILT_IN:
return TTR("Built-in");
return TTRC("Built-in");
case ScriptLanguage::TEMPLATE_EDITOR:
return TTR("Editor");
return TTRC("Editor");
case ScriptLanguage::TEMPLATE_PROJECT:
return TTR("Project");
return TTRC("Project");
}
return "";
}
@ -864,9 +870,11 @@ ScriptCreateDialog::ScriptCreateDialog() {
/* Language */
language_menu = memnew(OptionButton);
language_menu->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
language_menu->set_custom_minimum_size(Size2(350, 0) * EDSCALE);
language_menu->set_expand_icon(true);
language_menu->set_h_size_flags(Control::SIZE_EXPAND_FILL);
language_menu->set_accessibility_name(TTRC("Language"));
gc->add_child(memnew(Label(TTR("Language:"))));
gc->add_child(language_menu);
@ -891,14 +899,17 @@ ScriptCreateDialog::ScriptCreateDialog() {
HBoxContainer *hb = memnew(HBoxContainer);
hb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
parent_name = memnew(LineEdit);
parent_name->set_accessibility_name(TTRC("Parent Name"));
parent_name->connect(SceneStringName(text_changed), callable_mp(this, &ScriptCreateDialog::_parent_name_changed));
parent_name->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hb->add_child(parent_name);
register_text_enter(parent_name);
parent_search_button = memnew(Button);
parent_search_button->set_accessibility_name(TTRC("Search Parent"));
parent_search_button->connect(SceneStringName(pressed), callable_mp(this, &ScriptCreateDialog::_browse_class_in_tree));
hb->add_child(parent_search_button);
parent_browse_button = memnew(Button);
parent_browse_button->set_accessibility_name(TTRC("Select Parent"));
parent_browse_button->connect(SceneStringName(pressed), callable_mp(this, &ScriptCreateDialog::_browse_path).bind(true, false));
hb->add_child(parent_browse_button);
gc->add_child(memnew(Label(TTR("Inherits:"))));
@ -911,12 +922,15 @@ ScriptCreateDialog::ScriptCreateDialog() {
use_templates = memnew(CheckBox);
use_templates->set_pressed(is_using_templates);
use_templates->set_accessibility_name(TTRC("Use Template"));
use_templates->connect(SceneStringName(pressed), callable_mp(this, &ScriptCreateDialog::_use_template_pressed));
template_hb->add_child(use_templates);
template_inactive_message = "";
template_menu = memnew(OptionButton);
template_menu->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
template_menu->set_accessibility_name(TTRC("Template"));
template_menu->set_h_size_flags(Control::SIZE_EXPAND_FILL);
template_menu->connect(SceneStringName(item_selected), callable_mp(this, &ScriptCreateDialog::_template_changed));
template_hb->add_child(template_menu);
@ -927,6 +941,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
built_in = memnew(CheckBox);
built_in->set_text(TTR("On"));
built_in->set_accessibility_name(TTRC("Built-in Script"));
built_in->connect(SceneStringName(pressed), callable_mp(this, &ScriptCreateDialog::_built_in_pressed));
gc->add_child(memnew(Label(TTR("Built-in Script:"))));
gc->add_child(built_in);
@ -936,11 +951,13 @@ ScriptCreateDialog::ScriptCreateDialog() {
hb = memnew(HBoxContainer);
hb->connect(SceneStringName(sort_children), callable_mp(this, &ScriptCreateDialog::_path_hbox_sorted));
file_path = memnew(LineEdit);
file_path->set_accessibility_name(TTRC("File Path"));
file_path->connect(SceneStringName(text_changed), callable_mp(this, &ScriptCreateDialog::_path_changed));
file_path->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hb->add_child(file_path);
register_text_enter(file_path);
path_button = memnew(Button);
path_button->set_accessibility_name(TTRC("Select File"));
path_button->connect(SceneStringName(pressed), callable_mp(this, &ScriptCreateDialog::_browse_path).bind(false, true));
hb->add_child(path_button);
Label *label = memnew(Label(TTR("Path:")));
@ -953,6 +970,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
built_in_name = memnew(LineEdit);
built_in_name->set_h_size_flags(Control::SIZE_EXPAND_FILL);
built_in_name->set_accessibility_name(TTRC("Name"));
register_text_enter(built_in_name);
label = memnew(Label(TTR("Name:")));
gc->add_child(label);