mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-12 13:51:10 +01:00
Ported MultilineAction.
This commit is contained in:
parent
1e979d3061
commit
cfee15aa52
@ -35,20 +35,27 @@ bool MultiLineAction::can_commit() {
|
|||||||
void MultiLineAction::do_action(PaintCanvas *canvas, const Array &data) {
|
void MultiLineAction::do_action(PaintCanvas *canvas, const Array &data) {
|
||||||
PaintAction::do_action(canvas, data);
|
PaintAction::do_action(canvas, data);
|
||||||
|
|
||||||
/*
|
PoolVector2iArray pixels = PaintUtilities::get_pixels_in_line(data[0], data[1]);
|
||||||
.do_action(canvas, data)
|
|
||||||
|
|
||||||
var pixels = GEUtils.get_pixels_in_line(data[0], data[1])
|
for (int i = 0; i < pixels.size(); ++i) {
|
||||||
for pixel in pixels:
|
Vector2i pixel = pixels[i];
|
||||||
if pixel in action_data.undo.cells or canvas.get_pixel_v(pixel) == null or canvas.is_alpha_locked():
|
|
||||||
continue
|
|
||||||
action_data.undo.colors.append(canvas.get_pixel_v(pixel))
|
|
||||||
action_data.undo.cells.append(pixel)
|
|
||||||
canvas.set_pixel_v(pixel, data[2])
|
|
||||||
|
|
||||||
action_data.redo.cells.append(pixel)
|
Color col = canvas->get_pixel_v(pixel);
|
||||||
action_data.redo.colors.append(data[2])
|
|
||||||
*/
|
if (undo_cells.contains(pixel) || !canvas->validate_pixel_v(pixel) || (canvas->is_alpha_locked() && col.a < 0.0001)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
undo_colors.append(col);
|
||||||
|
undo_cells.append(pixel);
|
||||||
|
|
||||||
|
Color tpx = data[2];
|
||||||
|
|
||||||
|
canvas->set_pixel_v(pixel, tpx);
|
||||||
|
|
||||||
|
redo_cells.append(pixel);
|
||||||
|
redo_colors.append(tpx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MultiLineAction::MultiLineAction() {
|
MultiLineAction::MultiLineAction() {
|
||||||
|
Loading…
Reference in New Issue
Block a user