mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-19 09:39:48 +00:00
Properly update the tileset when using any tool
This commit is contained in:
parent
b87bfdf7e8
commit
12eda32176
|
@ -77,6 +77,10 @@ func update_texture() -> void:
|
||||||
cel.texture_changed.emit()
|
cel.texture_changed.emit()
|
||||||
|
|
||||||
|
|
||||||
|
func tool_finished_drawing() -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
## Returns a curated [Dictionary] containing the cel data.
|
## Returns a curated [Dictionary] containing the cel data.
|
||||||
func serialize() -> Dictionary:
|
func serialize() -> Dictionary:
|
||||||
var dict := {"opacity": opacity, "z_index": z_index}
|
var dict := {"opacity": opacity, "z_index": z_index}
|
||||||
|
|
|
@ -29,6 +29,10 @@ func update_texture() -> void:
|
||||||
super.update_texture()
|
super.update_texture()
|
||||||
|
|
||||||
|
|
||||||
|
func tool_finished_drawing() -> void:
|
||||||
|
update_tileset()
|
||||||
|
|
||||||
|
|
||||||
func update_tileset() -> void:
|
func update_tileset() -> void:
|
||||||
for i in indices.size():
|
for i in indices.size():
|
||||||
var coords := get_tile_coords(i)
|
var coords := get_tile_coords(i)
|
||||||
|
|
|
@ -128,8 +128,8 @@ func draw_move(pos: Vector2i) -> void:
|
||||||
|
|
||||||
func draw_end(pos: Vector2i) -> void:
|
func draw_end(pos: Vector2i) -> void:
|
||||||
pos = snap_position(pos)
|
pos = snap_position(pos)
|
||||||
super.draw_end(pos)
|
|
||||||
if _picking_color:
|
if _picking_color:
|
||||||
|
super.draw_end(pos)
|
||||||
return
|
return
|
||||||
|
|
||||||
if _drawing:
|
if _drawing:
|
||||||
|
@ -150,6 +150,7 @@ func draw_end(pos: Vector2i) -> void:
|
||||||
_drawing = false
|
_drawing = false
|
||||||
_displace_origin = false
|
_displace_origin = false
|
||||||
cursor_text = ""
|
cursor_text = ""
|
||||||
|
super.draw_end(pos)
|
||||||
|
|
||||||
|
|
||||||
func draw_preview() -> void:
|
func draw_preview() -> void:
|
||||||
|
|
|
@ -76,13 +76,16 @@ func draw_end(_pos: Vector2i) -> void:
|
||||||
is_moving = false
|
is_moving = false
|
||||||
_draw_cache = []
|
_draw_cache = []
|
||||||
var project := Global.current_project
|
var project := Global.current_project
|
||||||
for cel_index in project.selected_cels:
|
update_cels(project)
|
||||||
var cel := project.frames[cel_index[0]].cels[cel_index[1]]
|
|
||||||
if cel is CelTileMap:
|
|
||||||
cel.update_tileset()
|
|
||||||
project.can_undo = true
|
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:
|
func cursor_move(pos: Vector2i) -> void:
|
||||||
_cursor = pos
|
_cursor = pos
|
||||||
if _spacing_mode and is_moving:
|
if _spacing_mode and is_moving:
|
||||||
|
|
|
@ -120,8 +120,8 @@ func draw_move(pos: Vector2i) -> void:
|
||||||
|
|
||||||
func draw_end(pos: Vector2i) -> void:
|
func draw_end(pos: Vector2i) -> void:
|
||||||
pos = snap_position(pos)
|
pos = snap_position(pos)
|
||||||
super.draw_end(pos)
|
|
||||||
if _picking_color:
|
if _picking_color:
|
||||||
|
super.draw_end(pos)
|
||||||
return
|
return
|
||||||
|
|
||||||
if _drawing:
|
if _drawing:
|
||||||
|
@ -144,6 +144,7 @@ func draw_end(pos: Vector2i) -> void:
|
||||||
_drawing = false
|
_drawing = false
|
||||||
_displace_origin = false
|
_displace_origin = false
|
||||||
cursor_text = ""
|
cursor_text = ""
|
||||||
|
super.draw_end(pos)
|
||||||
|
|
||||||
|
|
||||||
func draw_preview() -> void:
|
func draw_preview() -> void:
|
||||||
|
|
|
@ -70,8 +70,8 @@ func draw_move(pos: Vector2i) -> void:
|
||||||
|
|
||||||
|
|
||||||
func draw_end(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():
|
if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn():
|
||||||
|
super.draw_end(pos)
|
||||||
return
|
return
|
||||||
if (
|
if (
|
||||||
_start_pos != Vector2i(Vector2.INF)
|
_start_pos != Vector2i(Vector2.INF)
|
||||||
|
@ -93,6 +93,7 @@ func draw_end(pos: Vector2i) -> void:
|
||||||
_snap_to_grid = false
|
_snap_to_grid = false
|
||||||
Global.canvas.sprite_changed_this_frame = true
|
Global.canvas.sprite_changed_this_frame = true
|
||||||
Global.canvas.measurements.update_measurement(Global.MeasurementMode.NONE)
|
Global.canvas.measurements.update_measurement(Global.MeasurementMode.NONE)
|
||||||
|
super.draw_end(pos)
|
||||||
|
|
||||||
|
|
||||||
func _move_image(image: Image, pixel_diff: Vector2i) -> void:
|
func _move_image(image: Image, pixel_diff: Vector2i) -> void:
|
||||||
|
|
|
@ -104,8 +104,8 @@ func draw_move(pos: Vector2i) -> void:
|
||||||
_offset = pos
|
_offset = pos
|
||||||
|
|
||||||
|
|
||||||
func draw_end(_position: Vector2i) -> void:
|
func draw_end(pos: Vector2i) -> void:
|
||||||
pass
|
super.draw_end(pos)
|
||||||
|
|
||||||
|
|
||||||
func text_to_pixels() -> void:
|
func text_to_pixels() -> void:
|
||||||
|
@ -159,6 +159,7 @@ func text_to_pixels() -> void:
|
||||||
if image is ImageExtended:
|
if image is ImageExtended:
|
||||||
image.convert_rgb_to_indexed()
|
image.convert_rgb_to_indexed()
|
||||||
commit_undo("Draw", undo_data)
|
commit_undo("Draw", undo_data)
|
||||||
|
update_cels(project)
|
||||||
|
|
||||||
|
|
||||||
func commit_undo(action: String, undo_data: Dictionary) -> void:
|
func commit_undo(action: String, undo_data: Dictionary) -> void:
|
||||||
|
|
|
@ -517,6 +517,7 @@ func transform_content_confirm() -> void:
|
||||||
big_bounding_rectangle.position
|
big_bounding_rectangle.position
|
||||||
)
|
)
|
||||||
cel_image.convert_rgb_to_indexed()
|
cel_image.convert_rgb_to_indexed()
|
||||||
|
cel.tool_finished_drawing()
|
||||||
project.selection_map.move_bitmap_values(project)
|
project.selection_map.move_bitmap_values(project)
|
||||||
commit_undo("Move Selection", undo_data)
|
commit_undo("Move Selection", undo_data)
|
||||||
|
|
||||||
|
@ -552,6 +553,7 @@ func transform_content_cancel() -> void:
|
||||||
big_bounding_rectangle.position
|
big_bounding_rectangle.position
|
||||||
)
|
)
|
||||||
cel.transformed_content = null
|
cel.transformed_content = null
|
||||||
|
cel.tool_finished_drawing()
|
||||||
for cel_index in project.selected_cels:
|
for cel_index in project.selected_cels:
|
||||||
canvas.update_texture(cel_index[1])
|
canvas.update_texture(cel_index[1])
|
||||||
original_preview_image = Image.new()
|
original_preview_image = Image.new()
|
||||||
|
|
Loading…
Reference in a new issue