2023-01-05 13:25:55 +01:00
|
|
|
/**************************************************************************/
|
|
|
|
/* import_dock.h */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/**************************************************************************/
|
2018-01-05 00:50:27 +01:00
|
|
|
|
2022-07-23 23:41:51 +02:00
|
|
|
#ifndef IMPORT_DOCK_H
|
|
|
|
#define IMPORT_DOCK_H
|
2017-02-01 13:45:45 +01:00
|
|
|
|
2018-08-18 15:07:23 +02:00
|
|
|
#include "core/io/config_file.h"
|
2019-02-12 13:30:56 +01:00
|
|
|
#include "core/io/resource_importer.h"
|
2018-08-18 15:07:23 +02:00
|
|
|
#include "editor/editor_file_system.h"
|
|
|
|
#include "editor/editor_inspector.h"
|
2017-02-01 13:45:45 +01:00
|
|
|
#include "scene/gui/box_container.h"
|
2019-01-25 21:23:56 +01:00
|
|
|
#include "scene/gui/dialogs.h"
|
2018-08-18 15:07:23 +02:00
|
|
|
#include "scene/gui/menu_button.h"
|
2017-02-01 13:45:45 +01:00
|
|
|
#include "scene/gui/option_button.h"
|
|
|
|
#include "scene/gui/popup_menu.h"
|
|
|
|
|
|
|
|
class ImportDockParameters;
|
|
|
|
class ImportDock : public VBoxContainer {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(ImportDock, VBoxContainer);
|
2017-02-01 13:45:45 +01:00
|
|
|
|
2022-04-04 15:06:57 +02:00
|
|
|
Label *imported = nullptr;
|
|
|
|
OptionButton *import_as = nullptr;
|
|
|
|
MenuButton *preset = nullptr;
|
|
|
|
EditorInspector *import_opts = nullptr;
|
2017-02-01 13:45:45 +01:00
|
|
|
|
|
|
|
List<PropertyInfo> properties;
|
2022-05-13 15:04:37 +02:00
|
|
|
HashMap<StringName, Variant> property_values;
|
2017-02-01 13:45:45 +01:00
|
|
|
|
2022-04-04 15:06:57 +02:00
|
|
|
ConfirmationDialog *reimport_confirm = nullptr;
|
2023-07-01 01:29:46 +02:00
|
|
|
Label *cleanup_warning = nullptr;
|
2022-04-04 15:06:57 +02:00
|
|
|
Label *label_warning = nullptr;
|
|
|
|
Button *import = nullptr;
|
2023-07-01 01:29:46 +02:00
|
|
|
List<String> need_cleanup;
|
2017-02-01 13:45:45 +01:00
|
|
|
|
2022-04-04 15:06:57 +02:00
|
|
|
Control *advanced_spacer = nullptr;
|
|
|
|
Button *advanced = nullptr;
|
2021-03-19 13:57:52 +01:00
|
|
|
|
2022-04-04 15:06:57 +02:00
|
|
|
ImportDockParameters *params = nullptr;
|
2017-02-01 13:45:45 +01:00
|
|
|
|
2022-04-04 15:06:57 +02:00
|
|
|
VBoxContainer *content = nullptr;
|
|
|
|
Label *select_a_resource = nullptr;
|
2021-12-25 16:31:36 +01:00
|
|
|
|
2017-02-01 13:45:45 +01:00
|
|
|
void _preset_selected(int p_idx);
|
2017-11-10 21:53:01 +01:00
|
|
|
void _importer_selected(int i_idx);
|
2021-11-14 18:02:38 +01:00
|
|
|
void _update_options(const String &p_path, const Ref<ConfigFile> &p_config = Ref<ConfigFile>());
|
2020-02-14 02:58:19 +01:00
|
|
|
void _update_preset_menu();
|
2021-09-22 07:10:09 +02:00
|
|
|
void _add_keep_import_option(const String &p_importer_name);
|
2017-02-01 13:45:45 +01:00
|
|
|
|
2021-10-09 12:29:53 +02:00
|
|
|
void _property_edited(const StringName &p_prop);
|
2018-10-30 17:11:54 +01:00
|
|
|
void _property_toggled(const StringName &p_prop, bool p_checked);
|
2021-10-09 12:29:53 +02:00
|
|
|
void _set_dirty(bool p_dirty);
|
2024-04-23 22:35:49 +02:00
|
|
|
void _reimport_pressed();
|
2019-01-25 21:23:56 +01:00
|
|
|
void _reimport_attempt();
|
2023-07-01 01:29:46 +02:00
|
|
|
void _reimport_and_cleanup();
|
2017-02-01 13:45:45 +01:00
|
|
|
void _reimport();
|
2017-03-05 16:44:50 +01:00
|
|
|
|
2021-03-19 13:57:52 +01:00
|
|
|
void _advanced_options();
|
2017-07-23 23:48:05 +02:00
|
|
|
enum {
|
|
|
|
ITEM_SET_AS_DEFAULT = 100,
|
|
|
|
ITEM_LOAD_DEFAULT,
|
|
|
|
ITEM_CLEAR_DEFAULT,
|
|
|
|
};
|
|
|
|
|
2021-11-17 21:08:55 +01:00
|
|
|
private:
|
|
|
|
static ImportDock *singleton;
|
|
|
|
|
|
|
|
public:
|
|
|
|
static ImportDock *get_singleton() { return singleton; }
|
|
|
|
|
2017-02-01 13:45:45 +01:00
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
2017-08-31 16:58:43 +02:00
|
|
|
void _notification(int p_what);
|
2017-02-01 13:45:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
public:
|
|
|
|
void set_edit_path(const String &p_path);
|
|
|
|
void set_edit_multiple_paths(const Vector<String> &p_paths);
|
2023-03-20 08:47:41 +01:00
|
|
|
void reimport_resources(const Vector<String> &p_paths);
|
2017-07-23 16:44:42 +02:00
|
|
|
void initialize_import_options() const;
|
2017-02-01 13:45:45 +01:00
|
|
|
void clear();
|
|
|
|
|
|
|
|
ImportDock();
|
|
|
|
~ImportDock();
|
|
|
|
};
|
|
|
|
|
2022-07-23 23:41:51 +02:00
|
|
|
#endif // IMPORT_DOCK_H
|