mirror of
https://github.com/Relintai/tile_map_backport.git
synced 2024-11-05 10:11:16 +01:00
More fixes.
This commit is contained in:
parent
b4c9be6299
commit
b54dec5622
@ -40,7 +40,7 @@
|
|||||||
#include "scene/gui/center_container.h"
|
#include "scene/gui/center_container.h"
|
||||||
#include "scene/gui/split_container.h"
|
#include "scene/gui/split_container.h"
|
||||||
|
|
||||||
#include "core/input/input.h"
|
#include "core/os/input.h"
|
||||||
#include "../geometry_2d.h"
|
#include "../geometry_2d.h"
|
||||||
#include "core/os/keyboard.h"
|
#include "core/os/keyboard.h"
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ private:
|
|||||||
void _set_tile_map_selection(const TypedArray<Vector2i> &p_selection);
|
void _set_tile_map_selection(const TypedArray<Vector2i> &p_selection);
|
||||||
TypedArray<Vector2i> _get_tile_map_selection() const;
|
TypedArray<Vector2i> _get_tile_map_selection() const;
|
||||||
|
|
||||||
Set<TileMapCell> tile_set_selection;
|
Set<RTileMapCell> tile_set_selection;
|
||||||
|
|
||||||
void _update_selection_pattern_from_tilemap_selection();
|
void _update_selection_pattern_from_tilemap_selection();
|
||||||
void _update_selection_pattern_from_tileset_tiles_selection();
|
void _update_selection_pattern_from_tileset_tiles_selection();
|
||||||
@ -152,7 +152,7 @@ private:
|
|||||||
void _update_source_display();
|
void _update_source_display();
|
||||||
|
|
||||||
// Atlas sources.
|
// Atlas sources.
|
||||||
TileMapCell hovered_tile;
|
RTileMapCell hovered_tile;
|
||||||
RTileAtlasView *tile_atlas_view;
|
RTileAtlasView *tile_atlas_view;
|
||||||
HSplitContainer *atlas_sources_split_container;
|
HSplitContainer *atlas_sources_split_container;
|
||||||
|
|
||||||
@ -253,14 +253,14 @@ private:
|
|||||||
bool drag_erasing = false;
|
bool drag_erasing = false;
|
||||||
Vector2 drag_start_mouse_pos;
|
Vector2 drag_start_mouse_pos;
|
||||||
Vector2 drag_last_mouse_pos;
|
Vector2 drag_last_mouse_pos;
|
||||||
Map<Vector2i, TileMapCell> drag_modified;
|
Map<Vector2i, RTileMapCell> drag_modified;
|
||||||
|
|
||||||
// Painting
|
// Painting
|
||||||
Map<Vector2i, TileMapCell> _draw_terrains(const Map<Vector2i, RTileSet::TerrainsPattern> &p_to_paint, int p_terrain_set) const;
|
Map<Vector2i, RTileMapCell> _draw_terrains(const Map<Vector2i, RTileSet::TerrainsPattern> &p_to_paint, int p_terrain_set) const;
|
||||||
Map<Vector2i, TileMapCell> _draw_line(Vector2i p_start_cell, Vector2i p_end_cell, bool p_erase);
|
Map<Vector2i, RTileMapCell> _draw_line(Vector2i p_start_cell, Vector2i p_end_cell, bool p_erase);
|
||||||
Map<Vector2i, TileMapCell> _draw_rect(Vector2i p_start_cell, Vector2i p_end_cell, bool p_erase);
|
Map<Vector2i, RTileMapCell> _draw_rect(Vector2i p_start_cell, Vector2i p_end_cell, bool p_erase);
|
||||||
Set<Vector2i> _get_cells_for_bucket_fill(Vector2i p_coords, bool p_contiguous);
|
Set<Vector2i> _get_cells_for_bucket_fill(Vector2i p_coords, bool p_contiguous);
|
||||||
Map<Vector2i, TileMapCell> _draw_bucket_fill(Vector2i p_coords, bool p_contiguous, bool p_erase);
|
Map<Vector2i, RTileMapCell> _draw_bucket_fill(Vector2i p_coords, bool p_contiguous, bool p_erase);
|
||||||
void _stop_dragging();
|
void _stop_dragging();
|
||||||
|
|
||||||
int selected_terrain_set = -1;
|
int selected_terrain_set = -1;
|
||||||
@ -350,13 +350,13 @@ public:
|
|||||||
bool forward_canvas_gui_input(const Ref<InputEvent> &p_event);
|
bool forward_canvas_gui_input(const Ref<InputEvent> &p_event);
|
||||||
void forward_canvas_draw_over_viewport(Control *p_overlay);
|
void forward_canvas_draw_over_viewport(Control *p_overlay);
|
||||||
|
|
||||||
void edit(TileMap *p_tile_map);
|
void edit(RTileMap *p_tile_map);
|
||||||
|
|
||||||
RTileMapEditor();
|
RTileMapEditor();
|
||||||
~RTileMapEditor();
|
~RTileMapEditor();
|
||||||
|
|
||||||
// Static functions.
|
// Static functions.
|
||||||
static Vector<Vector2i> get_line(TileMap *p_tile_map, Vector2i p_from_cell, Vector2i p_to_cell);
|
static Vector<Vector2i> get_line(RTileMap *p_tile_map, Vector2i p_from_cell, Vector2i p_to_cell);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TILE_MAP_EDITOR_PLUGIN_H
|
#endif // TILE_MAP_EDITOR_PLUGIN_H
|
||||||
|
@ -388,7 +388,7 @@ RTileProxiesManagerDialog::RTileProxiesManagerDialog() {
|
|||||||
source_from_property_editor->setup(-1, 99999, 1, true, false);
|
source_from_property_editor->setup(-1, 99999, 1, true, false);
|
||||||
vboxcontainer_from->add_child(source_from_property_editor);
|
vboxcontainer_from->add_child(source_from_property_editor);
|
||||||
|
|
||||||
coords_from_property_editor = memnew(EditorPropertyVector2i);
|
coords_from_property_editor = memnew(EditorPropertyVector2);
|
||||||
coords_from_property_editor->set_label(TTR("From Coords"));
|
coords_from_property_editor->set_label(TTR("From Coords"));
|
||||||
coords_from_property_editor->set_object_and_property(this, "from_coords");
|
coords_from_property_editor->set_object_and_property(this, "from_coords");
|
||||||
coords_from_property_editor->connect("property_changed", callable_mp(this, &RTileProxiesManagerDialog::_property_changed));
|
coords_from_property_editor->connect("property_changed", callable_mp(this, &RTileProxiesManagerDialog::_property_changed));
|
||||||
@ -422,7 +422,7 @@ RTileProxiesManagerDialog::RTileProxiesManagerDialog() {
|
|||||||
source_to_property_editor->setup(-1, 99999, 1, true, false);
|
source_to_property_editor->setup(-1, 99999, 1, true, false);
|
||||||
vboxcontainer_to->add_child(source_to_property_editor);
|
vboxcontainer_to->add_child(source_to_property_editor);
|
||||||
|
|
||||||
coords_to_property_editor = memnew(EditorPropertyVector2i);
|
coords_to_property_editor = memnew(EditorPropertyVector2);
|
||||||
coords_to_property_editor->set_label(TTR("To Coords"));
|
coords_to_property_editor->set_label(TTR("To Coords"));
|
||||||
coords_to_property_editor->set_object_and_property(this, "to_coords");
|
coords_to_property_editor->set_object_and_property(this, "to_coords");
|
||||||
coords_to_property_editor->connect("property_changed", callable_mp(this, &RTileProxiesManagerDialog::_property_changed));
|
coords_to_property_editor->connect("property_changed", callable_mp(this, &RTileProxiesManagerDialog::_property_changed));
|
||||||
|
@ -56,10 +56,10 @@ private:
|
|||||||
ItemList *alternative_level_list;
|
ItemList *alternative_level_list;
|
||||||
|
|
||||||
EditorPropertyInteger *source_from_property_editor;
|
EditorPropertyInteger *source_from_property_editor;
|
||||||
EditorPropertyVector2i *coords_from_property_editor;
|
EditorPropertyVector2 *coords_from_property_editor;
|
||||||
EditorPropertyInteger *alternative_from_property_editor;
|
EditorPropertyInteger *alternative_from_property_editor;
|
||||||
EditorPropertyInteger *source_to_property_editor;
|
EditorPropertyInteger *source_to_property_editor;
|
||||||
EditorPropertyVector2i *coords_to_property_editor;
|
EditorPropertyVector2 *coords_to_property_editor;
|
||||||
EditorPropertyInteger *alternative_to_property_editor;
|
EditorPropertyInteger *alternative_to_property_editor;
|
||||||
|
|
||||||
PopupMenu *popup_menu;
|
PopupMenu *popup_menu;
|
||||||
|
@ -96,9 +96,9 @@ bool RTileSetAtlasSourceEditor::RTileSetAtlasSourceProxyObject::_get(const Strin
|
|||||||
void RTileSetAtlasSourceEditor::RTileSetAtlasSourceProxyObject::_get_property_list(List<PropertyInfo> *p_list) const {
|
void RTileSetAtlasSourceEditor::RTileSetAtlasSourceProxyObject::_get_property_list(List<PropertyInfo> *p_list) const {
|
||||||
p_list->push_back(PropertyInfo(Variant::STRING, "name", PROPERTY_HINT_NONE, ""));
|
p_list->push_back(PropertyInfo(Variant::STRING, "name", PROPERTY_HINT_NONE, ""));
|
||||||
p_list->push_back(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"));
|
p_list->push_back(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"));
|
||||||
p_list->push_back(PropertyInfo(Variant::VECTOR2I, "margins", PROPERTY_HINT_NONE, ""));
|
p_list->push_back(PropertyInfo(Variant::VECTOR2, "margins", PROPERTY_HINT_NONE, ""));
|
||||||
p_list->push_back(PropertyInfo(Variant::VECTOR2I, "separation", PROPERTY_HINT_NONE, ""));
|
p_list->push_back(PropertyInfo(Variant::VECTOR2, "separation", PROPERTY_HINT_NONE, ""));
|
||||||
p_list->push_back(PropertyInfo(Variant::VECTOR2I, "texture_region_size", PROPERTY_HINT_NONE, ""));
|
p_list->push_back(PropertyInfo(Variant::VECTOR2, "texture_region_size", PROPERTY_HINT_NONE, ""));
|
||||||
p_list->push_back(PropertyInfo(Variant::BOOL, "use_texture_padding", PROPERTY_HINT_NONE, ""));
|
p_list->push_back(PropertyInfo(Variant::BOOL, "use_texture_padding", PROPERTY_HINT_NONE, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ private:
|
|||||||
ItemList *patterns_item_list;
|
ItemList *patterns_item_list;
|
||||||
Label *patterns_help_label;
|
Label *patterns_help_label;
|
||||||
void _patterns_item_list_gui_input(const Ref<InputEvent> &p_event);
|
void _patterns_item_list_gui_input(const Ref<InputEvent> &p_event);
|
||||||
void _pattern_preview_done(Ref<TileMapPattern> p_pattern, Ref<Texture> p_texture);
|
void _pattern_preview_done(Ref<RTileMapPattern> p_pattern, Ref<Texture> p_texture);
|
||||||
bool select_last_pattern = false;
|
bool select_last_pattern = false;
|
||||||
void _update_patterns_list();
|
void _update_patterns_list();
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ref<RTileSet> tile_set;
|
Ref<RTileSet> tile_set;
|
||||||
TileSetScenesCollectionSource *tile_set_scenes_collection_source = nullptr;
|
RTileSetScenesCollectionSource *tile_set_scenes_collection_source = nullptr;
|
||||||
int source_id = -1;
|
int source_id = -1;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -68,7 +68,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
RTileSetScenesCollectionSourceEditor *tile_set_scenes_collection_source_editor;
|
RTileSetScenesCollectionSourceEditor *tile_set_scenes_collection_source_editor;
|
||||||
|
|
||||||
TileSetScenesCollectionSource *tile_set_scenes_collection_source = nullptr;
|
RTileSetScenesCollectionSource *tile_set_scenes_collection_source = nullptr;
|
||||||
int source_id;
|
int source_id;
|
||||||
int scene_id;
|
int scene_id;
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Update the proxyed object.
|
// Update the proxyed object.
|
||||||
void edit(TileSetScenesCollectionSource *p_tile_set_atlas_source, int p_scene_id);
|
void edit(RTileSetScenesCollectionSource *p_tile_set_atlas_source, int p_scene_id);
|
||||||
|
|
||||||
SceneTileProxyObject(RTileSetScenesCollectionSourceEditor *p_tiles_set_scenes_collection_source_editor) {
|
SceneTileProxyObject(RTileSetScenesCollectionSourceEditor *p_tiles_set_scenes_collection_source_editor) {
|
||||||
tile_set_scenes_collection_source_editor = p_tiles_set_scenes_collection_source_editor;
|
tile_set_scenes_collection_source_editor = p_tiles_set_scenes_collection_source_editor;
|
||||||
@ -90,7 +90,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ref<RTileSet> tile_set;
|
Ref<RTileSet> tile_set;
|
||||||
TileSetScenesCollectionSource *tile_set_scenes_collection_source = nullptr;
|
RTileSetScenesCollectionSource *tile_set_scenes_collection_source = nullptr;
|
||||||
int tile_set_source_id = -1;
|
int tile_set_source_id = -1;
|
||||||
|
|
||||||
UndoRedo *undo_redo = EditorNode::get_undo_redo();
|
UndoRedo *undo_redo = EditorNode::get_undo_redo();
|
||||||
@ -133,7 +133,7 @@ protected:
|
|||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void edit(Ref<RTileSet> p_tile_set, TileSetScenesCollectionSource *p_tile_set_scenes_collection_source, int p_source_id);
|
void edit(Ref<RTileSet> p_tile_set, RTileSetScenesCollectionSource *p_tile_set_scenes_collection_source, int p_source_id);
|
||||||
RTileSetScenesCollectionSourceEditor();
|
RTileSetScenesCollectionSourceEditor();
|
||||||
~RTileSetScenesCollectionSourceEditor();
|
~RTileSetScenesCollectionSourceEditor();
|
||||||
};
|
};
|
||||||
|
@ -148,7 +148,7 @@ void RTilesEditorPlugin::_tile_map_changed() {
|
|||||||
void RTilesEditorPlugin::_update_editors() {
|
void RTilesEditorPlugin::_update_editors() {
|
||||||
// If tile_map is not edited, we change the edited only if we are not editing a tile_set.
|
// If tile_map is not edited, we change the edited only if we are not editing a tile_set.
|
||||||
tileset_editor->edit(tile_set);
|
tileset_editor->edit(tile_set);
|
||||||
TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id));
|
RTileMap *tile_map = Object::cast_to<RTileMap>(ObjectDB::get_instance(tile_map_id));
|
||||||
if (tile_map) {
|
if (tile_map) {
|
||||||
tilemap_editor->edit(tile_map);
|
tilemap_editor->edit(tile_map);
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,7 +54,7 @@ private:
|
|||||||
RTileMapEditor *tilemap_editor;
|
RTileMapEditor *tilemap_editor;
|
||||||
|
|
||||||
Button *tileset_editor_button;
|
Button *tileset_editor_button;
|
||||||
RRTileSetEditor *tileset_editor;
|
RTileSetEditor *tileset_editor;
|
||||||
|
|
||||||
void _update_editors();
|
void _update_editors();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user