mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-05-09 15:21:35 +02:00
Improved copying the data from an action to an another. I'll try an another solution though.
This commit is contained in:
parent
004bf8e812
commit
2f647c1561
@ -181,6 +181,25 @@ void PaintAction::draw_points(PaintCanvas *canvas, const PoolVector2iArray &poin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PaintAction::copy_data_from(const Ref<PaintAction> &other) {
|
||||||
|
action_data_undo = other->action_data_undo.duplicate(true);
|
||||||
|
action_data_redo = other->action_data_redo.duplicate(true);
|
||||||
|
action_data_preview = other->action_data_preview.duplicate(true);
|
||||||
|
|
||||||
|
undo_cells.append_array(other->undo_cells);
|
||||||
|
undo_colors.append_array(other->undo_colors);
|
||||||
|
|
||||||
|
redo_cells.append_array(other->redo_cells);
|
||||||
|
redo_colors.append_array(other->redo_colors);
|
||||||
|
|
||||||
|
preview_cells.append_array(other->preview_cells);
|
||||||
|
preview_colors.append_array(other->preview_colors);
|
||||||
|
|
||||||
|
layer = other->layer;
|
||||||
|
|
||||||
|
action_data = other->action_data.duplicate(true);
|
||||||
|
}
|
||||||
|
|
||||||
PaintAction::PaintAction() {
|
PaintAction::PaintAction() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +56,8 @@ public:
|
|||||||
|
|
||||||
void draw_points(PaintCanvas *canvas, const PoolVector2iArray &point_arr, const PoolColorArray &color_arr);
|
void draw_points(PaintCanvas *canvas, const PoolVector2iArray &point_arr, const PoolColorArray &color_arr);
|
||||||
|
|
||||||
|
void copy_data_from(const Ref<PaintAction> &other);
|
||||||
|
|
||||||
PaintAction();
|
PaintAction();
|
||||||
~PaintAction();
|
~PaintAction();
|
||||||
|
|
||||||
|
@ -609,7 +609,8 @@ void PaintWindow::commit_action() {
|
|||||||
//print("commit action")
|
//print("commit action")
|
||||||
_current_action->commit_action(paint_canvas);
|
_current_action->commit_action(paint_canvas);
|
||||||
Ref<PaintAction> action = get_action();
|
Ref<PaintAction> action = get_action();
|
||||||
action->action_data = _current_action->action_data.duplicate(true);
|
action->copy_data_from(_current_action);
|
||||||
|
|
||||||
_actions_history.push_back(action);
|
_actions_history.push_back(action);
|
||||||
_redo_history.clear();
|
_redo_history.clear();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user