Bugfix view config loading

This commit is contained in:
brunoherbelin
2021-03-27 18:13:09 +01:00
parent ee2ce3802f
commit bc4eadfd08
7 changed files with 22 additions and 21 deletions

View File

@@ -29,11 +29,11 @@
GeometryView::GeometryView() : View(GEOMETRY) GeometryView::GeometryView() : View(GEOMETRY)
{ {
scene.root()->scale_ = glm::vec3(GEOMETRY_DEFAULT_SCALE, GEOMETRY_DEFAULT_SCALE, 1.0f);
// read default settings // read default settings
if ( Settings::application.views[mode_].name.empty() ) { if ( Settings::application.views[mode_].name.empty() ) {
// no settings found: store application default // no settings found: store application default
Settings::application.views[mode_].name = "Geometry"; Settings::application.views[mode_].name = "Geometry";
scene.root()->scale_ = glm::vec3(GEOMETRY_DEFAULT_SCALE, GEOMETRY_DEFAULT_SCALE, 1.0f);
saveSettings(); saveSettings();
} }
else else

View File

@@ -25,16 +25,17 @@
LayerView::LayerView() : View(LAYER), aspect_ratio(1.f) LayerView::LayerView() : View(LAYER), aspect_ratio(1.f)
{ {
scene.root()->scale_ = glm::vec3(LAYER_DEFAULT_SCALE, LAYER_DEFAULT_SCALE, 1.0f);
scene.root()->translation_ = glm::vec3(2.2f, 1.2f, 0.0f);
// read default settings // read default settings
if ( Settings::application.views[mode_].name.empty() ) { if ( Settings::application.views[mode_].name.empty() ) {
// no settings found: store application default // no settings found: store application default
Settings::application.views[mode_].name = "Layer"; Settings::application.views[mode_].name = "Layer";
scene.root()->scale_ = glm::vec3(LAYER_DEFAULT_SCALE, LAYER_DEFAULT_SCALE, 1.0f);
scene.root()->translation_ = glm::vec3(2.2f, 1.2f, 0.0f);
saveSettings(); saveSettings();
} }
else else {
restoreSettings(); restoreSettings();
}
// Geometry Scene background // Geometry Scene background
frame_ = new Group; frame_ = new Group;

View File

@@ -32,12 +32,12 @@ uint textureMixingQuadratic();
MixingView::MixingView() : View(MIXING), limbo_scale_(MIXING_LIMBO_SCALE) MixingView::MixingView() : View(MIXING), limbo_scale_(MIXING_LIMBO_SCALE)
{ {
scene.root()->scale_ = glm::vec3(MIXING_DEFAULT_SCALE, MIXING_DEFAULT_SCALE, 1.0f);
scene.root()->translation_ = glm::vec3(0.0f, 0.0f, 0.0f);
// read default settings // read default settings
if ( Settings::application.views[mode_].name.empty() ) { if ( Settings::application.views[mode_].name.empty() ) {
// no settings found: store application default // no settings found: store application default
Settings::application.views[mode_].name = "Mixing"; Settings::application.views[mode_].name = "Mixing";
scene.root()->scale_ = glm::vec3(MIXING_DEFAULT_SCALE, MIXING_DEFAULT_SCALE, 1.0f);
scene.root()->translation_ = glm::vec3(0.0f, 0.0f, 0.0f);
saveSettings(); saveSettings();
} }
else else

View File

@@ -89,12 +89,12 @@ void SessionCreator::load(const std::string& filename)
// session file seems legit, create a session // session file seems legit, create a session
session_ = new Session; session_ = new Session;
// load views config (includes resolution of session rendering)
loadConfig( xmlDoc_.FirstChildElement("Views") );
// ready to read sources // ready to read sources
SessionLoader::load( xmlDoc_.FirstChildElement("Session") ); SessionLoader::load( xmlDoc_.FirstChildElement("Session") );
// load views config (includes resolution of session rendering: todo after load)
loadConfig( xmlDoc_.FirstChildElement("Views") );
// create groups // create groups
std::list< SourceList > groups = getMixingGroups(); std::list< SourceList > groups = getMixingGroups();
for (auto group_it = groups.begin(); group_it != groups.end(); group_it++) for (auto group_it = groups.begin(); group_it != groups.end(); group_it++)

View File

@@ -343,10 +343,10 @@ void Settings::Load()
// bloc views // bloc views
{ {
application.views.clear(); // trash existing list
XMLElement * pElement = pRoot->FirstChildElement("Views"); XMLElement * pElement = pRoot->FirstChildElement("Views");
if (pElement) if (pElement)
{ {
application.views.clear(); // trash existing list
pElement->QueryIntAttribute("current", &application.current_view); pElement->QueryIntAttribute("current", &application.current_view);
pElement->QueryIntAttribute("workspace", &application.current_workspace); pElement->QueryIntAttribute("workspace", &application.current_workspace);

View File

@@ -28,12 +28,12 @@
TextureView::TextureView() : View(TEXTURE), edit_source_(nullptr), need_edit_update_(true) TextureView::TextureView() : View(TEXTURE), edit_source_(nullptr), need_edit_update_(true)
{ {
scene.root()->scale_ = glm::vec3(APPEARANCE_DEFAULT_SCALE, APPEARANCE_DEFAULT_SCALE, 1.0f);
scene.root()->translation_ = glm::vec3(0.8f, 0.f, 0.0f);
// read default settings // read default settings
if ( Settings::application.views[mode_].name.empty() ) { if ( Settings::application.views[mode_].name.empty() ) {
// no settings found: store application default // no settings found: store application default
Settings::application.views[mode_].name = "Texture"; Settings::application.views[mode_].name = "Texture";
scene.root()->scale_ = glm::vec3(APPEARANCE_DEFAULT_SCALE, APPEARANCE_DEFAULT_SCALE, 1.0f);
scene.root()->translation_ = glm::vec3(0.8f, 0.f, 0.0f);
saveSettings(); saveSettings();
} }
else else

View File

@@ -25,27 +25,27 @@ XMLElement *tinyxml2::XMLElementFromGLM(XMLDocument *doc, glm::ivec2 vector)
XMLElement *tinyxml2::XMLElementFromGLM(XMLDocument *doc, glm::vec2 vector) XMLElement *tinyxml2::XMLElementFromGLM(XMLDocument *doc, glm::vec2 vector)
{ {
XMLElement *newelement = doc->NewElement( "vec2" ); XMLElement *newelement = doc->NewElement( "vec2" );
newelement->SetAttribute("x", vector.x); newelement->SetAttribute("x", (float) vector.x);
newelement->SetAttribute("y", vector.y); newelement->SetAttribute("y", (float) vector.y);
return newelement; return newelement;
} }
XMLElement *tinyxml2::XMLElementFromGLM(XMLDocument *doc, glm::vec3 vector) XMLElement *tinyxml2::XMLElementFromGLM(XMLDocument *doc, glm::vec3 vector)
{ {
XMLElement *newelement = doc->NewElement( "vec3" ); XMLElement *newelement = doc->NewElement( "vec3" );
newelement->SetAttribute("x", vector.x); newelement->SetAttribute("x", (float) vector.x);
newelement->SetAttribute("y", vector.y); newelement->SetAttribute("y", (float) vector.y);
newelement->SetAttribute("z", vector.z); newelement->SetAttribute("z", (float) vector.z);
return newelement; return newelement;
} }
XMLElement *tinyxml2::XMLElementFromGLM(XMLDocument *doc, glm::vec4 vector) XMLElement *tinyxml2::XMLElementFromGLM(XMLDocument *doc, glm::vec4 vector)
{ {
XMLElement *newelement = doc->NewElement( "vec4" ); XMLElement *newelement = doc->NewElement( "vec4" );
newelement->SetAttribute("x", vector.x); newelement->SetAttribute("x", (float) vector.x);
newelement->SetAttribute("y", vector.y); newelement->SetAttribute("y", (float) vector.y);
newelement->SetAttribute("z", vector.z); newelement->SetAttribute("z", (float) vector.z);
newelement->SetAttribute("w", vector.w); newelement->SetAttribute("w", (float) vector.w);
return newelement; return newelement;
} }