| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "core/io/config_file.h" |
| 34 |
#include "core/io/resource_importer.h" |
| 35 |
#include "editor/docks/editor_dock.h" |
| 36 |
#include "editor/file_system/editor_file_system.h" |
| 37 |
#include "editor/inspector/editor_inspector.h" |
| 38 |
#include "scene/gui/box_container.h" |
| 39 |
#include "scene/gui/dialogs.h" |
| 40 |
#include "scene/gui/menu_button.h" |
| 41 |
#include "scene/gui/option_button.h" |
| 42 |
#include "scene/gui/popup_menu.h" |
| 43 |
|
| 44 |
class ImportDockParameters; |
| 45 |
class VBoxContainer; |
| 46 |
|
| 47 |
class ImportDock : public EditorDock { |
| 48 |
GDCLASS(ImportDock, EditorDock); |
| 49 |
|
| 50 |
Label *imported = nullptr; |
| 51 |
OptionButton *import_as = nullptr; |
| 52 |
MenuButton *preset = nullptr; |
| 53 |
EditorInspector *import_opts = nullptr; |
| 54 |
|
| 55 |
ConfirmationDialog *reimport_confirm = nullptr; |
| 56 |
Label *cleanup_warning = nullptr; |
| 57 |
Label *label_warning = nullptr; |
| 58 |
Button *import = nullptr; |
| 59 |
List<String> need_cleanup; |
| 60 |
|
| 61 |
Control *advanced_spacer = nullptr; |
| 62 |
Button *advanced = nullptr; |
| 63 |
|
| 64 |
ImportDockParameters *params = nullptr; |
| 65 |
|
| 66 |
VBoxContainer *content = nullptr; |
| 67 |
Label *select_a_resource = nullptr; |
| 68 |
|
| 69 |
void _preset_selected(int p_idx); |
| 70 |
void _importer_selected(int i_idx); |
| 71 |
void _update_options(const String &p_path, const Ref<ConfigFile> &p_config = Ref<ConfigFile>()); |
| 72 |
void _update_preset_menu(); |
| 73 |
void _add_keep_import_option(const String &p_importer_name); |
| 74 |
|
| 75 |
void _property_edited(const StringName &p_prop); |
| 76 |
void _property_toggled(const StringName &p_prop, bool p_checked); |
| 77 |
void _set_dirty(bool p_dirty); |
| 78 |
void _reimport_pressed(); |
| 79 |
void _reimport_attempt(); |
| 80 |
void _reimport_and_cleanup(); |
| 81 |
void _reimport(); |
| 82 |
|
| 83 |
void _advanced_options(); |
| 84 |
enum { |
| 85 |
ITEM_SET_AS_DEFAULT = 100, |
| 86 |
ITEM_LOAD_DEFAULT, |
| 87 |
ITEM_CLEAR_DEFAULT, |
| 88 |
}; |
| 89 |
|
| 90 |
private: |
| 91 |
static ImportDock *singleton; |
| 92 |
|
| 93 |
public: |
| 94 |
static ImportDock *get_singleton() { return singleton; } |
| 95 |
|
| 96 |
protected: |
| 97 |
static void _bind_methods(); |
| 98 |
void _notification(int p_what); |
| 99 |
|
| 100 |
public: |
| 101 |
void set_edit_path(const String &p_path); |
| 102 |
void set_edit_multiple_paths(const Vector<String> &p_paths); |
| 103 |
void reimport_resources(const Vector<String> &p_paths); |
| 104 |
void initialize_import_options() const; |
| 105 |
void clear(); |
| 106 |
|
| 107 |
ImportDock(); |
| 108 |
~ImportDock(); |
| 109 |
}; |