@@ -110,7 +110,7 @@ func transform_content_confirm() -> void:
110
110
src .copy_from (cel .transformed_content )
111
111
cel .transformed_content = null
112
112
var transformation_origin := transformation_handles .get_transform_top_left (src .get_size ())
113
- if Tools .is_placing_tiles ():
113
+ if Tools .is_placing_tiles () and not is_pasting :
114
114
if cel is not CelTileMap :
115
115
continue
116
116
var tilemap := cel as CelTileMap
@@ -149,7 +149,7 @@ func transform_content_cancel() -> void:
149
149
project .selection_map_changed ()
150
150
for cel in get_selected_draw_cels ():
151
151
var cel_image := cel .get_image ()
152
- if ! is_pasting :
152
+ if ! is_pasting and cel . transformed_content :
153
153
cel_image .blit_rect_mask (
154
154
cel .transformed_content ,
155
155
cel .transformed_content ,
@@ -170,7 +170,7 @@ func commit_undo(action: String, undo_data_tmp: Dictionary) -> void:
170
170
print ("No undo data found!" )
171
171
return
172
172
var project := Global .current_project
173
- if Tools .is_placing_tiles ():
173
+ if Tools .is_placing_tiles () and not is_pasting :
174
174
for cel in undo_data_tmp :
175
175
if cel is CelTileMap :
176
176
(cel as CelTileMap ).re_index_all_cells (true )
@@ -373,19 +373,51 @@ func paste(in_place := false) -> void:
373
373
if Tools .is_placing_tiles ():
374
374
var tilemap_cel := Global .current_project .get_current_cel () as CelTileMap
375
375
var grid_size := tilemap_cel .get_tile_size ()
376
+ var offset := tilemap_cel .offset % grid_size
377
+ transform_origin = Vector2i (
378
+ Tools .snap_to_rectangular_grid_boundary (transform_origin , grid_size , offset )
379
+ )
380
+ elif Global .snap_to_rectangular_grid_center :
381
+ var grid_size := Global .grids [0 ].grid_size
382
+ var grid_offset := Global .grids [0 ].grid_offset
376
383
transform_origin = Vector2i (
377
- Tools .snap_to_rectangular_grid_boundary (transform_origin , grid_size )
384
+ Tools .snap_to_rectangular_grid_center (transform_origin , grid_size , grid_offset )
385
+ )
386
+ elif Global .snap_to_rectangular_grid_boundary :
387
+ var grid_size := Global .grids [0 ].grid_size
388
+ var grid_offset := Global .grids [0 ].grid_offset
389
+ transform_origin = Vector2i (
390
+ Tools .snap_to_rectangular_grid_boundary (transform_origin , grid_size , grid_offset )
378
391
)
379
392
project .selection_map .move_bitmap_values (Global .current_project , false )
380
393
else :
381
394
if Tools .is_placing_tiles ():
382
395
var tilemap_cel := Global .current_project .get_current_cel () as CelTileMap
383
396
var grid_size := tilemap_cel .get_tile_size ()
397
+ var offset := tilemap_cel .offset % grid_size
398
+ project .selection_offset = Tools .snap_to_rectangular_grid_boundary (
399
+ project .selection_offset , grid_size , offset
400
+ )
401
+ transform_origin = Vector2i (
402
+ Tools .snap_to_rectangular_grid_boundary (transform_origin , grid_size , offset )
403
+ )
404
+ elif Global .snap_to_rectangular_grid_center :
405
+ var grid_size := Global .grids [0 ].grid_size
406
+ var grid_offset := Global .grids [0 ].grid_offset
407
+ project .selection_offset = Tools .snap_to_rectangular_grid_center (
408
+ project .selection_offset , grid_size , grid_offset
409
+ )
410
+ transform_origin = Vector2i (
411
+ Tools .snap_to_rectangular_grid_center (transform_origin , grid_size , grid_offset )
412
+ )
413
+ elif Global .snap_to_rectangular_grid_boundary :
414
+ var grid_size := Global .grids [0 ].grid_size
415
+ var grid_offset := Global .grids [0 ].grid_offset
384
416
project .selection_offset = Tools .snap_to_rectangular_grid_boundary (
385
- project .selection_offset , grid_size
417
+ project .selection_offset , grid_size , grid_offset
386
418
)
387
419
transform_origin = Vector2i (
388
- Tools .snap_to_rectangular_grid_boundary (transform_origin , grid_size )
420
+ Tools .snap_to_rectangular_grid_boundary (transform_origin , grid_size , grid_offset )
389
421
)
390
422
391
423
is_pasting = true
0 commit comments