Trying to add history to the Fill tool

This commit is contained in:
2017-07-15 10:51:58 +01:00
parent 4666a3dffc
commit 4e765f1450
6 changed files with 112 additions and 17 deletions

View File

@@ -106,6 +106,7 @@ public:
void clear(const glm::vec4& color = { 1, 1, 1, 0 });
void snapshot_save(std::string data_path);
void snapshot_restore();
void snap_history(const std::vector<int>& planes);
void clear_context();
void export_equirectangular(std::string data_path);
void export_anim(std::string data_path);
@@ -122,7 +123,7 @@ public:
bool point_trace(glm::vec2 loc, glm::vec3& ray_origin, glm::vec3& ray_dir,
glm::vec3& hit_pos, glm::vec3& hit_normal, int& out_plane_id);
bool point_trace_plane(glm::vec2 loc, glm::vec3& ray_origin, glm::vec3& ray_dir,
glm::vec3& hit_pos, glm::vec3& hit_normal, int plane_id);
glm::vec3& hit_pos, glm::vec3& hit_normal, glm::vec2& hit_fb_pos, int plane_id);
};
class ActionStroke : public Action
@@ -134,6 +135,7 @@ public:
bool m_old_dirty[6];
glm::ivec4 m_box[6];
bool m_dirty[6];
bool clear_layer = false;
int m_layer_idx;
Canvas* m_canvas;
virtual void run() override
@@ -142,6 +144,8 @@ public:
}
virtual void undo() override
{
if (clear_layer)
m_canvas->m_layers[m_layer_idx].clear({ 0, 0, 0, 0 });
for (int i = 0; i < 6; i++)
{
// empty data