| 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_inspector.h" |
| 34 |
#include "scene/gui/box_container.h" |
| 35 |
#include "scene/resources/2d/tile_set.h" |
| 36 |
|
| 37 |
class Button; |
| 38 |
class ItemList; |
| 39 |
class Label; |
| 40 |
class EditorFileDialog; |
| 41 |
|
| 42 |
class TileSetScenesCollectionSourceEditor : public HBoxContainer { |
| 43 |
GDCLASS(TileSetScenesCollectionSourceEditor, HBoxContainer); |
| 44 |
|
| 45 |
private: |
| 46 |
|
| 47 |
class TileSetScenesCollectionProxyObject : public Object { |
| 48 |
GDCLASS(TileSetScenesCollectionProxyObject, Object); |
| 49 |
|
| 50 |
private: |
| 51 |
Ref<TileSet> tile_set; |
| 52 |
Ref<TileSetScenesCollectionSource> tile_set_scenes_collection_source; |
| 53 |
int source_id = -1; |
| 54 |
|
| 55 |
protected: |
| 56 |
bool _set(const StringName &p_name, const Variant &p_value); |
| 57 |
bool _get(const StringName &p_name, Variant &r_ret) const; |
| 58 |
void _get_property_list(List<PropertyInfo> *p_list) const; |
| 59 |
static void _bind_methods(); |
| 60 |
|
| 61 |
public: |
| 62 |
void set_id(int p_id); |
| 63 |
int get_id(); |
| 64 |
|
| 65 |
void edit(Ref<TileSet> p_tile_set, TileSetScenesCollectionSource *p_tile_set_scenes_collection_source, int p_source_id); |
| 66 |
}; |
| 67 |
|
| 68 |
|
| 69 |
class SceneTileProxyObject : public Object { |
| 70 |
GDCLASS(SceneTileProxyObject, Object); |
| 71 |
|
| 72 |
private: |
| 73 |
TileSetScenesCollectionSourceEditor *tile_set_scenes_collection_source_editor = nullptr; |
| 74 |
|
| 75 |
Ref<TileSetScenesCollectionSource> tile_set_scenes_collection_source; |
| 76 |
int source_id; |
| 77 |
int scene_id; |
| 78 |
|
| 79 |
protected: |
| 80 |
bool _set(const StringName &p_name, const Variant &p_value); |
| 81 |
bool _get(const StringName &p_name, Variant &r_ret) const; |
| 82 |
void _get_property_list(List<PropertyInfo> *p_list) const; |
| 83 |
|
| 84 |
static void _bind_methods(); |
| 85 |
|
| 86 |
public: |
| 87 |
|
| 88 |
void edit(TileSetScenesCollectionSource *p_tile_set_atlas_source, int p_scene_id); |
| 89 |
|
| 90 |
SceneTileProxyObject(TileSetScenesCollectionSourceEditor *p_tiles_set_scenes_collection_source_editor) { |
| 91 |
tile_set_scenes_collection_source_editor = p_tiles_set_scenes_collection_source_editor; |
| 92 |
} |
| 93 |
}; |
| 94 |
|
| 95 |
private: |
| 96 |
bool read_only = false; |
| 97 |
|
| 98 |
Ref<TileSet> tile_set; |
| 99 |
Ref<TileSetScenesCollectionSource> tile_set_scenes_collection_source; |
| 100 |
int tile_set_source_id = -1; |
| 101 |
|
| 102 |
bool tile_set_scenes_collection_source_changed_needs_update = false; |
| 103 |
|
| 104 |
|
| 105 |
TileSetScenesCollectionProxyObject *scenes_collection_source_proxy_object = nullptr; |
| 106 |
Label *scenes_collection_source_inspector_label = nullptr; |
| 107 |
EditorInspector *scenes_collection_source_inspector = nullptr; |
| 108 |
|
| 109 |
|
| 110 |
SceneTileProxyObject *tile_proxy_object = nullptr; |
| 111 |
Label *tile_inspector_label = nullptr; |
| 112 |
EditorInspector *tile_inspector = nullptr; |
| 113 |
|
| 114 |
ItemList *scene_tiles_list = nullptr; |
| 115 |
Button *scene_tile_add_button = nullptr; |
| 116 |
Button *scene_tile_delete_button = nullptr; |
| 117 |
EditorFileDialog *scene_select_dialog = nullptr; |
| 118 |
|
| 119 |
void _tile_set_scenes_collection_source_changed(); |
| 120 |
void _scenes_collection_source_proxy_object_changed(const String &p_what); |
| 121 |
void _scene_thumbnail_done(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, int p_idx); |
| 122 |
void _scenes_list_item_activated(int p_index); |
| 123 |
|
| 124 |
void _source_add_pressed(); |
| 125 |
void _scene_file_selected(const String &p_path); |
| 126 |
void _source_delete_pressed(); |
| 127 |
|
| 128 |
|
| 129 |
void _update_source_inspector(); |
| 130 |
void _update_tile_inspector(); |
| 131 |
void _update_scenes_list(); |
| 132 |
void _update_action_buttons(); |
| 133 |
void _update_all(); |
| 134 |
|
| 135 |
void _drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from); |
| 136 |
bool _can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; |
| 137 |
|
| 138 |
protected: |
| 139 |
void _notification(int p_what); |
| 140 |
static void _bind_methods(); |
| 141 |
|
| 142 |
public: |
| 143 |
void edit(Ref<TileSet> p_tile_set, TileSetScenesCollectionSource *p_tile_set_scenes_collection_source, int p_source_id); |
| 144 |
TileSetScenesCollectionSourceEditor(); |
| 145 |
~TileSetScenesCollectionSourceEditor(); |
| 146 |
}; |