diff --git a/editor/fbx_importer_manager.cpp b/editor/fbx_importer_manager.cpp index 2a005034a57..87f2d596e83 100644 --- a/editor/fbx_importer_manager.cpp +++ b/editor/fbx_importer_manager.cpp @@ -30,6 +30,8 @@ #include "fbx_importer_manager.h" +#include "core/config/project_settings.h" +#include "editor/editor_node.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "scene/gui/link_button.h" @@ -47,9 +49,19 @@ void FBXImporterManager::show_dialog(bool p_exclusive) { fbx_path->set_text(fbx2gltf_path); _validate_path(fbx2gltf_path); - set_flag(Window::FLAG_BORDERLESS, p_exclusive); // Avoid closing accidentally . + // If exclusive, we're importing a FBX file, there's no exit. + is_importing = p_exclusive; + set_flag(Window::FLAG_BORDERLESS, p_exclusive); // Avoid closing accidentally. set_close_on_escape(!p_exclusive); + if (is_importing) { + get_cancel_button()->set_text(TTR("Disable FBX & Restart")); + get_cancel_button()->set_tooltip_text(TTR("Canceling this dialog will disable the FBX importer.\nYou can re-enable it in the Project Settings under Filesystem > Import > FBX > Enabled.\n\nThe editor will restart as importers are registered when the editor starts.")); + } else { + get_cancel_button()->set_text(TTR("Cancel")); + get_cancel_button()->set_tooltip_text(""); + } + popup_centered(); } @@ -96,6 +108,17 @@ void FBXImporterManager::_path_confirmed() { EditorSettings::get_singleton()->save(); } +void FBXImporterManager::_cancel_setup() { + if (!is_importing) { + return; // No worry. + } + // No escape. + ProjectSettings::get_singleton()->set("filesystem/import/fbx/enabled", false); + ProjectSettings::get_singleton()->save(); + EditorNode::get_singleton()->save_all_scenes(); + EditorNode::get_singleton()->restart_editor(); +} + void FBXImporterManager::_browse_install() { if (fbx_path->get_text() != String()) { browse_dialog->set_current_file(fbx_path->get_text()); @@ -140,6 +163,7 @@ FBXImporterManager::FBXImporterManager() { fbx_path->connect("text_changed", callable_mp(this, &FBXImporterManager::_validate_path)); get_ok_button()->set_text(TTR("Confirm Path")); + get_cancel_button()->connect("pressed", callable_mp(this, &FBXImporterManager::_cancel_setup)); browse_dialog = memnew(EditorFileDialog); browse_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); diff --git a/editor/fbx_importer_manager.h b/editor/fbx_importer_manager.h index ed0a96337ee..dd5fcfd16e7 100644 --- a/editor/fbx_importer_manager.h +++ b/editor/fbx_importer_manager.h @@ -38,6 +38,8 @@ class FBXImporterManager : public ConfirmationDialog { GDCLASS(FBXImporterManager, ConfirmationDialog) + bool is_importing = false; + Label *message = nullptr; LineEdit *fbx_path = nullptr; Button *fbx_path_browse = nullptr; @@ -47,6 +49,7 @@ class FBXImporterManager : public ConfirmationDialog { void _validate_path(const String &p_path); void _select_file(const String &p_path); void _path_confirmed(); + void _cancel_setup(); void _browse_install(); void _link_clicked(); diff --git a/modules/gltf/register_types.cpp b/modules/gltf/register_types.cpp index 78589090db6..4754c316a1a 100644 --- a/modules/gltf/register_types.cpp +++ b/modules/gltf/register_types.cpp @@ -143,8 +143,8 @@ void initialize_gltf_module(ModuleInitializationLevel p_level) { EditorPlugins::add_by_type(); // Project settings defined here so doctool finds them. - GLOBAL_DEF_RST("filesystem/import/blender/enabled", true); - GLOBAL_DEF_RST("filesystem/import/fbx/enabled", true); + GLOBAL_DEF_RST_BASIC("filesystem/import/blender/enabled", true); + GLOBAL_DEF_RST_BASIC("filesystem/import/fbx/enabled", true); GDREGISTER_CLASS(EditorSceneFormatImporterBlend); GDREGISTER_CLASS(EditorSceneFormatImporterFBX); // Can't (a priori) run external app on these platforms. diff --git a/scene/gui/link_button.cpp b/scene/gui/link_button.cpp index e6c3ca3b5fd..b5797919902 100644 --- a/scene/gui/link_button.cpp +++ b/scene/gui/link_button.cpp @@ -243,11 +243,12 @@ void LinkButton::_notification(int p_what) { if (do_underline) { int underline_spacing = theme_cache.underline_spacing + text_buf->get_line_underline_position(); int y = text_buf->get_line_ascent() + underline_spacing; + int underline_thickness = MAX(1, text_buf->get_line_underline_thickness()); if (is_layout_rtl()) { - draw_line(Vector2(size.width - width, y), Vector2(size.width, y), color, text_buf->get_line_underline_thickness()); + draw_line(Vector2(size.width - width, y), Vector2(size.width, y), color, underline_thickness); } else { - draw_line(Vector2(0, y), Vector2(width, y), color, text_buf->get_line_underline_thickness()); + draw_line(Vector2(0, y), Vector2(width, y), color, underline_thickness); } } } break;