add auto-timelapse option

This commit is contained in:
2019-11-14 22:23:20 +01:00
parent 56fc581b04
commit 6581a92f40
4 changed files with 29 additions and 2 deletions

View File

@@ -266,6 +266,10 @@
<checkbox id="tools-vr-check" width="20" height="20"/>
<text text="Enable VR" margin="0 0 0 5"/>
</button-custom>
<button-custom id="tools-timelapse" height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
<checkbox id="tools-timelapse-check" width="20" height="20"/>
<text text="Auto Timelapse" margin="0 0 0 5"/>
</button-custom>
</popup-menu>
</layout>

View File

@@ -471,6 +471,7 @@ void App::init()
uirtt.create(width, height, -1, GL_RGBA8, true);
if (Settings::value_or<Serializer::Boolean>("auto-timelapse", false))
rec_start();
if (!check_license())

View File

@@ -994,6 +994,28 @@ void App::init_menu_tools()
}
};
}
if (auto btn = popup_time->find<NodeButtonCustom>("tools-timelapse"))
{
NodeCheckBox* cb = btn->find<NodeCheckBox>("tools-timelapse-check");
cb->set_value(Settings::value_or<Serializer::Boolean>("auto-timelapse", true), false);
btn->on_click = [this, btn](Node* b)
{
NodeCheckBox* cb = btn->find<NodeCheckBox>("tools-timelapse-check");
cb->set_value(!cb->checked, true);
};
btn->find<NodeCheckBox>("tools-timelapse-check")->on_value_changed = [this, main](Node*, bool checked)
{
if (!checked && App::I->rec_running)
App::I->rec_stop();
else if (checked && !App::I->rec_running)
App::I->rec_start();
Settings::set("auto-timelapse", Serializer::Boolean(checked));
Settings::save();
};
}
};
popup_exp->find<NodeButtonCustom>("clear-grids")->on_click = [this, popup_exp](Node*) {
@@ -1250,7 +1272,6 @@ void App::initLayout()
{
layers->add_layer("Default", false, true);
Canvas::I->m_unsaved = false;
Canvas::I->timelapse_reset_encoder();
}
init_toolbar_draw();

View File

@@ -2548,6 +2548,7 @@ bool Canvas::project_open_thread(std::string file_path)
{
pb->destroy();
App::I->title_update();
App::I->update_rec_frames();
App::I->animation->load_layers();
}
return true;