#include "tile_data_editors.h"
#include "tile_set_editor.h"
#include "core/math/geometry_2d.h"
#include "core/os/keyboard.h"
#include "editor/editor_node.h"
#include "editor/editor_properties.h"
#include "editor/editor_settings.h"
#include "editor/editor_string_names.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/themes/editor_scale.h"
#include "scene/gui/control.h"
#include "scene/gui/label.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/option_button.h"
#include "scene/gui/separator.h"
#include "scene/gui/spin_box.h"
#include "servers/navigation_server_2d.h"
void TileDataEditor::_tile_set_changed_plan_update() { … }
void TileDataEditor::_tile_set_changed_deferred_update() { … }
TileData *TileDataEditor::_get_tile_data(TileMapCell p_cell) { … }
void TileDataEditor::_bind_methods() { … }
void TileDataEditor::set_tile_set(Ref<TileSet> p_tile_set) { … }
bool DummyObject::_set(const StringName &p_name, const Variant &p_value) { … }
bool DummyObject::_get(const StringName &p_name, Variant &r_ret) const { … }
bool DummyObject::has_dummy_property(const StringName &p_name) { … }
void DummyObject::add_dummy_property(const StringName &p_name) { … }
void DummyObject::remove_dummy_property(const StringName &p_name) { … }
void DummyObject::clear_dummy_properties() { … }
void GenericTilePolygonEditor::_base_control_draw() { … }
void GenericTilePolygonEditor::_center_view() { … }
void GenericTilePolygonEditor::_zoom_changed() { … }
void GenericTilePolygonEditor::_advanced_menu_item_pressed(int p_item_pressed) { … }
void GenericTilePolygonEditor::_grab_polygon_point(Vector2 p_pos, const Transform2D &p_polygon_xform, int &r_polygon_index, int &r_point_index) { … }
void GenericTilePolygonEditor::_grab_polygon_segment_point(Vector2 p_pos, const Transform2D &p_polygon_xform, int &r_polygon_index, int &r_segment_index, Vector2 &r_point) { … }
void GenericTilePolygonEditor::_snap_to_tile_shape(Point2 &r_point, float &r_current_snapped_dist, float p_snap_dist) { … }
void GenericTilePolygonEditor::_snap_point(Point2 &r_point) { … }
void GenericTilePolygonEditor::_base_control_gui_input(Ref<InputEvent> p_event) { … }
void GenericTilePolygonEditor::_set_snap_option(int p_index) { … }
void GenericTilePolygonEditor::_store_snap_options() { … }
void GenericTilePolygonEditor::_toggle_expand(bool p_expand) { … }
void GenericTilePolygonEditor::set_use_undo_redo(bool p_use_undo_redo) { … }
void GenericTilePolygonEditor::set_tile_set(Ref<TileSet> p_tile_set) { … }
void GenericTilePolygonEditor::set_background_tile(const TileSetAtlasSource *p_atlas_source, const Vector2 &p_atlas_coords, int p_alternative_id) { … }
int GenericTilePolygonEditor::get_polygon_count() { … }
int GenericTilePolygonEditor::add_polygon(const Vector<Point2> &p_polygon, int p_index) { … }
void GenericTilePolygonEditor::remove_polygon(int p_index) { … }
void GenericTilePolygonEditor::clear_polygons() { … }
void GenericTilePolygonEditor::set_polygon(int p_polygon_index, const Vector<Point2> &p_polygon) { … }
Vector<Point2> GenericTilePolygonEditor::get_polygon(int p_polygon_index) { … }
void GenericTilePolygonEditor::set_polygons_color(Color p_color) { … }
void GenericTilePolygonEditor::set_multiple_polygon_mode(bool p_multiple_polygon_mode) { … }
void GenericTilePolygonEditor::_notification(int p_what) { … }
void GenericTilePolygonEditor::_bind_methods() { … }
GenericTilePolygonEditor::GenericTilePolygonEditor() { … }
void TileDataDefaultEditor::_property_value_changed(const StringName &p_property, const Variant &p_value, const StringName &p_field) { … }
Variant TileDataDefaultEditor::_get_painted_value() { … }
void TileDataDefaultEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { … }
void TileDataDefaultEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value) { … }
Variant TileDataDefaultEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { … }
void TileDataDefaultEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, const HashMap<TileMapCell, Variant, TileMapCell> &p_previous_values, const Variant &p_new_value) { … }
void TileDataDefaultEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) {
if (drag_type == DRAG_TYPE_PAINT_RECT) {
Color grid_color = EDITOR_GET("editors/tiles_editor/grid_color");
Color selection_color = Color().from_hsv(Math::fposmod(grid_color.get_h() + 0.5, 1.0), grid_color.get_s(), grid_color.get_v(), 1.0);
p_canvas_item->draw_set_transform_matrix(p_transform);
Rect2i rect;
rect.set_position(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_start_pos, true));
rect.set_end(p_tile_atlas_view->get_atlas_tile_coords_at_pos(p_transform.affine_inverse().xform(p_canvas_item->get_local_mouse_position()), true));
rect = rect.abs();
RBSet<TileMapCell> edited;
for (int x = rect.get_position().x; x <= rect.get_end().x; x++) {
for (int y = rect.get_position().y; y <= rect.get_end().y; y++) {
Vector2i coords = Vector2i(x, y);
coords = p_tile_set_atlas_source->get_tile_at_coords(coords);
if (coords != TileSetSource::INVALID_ATLAS_COORDS) {
TileMapCell cell;
cell.source_id = 0;
cell.set_atlas_coords(coords);
cell.alternative_tile = 0;
edited.insert(cell);
}
}
}
for (const TileMapCell &E : edited) {
Vector2i coords = E.get_atlas_coords();
p_canvas_item->draw_rect(p_tile_set_atlas_source->get_tile_texture_region(coords), selection_color, false);
}
p_canvas_item->draw_set_transform_matrix(Transform2D());
}
};
void TileDataDefaultEditor::forward_draw_over_alternatives(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform){
};
void TileDataDefaultEditor::forward_painting_atlas_gui_input(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, const Ref<InputEvent> &p_event) { … }
void TileDataDefaultEditor::forward_painting_alternatives_gui_input(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, const Ref<InputEvent> &p_event) { … }
void TileDataDefaultEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { … }
void TileDataDefaultEditor::setup_property_editor(Variant::Type p_type, const String &p_property, const String &p_label, const Variant &p_default_value) { … }
void TileDataDefaultEditor::_notification(int p_what) { … }
Variant::Type TileDataDefaultEditor::get_property_type() { … }
TileDataDefaultEditor::TileDataDefaultEditor() { … }
TileDataDefaultEditor::~TileDataDefaultEditor() { … }
void TileDataTextureOriginEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { … }
void TileDataPositionEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { … }
void TileDataYSortEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { … }
void TileDataOcclusionShapeEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { … }
Variant TileDataOcclusionShapeEditor::_get_painted_value() { … }
void TileDataOcclusionShapeEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { … }
void TileDataOcclusionShapeEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value) { … }
Variant TileDataOcclusionShapeEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { … }
void TileDataOcclusionShapeEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, const HashMap<TileMapCell, Variant, TileMapCell> &p_previous_values, const Variant &p_new_value) { … }
void TileDataOcclusionShapeEditor::_tile_set_changed() { … }
void TileDataOcclusionShapeEditor::_notification(int p_what) { … }
TileDataOcclusionShapeEditor::TileDataOcclusionShapeEditor() { … }
void TileDataCollisionEditor::_property_value_changed(const StringName &p_property, const Variant &p_value, const StringName &p_field) { … }
void TileDataCollisionEditor::_property_selected(const StringName &p_path, int p_focusable) { … }
void TileDataCollisionEditor::_polygons_changed() { … }
Variant TileDataCollisionEditor::_get_painted_value() { … }
void TileDataCollisionEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { … }
void TileDataCollisionEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value) { … }
Variant TileDataCollisionEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { … }
void TileDataCollisionEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, const HashMap<TileMapCell, Variant, TileMapCell> &p_previous_values, const Variant &p_new_value) { … }
void TileDataCollisionEditor::_tile_set_changed() { … }
void TileDataCollisionEditor::_notification(int p_what) { … }
TileDataCollisionEditor::TileDataCollisionEditor() { … }
TileDataCollisionEditor::~TileDataCollisionEditor() { … }
void TileDataCollisionEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { … }
void TileDataTerrainsEditor::_update_terrain_selector() { … }
void TileDataTerrainsEditor::_property_value_changed(const StringName &p_property, const Variant &p_value, const StringName &p_field) { … }
void TileDataTerrainsEditor::_tile_set_changed() { … }
void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) { … }
void TileDataTerrainsEditor::forward_draw_over_alternatives(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, CanvasItem *p_canvas_item, Transform2D p_transform) { … }
void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, const Ref<InputEvent> &p_event) { … }
void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasView *p_tile_atlas_view, TileSetAtlasSource *p_tile_set_atlas_source, const Ref<InputEvent> &p_event) { … }
void TileDataTerrainsEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { … }
void TileDataTerrainsEditor::_notification(int p_what) { … }
TileDataTerrainsEditor::TileDataTerrainsEditor() { … }
TileDataTerrainsEditor::~TileDataTerrainsEditor() { … }
Variant TileDataNavigationEditor::_get_painted_value() { … }
void TileDataNavigationEditor::_set_painted_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { … }
void TileDataNavigationEditor::_set_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile, const Variant &p_value) { … }
Variant TileDataNavigationEditor::_get_value(TileSetAtlasSource *p_tile_set_atlas_source, Vector2 p_coords, int p_alternative_tile) { … }
void TileDataNavigationEditor::_setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, const HashMap<TileMapCell, Variant, TileMapCell> &p_previous_values, const Variant &p_new_value) { … }
void TileDataNavigationEditor::_tile_set_changed() { … }
void TileDataNavigationEditor::_notification(int p_what) { … }
TileDataNavigationEditor::TileDataNavigationEditor() { … }
void TileDataNavigationEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2D p_transform, TileMapCell p_cell, bool p_selected) { … }