1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 09:09:47 +00:00

Fix some unintentional behaviors with tilemap layer tile editing modes

This commit is contained in:
Emmanouil Papadeas 2024-12-06 04:03:57 +02:00
parent f91bb18fb2
commit 1ea80a342a
7 changed files with 19 additions and 8 deletions

View file

@ -157,7 +157,10 @@ func display_animate_dialog() -> void:
func _commit_undo(action: String, undo_data: Dictionary, project: Project) -> void:
project.update_tilemaps(undo_data)
var tile_editing_mode := TileSetPanel.tile_editing_mode
if tile_editing_mode == TileSetPanel.TileEditingMode.MANUAL:
tile_editing_mode = TileSetPanel.TileEditingMode.AUTO
project.update_tilemaps(undo_data, tile_editing_mode)
var redo_data := _get_undo_data(project)
project.undos += 1
project.undo_redo.create_action(action)

View file

@ -1015,7 +1015,9 @@ func add_tileset(tileset: TileSetCustom) -> void:
## Loops through all cels in [param cel_dictionary], and for [CelTileMap]s,
## it calls [method CelTileMap.update_tilemap].
func update_tilemaps(cel_dictionary: Dictionary) -> void:
func update_tilemaps(
cel_dictionary: Dictionary, tile_editing_mode := TileSetPanel.tile_editing_mode
) -> void:
for cel in cel_dictionary:
if cel is CelTileMap:
(cel as CelTileMap).update_tilemap()
(cel as CelTileMap).update_tilemap(tile_editing_mode)

View file

@ -131,7 +131,7 @@ func _snap_position(pos: Vector2) -> Vector2:
func _commit_undo(action: String) -> void:
var project := Global.current_project
project.update_tilemaps(_undo_data)
project.update_tilemaps(_undo_data, TileSetPanel.TileEditingMode.AUTO)
var redo_data := _get_undo_data()
var frame := -1
var layer := -1

View file

@ -629,7 +629,7 @@ func commit_undo(action: String, undo_data_tmp: Dictionary) -> void:
print("No undo data found!")
return
var project := Global.current_project
project.update_tilemaps(undo_data_tmp)
project.update_tilemaps(undo_data_tmp, TileSetPanel.TileEditingMode.AUTO)
var redo_data := get_undo_data(undo_data_tmp["undo_image"])
project.undos += 1
project.undo_redo.create_action(action)

View file

@ -47,7 +47,10 @@ func _flip_image(cel: Image, affect_selection: bool, project: Project) -> void:
func _commit_undo(action: String, undo_data: Dictionary, project: Project) -> void:
_flip_selection(project)
project.update_tilemaps(undo_data)
var tile_editing_mode := TileSetPanel.tile_editing_mode
if tile_editing_mode == TileSetPanel.TileEditingMode.MANUAL:
tile_editing_mode = TileSetPanel.TileEditingMode.AUTO
project.update_tilemaps(undo_data, tile_editing_mode)
var redo_data := _get_undo_data(project)
project.undos += 1
project.undo_redo.create_action(action)

View file

@ -165,7 +165,10 @@ func _apply_effect(layer: BaseLayer, effect: LayerEffect) -> void:
var shader_image_effect := ShaderImageEffect.new()
shader_image_effect.generate_image(cel_image, effect.shader, effect.params, image_size)
project.update_tilemaps(undo_data)
var tile_editing_mode := TileSetPanel.tile_editing_mode
if tile_editing_mode == TileSetPanel.TileEditingMode.MANUAL:
tile_editing_mode = TileSetPanel.TileEditingMode.AUTO
project.update_tilemaps(undo_data, tile_editing_mode)
for frame in project.frames:
var cel := frame.cels[layer.index]
var cel_image := cel.get_image()

View file

@ -734,7 +734,7 @@ func _color_mode_submenu_id_pressed(id: ColorModes) -> void:
project.color_mode = Image.FORMAT_RGBA8
else:
project.color_mode = Project.INDEXED_MODE
project.update_tilemaps(undo_data)
project.update_tilemaps(undo_data, TileSetPanel.TileEditingMode.AUTO)
project.serialize_cel_undo_data(pixel_cels, redo_data)
project.undo_redo.create_action("Change color mode")
project.undos += 1