| 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 "editor/inspector/editor_properties.h" |
| 34 |
#include "scene/gui/dialogs.h" |
| 35 |
#include "scene/gui/item_list.h" |
| 36 |
#include "scene/gui/texture_rect.h" |
| 37 |
#include "scene/resources/2d/tile_set.h" |
| 38 |
|
| 39 |
class EditorFileDialog; |
| 40 |
class EditorPropertyVector2i; |
| 41 |
|
| 42 |
class AtlasMergingDialog : public ConfirmationDialog { |
| 43 |
GDCLASS(AtlasMergingDialog, ConfirmationDialog); |
| 44 |
|
| 45 |
private: |
| 46 |
int committed_actions_count = 0; |
| 47 |
bool delete_original_atlases = true; |
| 48 |
Ref<TileSetAtlasSource> merged; |
| 49 |
LocalVector<HashMap<Vector2i, Vector2i>> merged_mapping; |
| 50 |
Ref<TileSet> tile_set; |
| 51 |
|
| 52 |
|
| 53 |
int next_line_after_column = 30; |
| 54 |
|
| 55 |
|
| 56 |
ItemList *atlas_merging_atlases_list = nullptr; |
| 57 |
EditorPropertyInteger *columns_editor_property = nullptr; |
| 58 |
TextureRect *preview = nullptr; |
| 59 |
Label *select_2_atlases_label = nullptr; |
| 60 |
EditorFileDialog *editor_file_dialog = nullptr; |
| 61 |
Button *merge_button = nullptr; |
| 62 |
|
| 63 |
void _property_changed(const StringName &p_property, const Variant &p_value, const String &p_field, bool p_changing); |
| 64 |
|
| 65 |
void _generate_merged(const Vector<Ref<TileSetAtlasSource>> &p_atlas_sources, int p_max_columns); |
| 66 |
void _update_texture(); |
| 67 |
void _merge_confirmed(const String &p_path); |
| 68 |
|
| 69 |
protected: |
| 70 |
virtual void ok_pressed() override; |
| 71 |
virtual void cancel_pressed() override; |
| 72 |
virtual void custom_action(const String &) override; |
| 73 |
|
| 74 |
bool _set(const StringName &p_name, const Variant &p_value); |
| 75 |
bool _get(const StringName &p_name, Variant &r_ret) const; |
| 76 |
|
| 77 |
void _notification(int p_what); |
| 78 |
|
| 79 |
public: |
| 80 |
void update_tile_set(Ref<TileSet> p_tile_set); |
| 81 |
|
| 82 |
AtlasMergingDialog(); |
| 83 |
}; |