diff --git a/data/assets/customization/globebrowsing.asset b/data/assets/customization/globebrowsing.asset new file mode 100644 index 0000000000..9d73e15d8f --- /dev/null +++ b/data/assets/customization/globebrowsing.asset @@ -0,0 +1,32 @@ +-- Add folders to this list that contain .info files describing HiRISE patches +local vrt_folders = { + Mars = { + -- Add folders here whose contents will be automatically added to the Mars globe + -- If multiple folders are added, the results will be added sequentially, meaning that + -- if areas overlap (for example CTX and HiRISE) and CTX is specified *after* HiRISE, + -- CTX will stomp over the HiRISE + -- + -- tl;dr: Specify CTX folders first, then HiRISE + -- example: 'C:/OpenSpace/GlobeBrowsingData/Mars/CTX' + '', + '' + }, + Moon = { + -- Add folders here whose contents will be automatically added to the Moon globe + -- If multiple folders are added, the results will be added sequentially, meaning that + -- if areas overlap, images from the lower results will overwrite the images from former + -- results + -- example: 'C:/OpenSpace/GlobeBrowsingData/Moon' + '', + '' + } +} + +asset.onInitialize(function () + -- Add local patches described at the top of this file + for obj, list in pairs(vrt_folders) do + for _, dir in pairs(list) do + openspace.globebrowsing.addBlendingLayersFromDirectory(dir, obj) + end + end +end) diff --git a/data/assets/default.scene b/data/assets/default.scene index 61a868f304..304ca39320 100644 --- a/data/assets/default.scene +++ b/data/assets/default.scene @@ -12,25 +12,7 @@ assetHelper.requestAll(asset, 'scene/digitaluniverse') -- Load default key bindings applicable to most scenes asset.require('util/default_keybindings') --- Add folders to this list that contain .info files describing HiRISE patches -local vrt_folders = { - Mars = { - -- Add folders here whose contents will be automatically added to the Mars globe - -- If multiple folders are added, the results will be added sequentially, meaning that - -- if areas overlap (for example CTX and HiRISE) and CTX is specified *after* HiRISE, - -- CTX will stomp over the HiRISE - -- - -- tl;dr: Specify CTX folders first, then HiRISE - -- example: 'C:/OpenSpace/GlobeBrowsingData/Mars/CTX' - }, - Moon = { - -- Add folders here whose contents will be automatically added to the Moon globe - -- If multiple folders are added, the results will be added sequentially, meaning that - -- if areas overlap, images from the lower results will overwrite the images from former - -- results - -- example: 'C:/OpenSpace/GlobeBrowsingData/Moon' - } -} +asset.request('customization/globebrowsing') -- Keybindings that are specific for this scene local Keybindings = { @@ -107,13 +89,6 @@ asset.onInitialize(function () }) openspace.globebrowsing.goToGeo(58.5877, 16.1924, 20000000) - - -- Add local patches described at the top of this file - for obj, list in pairs(vrt_folders) do - for _, dir in pairs(list) do - openspace.globebrowsing.addBlendingLayersFromDirectory(dir, obj) - end - end end) asset.onDeinitialize(function () diff --git a/data/assets/everything.asset b/data/assets/everything.asset deleted file mode 100644 index 3ad44567f9..0000000000 --- a/data/assets/everything.asset +++ /dev/null @@ -1,10 +0,0 @@ --- Please note that this scene/asset is not meant to be included anywhere directly. --- Rather it is used in the Sync application to synchronize the entire asset folder --- without needing manual adaption - -local assetHelper = asset.require('util/asset_helper') -local sceneHelper = asset.require('util/scene_helper') - -assetHelper.requestAll(asset, 'scene') -assetHelper.requestAll(asset, 'spice') -assetHelper.requestAll(asset, 'util') diff --git a/data/assets/sync/everything.asset b/data/assets/sync/everything.asset new file mode 100644 index 0000000000..8979061ee2 --- /dev/null +++ b/data/assets/sync/everything.asset @@ -0,0 +1,10 @@ +-- Please note that this scene/asset is not meant to be included anywhere directly. +-- Rather it is used in the Sync application to synchronize the entire asset folder +-- without needing manual adaption + +local assetHelper = asset.require('../util/asset_helper') + +assetHelper.requestAll(asset, '../customization') +assetHelper.requestAll(asset, '../scene') +assetHelper.requestAll(asset, '../spice') +assetHelper.requestAll(asset, '../util') diff --git a/data/tasks/full_sync.task b/data/tasks/full_sync.task index 789779ccf9..3000126699 100644 --- a/data/tasks/full_sync.task +++ b/data/tasks/full_sync.task @@ -29,6 +29,6 @@ return { }, { Type = "SyncAssetTask", - Asset = "everything" + Asset = "sync/everything" } } diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h index 3c61a20fe6..54c70fb2f7 100644 --- a/include/openspace/engine/openspaceengine.h +++ b/include/openspace/engine/openspaceengine.h @@ -187,7 +187,7 @@ private: void configureLogging(bool consoleLog); - void runGlobalCustomizationScripts(const std::string& sceneDescription); + void runGlobalCustomizationScripts(); void configureLogging(); // Components diff --git a/include/openspace/util/httprequest.h b/include/openspace/util/httprequest.h index 44da1f0716..9e97bd3c3c 100644 --- a/include/openspace/util/httprequest.h +++ b/include/openspace/util/httprequest.h @@ -37,6 +37,11 @@ #include #include +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4250) +#endif + namespace openspace { namespace curlfunctions { @@ -294,4 +299,9 @@ public: } // namespace openspace +#ifdef _MSC_VER +#pragma warning(pop) +#endif + + #endif // __OPENSPACE_CORE___HTTPREQUEST___H__ diff --git a/modules/globebrowsing/scripts/layer_support.lua b/modules/globebrowsing/scripts/layer_support.lua index 3143d7c980..5b526c4dae 100644 --- a/modules/globebrowsing/scripts/layer_support.lua +++ b/modules/globebrowsing/scripts/layer_support.lua @@ -189,7 +189,7 @@ openspace.globebrowsing.addBlendingLayersFromDirectory = function (dir, node_nam local files = openspace.walkDirectoryFiles(dir, true, true) for _, file in pairs(files) do - if file:find('.info') then + if file and file:find('.info') then c, h = openspace.globebrowsing.parseInfoFile(file) if c then diff --git a/openspace.cfg b/openspace.cfg index 1014b04ff6..c86830bfaa 100644 --- a/openspace.cfg +++ b/openspace.cfg @@ -39,7 +39,7 @@ return { -- Asset = "osirisrex", -- Asset = "voyager", - -- These scripts are executed after the postInitialization of each scene, thus making + -- These scripts are executed after the initialization of each scene, thus making -- it possible to have global overrides to default values or execute other scripts -- regardless of the scene that is loaded GlobalCustomizationScripts = { diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 5e95fceac4..48a3c667ac 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -627,7 +627,7 @@ std::unique_ptr OpenSpaceEngine::createLoadingScreen() { } void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) { - LTRACE("OpenSpaceEngine::loadScene(begin)"); + LTRACE("OpenSpaceEngine::loadSingleAsset(begin)"); windowWrapper().setBarrier(false); windowWrapper().setSynchronization(false); @@ -750,9 +750,11 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) { showTouchbar(); #endif // APPLE + runGlobalCustomizationScripts(); + writeSceneDocumentation(); - LTRACE("OpenSpaceEngine::loadScene(end)"); + LTRACE("OpenSpaceEngine::loadSingleAsset(end)"); } void OpenSpaceEngine::deinitialize() { @@ -832,15 +834,12 @@ void OpenSpaceEngine::gatherCommandlineArguments() { )); } -void OpenSpaceEngine::runGlobalCustomizationScripts(const std::string& sceneDescription) { +void OpenSpaceEngine::runGlobalCustomizationScripts() { // @CLEANUP: Move this into the scene loading? ---abock LINFO("Running Global initialization scripts"); ghoul::lua::LuaState state; OsEng.scriptEngine().initializeLuaState(state); - // First execute the script to get all global variables - ghoul::lua::runScriptFile(state, absPath(sceneDescription)); - std::string k = ConfigurationManager::KeyGlobalCustomizationScripts; if (_configurationManager->hasKey(k)) { ghoul::Dictionary dict = _configurationManager->value(k);