mirror of
https://github.com/Relintai/GraphicsEditor.git
synced 2025-05-07 19:11:37 +02:00
update
This commit is contained in:
parent
fd5907a8b4
commit
52b5363c9a
@ -54,6 +54,8 @@ func _enter_tree():
|
|||||||
|
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
|
if not is_visible_in_tree():
|
||||||
|
return
|
||||||
var mouse_position = get_local_mouse_position()
|
var mouse_position = get_local_mouse_position()
|
||||||
var rect = Rect2(Vector2(0, 0), rect_size)
|
var rect = Rect2(Vector2(0, 0), rect_size)
|
||||||
mouse_in_region = rect.has_point(mouse_position)
|
mouse_in_region = rect.has_point(mouse_position)
|
||||||
|
@ -47,8 +47,6 @@ var _last_preview_draw_cell_pos = Vector2.ZERO
|
|||||||
var _selection_cells = []
|
var _selection_cells = []
|
||||||
var _selection_colors = []
|
var _selection_colors = []
|
||||||
|
|
||||||
var _just_cut = false
|
|
||||||
var _show_cut = false
|
|
||||||
var _cut_pos = Vector2.ZERO
|
var _cut_pos = Vector2.ZERO
|
||||||
var _cut_size = Vector2.ZERO
|
var _cut_size = Vector2.ZERO
|
||||||
|
|
||||||
@ -103,13 +101,9 @@ func _ready():
|
|||||||
|
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if Rect2(Vector2(), paint_canvas_container_node.rect_size).has_point(
|
if not is_visible_in_tree():
|
||||||
paint_canvas_container_node.get_local_mouse_position()):
|
return
|
||||||
mouse_in_region = true
|
if paint_canvas_container_node == null or paint_canvas == null:
|
||||||
elif mouse_in_region:
|
|
||||||
mouse_in_region = false
|
|
||||||
|
|
||||||
if not mouse_on_top or not mouse_in_region:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if event is InputEventKey:
|
if event is InputEventKey:
|
||||||
@ -118,40 +112,45 @@ func _input(event):
|
|||||||
elif event.scancode == KEY_Y and event.is_pressed() and not event.is_echo():
|
elif event.scancode == KEY_Y and event.is_pressed() and not event.is_echo():
|
||||||
redo_action()
|
redo_action()
|
||||||
|
|
||||||
|
if is_mouse_in_canvas():
|
||||||
_handle_zoom(event)
|
_handle_zoom(event)
|
||||||
|
|
||||||
if paint_canvas and \
|
if paint_canvas.is_active_layer_locked():
|
||||||
not paint_canvas.is_active_layer_locked() and \
|
return
|
||||||
(paint_canvas.mouse_in_region and paint_canvas.mouse_on_top):
|
|
||||||
|
if brush_mode == Tools.CUT:
|
||||||
|
if event is InputEventMouseButton:
|
||||||
|
if event.button_index == BUTTON_LEFT:
|
||||||
|
if not event.pressed:
|
||||||
|
commit_action()
|
||||||
|
|
||||||
|
if (paint_canvas.mouse_in_region and paint_canvas.mouse_on_top):
|
||||||
|
|
||||||
|
if event is InputEventMouseButton:
|
||||||
match brush_mode:
|
match brush_mode:
|
||||||
Tools.BUCKET:
|
Tools.BUCKET:
|
||||||
if _current_action == null:
|
|
||||||
_current_action = get_action()
|
|
||||||
if event is InputEventMouseButton:
|
|
||||||
if event.button_index == BUTTON_LEFT:
|
if event.button_index == BUTTON_LEFT:
|
||||||
if event.pressed:
|
if event.pressed:
|
||||||
do_action([cell_mouse_position, last_cell_mouse_position, selected_color])
|
do_action([cell_mouse_position, last_cell_mouse_position, selected_color])
|
||||||
Tools.COLORPICKER:
|
Tools.COLORPICKER:
|
||||||
if event is InputEventMouseButton:
|
|
||||||
if event.button_index == BUTTON_LEFT:
|
if event.button_index == BUTTON_LEFT:
|
||||||
if event.pressed:
|
if event.pressed:
|
||||||
find_node("Colors").add_color_prefab(selected_color)
|
find_node("Colors").add_color_prefab(selected_color)
|
||||||
set_brush(_previous_tool)
|
set_brush(_previous_tool)
|
||||||
|
Tools.PASTECUT:
|
||||||
|
if event.button_index == BUTTON_RIGHT:
|
||||||
|
if event.pressed:
|
||||||
|
commit_action()
|
||||||
|
set_brush(Tools.PAINT)
|
||||||
|
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
if not mouse_on_top or not mouse_in_region:
|
if not is_visible_in_tree():
|
||||||
return
|
return
|
||||||
update_text_info()
|
if paint_canvas_container_node == null or paint_canvas == null:
|
||||||
#It's a lot more easier to just keep updating the variables in here than just have a bunch of local variables
|
|
||||||
#in every update function and make it very messy
|
|
||||||
if paint_canvas == null:
|
|
||||||
#_check_variables()
|
|
||||||
set_process(false)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if is_mouse_in_canvas():
|
||||||
if mouse_on_top and mouse_in_region:
|
|
||||||
_handle_scroll()
|
_handle_scroll()
|
||||||
|
|
||||||
#Update commonly used variables
|
#Update commonly used variables
|
||||||
@ -162,30 +161,13 @@ func _process(delta):
|
|||||||
cell_mouse_position = Vector2(floor(canvas_mouse_position.x / grid_size), floor(canvas_mouse_position.y / grid_size))
|
cell_mouse_position = Vector2(floor(canvas_mouse_position.x / grid_size), floor(canvas_mouse_position.y / grid_size))
|
||||||
if cell_mouse_position.x >= 0 and cell_mouse_position.y >= 0:
|
if cell_mouse_position.x >= 0 and cell_mouse_position.y >= 0:
|
||||||
cell_color = paint_canvas.get_pixel(cell_mouse_position.x, cell_mouse_position.y)
|
cell_color = paint_canvas.get_pixel(cell_mouse_position.x, cell_mouse_position.y)
|
||||||
|
update_text_info()
|
||||||
|
|
||||||
if (paint_canvas.mouse_in_region and paint_canvas.mouse_on_top):
|
|
||||||
if not paint_canvas.is_active_layer_locked():
|
if not paint_canvas.is_active_layer_locked():
|
||||||
|
if is_position_in_canvas(last_cell_mouse_position) or is_position_in_canvas(cell_mouse_position):
|
||||||
brush_process()
|
brush_process()
|
||||||
|
|
||||||
paint_canvas.tool_layer.clear()
|
_draw_tool_brush()
|
||||||
#TODO add here brush prefab drawing
|
|
||||||
paint_canvas._set_pixel(paint_canvas.tool_layer,
|
|
||||||
cell_mouse_position.x, cell_mouse_position.y, selected_color)
|
|
||||||
paint_canvas.tool_layer.update_texture()
|
|
||||||
else:
|
|
||||||
paint_canvas.tool_layer.clear()
|
|
||||||
paint_canvas.tool_layer.update_texture()
|
|
||||||
|
|
||||||
#Canvas Shift Moving
|
|
||||||
if not mouse_position == last_mouse_position:
|
|
||||||
if paint_canvas.has_focus():
|
|
||||||
if Input.is_key_pressed(KEY_SHIFT):
|
|
||||||
if Input.is_mouse_button_pressed(BUTTON_LEFT):
|
|
||||||
var relative = mouse_position - last_mouse_position
|
|
||||||
paint_canvas.rect_position += relative
|
|
||||||
allow_drawing = false
|
|
||||||
else:
|
|
||||||
allow_drawing = true
|
|
||||||
|
|
||||||
#Update last variables with the current variables
|
#Update last variables with the current variables
|
||||||
last_mouse_position = mouse_position
|
last_mouse_position = mouse_position
|
||||||
@ -195,6 +177,28 @@ func _process(delta):
|
|||||||
last_cell_color = cell_color
|
last_cell_color = cell_color
|
||||||
|
|
||||||
|
|
||||||
|
func _draw_tool_brush():
|
||||||
|
paint_canvas.tool_layer.clear()
|
||||||
|
|
||||||
|
match brush_mode:
|
||||||
|
Tools.PASTECUT:
|
||||||
|
for idx in range(_selection_cells.size()):
|
||||||
|
var pixel = _selection_cells[idx]
|
||||||
|
if pixel.x < 0 or pixel.y < 0:
|
||||||
|
print(pixel)
|
||||||
|
var color = _selection_colors[idx]
|
||||||
|
pixel -= _cut_pos + _cut_size / 2
|
||||||
|
pixel += cell_mouse_position
|
||||||
|
paint_canvas._set_pixel_v(paint_canvas.tool_layer, pixel, color)
|
||||||
|
paint_canvas.update()
|
||||||
|
_:
|
||||||
|
paint_canvas._set_pixel(paint_canvas.tool_layer,
|
||||||
|
cell_mouse_position.x, cell_mouse_position.y, selected_color)
|
||||||
|
|
||||||
|
#TODO add here brush prefab drawing
|
||||||
|
paint_canvas.tool_layer.update_texture()
|
||||||
|
|
||||||
|
|
||||||
func _handle_scroll():
|
func _handle_scroll():
|
||||||
if Input.is_mouse_button_pressed(BUTTON_MIDDLE):
|
if Input.is_mouse_button_pressed(BUTTON_MIDDLE):
|
||||||
if _middle_mouse_pressed_start_pos == null:
|
if _middle_mouse_pressed_start_pos == null:
|
||||||
@ -233,17 +237,9 @@ func _handle_zoom(event):
|
|||||||
paint_canvas.rect_position.y = clamp(paint_canvas.rect_position.y, -paint_canvas.rect_size.y * 0.8, rect_size.y)
|
paint_canvas.rect_position.y = clamp(paint_canvas.rect_position.y, -paint_canvas.rect_size.y * 0.8, rect_size.y)
|
||||||
|
|
||||||
|
|
||||||
func _reset_cut_tool():
|
|
||||||
_just_cut = false
|
|
||||||
_show_cut = false
|
|
||||||
_selection_cells.clear()
|
|
||||||
_selection_colors.clear()
|
|
||||||
|
|
||||||
|
|
||||||
func _handle_cut():
|
func _handle_cut():
|
||||||
if Input.is_mouse_button_pressed(BUTTON_RIGHT):
|
if Input.is_mouse_button_pressed(BUTTON_RIGHT):
|
||||||
paint_canvas.clear_preview_layer()
|
paint_canvas.clear_preview_layer()
|
||||||
_reset_cut_tool()
|
|
||||||
set_brush(_previous_tool)
|
set_brush(_previous_tool)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -269,15 +265,9 @@ func _handle_cut():
|
|||||||
|
|
||||||
|
|
||||||
func brush_process():
|
func brush_process():
|
||||||
if _just_cut:
|
|
||||||
_handle_cut()
|
|
||||||
paint_canvas.update()
|
|
||||||
return
|
|
||||||
|
|
||||||
if Input.is_mouse_button_pressed(BUTTON_LEFT):
|
if Input.is_mouse_button_pressed(BUTTON_LEFT):
|
||||||
if _current_action == null and brush_mode != Tools.COLORPICKER:
|
if _current_action == null and brush_mode != Tools.COLORPICKER:
|
||||||
_current_action = get_action()
|
_current_action = get_action()
|
||||||
|
|
||||||
match brush_mode:
|
match brush_mode:
|
||||||
Tools.PAINT:
|
Tools.PAINT:
|
||||||
do_action([cell_mouse_position, last_cell_mouse_position, selected_color])
|
do_action([cell_mouse_position, last_cell_mouse_position, selected_color])
|
||||||
@ -302,11 +292,9 @@ func brush_process():
|
|||||||
_cut_pos, _cut_size])
|
_cut_pos, _cut_size])
|
||||||
Tools.RAINBOW:
|
Tools.RAINBOW:
|
||||||
do_action([cell_mouse_position, last_cell_mouse_position])
|
do_action([cell_mouse_position, last_cell_mouse_position])
|
||||||
update()
|
|
||||||
paint_canvas.update()
|
paint_canvas.update()
|
||||||
|
|
||||||
elif Input.is_mouse_button_pressed(BUTTON_RIGHT):
|
elif Input.is_mouse_button_pressed(BUTTON_RIGHT):
|
||||||
update()
|
|
||||||
paint_canvas.update()
|
paint_canvas.update()
|
||||||
if _current_action == null:
|
if _current_action == null:
|
||||||
_current_action = get_action()
|
_current_action = get_action()
|
||||||
@ -319,7 +307,6 @@ func brush_process():
|
|||||||
else:
|
else:
|
||||||
if _current_action and _current_action.can_commit():
|
if _current_action and _current_action.can_commit():
|
||||||
commit_action()
|
commit_action()
|
||||||
update()
|
|
||||||
paint_canvas.update()
|
paint_canvas.update()
|
||||||
|
|
||||||
|
|
||||||
@ -377,20 +364,12 @@ func commit_action():
|
|||||||
|
|
||||||
match brush_mode:
|
match brush_mode:
|
||||||
Tools.CUT:
|
Tools.CUT:
|
||||||
if _just_cut:
|
|
||||||
continue
|
|
||||||
_cut_pos = _current_action.mouse_start_pos
|
_cut_pos = _current_action.mouse_start_pos
|
||||||
_cut_size = _current_action.mouse_end_pos - _current_action.mouse_start_pos
|
_cut_size = _current_action.mouse_end_pos - _current_action.mouse_start_pos
|
||||||
_selection_cells = _current_action.action_data.redo.cells.duplicate()
|
_selection_cells = _current_action.action_data.redo.cells.duplicate()
|
||||||
_selection_colors = _current_action.action_data.redo.colors.duplicate()
|
_selection_colors = _current_action.action_data.redo.colors.duplicate()
|
||||||
_just_cut = true
|
set_brush(Tools.PASTECUT)
|
||||||
|
_:
|
||||||
_current_action = null
|
|
||||||
return
|
|
||||||
action.action_data = _current_action.action_data
|
|
||||||
if not "action_data" in action:
|
|
||||||
print(action.get_class())
|
|
||||||
return
|
|
||||||
_current_action = null
|
_current_action = null
|
||||||
|
|
||||||
|
|
||||||
@ -438,6 +417,8 @@ func get_action():
|
|||||||
return GEBrighten.new()
|
return GEBrighten.new()
|
||||||
Tools.CUT:
|
Tools.CUT:
|
||||||
return GECut.new()
|
return GECut.new()
|
||||||
|
Tools.PASTECUT:
|
||||||
|
return GEPasteCut.new()
|
||||||
_:
|
_:
|
||||||
print("no tool!")
|
print("no tool!")
|
||||||
return null
|
return null
|
||||||
@ -458,10 +439,14 @@ func set_brush(new_mode):
|
|||||||
_previous_tool = brush_mode
|
_previous_tool = brush_mode
|
||||||
brush_mode = new_mode
|
brush_mode = new_mode
|
||||||
|
|
||||||
|
_current_action = get_action()
|
||||||
|
|
||||||
match _previous_tool:
|
match _previous_tool:
|
||||||
Tools.CUT:
|
Tools.CUT:
|
||||||
paint_canvas.clear_preview_layer()
|
paint_canvas.clear_preview_layer()
|
||||||
_just_cut = false
|
Tools.PASTECUT:
|
||||||
|
_selection_cells.clear()
|
||||||
|
_selection_colors.clear()
|
||||||
Tools.BUCKET:
|
Tools.BUCKET:
|
||||||
_current_action = null
|
_current_action = null
|
||||||
print("Selected: ", Tools.keys()[brush_mode])
|
print("Selected: ", Tools.keys()[brush_mode])
|
||||||
@ -635,3 +620,22 @@ func _on_PaintCanvasContainer_mouse_exited():
|
|||||||
|
|
||||||
func _on_ColorPicker_popup_closed():
|
func _on_ColorPicker_popup_closed():
|
||||||
find_node("Colors").add_color_prefab(find_node("ColorPicker").color)
|
find_node("Colors").add_color_prefab(find_node("ColorPicker").color)
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------
|
||||||
|
# MISC
|
||||||
|
#---------------------------------------
|
||||||
|
|
||||||
|
func is_position_in_canvas(pos):
|
||||||
|
last_cell_mouse_position
|
||||||
|
if Rect2(Vector2(), paint_canvas_container_node.rect_size).has_point(
|
||||||
|
pos):
|
||||||
|
return true
|
||||||
|
return false
|
||||||
|
|
||||||
|
|
||||||
|
func is_mouse_in_canvas() -> bool:
|
||||||
|
if is_position_in_canvas(paint_canvas_container_node.get_local_mouse_position()):
|
||||||
|
return true #mouse_on_top # check if mouse is inside canvas
|
||||||
|
else:
|
||||||
|
return false
|
||||||
|
File diff suppressed because one or more lines are too long
@ -12,25 +12,13 @@ func _enter_tree():
|
|||||||
editor = get_parent()
|
editor = get_parent()
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
|
||||||
#start_time = OS.get_ticks_msec()
|
|
||||||
return
|
|
||||||
get_node("CanvasOutlineToggle/CheckButton").pressed = canvas_outline.visible
|
|
||||||
get_node("CanvasOutlineColor/ColorPickerButton").color = canvas_outline.color
|
|
||||||
|
|
||||||
func _process(delta):
|
|
||||||
# if get_parent().paint_canvas_node != null:
|
|
||||||
# canvas_outline = get_parent().paint_canvas_node.get_node("CanvasOutline")
|
|
||||||
# end_time = OS.get_ticks_msec()
|
|
||||||
# print("[Settings] Found Editor node in %s seconds!" % [(end_time - start_time) / float(1000)])
|
|
||||||
# set_process(false)
|
|
||||||
pass
|
|
||||||
|
|
||||||
func _on_ColorPickerButton_color_changed(color):
|
func _on_ColorPickerButton_color_changed(color):
|
||||||
canvas_outline.color = color
|
canvas_outline.color = color
|
||||||
|
|
||||||
|
|
||||||
func _on_CheckButton_toggled(button_pressed):
|
func _on_CheckButton_toggled(button_pressed):
|
||||||
canvas_outline.visible = button_pressed
|
canvas_outline.visible = button_pressed
|
||||||
|
|
||||||
|
|
||||||
func _on_Ok_pressed():
|
func _on_Ok_pressed():
|
||||||
hide()
|
hide()
|
||||||
|
@ -36,4 +36,6 @@ func _draw():
|
|||||||
|
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
|
if not is_visible_in_tree():
|
||||||
|
return
|
||||||
update()
|
update()
|
||||||
|
@ -36,7 +36,6 @@ func commit_action(canvas):
|
|||||||
func undo_action(canvas):
|
func undo_action(canvas):
|
||||||
var cells = action_data.undo.cells
|
var cells = action_data.undo.cells
|
||||||
var colors = action_data.undo.colors
|
var colors = action_data.undo.colors
|
||||||
print(action_data.keys())
|
|
||||||
for idx in range(cells.size()):
|
for idx in range(cells.size()):
|
||||||
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ func commit_action(canvas):
|
|||||||
func undo_action(canvas):
|
func undo_action(canvas):
|
||||||
var cells = action_data.undo.cells
|
var cells = action_data.undo.cells
|
||||||
var colors = action_data.undo.colors
|
var colors = action_data.undo.colors
|
||||||
print(action_data.keys())
|
|
||||||
for idx in range(cells.size()):
|
for idx in range(cells.size()):
|
||||||
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ func commit_action(canvas):
|
|||||||
func undo_action(canvas):
|
func undo_action(canvas):
|
||||||
var cells = action_data.undo.cells
|
var cells = action_data.undo.cells
|
||||||
var colors = action_data.undo.colors
|
var colors = action_data.undo.colors
|
||||||
print(action_data.keys())
|
|
||||||
for idx in range(cells.size()):
|
for idx in range(cells.size()):
|
||||||
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
||||||
|
|
||||||
|
@ -5,6 +5,11 @@ const selection_color = Color(0.8, 0.8, 0.8, 0.5)
|
|||||||
var mouse_start_pos = null
|
var mouse_start_pos = null
|
||||||
var mouse_end_pos = null
|
var mouse_end_pos = null
|
||||||
|
|
||||||
|
|
||||||
|
func can_commit() -> bool:
|
||||||
|
return false #ugly way of handling a cut
|
||||||
|
|
||||||
|
|
||||||
func do_action(canvas, data: Array):
|
func do_action(canvas, data: Array):
|
||||||
.do_action(canvas, data)
|
.do_action(canvas, data)
|
||||||
|
|
||||||
@ -47,7 +52,7 @@ func commit_action(canvas):
|
|||||||
var pos = p + Vector2(px, py)
|
var pos = p + Vector2(px, py)
|
||||||
var color = canvas.get_pixel(pos.x, pos.y)
|
var color = canvas.get_pixel(pos.x, pos.y)
|
||||||
|
|
||||||
if color == Color.transparent:
|
if color.a == 0.0:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
action_data.redo.cells.append(pos)
|
action_data.redo.cells.append(pos)
|
||||||
@ -63,7 +68,6 @@ func commit_action(canvas):
|
|||||||
func undo_action(canvas):
|
func undo_action(canvas):
|
||||||
var cells = action_data.undo.cells
|
var cells = action_data.undo.cells
|
||||||
var colors = action_data.undo.colors
|
var colors = action_data.undo.colors
|
||||||
print(action_data.keys())
|
|
||||||
for idx in range(cells.size()):
|
for idx in range(cells.size()):
|
||||||
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@ func commit_action(canvas):
|
|||||||
func undo_action(canvas):
|
func undo_action(canvas):
|
||||||
var cells = action_data.undo.cells
|
var cells = action_data.undo.cells
|
||||||
var colors = action_data.undo.colors
|
var colors = action_data.undo.colors
|
||||||
print(action_data.keys())
|
|
||||||
for idx in range(cells.size()):
|
for idx in range(cells.size()):
|
||||||
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
||||||
|
|
||||||
|
@ -40,7 +40,6 @@ func commit_action(canvas):
|
|||||||
func undo_action(canvas):
|
func undo_action(canvas):
|
||||||
var cells = action_data.undo.cells
|
var cells = action_data.undo.cells
|
||||||
var colors = action_data.undo.colors
|
var colors = action_data.undo.colors
|
||||||
print(action_data.keys())
|
|
||||||
for idx in range(cells.size()):
|
for idx in range(cells.size()):
|
||||||
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@ func commit_action(canvas):
|
|||||||
func undo_action(canvas):
|
func undo_action(canvas):
|
||||||
var cells = action_data.undo.cells
|
var cells = action_data.undo.cells
|
||||||
var colors = action_data.undo.colors
|
var colors = action_data.undo.colors
|
||||||
print(action_data.keys())
|
|
||||||
for idx in range(cells.size()):
|
for idx in range(cells.size()):
|
||||||
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ func commit_action(canvas):
|
|||||||
func undo_action(canvas):
|
func undo_action(canvas):
|
||||||
var cells = action_data.undo.cells
|
var cells = action_data.undo.cells
|
||||||
var colors = action_data.undo.colors
|
var colors = action_data.undo.colors
|
||||||
print(action_data.keys())
|
|
||||||
for idx in range(cells.size()):
|
for idx in range(cells.size()):
|
||||||
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@ func commit_action(canvas):
|
|||||||
func undo_action(canvas):
|
func undo_action(canvas):
|
||||||
var cells = action_data.undo.cells
|
var cells = action_data.undo.cells
|
||||||
var colors = action_data.undo.colors
|
var colors = action_data.undo.colors
|
||||||
print(action_data.keys())
|
|
||||||
for idx in range(cells.size()):
|
for idx in range(cells.size()):
|
||||||
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ _global_script_classes=[ {
|
|||||||
"base": "GEAction",
|
"base": "GEAction",
|
||||||
"class": "GECut",
|
"class": "GECut",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://addons/graphics_editor/actions/PasteCut.gd"
|
"path": "res://addons/graphics_editor/actions/Cut.gd"
|
||||||
}, {
|
}, {
|
||||||
"base": "GEAction",
|
"base": "GEAction",
|
||||||
"class": "GEDarken",
|
"class": "GEDarken",
|
||||||
@ -60,6 +60,11 @@ _global_script_classes=[ {
|
|||||||
"path": "res://addons/graphics_editor/actions/Line.gd"
|
"path": "res://addons/graphics_editor/actions/Line.gd"
|
||||||
}, {
|
}, {
|
||||||
"base": "GEAction",
|
"base": "GEAction",
|
||||||
|
"class": "GEPasteCut",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://addons/graphics_editor/actions/PasteCut.gd"
|
||||||
|
}, {
|
||||||
|
"base": "GEAction",
|
||||||
"class": "GEPencil",
|
"class": "GEPencil",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://addons/graphics_editor/actions/Pencil.gd"
|
"path": "res://addons/graphics_editor/actions/Pencil.gd"
|
||||||
@ -90,6 +95,7 @@ _global_script_class_icons={
|
|||||||
"GEDarken": "",
|
"GEDarken": "",
|
||||||
"GELayer": "",
|
"GELayer": "",
|
||||||
"GELine": "",
|
"GELine": "",
|
||||||
|
"GEPasteCut": "",
|
||||||
"GEPencil": "",
|
"GEPencil": "",
|
||||||
"GERainbow": "",
|
"GERainbow": "",
|
||||||
"GERect": "",
|
"GERect": "",
|
||||||
|
Loading…
Reference in New Issue
Block a user