summaryrefslogtreecommitdiff
path: root/editor/import_dock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/import_dock.cpp')
-rw-r--r--editor/import_dock.cpp36
1 files changed, 29 insertions, 7 deletions
diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp
index 3507eaff94..10654cfe43 100644
--- a/editor/import_dock.cpp
+++ b/editor/import_dock.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -31,6 +31,7 @@
#include "import_dock.h"
#include "editor_node.h"
#include "editor_resource_preview.h"
+#include "editor_scale.h"
class ImportDockParameters : public Object {
GDCLASS(ImportDockParameters, Object);
@@ -135,6 +136,8 @@ void ImportDock::set_edit_path(const String &p_path) {
_set_dirty(false);
import_as->set_disabled(false);
preset->set_disabled(false);
+ content->show();
+ select_a_resource->hide();
imported->set_text(p_path.get_file());
}
@@ -294,6 +297,8 @@ void ImportDock::set_edit_multiple_paths(const Vector<String> &p_paths) {
_set_dirty(false);
import_as->set_disabled(false);
preset->set_disabled(false);
+ content->show();
+ select_a_resource->hide();
imported->set_text(vformat(TTR("%d Files"), p_paths.size()));
@@ -423,6 +428,8 @@ void ImportDock::clear() {
params->properties.clear();
params->update();
preset->get_popup()->clear();
+ content->hide();
+ select_a_resource->show();
}
static bool _find_owners(EditorFileSystemDirectory *efsd, const String &p_path) {
@@ -600,12 +607,18 @@ void ImportDock::initialize_import_options() const {
ImportDock::ImportDock() {
set_name("Import");
+
+ content = memnew(VBoxContainer);
+ content->set_v_size_flags(SIZE_EXPAND_FILL);
+ add_child(content);
+ content->hide();
+
imported = memnew(Label);
imported->add_theme_style_override("normal", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("normal"), SNAME("LineEdit")));
imported->set_clip_text(true);
- add_child(imported);
+ content->add_child(imported);
HBoxContainer *hb = memnew(HBoxContainer);
- add_margin_child(TTR("Import As:"), hb);
+ content->add_margin_child(TTR("Import As:"), hb);
import_as = memnew(OptionButton);
import_as->set_disabled(true);
import_as->connect("item_selected", callable_mp(this, &ImportDock::_importer_selected));
@@ -618,13 +631,13 @@ ImportDock::ImportDock() {
hb->add_child(preset);
import_opts = memnew(EditorInspector);
- add_child(import_opts);
+ content->add_child(import_opts);
import_opts->set_v_size_flags(SIZE_EXPAND_FILL);
import_opts->connect("property_edited", callable_mp(this, &ImportDock::_property_edited));
import_opts->connect("property_toggled", callable_mp(this, &ImportDock::_property_toggled));
hb = memnew(HBoxContainer);
- add_child(hb);
+ content->add_child(hb);
import = memnew(Button);
import->set_text(TTR("Reimport"));
import->set_disabled(true);
@@ -652,7 +665,7 @@ ImportDock::ImportDock() {
reimport_confirm = memnew(ConfirmationDialog);
reimport_confirm->get_ok_button()->set_text(TTR("Save Scenes, Re-Import, and Restart"));
- add_child(reimport_confirm);
+ content->add_child(reimport_confirm);
reimport_confirm->connect("confirmed", callable_mp(this, &ImportDock::_reimport_and_restart));
VBoxContainer *vbc_confirm = memnew(VBoxContainer());
@@ -662,6 +675,15 @@ ImportDock::ImportDock() {
reimport_confirm->add_child(vbc_confirm);
params = memnew(ImportDockParameters);
+
+ select_a_resource = memnew(Label);
+ select_a_resource->set_text(TTR("Select a resource file in the filesystem or in the inspector to adjust import settings."));
+ select_a_resource->set_autowrap_mode(Label::AUTOWRAP_WORD);
+ select_a_resource->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
+ select_a_resource->set_v_size_flags(SIZE_EXPAND_FILL);
+ select_a_resource->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ select_a_resource->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
+ add_child(select_a_resource);
}
ImportDock::~ImportDock() {