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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148 | /**************************************************************************/
/* tile_set_scenes_collection_source_editor.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. */
/**************************************************************************/
#ifndef TILE_SET_SCENES_COLLECTION_SOURCE_EDITOR_H
#define TILE_SET_SCENES_COLLECTION_SOURCE_EDITOR_H
#include "editor/editor_inspector.h"
#include "scene/gui/box_container.h"
#include "scene/resources/2d/tile_set.h"
class Button;
class ItemList;
class Label;
class EditorFileDialog;
class TileSetScenesCollectionSourceEditor : public HBoxContainer {
GDCLASS(TileSetScenesCollectionSourceEditor, HBoxContainer);
private:
// -- Proxy object for an atlas source, needed by the inspector --
class TileSetScenesCollectionProxyObject : public Object {
GDCLASS(TileSetScenesCollectionProxyObject, Object);
private:
Ref<TileSet> tile_set;
TileSetScenesCollectionSource *tile_set_scenes_collection_source = nullptr;
int source_id = -1;
protected:
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
void _get_property_list(List<PropertyInfo> *p_list) const;
static void _bind_methods();
public:
void set_id(int p_id);
int get_id();
void edit(Ref<TileSet> p_tile_set, TileSetScenesCollectionSource *p_tile_set_scenes_collection_source, int p_source_id);
};
// -- Proxy object for a tile, needed by the inspector --
class SceneTileProxyObject : public Object {
GDCLASS(SceneTileProxyObject, Object);
private:
TileSetScenesCollectionSourceEditor *tile_set_scenes_collection_source_editor = nullptr;
TileSetScenesCollectionSource *tile_set_scenes_collection_source = nullptr;
int source_id;
int scene_id;
protected:
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
void _get_property_list(List<PropertyInfo> *p_list) const;
static void _bind_methods();
public:
// Update the proxyed object.
void edit(TileSetScenesCollectionSource *p_tile_set_atlas_source, int p_scene_id);
SceneTileProxyObject(TileSetScenesCollectionSourceEditor *p_tiles_set_scenes_collection_source_editor) {<--- Member variable 'SceneTileProxyObject::source_id' is not initialized in the constructor.<--- Member variable 'SceneTileProxyObject::scene_id' is not initialized in the constructor.<--- Class 'SceneTileProxyObject' has a constructor with 1 argument that is not explicit. [+]Class 'SceneTileProxyObject' has a constructor with 1 argument that is not explicit. Such constructors should in general be explicit for type safety reasons. Using the explicit keyword in the constructor means some mistakes when using the class can be avoided.
tile_set_scenes_collection_source_editor = p_tiles_set_scenes_collection_source_editor;
}
};
private:
bool read_only = false;
Ref<TileSet> tile_set;
TileSetScenesCollectionSource *tile_set_scenes_collection_source = nullptr;
int tile_set_source_id = -1;
bool tile_set_scenes_collection_source_changed_needs_update = false;
// Source inspector.
TileSetScenesCollectionProxyObject *scenes_collection_source_proxy_object = nullptr;
Label *scenes_collection_source_inspector_label = nullptr;
EditorInspector *scenes_collection_source_inspector = nullptr;
// Tile inspector.
SceneTileProxyObject *tile_proxy_object = nullptr;
Label *tile_inspector_label = nullptr;
EditorInspector *tile_inspector = nullptr;
ItemList *scene_tiles_list = nullptr;
Button *scene_tile_add_button = nullptr;
Button *scene_tile_delete_button = nullptr;
EditorFileDialog *scene_select_dialog = nullptr;
void _tile_set_scenes_collection_source_changed();
void _scenes_collection_source_proxy_object_changed(const String &p_what);
void _scene_thumbnail_done(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, const Variant &p_ud);
void _scenes_list_item_activated(int p_index);
void _source_add_pressed();
void _scene_file_selected(const String &p_path);
void _source_delete_pressed();
// Update methods.
void _update_source_inspector();
void _update_tile_inspector();
void _update_scenes_list();
void _update_action_buttons();
void _drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
bool _can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
protected:
void _notification(int p_what);
static void _bind_methods();
public:
void edit(Ref<TileSet> p_tile_set, TileSetScenesCollectionSource *p_tile_set_scenes_collection_source, int p_source_id);
TileSetScenesCollectionSourceEditor();
~TileSetScenesCollectionSourceEditor();
};
#endif // TILE_SET_SCENES_COLLECTION_SOURCE_EDITOR_H
|