Browse Source

Add loading presets from xml

master
Krisjanis Rijnieks 9 years ago
parent
commit
17433cdb97
  1. 4
      src/Application/Modes/ProjectionMappingMode.cpp
  2. 19
      src/Application/SettingsLoader.cpp
  3. 4
      src/Application/SettingsLoader.h

4
src/Application/Modes/ProjectionMappingMode.cpp

@ -285,6 +285,10 @@ void ProjectionMappingMode::onKeyPressed(Application * app, ofKeyEventArgs & arg
}
break;
case 'n': // Set next preset
app->getSurfaceManager()->setNextPreset();
break;
default:
break;
}

19
src/Application/SettingsLoader.cpp

@ -32,12 +32,6 @@ bool SettingsLoader::load(
return false;
}
/* TODO: Add presets.
* Presets would be surface groups. Now we are using a single <surfaces> tag
* to store only one possible composition. We can multiply the <surfaces> container
* in order to get presets working.
*/
if(!xmlSettings->tagExists("surfaces")){
ofLogWarning("SettingsLoader::load()") << "XML settings is empty or has wrong markup";
return false;
@ -47,13 +41,14 @@ bool SettingsLoader::load(
cout << "numPresets: " << numPresets << endl;
// Clear previous presets and surfaces first.
// TODO...
surfaceManager.clearPresets();
// Add new presets.
// surfaceManager.createPreset...
SurfaceStack * surfaces = surfaceManager.createPreset();
// Loop through <surfaces> tags in the XML.
for(unsigned int i = 0; i < numPresets; ++i){
xmlSettings->pushTag("surfaces");
xmlSettings->pushTag("surfaces", i);
SurfaceStack * surfaces = surfaceManager.createPreset();
int numSurfaces = xmlSettings->getNumTags("surface");
for(int i = 0; i < numSurfaces; i++){
@ -139,6 +134,8 @@ bool SettingsLoader::load(
}
xmlSettings->popTag(); // surfaces
} // for
}
_lastLoadedFilename = fileName;

4
src/Application/SettingsLoader.h

@ -34,5 +34,5 @@ class SettingsLoader {
string _lastLoadedFilename;
};
}
}
} // namespace piMapper
} // namespace ofx
Loading…
Cancel
Save