diff --git a/src/Classes/Cels/BaseCel.gd b/src/Classes/Cels/BaseCel.gd index 8dedefba4..313544956 100644 --- a/src/Classes/Cels/BaseCel.gd +++ b/src/Classes/Cels/BaseCel.gd @@ -77,6 +77,10 @@ func update_texture() -> void: cel.texture_changed.emit() +func tool_finished_drawing() -> void: + pass + + ## Returns a curated [Dictionary] containing the cel data. func serialize() -> Dictionary: var dict := {"opacity": opacity, "z_index": z_index} diff --git a/src/Classes/Cels/CelTileMap.gd b/src/Classes/Cels/CelTileMap.gd index 4424daa1c..9f1a5cb1b 100644 --- a/src/Classes/Cels/CelTileMap.gd +++ b/src/Classes/Cels/CelTileMap.gd @@ -29,6 +29,10 @@ func update_texture() -> void: super.update_texture() +func tool_finished_drawing() -> void: + update_tileset() + + func update_tileset() -> void: for i in indices.size(): var coords := get_tile_coords(i) diff --git a/src/Tools/BaseShapeDrawer.gd b/src/Tools/BaseShapeDrawer.gd index 4af1a156f..8789fccd2 100644 --- a/src/Tools/BaseShapeDrawer.gd +++ b/src/Tools/BaseShapeDrawer.gd @@ -128,8 +128,8 @@ func draw_move(pos: Vector2i) -> void: func draw_end(pos: Vector2i) -> void: pos = snap_position(pos) - super.draw_end(pos) if _picking_color: + super.draw_end(pos) return if _drawing: @@ -150,6 +150,7 @@ func draw_end(pos: Vector2i) -> void: _drawing = false _displace_origin = false cursor_text = "" + super.draw_end(pos) func draw_preview() -> void: diff --git a/src/Tools/BaseTool.gd b/src/Tools/BaseTool.gd index a1994da8b..e7bc269a1 100644 --- a/src/Tools/BaseTool.gd +++ b/src/Tools/BaseTool.gd @@ -76,13 +76,16 @@ func draw_end(_pos: Vector2i) -> void: is_moving = false _draw_cache = [] var project := Global.current_project - for cel_index in project.selected_cels: - var cel := project.frames[cel_index[0]].cels[cel_index[1]] - if cel is CelTileMap: - cel.update_tileset() + update_cels(project) project.can_undo = true +func update_cels(project := Global.current_project) -> void: + for cel_index in project.selected_cels: + var cel := project.frames[cel_index[0]].cels[cel_index[1]] as BaseCel + cel.tool_finished_drawing() + + func cursor_move(pos: Vector2i) -> void: _cursor = pos if _spacing_mode and is_moving: diff --git a/src/Tools/DesignTools/LineTool.gd b/src/Tools/DesignTools/LineTool.gd index 3f2f858b2..7c97d0511 100644 --- a/src/Tools/DesignTools/LineTool.gd +++ b/src/Tools/DesignTools/LineTool.gd @@ -120,8 +120,8 @@ func draw_move(pos: Vector2i) -> void: func draw_end(pos: Vector2i) -> void: pos = snap_position(pos) - super.draw_end(pos) if _picking_color: + super.draw_end(pos) return if _drawing: @@ -144,6 +144,7 @@ func draw_end(pos: Vector2i) -> void: _drawing = false _displace_origin = false cursor_text = "" + super.draw_end(pos) func draw_preview() -> void: diff --git a/src/Tools/UtilityTools/Move.gd b/src/Tools/UtilityTools/Move.gd index 247ab85de..476ae025e 100644 --- a/src/Tools/UtilityTools/Move.gd +++ b/src/Tools/UtilityTools/Move.gd @@ -70,8 +70,8 @@ func draw_move(pos: Vector2i) -> void: func draw_end(pos: Vector2i) -> void: - super.draw_end(pos) if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn(): + super.draw_end(pos) return if ( _start_pos != Vector2i(Vector2.INF) @@ -93,6 +93,7 @@ func draw_end(pos: Vector2i) -> void: _snap_to_grid = false Global.canvas.sprite_changed_this_frame = true Global.canvas.measurements.update_measurement(Global.MeasurementMode.NONE) + super.draw_end(pos) func _move_image(image: Image, pixel_diff: Vector2i) -> void: diff --git a/src/Tools/UtilityTools/Text.gd b/src/Tools/UtilityTools/Text.gd index b1128de66..f267254bb 100644 --- a/src/Tools/UtilityTools/Text.gd +++ b/src/Tools/UtilityTools/Text.gd @@ -103,8 +103,8 @@ func draw_move(pos: Vector2i) -> void: _offset = pos -func draw_end(_position: Vector2i) -> void: - pass +func draw_end(pos: Vector2i) -> void: + super.draw_end(pos) func text_to_pixels() -> void: @@ -158,6 +158,7 @@ func text_to_pixels() -> void: if image is ImageExtended: image.convert_rgb_to_indexed() commit_undo("Draw", undo_data) + update_cels(project) func commit_undo(action: String, undo_data: Dictionary) -> void: diff --git a/src/UI/Canvas/Selection.gd b/src/UI/Canvas/Selection.gd index f28fd7cd7..9f12b69b2 100644 --- a/src/UI/Canvas/Selection.gd +++ b/src/UI/Canvas/Selection.gd @@ -517,6 +517,7 @@ func transform_content_confirm() -> void: big_bounding_rectangle.position ) cel_image.convert_rgb_to_indexed() + cel.tool_finished_drawing() project.selection_map.move_bitmap_values(project) commit_undo("Move Selection", undo_data) @@ -552,6 +553,7 @@ func transform_content_cancel() -> void: big_bounding_rectangle.position ) cel.transformed_content = null + cel.tool_finished_drawing() for cel_index in project.selected_cels: canvas.update_texture(cel_index[1]) original_preview_image = Image.new()