Rearranged profile initializations and verified that all init correctly

This commit is contained in:
GPayne
2021-09-12 21:05:00 -06:00
parent 284c68f952
commit 51f6c9d45b
17 changed files with 231 additions and 683 deletions

View File

@@ -26,7 +26,6 @@
#define __OPENSPACE_CORE___MODULEENGINE___H__
#include <openspace/properties/propertyowner.h>
#include <openspace/scene/profile.h>
#include <map>
#include <memory>
@@ -117,14 +116,6 @@ public:
*/
ghoul::systemcapabilities::Version requiredOpenGLVersion() const;
/**
* Reads a list of modules from a profile, and executes scripts based on whether or
* not the corresponding module is loaded.
*
* \param p The Profile to be read.
*/
void setFromProfile_modules(const Profile& p);
/**
* Returns the Lua library that contains all Lua functions available to affect the
* modules.

View File

@@ -26,6 +26,7 @@
#define __OPENSPACE_CORE___OPENSPACEENGINE___H__
#include <openspace/properties/stringproperty.h>
#include <openspace/scene/profile.h>
#include <openspace/util/keys.h>
#include <openspace/util/mouse.h>
#include <openspace/util/touch.h>
@@ -101,6 +102,61 @@ public:
void writeStaticDocumentation();
void createUserDirectoriesIfNecessary();
/**
* Sets the camera position using the time contents of a profile. The function will
* set an absolute position or a go-to-geolocation command using the globebrowsing
* module.
* \param p The Profile to be read.
*/
void setFromProfile_camera(const Profile& p);
/**
* Sets the delta times using the delta time array from a profile.
*
* \param p The Profile to be read.
*/
void setFromProfile_deltaTimes(const Profile& p);
/**
* Reads a list of modules from a profile, and executes scripts based on whether or
* not the corresponding module is loaded.
*
* \param p The Profile to be read.
*/
void setFromProfile_modules(const Profile& p);
/**
* Registers actions from the contents of a profile.
*
* \param p The Profile to be read.
*/
void setFromProfile_actions(const Profile& p);
/**
* Registers keybindings from the contents of a profile.
*
* \param p The Profile to be read.
*/
void setFromProfile_keybindings(const Profile& p);
/**
* Reads list of nodes from profile to be marked as interesting nodes.
* If any nodes are listed, a script to mark these will be queued with the
* script engine.
*
* \param p The Profile to be read.
*/
void setFromProfile_markInterestingNodes(const Profile& p);
/**
* Reads list of "additional scripts" that are added to the profile to be run
* at the end of the initialization. Any openspace lua commands are allowed,
* and will be added to the script queue.
*
* \param p The Profile to be read.
*/
void setFromProfile_additionalScripts(const Profile& p);
/**
* Returns the Lua library that contains all Lua functions available to affect the
* application.

View File

@@ -26,7 +26,6 @@
#define __OPENSPACE_CORE___ACTIONMANAGER___H__
#include <openspace/interaction/action.h>
#include <openspace/scene/profile.h>
#include <unordered_map>
namespace ghoul { class Dictionary; }
@@ -44,12 +43,6 @@ public:
void triggerAction(const std::string& identifier,
const ghoul::Dictionary& arguments) const;
/**
* Registers actions from the contents of a profile.
*
* \param p The Profile to be read.
*/
void setFromProfile_actions(const Profile& p);
static scripting::LuaLibrary luaLibrary();
private:

View File

@@ -27,7 +27,6 @@
#include <openspace/documentation/documentationgenerator.h>
#include <openspace/scene/profile.h>
#include <openspace/util/keys.h>
namespace openspace {
@@ -52,13 +51,6 @@ public:
std::vector<std::pair<KeyWithModifier, std::string>> keyBinding(
const KeyWithModifier& key) const;
/**
* Registers keybindings from the contents of a profile.
*
* \param p The Profile to be read.
*/
void setFromProfile_keybindings(const Profile& p);
static scripting::LuaLibrary luaLibrary();
void keyboardCallback(Key key, KeyModifier modifier, KeyAction action);

View File

@@ -132,14 +132,6 @@ public:
void setNavigationStateNextFrame(NavigationState state);
/**
* Sets the camera position using the time contents of a profile. The function will
* set an absolute position or a go-to-geolocation command using the globebrowsing
* module.
* \param p The Profile to be read.
*/
void setFromProfile_camera(const Profile& p);
/**
* \return The Lua library that contains all Lua functions available to affect the
* interaction

View File

@@ -168,152 +168,6 @@ public:
std::string assetFileExtension = ".asset";
};
/**
* Function to convert a profile into separate files with converted asset contents
* from each section
*
* \param filePre The prefix name for the asset section to be applied to the output
* filename. The pattern is "<filePre>_<profilePrefix>.asset"
* \param p The profile that should be processed
*/
void convertToSeparatedAssets(const std::string filePre, const Profile& p);
/**
* Function to convert a specific section of a profile into an asset file, which allows
* that section to be individually loaded.
*
* \param profilePrefix The name for the asset section to be applied to the output
* filename. The pattern is "<profileName>_<profilePrefix>.asset"
* \param p The profile that should be processed
* \param profileSectionName The name of the profile subsection used for output filename
* \param func a std::function that takes a reference to a const Profile as arg, and
* returns the asset-ified contents as a std::string object
*/
void convertSectionToAssetFile(const std::string profilePrefix, const Profile& p,
const std::string profileSectionName,
std::function<std::string(const Profile&)> func);
/**
* convertToAsset_* functions extract a section (* as section name) and returns its
* asset-ified version as a string. This allows the profile section to be processed
* by the asset loader. Having individual sections allows for controlling the order of
* processing/loading the profile. It also makes it possible for changing the way
* sections are processed.
*/
/**
* Function to process the meta information included in the profile
*
* \param p The profile that should be processed
*
* \return The string representation of the provided profile's meta section, ready
* to be loaded as an asset
*/
std::string convertToAsset_meta(const Profile& p);
/**
* Function to process the assets that are included in the profile
*
* \param p The profile that should be processed
*
* \return The string representation of the provided profile's asset section, ready
* to be loaded as an asset
*/
std::string convertToAsset_addedAssets(const Profile& p);
/**
* Function to process the modules that may be included in the profile, and the commands
* to execute if they are/aren't loaded
*
* \param p The profile that should be processed
*
* \return The string representation of the provided profile's modules section, ready
* to be loaded as an asset
*/
std::string convertToAsset_modules(const Profile& p);
/**
* Function to process the actions that are included in the profile.
* This is separate from, but closely-related to, the keybindings section
*
* \param p The profile that should be processed
*
* \return The string representation of the provided profile's actions section,
* ready to be loaded as an asset
*/
std::string convertToAsset_actions(const Profile& p);
/**
* Function to process the keybindings that are included in the profile.
* This is separate from, but closely-related to, the actions section
*
* \param p The profile that should be processed
*
* \return The string representation of the provided profile's keybindings
* section, ready to be loaded as an asset
*/
std::string convertToAsset_keybinds(const Profile& p);
/**
* Function to process the time setting that is included in the profile
*
* \param p The profile that should be processed
*
* \return The string representation of the provided profile's time section, ready
* to be loaded as an asset
*/
std::string convertToAsset_time(const Profile& p);
/**
* Function to process the delta time settings that are included in the profile
*
* \param p The profile that should be processed
*
* \return The string representation of the provided profile's delta times section, ready
* to be loaded as an asset
*/
std::string convertToAsset_deltaTimes(const Profile& p);
/**
* Function to process the mark-interesting-nodes that are included in the profile
*
* \param p The profile that should be processed
*
* \return The string representation of the provided profile's mark-interesting-nodes
* section, ready to be loaded as an asset
*/
std::string convertToAsset_markNodes(const Profile& p);
/**
* Function to process the properties that are included in the profile
*
* \param p The profile that should be processed
*
* \return The string representation of the provided profile's properties section, ready
* to be loaded as an asset
*/
std::string convertToAsset_properties(const Profile& p);
/**
* Function to process the initial camera orientation that is included in the profile
*
* \param p The profile that should be processed
*
* \return The string representation of the provided profile's camera section, ready
* to be loaded as an asset
*/
std::string convertToAsset_camera(const Profile& p);
/**
* Function to process the additional scripts command section that is included in the
* profile
*
* \param p The profile that should be processed
*
* \return The string representation of the provided profile's additional scripts
* section, ready to be loaded as an asset
*/
std::string convertToAsset_addedScripts(const Profile& p);
/**
* Function to retrieve the individual additional script lines included in the profile
*

View File

@@ -235,15 +235,6 @@ public:
*/
static scripting::LuaLibrary luaLibrary();
/**
* Creates an initial asset file to load, which contains:
* 1. Meta information
* 2. Assets to include
*
* \param p The Profile to be read.
*/
void createInitialAssetToLoad(const Profile& p, const std::string& assetFilename);
/**
* Sets a property using the 'properties' contents of a profile. The function will
* loop through each setProperty command. A property may be set to a bool, float,
@@ -264,15 +255,6 @@ public:
void property_pushValueFromProfileToLuaState(ghoul::lua::LuaState& L,
const std::string& value);
/**
* Reads list of nodes from profile to be marked as interesting nodes.
* If any nodes are listed, a script to mark these will be queued with the
* script engine.
*
* \param p The Profile to be read.
*/
void setFromProfile_markInterestingNodes(const Profile& p);
private:
/**
* Update dependencies.

View File

@@ -87,13 +87,6 @@ public:
*/
void setFromProfile_time(const Profile& p);
/**
* Sets the delta times using the delta time array from a profile.
*
* \param p The Profile to be read.
*/
void setFromProfile_deltaTimes(const Profile& p);
bool isPaused() const;
std::vector<double> deltaTimeSteps() const;