|
@@ -926,8 +926,8 @@ void TileDataDefaultEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas_
|
|
p_canvas_item->draw_set_transform_matrix(p_transform);
|
|
p_canvas_item->draw_set_transform_matrix(p_transform);
|
|
|
|
|
|
Rect2i rect;
|
|
Rect2i rect;
|
|
- rect.set_position(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_start_pos));
|
|
|
|
- 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())));
|
|
|
|
|
|
+ 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();
|
|
rect = rect.abs();
|
|
|
|
|
|
RBSet<TileMapCell> edited;
|
|
RBSet<TileMapCell> edited;
|
|
@@ -961,7 +961,7 @@ void TileDataDefaultEditor::forward_painting_atlas_gui_input(TileAtlasView *p_ti
|
|
Ref<InputEventMouseMotion> mm = p_event;
|
|
Ref<InputEventMouseMotion> mm = p_event;
|
|
if (mm.is_valid()) {
|
|
if (mm.is_valid()) {
|
|
if (drag_type == DRAG_TYPE_PAINT) {
|
|
if (drag_type == DRAG_TYPE_PAINT) {
|
|
- Vector<Vector2i> line = Geometry2D::bresenham_line(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_last_pos), p_tile_atlas_view->get_atlas_tile_coords_at_pos(mm->get_position()));
|
|
|
|
|
|
+ Vector<Vector2i> line = Geometry2D::bresenham_line(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_last_pos, true), p_tile_atlas_view->get_atlas_tile_coords_at_pos(mm->get_position(), true));
|
|
for (int i = 0; i < line.size(); i++) {
|
|
for (int i = 0; i < line.size(); i++) {
|
|
Vector2i coords = p_tile_set_atlas_source->get_tile_at_coords(line[i]);
|
|
Vector2i coords = p_tile_set_atlas_source->get_tile_at_coords(line[i]);
|
|
if (coords != TileSetSource::INVALID_ATLAS_COORDS) {
|
|
if (coords != TileSetSource::INVALID_ATLAS_COORDS) {
|
|
@@ -985,7 +985,7 @@ void TileDataDefaultEditor::forward_painting_atlas_gui_input(TileAtlasView *p_ti
|
|
if (mb->get_button_index() == MouseButton::LEFT) {
|
|
if (mb->get_button_index() == MouseButton::LEFT) {
|
|
if (mb->is_pressed()) {
|
|
if (mb->is_pressed()) {
|
|
if (picker_button->is_pressed() || (mb->is_command_or_control_pressed() && !mb->is_shift_pressed())) {
|
|
if (picker_button->is_pressed() || (mb->is_command_or_control_pressed() && !mb->is_shift_pressed())) {
|
|
- Vector2i coords = p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position());
|
|
|
|
|
|
+ Vector2i coords = p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position(), true);
|
|
coords = p_tile_set_atlas_source->get_tile_at_coords(coords);
|
|
coords = p_tile_set_atlas_source->get_tile_at_coords(coords);
|
|
if (coords != TileSetSource::INVALID_ATLAS_COORDS) {
|
|
if (coords != TileSetSource::INVALID_ATLAS_COORDS) {
|
|
_set_painted_value(p_tile_set_atlas_source, coords, 0);
|
|
_set_painted_value(p_tile_set_atlas_source, coords, 0);
|
|
@@ -1000,7 +1000,7 @@ void TileDataDefaultEditor::forward_painting_atlas_gui_input(TileAtlasView *p_ti
|
|
drag_type = DRAG_TYPE_PAINT;
|
|
drag_type = DRAG_TYPE_PAINT;
|
|
drag_modified.clear();
|
|
drag_modified.clear();
|
|
drag_painted_value = _get_painted_value();
|
|
drag_painted_value = _get_painted_value();
|
|
- Vector2i coords = p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position());
|
|
|
|
|
|
+ Vector2i coords = p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position(), true);
|
|
coords = p_tile_set_atlas_source->get_tile_at_coords(coords);
|
|
coords = p_tile_set_atlas_source->get_tile_at_coords(coords);
|
|
if (coords != TileSetSource::INVALID_ATLAS_COORDS) {
|
|
if (coords != TileSetSource::INVALID_ATLAS_COORDS) {
|
|
TileMapCell cell;
|
|
TileMapCell cell;
|
|
@@ -1015,8 +1015,8 @@ void TileDataDefaultEditor::forward_painting_atlas_gui_input(TileAtlasView *p_ti
|
|
} else {
|
|
} else {
|
|
if (drag_type == DRAG_TYPE_PAINT_RECT) {
|
|
if (drag_type == DRAG_TYPE_PAINT_RECT) {
|
|
Rect2i rect;
|
|
Rect2i rect;
|
|
- rect.set_position(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_start_pos));
|
|
|
|
- rect.set_end(p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position()));
|
|
|
|
|
|
+ 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(mb->get_position(), true));
|
|
rect = rect.abs();
|
|
rect = rect.abs();
|
|
|
|
|
|
drag_modified.clear();
|
|
drag_modified.clear();
|
|
@@ -1818,8 +1818,8 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas
|
|
p_canvas_item->draw_set_transform_matrix(p_transform);
|
|
p_canvas_item->draw_set_transform_matrix(p_transform);
|
|
|
|
|
|
Rect2i rect;
|
|
Rect2i rect;
|
|
- rect.set_position(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_start_pos));
|
|
|
|
- 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())));
|
|
|
|
|
|
+ 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();
|
|
rect = rect.abs();
|
|
|
|
|
|
RBSet<TileMapCell> edited;
|
|
RBSet<TileMapCell> edited;
|
|
@@ -1848,8 +1848,8 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas
|
|
int terrain_set = int(painted["terrain_set"]);
|
|
int terrain_set = int(painted["terrain_set"]);
|
|
|
|
|
|
Rect2i rect;
|
|
Rect2i rect;
|
|
- rect.set_position(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_start_pos));
|
|
|
|
- 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())));
|
|
|
|
|
|
+ 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();
|
|
rect = rect.abs();
|
|
|
|
|
|
RBSet<TileMapCell> edited;
|
|
RBSet<TileMapCell> edited;
|
|
@@ -2009,7 +2009,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
|
|
Ref<InputEventMouseMotion> mm = p_event;
|
|
Ref<InputEventMouseMotion> mm = p_event;
|
|
if (mm.is_valid()) {
|
|
if (mm.is_valid()) {
|
|
if (drag_type == DRAG_TYPE_PAINT_TERRAIN_SET) {
|
|
if (drag_type == DRAG_TYPE_PAINT_TERRAIN_SET) {
|
|
- Vector<Vector2i> line = Geometry2D::bresenham_line(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_last_pos), p_tile_atlas_view->get_atlas_tile_coords_at_pos(mm->get_position()));
|
|
|
|
|
|
+ Vector<Vector2i> line = Geometry2D::bresenham_line(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_last_pos, true), p_tile_atlas_view->get_atlas_tile_coords_at_pos(mm->get_position(), true));
|
|
for (int i = 0; i < line.size(); i++) {
|
|
for (int i = 0; i < line.size(); i++) {
|
|
Vector2i coords = p_tile_set_atlas_source->get_tile_at_coords(line[i]);
|
|
Vector2i coords = p_tile_set_atlas_source->get_tile_at_coords(line[i]);
|
|
if (coords != TileSetSource::INVALID_ATLAS_COORDS) {
|
|
if (coords != TileSetSource::INVALID_ATLAS_COORDS) {
|
|
@@ -2043,7 +2043,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
|
|
} else if (drag_type == DRAG_TYPE_PAINT_TERRAIN_BITS) {
|
|
} else if (drag_type == DRAG_TYPE_PAINT_TERRAIN_BITS) {
|
|
int terrain_set = Dictionary(drag_painted_value)["terrain_set"];
|
|
int terrain_set = Dictionary(drag_painted_value)["terrain_set"];
|
|
int terrain = Dictionary(drag_painted_value)["terrain"];
|
|
int terrain = Dictionary(drag_painted_value)["terrain"];
|
|
- Vector<Vector2i> line = Geometry2D::bresenham_line(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_last_pos), p_tile_atlas_view->get_atlas_tile_coords_at_pos(mm->get_position()));
|
|
|
|
|
|
+ Vector<Vector2i> line = Geometry2D::bresenham_line(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_last_pos, true), p_tile_atlas_view->get_atlas_tile_coords_at_pos(mm->get_position(), true));
|
|
for (int i = 0; i < line.size(); i++) {
|
|
for (int i = 0; i < line.size(); i++) {
|
|
Vector2i coords = p_tile_set_atlas_source->get_tile_at_coords(line[i]);
|
|
Vector2i coords = p_tile_set_atlas_source->get_tile_at_coords(line[i]);
|
|
if (coords != TileSetSource::INVALID_ATLAS_COORDS) {
|
|
if (coords != TileSetSource::INVALID_ATLAS_COORDS) {
|
|
@@ -2244,8 +2244,8 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
|
|
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
|
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
|
if (drag_type == DRAG_TYPE_PAINT_TERRAIN_SET_RECT) {
|
|
if (drag_type == DRAG_TYPE_PAINT_TERRAIN_SET_RECT) {
|
|
Rect2i rect;
|
|
Rect2i rect;
|
|
- rect.set_position(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_start_pos));
|
|
|
|
- rect.set_end(p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position()));
|
|
|
|
|
|
+ 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(mb->get_position(), true));
|
|
rect = rect.abs();
|
|
rect = rect.abs();
|
|
|
|
|
|
RBSet<TileMapCell> edited;
|
|
RBSet<TileMapCell> edited;
|
|
@@ -2332,8 +2332,8 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
|
|
int terrain = int(painted["terrain"]);
|
|
int terrain = int(painted["terrain"]);
|
|
|
|
|
|
Rect2i rect;
|
|
Rect2i rect;
|
|
- rect.set_position(p_tile_atlas_view->get_atlas_tile_coords_at_pos(drag_start_pos));
|
|
|
|
- rect.set_end(p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position()));
|
|
|
|
|
|
+ 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(mb->get_position(), true));
|
|
rect = rect.abs();
|
|
rect = rect.abs();
|
|
|
|
|
|
RBSet<TileMapCell> edited;
|
|
RBSet<TileMapCell> edited;
|