add history to equirect import
This commit is contained in:
@@ -141,7 +141,12 @@ void Canvas::pick_end()
|
||||
}
|
||||
void Canvas::clear(const glm::vec4& c/*={0,0,0,1}*/)
|
||||
{
|
||||
snap_history({ 0, 1, 2, 3, 4, 5 });
|
||||
auto a = new ActionLayerClear;
|
||||
a->m_layer = m_layers[m_current_layer_idx];
|
||||
a->m_snap = std::make_shared<Layer::Snapshot>(a->m_layer->snapshot());
|
||||
a->m_color = c;
|
||||
ActionManager::add(a);
|
||||
|
||||
m_layers[m_current_layer_idx]->clear(c);
|
||||
m_unsaved = true;
|
||||
}
|
||||
@@ -1638,24 +1643,35 @@ void Canvas::clear_context()
|
||||
}
|
||||
};
|
||||
|
||||
void Canvas::import_equirectangular(std::string file_path)
|
||||
void Canvas::import_equirectangular(std::string file_path, std::shared_ptr<Layer> layer /*= nullptr*/)
|
||||
{
|
||||
std::thread t(&Canvas::import_equirectangular_thread, this, file_path);
|
||||
std::thread t(&Canvas::import_equirectangular_thread, this, file_path, layer);
|
||||
t.detach();
|
||||
}
|
||||
|
||||
void Canvas::import_equirectangular_thread(std::string file_path)
|
||||
void Canvas::import_equirectangular_thread(std::string file_path, std::shared_ptr<Layer> layer /*= nullptr*/)
|
||||
{
|
||||
BT_SetTerminate();
|
||||
|
||||
Image img;
|
||||
if (!img.load_file(file_path))
|
||||
return;
|
||||
|
||||
App::I.async_start();
|
||||
|
||||
if (!layer)
|
||||
layer = m_layers[m_current_layer_idx];
|
||||
|
||||
gl_state gl;
|
||||
gl.save();
|
||||
snap_history({0,1,2,3,4,5});
|
||||
m_unsaved = true;
|
||||
|
||||
Image img;
|
||||
img.load_file(file_path);
|
||||
auto a = new ActionImportEquirect;
|
||||
a->m_layer = layer;
|
||||
a->m_snap = std::make_shared<Layer::Snapshot>(layer->snapshot());
|
||||
a->m_path = file_path;
|
||||
ActionManager::add(a);
|
||||
|
||||
m_unsaved = true;
|
||||
|
||||
if (img.width == img.height / 6)
|
||||
{
|
||||
@@ -1702,8 +1718,8 @@ void Canvas::import_equirectangular_thread(std::string file_path)
|
||||
}
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
m_layers[m_current_layer_idx]->m_dirty_box[i] = glm::vec4(0, 0, m_width, m_height);
|
||||
m_layers[m_current_layer_idx]->m_dirty_face[i] = true;
|
||||
layer->m_dirty_box[i] = glm::vec4(0, 0, m_width, m_height);
|
||||
layer->m_dirty_face[i] = true;
|
||||
}
|
||||
App::I.async_update();
|
||||
gl.restore();
|
||||
|
||||
Reference in New Issue
Block a user