mirror of
https://github.com/godotengine/godot.git
synced 2024-11-10 06:03:09 +00:00
Don't use EditorSettings metadata
This commit is contained in:
parent
88ed6af1e6
commit
c8a0766930
@ -571,7 +571,7 @@ bool ExportTemplateManager::_install_file_selected(const String &p_file, bool p_
|
|||||||
unzClose(pkg);
|
unzClose(pkg);
|
||||||
|
|
||||||
_update_template_status();
|
_update_template_status();
|
||||||
EditorSettings::get_singleton()->set_meta("export_template_download_directory", p_file.get_base_dir());
|
EditorSettings::get_singleton()->set("_export_template_download_directory", p_file.get_base_dir());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1102,7 +1102,7 @@ ExportTemplateManager::ExportTemplateManager() {
|
|||||||
install_file_dialog->set_title(TTR("Select Template File"));
|
install_file_dialog->set_title(TTR("Select Template File"));
|
||||||
install_file_dialog->set_access(FileDialog::ACCESS_FILESYSTEM);
|
install_file_dialog->set_access(FileDialog::ACCESS_FILESYSTEM);
|
||||||
install_file_dialog->set_file_mode(FileDialog::FILE_MODE_OPEN_FILE);
|
install_file_dialog->set_file_mode(FileDialog::FILE_MODE_OPEN_FILE);
|
||||||
install_file_dialog->set_current_dir(EditorSettings::get_singleton()->get_meta("export_template_download_directory", ""));
|
install_file_dialog->set_current_dir(EDITOR_DEF("_export_template_download_directory", ""));
|
||||||
install_file_dialog->add_filter("*.tpz", TTR("Godot Export Templates"));
|
install_file_dialog->add_filter("*.tpz", TTR("Godot Export Templates"));
|
||||||
install_file_dialog->connect("file_selected", callable_mp(this, &ExportTemplateManager::_install_file_selected).bind(false));
|
install_file_dialog->connect("file_selected", callable_mp(this, &ExportTemplateManager::_install_file_selected).bind(false));
|
||||||
add_child(install_file_dialog);
|
add_child(install_file_dialog);
|
||||||
|
@ -111,15 +111,7 @@ static Vector<String> _get_hierarchy(const String &p_class_name) {
|
|||||||
|
|
||||||
void ScriptCreateDialog::_notification(int p_what) {
|
void ScriptCreateDialog::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE:
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
|
||||||
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
|
|
||||||
Ref<Texture2D> language_icon = get_editor_theme_icon(ScriptServer::get_language(i)->get_type());
|
|
||||||
if (language_icon.is_valid()) {
|
|
||||||
language_menu->set_item_icon(i, language_icon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String last_language = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", "");
|
String last_language = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", "");
|
||||||
if (!last_language.is_empty()) {
|
if (!last_language.is_empty()) {
|
||||||
for (int i = 0; i < language_menu->get_item_count(); i++) {
|
for (int i = 0; i < language_menu->get_item_count(); i++) {
|
||||||
@ -131,9 +123,16 @@ void ScriptCreateDialog::_notification(int p_what) {
|
|||||||
} else {
|
} else {
|
||||||
language_menu->select(default_language);
|
language_menu->select(default_language);
|
||||||
}
|
}
|
||||||
if (EditorSettings::get_singleton()->has_meta("script_setup_use_script_templates")) {
|
is_using_templates = EDITOR_DEF("_script_setup_use_script_templates", false);
|
||||||
is_using_templates = bool(EditorSettings::get_singleton()->get_meta("script_setup_use_script_templates"));
|
use_templates->set_pressed(is_using_templates);
|
||||||
use_templates->set_pressed(is_using_templates);
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
|
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
|
||||||
|
Ref<Texture2D> language_icon = get_editor_theme_icon(ScriptServer::get_language(i)->get_type());
|
||||||
|
if (language_icon.is_valid()) {
|
||||||
|
language_menu->set_item_icon(i, language_icon);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
path_button->set_icon(get_editor_theme_icon(SNAME("Folder")));
|
path_button->set_icon(get_editor_theme_icon(SNAME("Folder")));
|
||||||
@ -297,12 +296,9 @@ void ScriptCreateDialog::_template_changed(int p_template) {
|
|||||||
EditorSettings::get_singleton()->set_project_metadata("script_setup", "templates_dictionary", dic_templates_project);
|
EditorSettings::get_singleton()->set_project_metadata("script_setup", "templates_dictionary", dic_templates_project);
|
||||||
} else {
|
} else {
|
||||||
// Save template info to editor dictionary (not a project template).
|
// Save template info to editor dictionary (not a project template).
|
||||||
Dictionary dic_templates;
|
Dictionary dic_templates = EDITOR_GET("_script_setup_templates_dictionary");
|
||||||
if (EditorSettings::get_singleton()->has_meta("script_setup_templates_dictionary")) {
|
|
||||||
dic_templates = (Dictionary)EditorSettings::get_singleton()->get_meta("script_setup_templates_dictionary");
|
|
||||||
}
|
|
||||||
dic_templates[parent_name->get_text()] = sinfo.get_hash();
|
dic_templates[parent_name->get_text()] = sinfo.get_hash();
|
||||||
EditorSettings::get_singleton()->set_meta("script_setup_templates_dictionary", dic_templates);
|
EditorSettings::get_singleton()->set("_script_setup_templates_dictionary", dic_templates);
|
||||||
// Remove template from project dictionary as we last used an editor level template.
|
// Remove template from project dictionary as we last used an editor level template.
|
||||||
Dictionary dic_templates_project = EditorSettings::get_singleton()->get_project_metadata("script_setup", "templates_dictionary", Dictionary());
|
Dictionary dic_templates_project = EditorSettings::get_singleton()->get_project_metadata("script_setup", "templates_dictionary", Dictionary());
|
||||||
if (dic_templates_project.has(parent_name->get_text())) {
|
if (dic_templates_project.has(parent_name->get_text())) {
|
||||||
@ -415,7 +411,7 @@ void ScriptCreateDialog::_built_in_pressed() {
|
|||||||
|
|
||||||
void ScriptCreateDialog::_use_template_pressed() {
|
void ScriptCreateDialog::_use_template_pressed() {
|
||||||
is_using_templates = use_templates->is_pressed();
|
is_using_templates = use_templates->is_pressed();
|
||||||
EditorSettings::get_singleton()->set_meta("script_setup_use_script_templates", is_using_templates);
|
EditorSettings::get_singleton()->set("_script_setup_use_script_templates", is_using_templates);
|
||||||
validation_panel->update();
|
validation_panel->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,10 +505,7 @@ void ScriptCreateDialog::_update_template_menu() {
|
|||||||
if (is_language_using_templates) {
|
if (is_language_using_templates) {
|
||||||
// Get the latest templates used for each type of node from project settings then global settings.
|
// Get the latest templates used for each type of node from project settings then global settings.
|
||||||
Dictionary last_local_templates = EditorSettings::get_singleton()->get_project_metadata("script_setup", "templates_dictionary", Dictionary());
|
Dictionary last_local_templates = EditorSettings::get_singleton()->get_project_metadata("script_setup", "templates_dictionary", Dictionary());
|
||||||
Dictionary last_global_templates;
|
Dictionary last_global_templates = EDITOR_GET("_script_setup_templates_dictionary");
|
||||||
if (EditorSettings::get_singleton()->has_meta("script_setup_templates_dictionary")) {
|
|
||||||
last_global_templates = (Dictionary)EditorSettings::get_singleton()->get_meta("script_setup_templates_dictionary");
|
|
||||||
}
|
|
||||||
String inherits_base_type = parent_name->get_text();
|
String inherits_base_type = parent_name->get_text();
|
||||||
|
|
||||||
// If it inherits from a script, get its parent class first.
|
// If it inherits from a script, get its parent class first.
|
||||||
@ -825,6 +818,8 @@ void ScriptCreateDialog::_bind_methods() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ScriptCreateDialog::ScriptCreateDialog() {
|
ScriptCreateDialog::ScriptCreateDialog() {
|
||||||
|
EDITOR_DEF("_script_setup_templates_dictionary", Dictionary());
|
||||||
|
|
||||||
/* Main Controls */
|
/* Main Controls */
|
||||||
|
|
||||||
GridContainer *gc = memnew(GridContainer);
|
GridContainer *gc = memnew(GridContainer);
|
||||||
|
Loading…
Reference in New Issue
Block a user