improve progress bar, refactor node destruction, simplify layers export

This commit is contained in:
2019-08-16 10:15:14 +02:00
parent bb7d681dc3
commit fa94aa632f
17 changed files with 66 additions and 169 deletions

View File

@@ -41,6 +41,7 @@ void Node::app_redraw()
{
App::I->redraw = true;
App::I->ui_cv.notify_all();
App::I->render_cv.notify_all();
}
void Node::watch(std::function<bool(Node*)> observer)
@@ -58,20 +59,17 @@ void Node::watch(std::function<bool(Node*)> observer)
void Node::destroy()
{
m_destroyed = true;
auto children_copy = m_children;
for (auto c : children_copy)
c->destroy();
mouse_release();
key_release();
}
void Node::destroy_immediate()
{
for (auto c : m_children)
c->destroy_immediate();
remove_from_parent();
app_redraw();
}
Node* Node::root()
{
Node* ret = this;
while (ret->m_parent)
ret = ret->m_parent;
@@ -657,7 +655,6 @@ Node::Node(Node&& o)
m_flood_events = o.m_flood_events;
m_force_mouse_capture = o.m_force_mouse_capture;
m_capture_children = o.m_capture_children;
m_destroyed = false;// o.m_destroyed;
m_scale = o.m_scale;
m_pos_origin = o.m_pos_origin;
@@ -1007,16 +1004,6 @@ void Node::update_internal(const glm::vec2& origin, const glm::mat4& proj, float
m_mvp = proj * pos * scale * pivot * prescale;
m_proj = proj;
for (int i = 0; i < m_children.size(); i++)
{
if (m_children[i]->m_destroyed)
{
m_children[i]->destroy_immediate();
remove_child(m_children[i].get());
i--;
}
}
if (m_size != old_size || m_zoom != zoom)
{
m_zoom = zoom;
@@ -1370,14 +1357,11 @@ void Node::clone_copy(Node* dest) const
dest->m_mvp = m_mvp;
dest->m_mouse_inside = m_mouse_inside;
dest->m_capture_children = m_capture_children;
dest->m_destroyed = false;// m_destroyed;
dest->m_scale = m_scale;
dest->m_pos_origin = m_pos_origin;
dest->m_pos_offset = m_pos_offset;
dest->m_pos_offset_childred = m_pos_offset_childred;
dest->m_clip_uncut = m_clip_uncut;
}
void Node::clone_children(Node* dest) const