mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Make it possible to not load an asset on default and later load it at runtime (closes #694)
This commit is contained in:
@@ -37,7 +37,7 @@ namespace documentation { struct Documentation; }
|
||||
|
||||
struct Configuration {
|
||||
std::string windowConfiguration = "${CONFIG}/single.xml";
|
||||
std::string asset = "default";
|
||||
std::string asset;
|
||||
std::vector<std::string> globalCustomizationScripts;
|
||||
std::map<std::string, std::string> pathTokens = {
|
||||
{ "CACHE" , "CACHE = \"${BASE}/cache\"" }
|
||||
|
||||
@@ -44,7 +44,7 @@ documentation::Documentation Configuration::Documentation = {
|
||||
new StringAnnotationVerifier(
|
||||
"A valid scene file as described in the Scene documentation"
|
||||
),
|
||||
Optional::No,
|
||||
Optional::Yes,
|
||||
"The scene description that is used to populate the application after "
|
||||
"startup. The scene determines which objects are loaded, the startup "
|
||||
"time and other scene-specific settings. More information is provided in "
|
||||
|
||||
@@ -1193,10 +1193,12 @@ void OpenSpaceEngine::preSynchronization() {
|
||||
_renderEngine->updateScene();
|
||||
//_navigationHandler->updateCamera(dt);
|
||||
|
||||
Camera* camera = _scene->camera();
|
||||
if (camera) {
|
||||
_navigationHandler->updateCamera(dt);
|
||||
camera->invalidateCache();
|
||||
if (_scene) {
|
||||
Camera* camera = _scene->camera();
|
||||
if (camera) {
|
||||
_navigationHandler->updateCamera(dt);
|
||||
camera->invalidateCache();
|
||||
}
|
||||
}
|
||||
_parallelPeer->preSynchronization();
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
|
||||
namespace openspace::luascriptfunctions::asset {
|
||||
|
||||
int add(lua_State* state) {
|
||||
@@ -35,7 +38,16 @@ int add(lua_State* state) {
|
||||
1,
|
||||
ghoul::lua::PopValue::Yes
|
||||
);
|
||||
assetManager->add(assetName);
|
||||
|
||||
if (OsEng.renderEngine().scene()) {
|
||||
assetManager->add(assetName);
|
||||
}
|
||||
else {
|
||||
// The scene might not exist yet if OpenSpace was started without specifying an
|
||||
// initial asset
|
||||
OsEng.scheduleLoadSingleAsset(assetName);
|
||||
}
|
||||
|
||||
|
||||
ghoul_assert(lua_gettop(state) == 0, "Incorrect number of items left on stack");
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user