Merge branch 'master' into feature/multiple-joysticks

* Solve conflicts in navigationhandler.cpp
This commit is contained in:
Malin E
2021-11-12 09:51:05 +01:00
37 changed files with 226 additions and 351 deletions
+9 -6
View File
@@ -33,9 +33,9 @@
namespace openspace::scripting {
/**
* This structure represents a Lua library, itself consisting of a unique #name and
* an arbitrary number of #functions
*/
* This structure represents a Lua library, itself consisting of a unique #name and
* an arbitrary number of #functions
*/
struct LuaLibrary {
/**
* This structure represents a Lua function with its #name, #function pointer
@@ -47,9 +47,7 @@ struct LuaLibrary {
std::string name;
/// The function pointer that is executed if the function is called
lua_CFunction function;
/// A vector of light userdata to be passed into the function
std::vector<void*> userdata;
/// A text describing the arugments to this function
/// A text describing the arguments to this function
std::string argumentText;
/// A help text describing what the function does/
std::string helpText;
@@ -60,6 +58,8 @@ struct LuaLibrary {
std::vector<Function> functions;
/// A list of script files that are executed for each Lua state
std::vector<std::filesystem::path> scripts = std::vector<std::filesystem::path>();
/// A list of all libraries that are children for this library
std::vector<LuaLibrary> subLibraries;
/// This struct contains information about a function or constant that is defined in
/// a Lua script
@@ -77,6 +77,9 @@ struct LuaLibrary {
/// Comparison function that compares two LuaLibrary%s name
bool operator<(const LuaLibrary& rhs) const;
/// Merges the contents of a second LuaLibrary into this LuaLibrary
void merge(LuaLibrary rhs);
};
} // namespace openspace::scripting
@@ -139,14 +139,12 @@ scripting::LuaLibrary ScreenSpaceDashboard::luaLibrary() {
{
"addDashboardItemToScreenSpace",
&luascriptfunctions::addDashboardItemToScreenSpace,
{},
"string, table",
"Adds a new dashboard item to an existing SceenSpaceDashboard."
},
{
"removeDashboardItemsFromScreenSpace",
&luascriptfunctions::removeDashboardItemsFromScreenSpace,
{},
"string",
"Removes all dashboard items from an existing ScreenSpaceDashboard."
}
-5
View File
@@ -58,7 +58,6 @@ scripting::LuaLibrary DebuggingModule::luaLibrary() const {
{
"renderCameraPath",
&luascriptfunctions::renderCameraPath,
{},
"[number, bool, number]",
"Render the current camera path from the path navigation system. The "
"first optional argument is the number of samples to take along the path "
@@ -71,14 +70,12 @@ scripting::LuaLibrary DebuggingModule::luaLibrary() const {
{
"removeRenderedCameraPath",
&luascriptfunctions::removeRenderedCameraPath,
{},
"",
"Removes the rendered camera path, if there is one"
},
{
"renderPathControlPoints",
&luascriptfunctions::renderPathControlPoints,
{},
"[number]",
"Render the control points for the camera path spline as spheres. The "
"optional argument can be used to set the radius of the created spheres. "
@@ -86,14 +83,12 @@ scripting::LuaLibrary DebuggingModule::luaLibrary() const {
{
"removePathControlPoints",
&luascriptfunctions::removePathControlPoints,
{},
"",
"Removes the rendered control points"
},
{
"addCartesianAxes",
&luascriptfunctions::addCartesianAxes,
{},
"string, [number]",
"Adds a set of Cartesian axes to the scene graph node identified by the "
"first string, to illustrate its local coordinate system. The second "
-4
View File
@@ -255,7 +255,6 @@ scripting::LuaLibrary ExoplanetsModule::luaLibrary() const {
{
"addExoplanetSystem",
&exoplanets::luascriptfunctions::addExoplanetSystem,
{},
"string or list of strings",
"Add one or multiple exoplanet systems to the scene, as specified by the "
"input. An input string should be the name of the system host star"
@@ -263,14 +262,12 @@ scripting::LuaLibrary ExoplanetsModule::luaLibrary() const {
{
"removeExoplanetSystem",
&exoplanets::luascriptfunctions::removeExoplanetSystem,
{},
"string",
"Removes the nodes of the specified exoplanet system from the scene graph"
},
{
"listAvailableExoplanetSystems",
&exoplanets::luascriptfunctions::listAvailableExoplanetSystems,
{},
"",
"Prints a list with the names of all exoplanet systems that can be added to "
"the scene graph to the OpenSpace Log"
@@ -278,7 +275,6 @@ scripting::LuaLibrary ExoplanetsModule::luaLibrary() const {
{
"getListOfExoplanets",
&exoplanets::luascriptfunctions::getListOfExoplanets,
{},
"",
"Gets a list with the names of all exoplanet systems"
}
@@ -819,7 +819,7 @@ std::unordered_map<std::string, std::vector<glm::vec3>>
continue;
}
std::ifstream seedFile(spFile);
std::ifstream seedFile(spFile.path());
if (!seedFile.good()) {
LERROR(fmt::format("Could not open seed points file '{}'", seedFilePath));
outMap.clear();
@@ -340,7 +340,6 @@ scripting::LuaLibrary GlobeBrowsingModule::luaLibrary() const {
{
"addLayer",
&globebrowsing::luascriptfunctions::addLayer,
{},
"string, string, table",
"Adds a layer to the specified globe. The first argument specifies the "
"name of the scene graph node of which to add the layer. The renderable "
@@ -352,7 +351,6 @@ scripting::LuaLibrary GlobeBrowsingModule::luaLibrary() const {
{
"deleteLayer",
&globebrowsing::luascriptfunctions::deleteLayer,
{},
"string, string",
"Removes a layer from the specified globe. The first argument specifies "
"the name of the scene graph node of which to remove the layer. "
@@ -364,7 +362,6 @@ scripting::LuaLibrary GlobeBrowsingModule::luaLibrary() const {
{
"getLayers",
&globebrowsing::luascriptfunctions::getLayers,
{},
"string, string",
"Returns the list of layers for the scene graph node specified in the first "
"parameter. The second parameter specifies which layer type should be "
@@ -373,7 +370,6 @@ scripting::LuaLibrary GlobeBrowsingModule::luaLibrary() const {
{
"moveLayer",
&globebrowsing::luascriptfunctions::moveLayer,
{},
"string, string, number, number",
"Rearranges the order of a single layer in a scene graph node. The first "
"parameter specifies the scene graph node, the second parameter specifies "
@@ -385,14 +381,12 @@ scripting::LuaLibrary GlobeBrowsingModule::luaLibrary() const {
{
"goToChunk",
&globebrowsing::luascriptfunctions::goToChunk,
{},
"void",
"Go to chunk with given index x, y, level"
},
{
"goToGeo",
&globebrowsing::luascriptfunctions::goToGeo,
{},
"[string], number, number, [number]",
"Go to geographic coordinates of a globe. The first (optional) argument is "
"the identifier of a scene graph node that has a RenderableGlobe attached. "
@@ -408,7 +402,6 @@ scripting::LuaLibrary GlobeBrowsingModule::luaLibrary() const {
// paths work really well close to surfaces
"flyToGeo",
&globebrowsing::luascriptfunctions::flyToGeo,
{},
"[string], number, number, number [, bool, number]",
"Fly the camera to geographic coordinates of a globe, using the path "
"navigation system. The first (optional) argument is the identifier of a "
@@ -422,7 +415,6 @@ scripting::LuaLibrary GlobeBrowsingModule::luaLibrary() const {
{
"getLocalPositionFromGeo",
&globebrowsing::luascriptfunctions::getLocalPositionFromGeo,
{},
"string, number, number, number",
"Returns a position in the local Cartesian coordinate system of the globe "
"identified by the first argument, that corresponds to the given geographic "
@@ -433,7 +425,6 @@ scripting::LuaLibrary GlobeBrowsingModule::luaLibrary() const {
{
"getGeoPositionForCamera",
&globebrowsing::luascriptfunctions::getGeoPositionForCamera,
{},
"void",
"Get geographic coordinates of the camera position in latitude, "
"longitude, and altitude (degrees and meters)."
@@ -441,7 +432,6 @@ scripting::LuaLibrary GlobeBrowsingModule::luaLibrary() const {
{
"loadWMSCapabilities",
&globebrowsing::luascriptfunctions::loadWMSCapabilities,
{},
"string, string, string",
"Loads and parses the WMS capabilities xml file from a remote server. "
"The first argument is the name of the capabilities that can be used to "
@@ -452,7 +442,6 @@ scripting::LuaLibrary GlobeBrowsingModule::luaLibrary() const {
{
"removeWMSServer",
&globebrowsing::luascriptfunctions::removeWMSServer,
{},
"string",
"Removes the WMS server identified by the first argument from the list "
"of available servers. The parameter corrsponds to the first argument in "
@@ -461,7 +450,6 @@ scripting::LuaLibrary GlobeBrowsingModule::luaLibrary() const {
{
"capabilitiesWMS",
&globebrowsing::luascriptfunctions::capabilities,
{},
"string",
"Returns an array of tables that describe the available layers that are "
"supported by the WMS server identified by the provided name. The 'URL'"
+22 -7
View File
@@ -151,14 +151,29 @@ Layer* LayerGroup::addLayer(const ghoul::Dictionary& layerDict) {
properties::PropertyOwner* layerGroup = ptr->owner();
properties::PropertyOwner* layerManager = layerGroup->owner();
properties::PropertyOwner* globe = layerManager->owner();
properties::PropertyOwner* sceneGraphNode = globe->owner();
global::eventEngine->publishEvent<events::EventLayerAdded>(
sceneGraphNode->identifier(),
layerGroup->identifier(),
ptr->identifier()
);
// @TODO (emmbr, 2021-11-03) If the layer is added as part of the globe's
// dictionary during construction this function is called in the LayerManager's
// initialize function. This means that the layerManager does not exists yet, and
// we cannot find which SGN it belongs to... Want to avoid doing this check, so
// this should be fixed (probably as part of a cleanup/rewite of the LayerManager)
if (!layerManager) {
global::eventEngine->publishEvent<events::EventLayerAdded>(
"", // we don't know this yet
layerGroup->identifier(),
ptr->identifier()
);
}
else {
properties::PropertyOwner* globe = layerManager->owner();
properties::PropertyOwner* sceneGraphNode = globe->owner();
global::eventEngine->publishEvent<events::EventLayerAdded>(
sceneGraphNode->identifier(),
layerGroup->identifier(),
ptr->identifier()
);
}
return ptr;
}
-15
View File
@@ -757,63 +757,48 @@ scripting::LuaLibrary IswaManager::luaLibrary() {
{
"addCygnet",
&luascriptfunctions::iswa_addCygnet,
{},
"int, string, string",
"Adds a IswaCygnet",
},
{
"addScreenSpaceCygnet",
&luascriptfunctions::iswa_addScreenSpaceCygnet,
{},
"int, string, string",
"Adds a Screen Space Cygnets",
},
{
"addKameleonPlanes",
&luascriptfunctions::iswa_addKameleonPlanes,
{},
"string, int",
"Adds KameleonPlanes from cdf file.",
},
// {
// "addKameleonPlane",
// &luascriptfunctions::iswa_addKameleonPlane,
// "string, string, string",
// "Adds a KameleonPlane from cdf file.",
// true
// },
{
"addCdfFiles",
&luascriptfunctions::iswa_addCdfFiles,
{},
"string",
"Adds a cdf files to choose from.",
},
{
"removeCygnet",
&luascriptfunctions::iswa_removeCygnet,
{},
"string",
"Remove a Cygnets",
},
{
"removeScreenSpaceCygnet",
&luascriptfunctions::iswa_removeScrenSpaceCygnet,
{},
"int",
"Remove a Screen Space Cygnets",
},
{
"removeGroup",
&luascriptfunctions::iswa_removeGroup,
{},
"int",
"Remove a group of Cygnets",
},
{
"setBaseUrl",
&luascriptfunctions::iswa_setBaseUrl,
{},
"string",
"sets the base url",
}
-2
View File
@@ -149,7 +149,6 @@ scripting::LuaLibrary SpaceModule::luaLibrary() const {
{
"convertFromRaDec",
&space::luascriptfunctions::convertFromRaDec,
{},
"string/double, string/double, double",
"Returns the cartesian world position of a ra dec coordinate with distance. "
"If the coordinate is given as strings the format should be ra 'XhYmZs' and "
@@ -159,7 +158,6 @@ scripting::LuaLibrary SpaceModule::luaLibrary() const {
{
"convertToRaDec",
&space::luascriptfunctions::convertToRaDec,
{},
"double, double, double",
"Returns the formatted ra, dec strings and distance for a given cartesian "
"world coordinate."
@@ -146,7 +146,6 @@ scripting::LuaLibrary StateMachineModule::luaLibrary() const {
{
"createStateMachine",
&luascriptfunctions::createStateMachine,
{},
"table, table, [string]",
"Creates a state machine from a list of states and transitions. See State "
"and Transition documentation for details. The optional thrid argument is "
@@ -156,14 +155,12 @@ scripting::LuaLibrary StateMachineModule::luaLibrary() const {
{
"destroyStateMachine",
&luascriptfunctions::destroyStateMachine,
{},
"",
"Destroys the current state machine and deletes all the memory."
},
{
"goToState",
&luascriptfunctions::goToState,
{},
"string",
"Triggers a transition from the current state to the state with the given "
"identifier. Requires that the specified string corresponds to an existing "
@@ -172,7 +169,6 @@ scripting::LuaLibrary StateMachineModule::luaLibrary() const {
{
"setInitialState",
&luascriptfunctions::setInitialState,
{},
"string",
"Immediately sets the current state to the state with the given name, if "
"it exists. This is done without doing a transition and completely ignores "
@@ -181,14 +177,12 @@ scripting::LuaLibrary StateMachineModule::luaLibrary() const {
{
"currentState",
&luascriptfunctions::currentState,
{},
"",
"Returns the string name of the current state that the statemachine is in."
},
{
"possibleTransitions",
&luascriptfunctions::possibleTransitions,
{},
"",
"Returns a list with the identifiers of all the states that can be "
"transitioned to from the current state."
@@ -196,7 +190,6 @@ scripting::LuaLibrary StateMachineModule::luaLibrary() const {
{
"canGoToState",
&luascriptfunctions::canGoToState,
{},
"string",
"Returns true if there is a defined transition between the current state and "
"the given string name of a state, otherwise false"
@@ -204,7 +197,6 @@ scripting::LuaLibrary StateMachineModule::luaLibrary() const {
{
"printCurrentStateInfo",
&luascriptfunctions::printCurrentStateInfo,
{},
"",
"Prints information about the current state and possible transitions to the "
"log."
@@ -212,7 +204,6 @@ scripting::LuaLibrary StateMachineModule::luaLibrary() const {
{
"saveToDotFile",
&luascriptfunctions::saveToDotFile,
{},
"string, [string]",
"Saves the current state machine to a .dot file as a directed graph. The "
"resulting graph can be rendered using external tools such as Graphviz. "
-2
View File
@@ -150,7 +150,6 @@ scripting::LuaLibrary SyncModule::luaLibrary() const {
{
"syncResource",
&luascriptfunctions::syncResource,
{},
"string, number",
"Synchronizes the http resource identified by the name passed as the "
"first parameter and the version provided as the second parameter. The "
@@ -159,7 +158,6 @@ scripting::LuaLibrary SyncModule::luaLibrary() const {
{
"unsyncResource",
&luascriptfunctions::unsyncResource,
{},
"string [, number]",
"Unsynchronizes the http resources identified by the name passed as the "
"first parameter by removing all data that was downloaded as part of the "
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<!--The compatibility section will be merged from build/win/compatibility.manifest -->
<dependency>
<dependentAssembly>
<assemblyIdentity type="Win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
-1
View File
@@ -171,7 +171,6 @@ scripting::LuaLibrary ModuleEngine::luaLibrary() {
{
"isLoaded",
&luascriptfunctions::isLoaded,
{},
"string",
"Checks whether a specific module is loaded"
}
-11
View File
@@ -1742,7 +1742,6 @@ scripting::LuaLibrary OpenSpaceEngine::luaLibrary() {
{
"toggleShutdown",
&luascriptfunctions::toggleShutdown,
{},
"",
"Toggles the shutdown mode that will close the application after the "
"count down timer is reached"
@@ -1750,21 +1749,18 @@ scripting::LuaLibrary OpenSpaceEngine::luaLibrary() {
{
"writeDocumentation",
&luascriptfunctions::writeDocumentation,
{},
"",
"Writes out documentation files"
},
{
"downloadFile",
&luascriptfunctions::downloadFile,
{},
"",
"Downloads a file from Lua scope"
},
{
"addVirtualProperty",
&luascriptfunctions::addVirtualProperty,
{},
"type, name, identifier,"
"[description, value, minimumValue, maximumValue]",
"Adds a virtual property that will set a group of properties"
@@ -1772,42 +1768,36 @@ scripting::LuaLibrary OpenSpaceEngine::luaLibrary() {
{
"removeVirtualProperty",
&luascriptfunctions::removeVirtualProperty,
{},
"string",
"Removes a previously added virtual property"
},
{
"removeAllVirtualProperties",
&luascriptfunctions::removeAllVirtualProperties,
{},
"",
"Remove all registered virtual properties"
},
{
"setScreenshotFolder",
&luascriptfunctions::setScreenshotFolder,
{},
"string",
"Sets the folder used for storing screenshots or session recording frames"
},
{
"addTag",
&luascriptfunctions::addTag,
{},
"string, string",
"Adds a tag (second argument) to a scene graph node (first argument)"
},
{
"removeTag",
&luascriptfunctions::removeTag,
{},
"string, string",
"Removes a tag (second argument) from a scene graph node (first argument)"
},
{
"createSingleColorImage",
&luascriptfunctions::createSingleColorImage,
{},
"string, vec3",
"Creates a 1 pixel image with a certain color in the cache folder and "
"returns the path to the file. If a cached file with the given name "
@@ -1818,7 +1808,6 @@ scripting::LuaLibrary OpenSpaceEngine::luaLibrary() {
{
"isMaster",
&luascriptfunctions::isMaster,
{},
"",
"Returns whether the current OpenSpace instance is the master node of a "
"cluster configuration. If this instance is not part of a cluster, this "
-2
View File
@@ -112,7 +112,6 @@ scripting::LuaLibrary EventEngine::luaLibrary() {
res.functions.push_back({
"registerEventAction",
&luascriptfunctions::registerEventAction,
{},
"string, string [, table]",
"Registers an action (second parameter) to be executed whenever an event (first "
"parameter) is encountered. If the optional third parameter is provided, it "
@@ -122,7 +121,6 @@ scripting::LuaLibrary EventEngine::luaLibrary() {
res.functions.push_back({
"unregisterEventAction",
&luascriptfunctions::unregisterEventAction,
{},
"string, string [, table]",
"Unregisters a specific combination of event (first parameter), action (second "
"parameter), and potentially a filter (optional third argument)"
-6
View File
@@ -117,21 +117,18 @@ scripting::LuaLibrary ActionManager::luaLibrary() {
{
"hasAction",
&luascriptfunctions::hasAction,
{},
"string",
"Checks if the passed identifier corresponds to an action"
},
{
"removeAction",
&luascriptfunctions::removeAction,
{},
"string",
"Removes an existing action from the list of possible actions"
},
{
"registerAction",
&luascriptfunctions::registerAction,
{},
"table",
"Registers a new action. The table must at least contain the keys "
"'Identifier' and 'Command' represeting the unique identifier and the "
@@ -145,7 +142,6 @@ scripting::LuaLibrary ActionManager::luaLibrary() {
{
"action",
&luascriptfunctions::action,
{},
"string",
"Returns information about the action as a table with the keys "
"'Identifier', 'Command', 'Name', 'Documentation', 'GuiPath', and "
@@ -154,7 +150,6 @@ scripting::LuaLibrary ActionManager::luaLibrary() {
{
"actions",
&luascriptfunctions::actions,
{},
"",
"Returns all registered actions in the system as a table of tables each "
"containing the keys 'Identifier', 'Command', 'Name', 'Documentation', "
@@ -163,7 +158,6 @@ scripting::LuaLibrary ActionManager::luaLibrary() {
{
"triggerAction",
&luascriptfunctions::triggerAction,
{},
"string",
"Triggers the action given by the specified identifier"
}
-4
View File
@@ -149,14 +149,12 @@ scripting::LuaLibrary KeybindingManager::luaLibrary() {
{
"clearKeys",
&luascriptfunctions::clearKeys,
{},
"",
"Clear all key bindings"
},
{
"clearKey",
&luascriptfunctions::clearKey,
{},
"string or strings",
"Unbinds the key or keys that have been provided. This function can be "
"called with a single key or with an array of keys to remove all of the "
@@ -165,14 +163,12 @@ scripting::LuaLibrary KeybindingManager::luaLibrary() {
{
"bindKey",
&luascriptfunctions::bindKey,
{},
"string, string",
"Binds a key by name to the action identified by the second argument"
},
{
"getKeyBinding",
&luascriptfunctions::getKeyBindings,
{},
"string",
"Returns a list of information about the keybindings for the provided key"
}
+2 -16
View File
@@ -2559,7 +2559,6 @@ scripting::LuaLibrary SessionRecording::luaLibrary() {
{
"startRecording",
&luascriptfunctions::startRecording,
{},
"string",
"Starts a recording session. The string argument is the filename used "
"for the file where the recorded keyframes are saved. "
@@ -2568,7 +2567,6 @@ scripting::LuaLibrary SessionRecording::luaLibrary() {
{
"startRecordingAscii",
&luascriptfunctions::startRecordingAscii,
{},
"string",
"Starts a recording session. The string argument is the filename used "
"for the file where the recorded keyframes are saved. "
@@ -2577,14 +2575,12 @@ scripting::LuaLibrary SessionRecording::luaLibrary() {
{
"stopRecording",
&luascriptfunctions::stopRecording,
{},
"void",
"Stops a recording session"
},
{
"startPlayback",
&luascriptfunctions::startPlaybackDefault,
{},
"string [, bool]",
"Starts a playback session with keyframe times that are relative to "
"the time since the recording was started (the same relative time "
@@ -2598,7 +2594,6 @@ scripting::LuaLibrary SessionRecording::luaLibrary() {
{
"startPlaybackApplicationTime",
&luascriptfunctions::startPlaybackApplicationTime,
{},
"string",
"Starts a playback session with keyframe times that are relative to "
"application time (seconds since OpenSpace application started). "
@@ -2609,7 +2604,6 @@ scripting::LuaLibrary SessionRecording::luaLibrary() {
{
"startPlaybackRecordedTime",
&luascriptfunctions::startPlaybackRecordedTime,
{},
"string [, bool]",
"Starts a playback session with keyframe times that are relative to "
"the time since the recording was started (the same relative time "
@@ -2622,7 +2616,6 @@ scripting::LuaLibrary SessionRecording::luaLibrary() {
{
"startPlaybackSimulationTime",
&luascriptfunctions::startPlaybackSimulationTime,
{},
"string",
"Starts a playback session with keyframe times that are relative to "
"the simulated date & time. The string argument is the filename to pull "
@@ -2632,14 +2625,12 @@ scripting::LuaLibrary SessionRecording::luaLibrary() {
{
"stopPlayback",
&luascriptfunctions::stopPlayback,
{},
"void",
"",
"Stops a playback session before playback of all keyframes is complete"
},
{
"enableTakeScreenShotDuringPlayback",
&luascriptfunctions::enableTakeScreenShotDuringPlayback,
{},
"[int]",
"Enables that rendered frames should be saved during playback. The "
"parameter determines the number of frames that are exported per second "
@@ -2648,14 +2639,12 @@ scripting::LuaLibrary SessionRecording::luaLibrary() {
{
"disableTakeScreenShotDuringPlayback",
&luascriptfunctions::disableTakeScreenShotDuringPlayback,
{},
"void",
"",
"Used to disable that renderings are saved during playback"
},
{
"fileFormatConversion",
&luascriptfunctions::fileFormatConversion,
{},
"string",
"Performs a conversion of the specified file to the most most recent "
"file format, creating a copy of the recording file."
@@ -2663,14 +2652,12 @@ scripting::LuaLibrary SessionRecording::luaLibrary() {
{
"setPlaybackPause",
&luascriptfunctions::setPlaybackPause,
{},
"bool",
"Pauses or resumes the playback progression through keyframes"
},
{
"togglePlaybackPause",
&luascriptfunctions::togglePlaybackPause,
{},
"",
"Toggles the pause function, i.e. temporarily setting the delta time to 0"
" and restoring it afterwards"
@@ -2678,7 +2665,6 @@ scripting::LuaLibrary SessionRecording::luaLibrary() {
{
"isPlayingBack",
& luascriptfunctions::isPlayingBack,
{},
"",
"Returns true if session recording is currently playing back a recording"
}
-4
View File
@@ -111,28 +111,24 @@ scripting::LuaLibrary MissionManager::luaLibrary() {
{
"loadMission",
&luascriptfunctions::loadMission,
{},
"string",
"Load mission phases from file"
},
{
"unloadMission",
&luascriptfunctions::unloadMission,
{},
"string",
"Unloads a previously loaded mission"
},
{
"hasMission",
&luascriptfunctions::hasMission,
{},
"string",
"Returns whether a mission with the provided name has been loaded"
},
{
"setCurrentMission",
&luascriptfunctions::setCurrentMission,
{},
"string",
"Set the currnet mission"
},
-18
View File
@@ -604,7 +604,6 @@ scripting::LuaLibrary NavigationHandler::luaLibrary() {
{
"getNavigationState",
&luascriptfunctions::getNavigationState,
{},
"[string]",
"Return the current navigation state as a lua table. The optional "
"argument is the scene graph node to use as reference frame. By default, "
@@ -616,14 +615,12 @@ scripting::LuaLibrary NavigationHandler::luaLibrary() {
{
"setNavigationState",
&luascriptfunctions::setNavigationState,
{},
"table",
"Set the navigation state. The argument must be a valid Navigation State."
},
{
"saveNavigationState",
&luascriptfunctions::saveNavigationState,
{},
"string, [string]",
"Save the current navigation state to a file with the path given by the "
"first argument. The optoinal second argument is the scene graph node to "
@@ -635,7 +632,6 @@ scripting::LuaLibrary NavigationHandler::luaLibrary() {
{
"loadNavigationState",
&luascriptfunctions::loadNavigationState,
{},
"string",
"Load a navigation state from file. The file should be a lua file "
"returning the navigation state as a table formatted as a "
@@ -644,21 +640,18 @@ scripting::LuaLibrary NavigationHandler::luaLibrary() {
{
"retargetAnchor",
&luascriptfunctions::retargetAnchor,
{},
"void",
"Reset the camera direction to point at the anchor node"
},
{
"retargetAim",
&luascriptfunctions::retargetAim,
{},
"void",
"Reset the camera direction to point at the aim node"
},
{
"bindJoystickAxis",
&luascriptfunctions::bindJoystickAxis,
{},
"name, axis, axisType [, isInverted, isNormalized, isSticky, sensitivity]",
"Finds the input joystick with the given 'name' and binds the axis "
"identified by the second argument to be used as the type identified by "
@@ -672,7 +665,6 @@ scripting::LuaLibrary NavigationHandler::luaLibrary() {
{
"bindJoystickAxisProperty",
&luascriptfunctions::bindJoystickAxisProperty,
{},
"name, axis, propertyUri [, min, max, isInverted, isSticky, sensitivity, "
"isRemote]",
"Finds the input joystick with the given 'name' and binds the axis "
@@ -690,7 +682,6 @@ scripting::LuaLibrary NavigationHandler::luaLibrary() {
{
"joystickAxis",
&luascriptfunctions::joystickAxis,
{},
"name, axis",
"Finds the input joystick with the given 'name' and returns the joystick "
"axis information for the passed axis. The information that is returned "
@@ -704,7 +695,6 @@ scripting::LuaLibrary NavigationHandler::luaLibrary() {
{
"setAxisDeadZone",
&luascriptfunctions::setJoystickAxisDeadzone,
{},
"name, axis, float",
"Finds the input joystick with the given 'name' and sets the deadzone "
"for a particular joystick axis, which means that any input less than "
@@ -713,7 +703,6 @@ scripting::LuaLibrary NavigationHandler::luaLibrary() {
{
"bindJoystickButton",
&luascriptfunctions::bindJoystickButton,
{},
"name, button, string [, string, string, bool]",
"Finds the input joystick with the given 'name' and binds a Lua script "
"given by the third argument to be executed when the joystick button "
@@ -728,7 +717,6 @@ scripting::LuaLibrary NavigationHandler::luaLibrary() {
{
"clearJoystickButton",
&luascriptfunctions::clearJoystickButton,
{},
"name, button",
"Finds the input joystick with the given 'name' and removes all commands "
"that are currently bound to the button identified by the second argument."
@@ -736,7 +724,6 @@ scripting::LuaLibrary NavigationHandler::luaLibrary() {
{
"joystickButton",
&luascriptfunctions::joystickButton,
{},
"name, button",
"Finds the input joystick with the given 'name' and returns the script "
"that is currently bound to be executed when the provided button is "
@@ -745,35 +732,30 @@ scripting::LuaLibrary NavigationHandler::luaLibrary() {
{
"addGlobalRotation",
&luascriptfunctions::addGlobalRotation,
{},
"double, double",
"Directly adds to the global rotation of the camera"
},
{
"addLocalRotation",
&luascriptfunctions::addLocalRotation,
{},
"double, double",
"Directly adds to the local rotation of the camera"
},
{
"addTruckMovement",
&luascriptfunctions::addTruckMovement,
{},
"double, double",
"Directly adds to the truck movement of the camera"
},
{
"addLocalRoll",
&luascriptfunctions::addLocalRoll,
{},
"double, double",
"Directly adds to the local roll of the camera"
},
{
"addGlobalRoll",
&luascriptfunctions::addGlobalRoll,
{},
"double, double",
"Directly adds to the global roll of the camera"
}
-8
View File
@@ -391,35 +391,30 @@ scripting::LuaLibrary PathNavigator::luaLibrary() {
{
"isFlying",
&luascriptfunctions::isFlying,
{},
"",
"Returns true if a camera path is currently running, and false otherwise"
},
{
"continuePath",
&luascriptfunctions::continuePath,
{},
"",
"Continue playing a paused camera path"
},
{
"pausePath",
&luascriptfunctions::pausePath,
{},
"",
"Pause a playing camera path"
},
{
"stopPath",
&luascriptfunctions::stopPath,
{},
"",
"Stops a path, if one is being played"
},
{
"goTo",
&luascriptfunctions::goTo,
{},
"string [, bool, double]",
"Move the camera to the node with the specified identifier. The optional "
"double specifies the duration of the motion. If the optional bool is "
@@ -429,7 +424,6 @@ scripting::LuaLibrary PathNavigator::luaLibrary() {
{
"goToHeight",
&luascriptfunctions::goToHeight,
{},
"string, double [, bool, double]",
"Move the camera to the node with the specified identifier. The second "
"argument is the desired target height above the target node's bounding "
@@ -441,7 +435,6 @@ scripting::LuaLibrary PathNavigator::luaLibrary() {
{
"goToNavigationState",
&luascriptfunctions::goToNavigationState,
{},
"table, [double]",
"Create a path to the navigation state described by the input table. "
"The optional double specifies the target duration of the motion. Note "
@@ -451,7 +444,6 @@ scripting::LuaLibrary PathNavigator::luaLibrary() {
{
"createPath",
&luascriptfunctions::createPath,
{},
"table",
"Create the path as described by the lua table input argument"
},
-4
View File
@@ -736,28 +736,24 @@ scripting::LuaLibrary ParallelPeer::luaLibrary() {
{
"connect",
&luascriptfunctions::connect,
{},
"",
"Connect to parallel"
},
{
"disconnect",
&luascriptfunctions::disconnect,
{},
"",
"Disconnect from parallel"
},
{
"requestHostship",
&luascriptfunctions::requestHostship,
{},
"",
"Request to be the host for this session"
},
{
"resignHostship",
&luascriptfunctions::resignHostship,
{},
"",
"Resign hostship"
},
-3
View File
@@ -152,21 +152,18 @@ scripting::LuaLibrary Dashboard::luaLibrary() {
{
"addDashboardItem",
&luascriptfunctions::addDashboardItem,
{},
"table",
"Adds a new dashboard item to the main dashboard."
},
{
"removeDashboardItem",
&luascriptfunctions::removeDashboardItem,
{},
"string",
"Removes the dashboard item with the specified identifier."
},
{
"clearDashboardItems",
&luascriptfunctions::clearDashboardItems,
{},
"",
"Removes all dashboard items from the main dashboard."
}
+1 -4
View File
@@ -1060,7 +1060,6 @@ scripting::LuaLibrary RenderEngine::luaLibrary() {
{
"addScreenSpaceRenderable",
&luascriptfunctions::addScreenSpaceRenderable,
{},
"table",
"Will create a ScreenSpaceRenderable from a lua Table and add it in the "
"RenderEngine"
@@ -1068,7 +1067,6 @@ scripting::LuaLibrary RenderEngine::luaLibrary() {
{
"removeScreenSpaceRenderable",
&luascriptfunctions::removeScreenSpaceRenderable,
{},
"string",
"Given a ScreenSpaceRenderable name this script will remove it from the "
"renderengine"
@@ -1076,12 +1074,11 @@ scripting::LuaLibrary RenderEngine::luaLibrary() {
{
"takeScreenshot",
&luascriptfunctions::takeScreenshot,
{},
"",
"Take a screenshot and return the screenshot number. The screenshot will "
"be stored in the ${SCREENSHOTS} folder. "
}
},
}
};
}
-2
View File
@@ -134,14 +134,12 @@ scripting::LuaLibrary AssetManager::luaLibrary() {
{
"add",
&luascriptfunctions::asset::add,
{ this },
"string",
""
},
{
"remove",
&luascriptfunctions::asset::remove,
{ this },
"string",
""
}
+6 -11
View File
@@ -31,13 +31,11 @@ namespace openspace::luascriptfunctions::asset {
int add(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::add");
AssetManager* assetManager = reinterpret_cast<AssetManager*>(
lua_touserdata(L, lua_upvalueindex(1))
);
AssetManager& assetManager = global::openSpaceEngine->assetManager();
const std::string assetName = ghoul::lua::value<std::string>(L);
if (global::renderEngine->scene()) {
assetManager->add(assetName);
assetManager.add(assetName);
}
else {
// The scene might not exist yet if OpenSpace was started without specifying an
@@ -51,21 +49,18 @@ int add(lua_State* L) {
int remove(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::remove");
AssetManager* assetManager =
reinterpret_cast<AssetManager*>(lua_touserdata(L, lua_upvalueindex(1)));
AssetManager& assetManager = global::openSpaceEngine->assetManager();
const std::string assetName = ghoul::lua::value<std::string>(L);
assetManager->remove(assetName);
assetManager.remove(assetName);
return 0;
}
int removeAll(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::removeAll");
AssetManager* assetManager =
reinterpret_cast<AssetManager*>(lua_touserdata(L, lua_upvalueindex(1)));
assetManager->removeAll();
AssetManager& assetManager = global::openSpaceEngine->assetManager();
assetManager.removeAll();
return 0;
}
-1
View File
@@ -718,7 +718,6 @@ scripting::LuaLibrary Profile::luaLibrary() {
{
"saveSettingsToProfile",
&luascriptfunctions::saveSettingsToProfile,
{},
"[string, bool]",
"Collects all changes that have been made since startup, including all "
"property changes and assets required, requested, or removed. All "
-14
View File
@@ -798,7 +798,6 @@ scripting::LuaLibrary Scene::luaLibrary() {
{
"setPropertyValue",
&luascriptfunctions::property_setValue,
{},
"name, value [, duration, easing, optimization]",
"Sets all property(s) identified by the URI (with potential wildcards) "
"in the first argument. The second argument can be any type, but it has "
@@ -823,7 +822,6 @@ scripting::LuaLibrary Scene::luaLibrary() {
{
"setPropertyValueSingle",
&luascriptfunctions::property_setValueSingle,
{},
"URI, value [, duration, easing]",
"Sets the property identified by the URI in the first argument. The "
"second argument can be any type, but it has to match the type that the "
@@ -839,21 +837,18 @@ scripting::LuaLibrary Scene::luaLibrary() {
{
"hasProperty",
&luascriptfunctions::property_hasProperty,
{},
"string",
"Returns whether a property with the given URI exists"
},
{
"getPropertyValue",
&luascriptfunctions::property_getValue,
{},
"string",
"Returns the value the property, identified by the provided URI."
},
{
"getProperty",
&luascriptfunctions::property_getProperty,
{},
"string",
"Returns a list of property identifiers that match the passed regular "
"expression"
@@ -861,7 +856,6 @@ scripting::LuaLibrary Scene::luaLibrary() {
{
"loadScene",
&luascriptfunctions::loadScene,
{},
"string",
"Loads the scene found at the file passed as an "
"argument. If a scene is already loaded, it is unloaded first"
@@ -869,7 +863,6 @@ scripting::LuaLibrary Scene::luaLibrary() {
{
"addSceneGraphNode",
&luascriptfunctions::addSceneGraphNode,
{},
"table",
"Loads the SceneGraphNode described in the table and adds it to the "
"SceneGraph"
@@ -877,14 +870,12 @@ scripting::LuaLibrary Scene::luaLibrary() {
{
"removeSceneGraphNode",
&luascriptfunctions::removeSceneGraphNode,
{},
"string",
"Removes the SceneGraphNode identified by name"
},
{
"removeSceneGraphNodesFromRegex",
&luascriptfunctions::removeSceneGraphNodesFromRegex,
{},
"string",
"Removes all SceneGraphNodes with identifiers matching the input regular "
"expression"
@@ -892,7 +883,6 @@ scripting::LuaLibrary Scene::luaLibrary() {
{
"hasSceneGraphNode",
&luascriptfunctions::hasSceneGraphNode,
{},
"string",
"Checks whether the specifies SceneGraphNode is present in the current "
"scene"
@@ -900,7 +890,6 @@ scripting::LuaLibrary Scene::luaLibrary() {
{
"addInterestingTime",
&luascriptfunctions::addInterestingTime,
{},
"string, string",
"Adds an interesting time to the current scene. The first argument is "
"the name of the time and the second argument is the time itself in the "
@@ -909,7 +898,6 @@ scripting::LuaLibrary Scene::luaLibrary() {
{
"worldPosition",
&luascriptfunctions::worldPosition,
{},
"string",
"Returns the world position of the scene graph node with the given "
"string as identifier"
@@ -917,7 +905,6 @@ scripting::LuaLibrary Scene::luaLibrary() {
{
"worldRotation",
& luascriptfunctions::worldRotation,
{},
"string",
"Returns the world rotation matrix of the scene graph node with the "
"given string as identifier"
@@ -925,7 +912,6 @@ scripting::LuaLibrary Scene::luaLibrary() {
{
"setParent",
&luascriptfunctions::setParent,
{},
"string, string",
"The scene graph node identified by the first string is reparented to be "
"a child of the scene graph node identified by the second string."
+50
View File
@@ -24,10 +24,60 @@
#include <openspace/scripting/lualibrary.h>
#include <ghoul/logging/logmanager.h>
namespace openspace::scripting {
bool LuaLibrary::operator<(const LuaLibrary& rhs) const {
return name < rhs.name;
}
void LuaLibrary::merge(LuaLibrary rhs) {
for (const LuaLibrary::Function& fun : rhs.functions) {
const auto itf = std::find_if(
functions.begin(),
functions.end(),
[&fun](const LuaLibrary::Function& function) {
return fun.name == function.name;
}
);
if (itf != functions.end()) {
// the function with the desired name is already present, but we don't
// want to overwrite it
LERRORC(
"LuaLibrary",
fmt::format(
"Lua function '{}' in library '{}' has been defined twice",
fun.name, rhs.name
)
);
return;
}
else {
functions.push_back(fun);
}
}
for (LuaLibrary s : rhs.subLibraries) {
if (s.name.empty()) {
LERRORC("LuaLibrary", "Sublibraries must have a non-empty name");
}
auto it = std::find_if(
subLibraries.begin(), subLibraries.end(),
[&s](const LuaLibrary& lib) { return lib.name == s.name; }
);
if (it == subLibraries.end()) {
subLibraries.push_back(std::move(s));
}
else {
it->merge(std::move(s));
}
}
for (const std::filesystem::path& script : rhs.scripts) {
scripts.push_back(script);
}
}
} // namespace openspace::scripting
+107 -117
View File
@@ -43,6 +43,80 @@ namespace {
constexpr const char* _loggerCat = "ScriptEngine";
constexpr const int TableOffset = -3; // top-first argument-second argument
std::vector<std::string> luaFunctions(const openspace::scripting::LuaLibrary& library,
std::string prefix)
{
using namespace openspace::scripting;
std::vector<std::string> result;
std::string total = prefix;
if (!library.name.empty()) {
total += library.name + ".";
}
for (const LuaLibrary::Function& function : library.functions) {
result.push_back(total + function.name);
}
for (const LuaLibrary& sl : library.subLibraries) {
std::vector<std::string> r = luaFunctions(sl, total);
result.insert(result.end(), r.begin(), r.end());
}
for (const LuaLibrary::Documentation& doc : library.documentations) {
result.push_back(total + doc.name);
}
return result;
}
void toJson(const openspace::scripting::LuaLibrary& library, std::stringstream& json)
{
constexpr const char* replStr = R"("{}": "{}", )";
constexpr const char* replStr2 = R"("{}": "{}")";
using namespace openspace;
using namespace openspace::scripting;
json << "{";
json << fmt::format(replStr, "library", library.name);
json << "\"functions\": [";
for (const LuaLibrary::Function& f : library.functions) {
json << "{";
json << fmt::format(replStr, "name", f.name);
json << fmt::format(replStr, "arguments", escapedJson(f.argumentText));
json << fmt::format(replStr2, "help", escapedJson(f.helpText));
json << "}";
if (&f != &library.functions.back() || !library.documentations.empty()) {
json << ",";
}
}
for (const LuaLibrary::Documentation& doc : library.documentations) {
json << "{";
json << fmt::format(replStr, "name", doc.name);
json << fmt::format(replStr, "arguments", escapedJson(doc.parameter));
json << fmt::format(replStr2, "help", escapedJson(doc.description));
json << "}";
if (&doc != &library.documentations.back()) {
json << ",";
}
}
json << "],";
json << "\"subLibraries\": [";
for (const LuaLibrary& sl : library.subLibraries) {
toJson(sl, json);
if (&sl != &library.subLibraries.back()) {
json << ",";
}
}
json << "]}";
}
} // namespace
namespace openspace::scripting {
@@ -99,8 +173,7 @@ ghoul::lua::LuaState* ScriptEngine::luaState() {
void ScriptEngine::addLibrary(LuaLibrary library) {
ZoneScoped
auto sortFunc = [](const LuaLibrary::Function& lhs, const LuaLibrary::Function& rhs)
{
auto sortFunc = [](const LuaLibrary::Function& lhs, const LuaLibrary::Function& rhs) {
return lhs.name < rhs.name;
};
@@ -111,50 +184,18 @@ void ScriptEngine::addLibrary(LuaLibrary library) {
[&library](const LuaLibrary& lib) { return lib.name == library.name; }
);
if (it == _registeredLibraries.end()) {
// If not, we can add it after we sorted it
std::sort(library.functions.begin(), library.functions.end(), sortFunc);
_registeredLibraries.push_back(std::move(library));
std::sort(_registeredLibraries.begin(), _registeredLibraries.end());
}
else {
// otherwise, we merge the libraries
LuaLibrary merged = *it;
for (const LuaLibrary::Function& fun : library.functions) {
const auto itf = std::find_if(
merged.functions.begin(),
merged.functions.end(),
[&fun](const LuaLibrary::Function& function) {
return fun.name == function.name;
}
);
if (itf != merged.functions.end()) {
// the function with the desired name is already present, but we don't
// want to overwrite it
LERROR(fmt::format(
"Lua function '{}' in library '{}' has been defined twice",
fun.name,
library.name
));
return;
}
else {
merged.functions.push_back(fun);
}
}
for (const std::filesystem::path& script : library.scripts) {
merged.scripts.push_back(script);
}
if (it != _registeredLibraries.end()) {
// if we found the library, we want to merge them
LuaLibrary cpy = *it;
cpy.merge(std::move(library));
_registeredLibraries.erase(it);
// Sort the merged library before inserting it
std::sort(merged.functions.begin(), merged.functions.end(), sortFunc);
_registeredLibraries.push_back(std::move(merged));
std::sort(_registeredLibraries.begin(), _registeredLibraries.end());
library = cpy;
}
// If not, we can add it after we sorted it
std::sort(library.functions.begin(), library.functions.end(), sortFunc);
_registeredLibraries.push_back(std::move(library));
std::sort(_registeredLibraries.begin(), _registeredLibraries.end());
}
bool ScriptEngine::hasLibrary(const std::string& name) {
@@ -307,13 +348,26 @@ void ScriptEngine::addLibraryFunctions(lua_State* state, LuaLibrary& library,
lua_pop(state, 1);
}
ghoul::lua::push(state, p.name);
for (void* d : p.userdata) {
lua_pushlightuserdata(state, d);
}
lua_pushcclosure(state, p.function, static_cast<int>(p.userdata.size()));
lua_pushcfunction(state, p.function);
lua_settable(state, TableOffset);
}
for (LuaLibrary& sl : library.subLibraries) {
ghoul::lua::push(state, sl.name);
lua_newtable(state);
lua_settable(state, TableOffset);
// Retrieve the table
ghoul::lua::push(state, sl.name);
lua_gettable(state, -2);
// Add the library functions into the table
addLibraryFunctions(state, sl, Replace::No);
// Pop the table
lua_pop(state, 1);
}
for (const std::filesystem::path& script : library.scripts) {
// First we run the script to set its values in the current state
ghoul::lua::runScriptFile(state, script.string());
@@ -363,7 +417,6 @@ void ScriptEngine::addBaseLibrary() {
{
"printTrace",
&luascriptfunctions::printTrace,
{},
"*",
"Logs the passed value to the installed LogManager with a LogLevel of "
"'Trace'"
@@ -371,7 +424,6 @@ void ScriptEngine::addBaseLibrary() {
{
"printDebug",
&luascriptfunctions::printDebug,
{},
"*",
"Logs the passed value to the installed LogManager with a LogLevel of "
"'Debug'"
@@ -379,7 +431,6 @@ void ScriptEngine::addBaseLibrary() {
{
"printInfo",
&luascriptfunctions::printInfo,
{},
"*",
"Logs the passed value to the installed LogManager with a LogLevel of "
"'Info'"
@@ -387,7 +438,6 @@ void ScriptEngine::addBaseLibrary() {
{
"printWarning",
&luascriptfunctions::printWarning,
{},
"*",
"Logs the passed value to the installed LogManager with a LogLevel of "
"'Warning'"
@@ -395,7 +445,6 @@ void ScriptEngine::addBaseLibrary() {
{
"printError",
&luascriptfunctions::printError,
{},
"*",
"Logs the passed value to the installed LogManager with a LogLevel of "
"'Error'"
@@ -403,7 +452,6 @@ void ScriptEngine::addBaseLibrary() {
{
"printFatal",
&luascriptfunctions::printFatal,
{},
"*",
"Logs the passed value to the installed LogManager with a LogLevel of "
"'Fatal'"
@@ -411,7 +459,6 @@ void ScriptEngine::addBaseLibrary() {
{
"absPath",
&luascriptfunctions::absolutePath,
{},
"string",
"Returns the absolute path to the passed path, resolving path tokens as "
"well as resolving relative paths"
@@ -419,28 +466,24 @@ void ScriptEngine::addBaseLibrary() {
{
"fileExists",
&luascriptfunctions::fileExists,
{},
"string",
"Checks whether the provided file exists."
},
{
"readFile",
&luascriptfunctions::readFile,
{},
"string",
"Reads a file from disk and return its contents"
},
{
"directoryExists",
&luascriptfunctions::directoryExists,
{},
"string",
"Chckes whether the provided directory exists."
},
{
"setPathToken",
&luascriptfunctions::setPathToken,
{},
"string, string",
"Registers a new path token provided by the first argument to the path "
"provided in the second argument"
@@ -448,7 +491,6 @@ void ScriptEngine::addBaseLibrary() {
{
"walkDirectory",
&luascriptfunctions::walkDirectory,
{},
"string [bool, bool]",
"Walks a directory and returns all contents (files and directories) of "
"the directory as absolute paths. The first argument is the path of the "
@@ -459,7 +501,6 @@ void ScriptEngine::addBaseLibrary() {
{
"walkDirectoryFiles",
&luascriptfunctions::walkDirectoryFiles,
{},
"string [bool, bool]",
"Walks a directory and returns the files of the directory as absolute "
"paths. The first argument is the path of the directory that should be "
@@ -470,7 +511,6 @@ void ScriptEngine::addBaseLibrary() {
{
"walkDirectoryFolder",
&luascriptfunctions::walkDirectoryFolder,
{},
"string [bool, bool]",
"Walks a directory and returns the subfolders of the directory as "
"absolute paths. The first argument is the path of the directory that "
@@ -481,7 +521,6 @@ void ScriptEngine::addBaseLibrary() {
{
"directoryForPath",
&luascriptfunctions::directoryForPath,
{},
"string",
"This function extracts the directory part of the passed path. For "
"example, if the parameter is 'C:/OpenSpace/foobar/foo.txt', this "
@@ -490,7 +529,6 @@ void ScriptEngine::addBaseLibrary() {
{
"unzipFile",
&luascriptfunctions::unzipFile,
{},
"string, string [bool]",
"This function extracts the contents of a zip file. The first "
"argument is the path to the zip file. The second argument is the "
@@ -501,10 +539,9 @@ void ScriptEngine::addBaseLibrary() {
{
"saveLastChangeToProfile",
&luascriptfunctions::saveLastChangeToProfile,
{},
"",
"This function saves the last script log action into the profile "
},
"This function saves the last script log action into the profile."
}
}
};
addLibrary(lib);
@@ -567,27 +604,10 @@ std::vector<std::string> ScriptEngine::allLuaFunctions() const {
ZoneScoped
std::vector<std::string> result;
for (const LuaLibrary& library : _registeredLibraries) {
for (const LuaLibrary::Function& function : library.functions) {
std::string total = "openspace.";
if (!library.name.empty()) {
total += library.name + ".";
}
total += function.name;
result.push_back(std::move(total));
}
for (const LuaLibrary::Documentation& doc : library.documentations) {
std::string total = "openspace.";
if (!library.name.empty()) {
total += library.name + ".";
}
total += doc.name;
result.push_back(std::move(total));
}
std::vector<std::string> r = luaFunctions(library, "openspace.");
result.insert(result.end(), r.begin(), r.end());
}
return result;
}
@@ -600,42 +620,12 @@ std::string ScriptEngine::generateJson() const {
bool first = true;
for (const LuaLibrary& l : _registeredLibraries) {
constexpr const char* replStr = R"("{}": "{}", )";
constexpr const char* replStr2 = R"("{}": "{}")";
if (!first) {
json << ",";
}
first = false;
json << "{";
json << fmt::format(replStr, "library", l.name);
json << "\"functions\": [";
for (const LuaLibrary::Function& f : l.functions) {
json << "{";
json << fmt::format(replStr, "name", f.name);
json << fmt::format(replStr, "arguments", escapedJson(f.argumentText));
json << fmt::format(replStr2, "help", escapedJson(f.helpText));
json << "}";
if (&f != &l.functions.back() || !l.documentations.empty()) {
json << ",";
}
}
for (const LuaLibrary::Documentation& doc : l.documentations) {
json << "{";
json << fmt::format(replStr, "name", doc.name);
json << fmt::format(replStr, "arguments", escapedJson(doc.parameter));
json << fmt::format(replStr2, "help", escapedJson(doc.description));
json << "}";
if (&doc != &l.documentations.back()) {
json << ",";
}
}
json << "]}";
toJson(l, json);
}
json << "]";
+1 -7
View File
@@ -297,7 +297,6 @@ LuaLibrary ScriptScheduler::luaLibrary() {
{
"loadFile",
&luascriptfunctions::loadFile,
{},
"string",
"Load timed scripts from a Lua script file that returns a list of "
"scheduled scripts."
@@ -305,7 +304,6 @@ LuaLibrary ScriptScheduler::luaLibrary() {
{
"loadScheduledScript",
&luascriptfunctions::loadScheduledScript,
{},
"string, string, (string, string)",
"Load a single scheduled script. The first argument is the time at which "
"the scheduled script is triggered, the second argument is the script "
@@ -317,7 +315,6 @@ LuaLibrary ScriptScheduler::luaLibrary() {
{
"setModeApplicationTime",
&luascriptfunctions::setModeApplicationTime,
{},
"",
"Sets the time reference for scheduled scripts to application time "
"(seconds since OpenSpace application started)."
@@ -325,7 +322,6 @@ LuaLibrary ScriptScheduler::luaLibrary() {
{
"setModeRecordedTime",
&luascriptfunctions::setModeRecordedTime,
{},
"",
"Sets the time reference for scheduled scripts to the time since the "
"recording was started (the same relative time applies to playback)."
@@ -333,7 +329,6 @@ LuaLibrary ScriptScheduler::luaLibrary() {
{
"setModeSimulationTime",
&luascriptfunctions::setModeSimulationTime,
{},
"",
"Sets the time reference for scheduled scripts to the simulated "
"date & time (J2000 epoch seconds)."
@@ -341,10 +336,9 @@ LuaLibrary ScriptScheduler::luaLibrary() {
{
"clear",
&luascriptfunctions::clear,
{},
"",
"Clears all scheduled scripts."
},
}
}
};
}
@@ -237,7 +237,6 @@ LuaLibrary generalSystemCapabilities() {
{
"os",
&luascripting::general::operatingSystem,
{},
"",
"This function returns a string identifying the currently running "
"operating system. For Windows, the string is 'windows', for MacOS, it "
@@ -247,7 +246,6 @@ LuaLibrary generalSystemCapabilities() {
{
"fullOperatingSystem",
&luascripting::general::fullOperatingSystem,
{},
"",
"Returns the operating system as a string. The exact format of the "
"returned string is implementation and operating system-dependent but it "
@@ -256,7 +254,6 @@ LuaLibrary generalSystemCapabilities() {
{
"installedMainMemory",
&luascripting::general::installedMainMemory,
{},
"",
"Returns the amount of available, installed main memory (RAM) on the "
"system in MB."
@@ -264,35 +261,30 @@ LuaLibrary generalSystemCapabilities() {
{
"cores",
&luascripting::general::cores,
{},
"",
"Returns the number of cores."
},
{
"cacheLineSize",
&luascripting::general::cacheLineSize,
{},
"",
"Returns the cache line size."
},
{
"L2Associativity",
&luascripting::general::L2Associativity,
{},
"",
"Returns the L2 associativity."
},
{
"cacheSize",
&luascripting::general::cacheSize,
{},
"",
"Returns the cache size."
},
{
"extensions",
&luascripting::general::extensions,
{},
"",
"Returns all supported exteions as comma-separated string."
}
@@ -307,7 +299,6 @@ LuaLibrary openglSystemCapabilities() {
{
"hasOpenGLVersion",
&luascripting::opengl::hasOpenGLVersion,
{},
"string",
"Tests whether the current instance supports the passed OpenGL version. "
"The parameter has to have the form 'X.Y' or 'X.Y.Z'."
@@ -315,14 +306,12 @@ LuaLibrary openglSystemCapabilities() {
{
"openGLVersion",
&luascripting::opengl::openGLVersion,
{},
"",
"Returns the maximum OpenGL version that is supported on this platform."
},
{
"glslCompiler",
&luascripting::opengl::glslCompiler,
{},
"",
"Returns the value of a call to <code>glGetString(GL_VENDOR)</code>. "
"This will give detailed information about the vendor of the main "
@@ -332,28 +321,24 @@ LuaLibrary openglSystemCapabilities() {
{
"gpuVendor",
&luascripting::opengl::gpuVendor,
{},
"",
"Returns the vendor of the main graphics card."
},
{
"extensions",
&luascripting::opengl::extensions,
{},
"",
"Returns all available extensions as a list of names."
},
{
"isExtensionSupported",
&luascripting::opengl::isExtensionSupported,
{},
"string",
"Checks is a specific <code>extension</code> is supported or not."
},
{
"maxTextureUnits",
&luascripting::opengl::maxTextureUnits,
{},
"",
"Returns the maximum number of texture units that are available on the "
"main graphics card."
@@ -361,21 +346,18 @@ LuaLibrary openglSystemCapabilities() {
{
"max2DTextureSize",
&luascripting::opengl::max2DTextureSize,
{},
"",
"Returns the largest dimension for a 2D texture on this graphics card."
},
{
"max3DTextureSize",
&luascripting::opengl::max3DTextureSize,
{},
"",
"Returns the largest dimension for a 3D texture on this graphics card."
},
{
"maxAtomicCounterBufferBindings",
&luascripting::opengl::maxAtomicCounterBufferBindings,
{},
"",
"Returns the maximum number of atomic counter buffer bindings that are "
"available on the main graphics card."
@@ -383,7 +365,6 @@ LuaLibrary openglSystemCapabilities() {
{
"maxShaderStorageBufferBindings",
&luascripting::opengl::maxShaderStorageBufferBindings,
{},
"",
"Returns the maximum number of shader storage bindings that are "
"available on the main graphics card."
@@ -391,7 +372,6 @@ LuaLibrary openglSystemCapabilities() {
{
"maxUniformBufferBindings",
&luascripting::opengl::maxUniformBufferBindings,
{},
"",
"Returns the maximum number of uniform buffer bindings that are "
"available on the main graphics card."
-7
View File
@@ -1345,7 +1345,6 @@ scripting::LuaLibrary SpiceManager::luaLibrary() {
{
"loadKernel",
&luascriptfunctions::loadKernel,
{},
"string",
"Loads the provided SPICE kernel by name. The name can contain path "
"tokens, which are automatically resolved"
@@ -1353,7 +1352,6 @@ scripting::LuaLibrary SpiceManager::luaLibrary() {
{
"unloadKernel",
&luascriptfunctions::unloadKernel,
{},
"{string, number}",
"Unloads the provided SPICE kernel. The name can contain path tokens, "
"which are automatically resolved"
@@ -1361,21 +1359,18 @@ scripting::LuaLibrary SpiceManager::luaLibrary() {
{
"getSpkCoverage",
&luascriptfunctions::spkCoverage,
{},
"string",
"Returns a list of SPK coverage intervals for the target."
},
{
"getCkCoverage",
&luascriptfunctions::ckCoverage,
{},
"string",
"Returns a list of CK coverage intervals for the target."
},
{
"rotationMatrix",
&luascriptfunctions::rotationMatrix,
{},
"{string, string, string}",
"Returns the rotationMatrix for a given body in a frame of reference at "
"a specific time. The first agument is the target body, the second is "
@@ -1386,7 +1381,6 @@ scripting::LuaLibrary SpiceManager::luaLibrary() {
{
"position",
&luascriptfunctions::position,
{},
"{string, string, string, string}",
"Returns the position for a target by an observer in a frame of "
"reference at a specific time. The first agument is the target body, the "
@@ -1397,7 +1391,6 @@ scripting::LuaLibrary SpiceManager::luaLibrary() {
{
"getSpiceBodies",
&luascriptfunctions::spiceBodies,
{},
"{ builtInFrames [, printValues] }",
"Returns a list of Spice Bodies loaded into the system. Returns SPICE "
"built in frames if builtInFrames. Returns User loaded frames if "
-21
View File
@@ -145,7 +145,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"setTime",
&luascriptfunctions::time_setTime,
{},
"{number, string}",
"Sets the current simulation time to the "
"specified value. If the parameter is a number, the value is the number "
@@ -157,7 +156,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"setDeltaTime",
&luascriptfunctions::time_setDeltaTime,
{},
"number",
"Sets the amount of simulation time that happens "
"in one second of real time"
@@ -165,7 +163,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"setDeltaTimeSteps",
&luascriptfunctions::time_setDeltaTimeSteps,
{},
"List of numbers",
"Sets the list of discrete delta time steps for the simulation speed "
"that can be quickly jumped between. The list will be sorted to be in "
@@ -175,7 +172,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"deltaTime",
&luascriptfunctions::time_deltaTime,
{},
"",
"Returns the amount of simulated time that passes in one "
"second of real time"
@@ -183,14 +179,12 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"setPause",
&luascriptfunctions::time_setPause,
{},
"bool",
"Pauses the simulation time or restores the delta time"
},
{
"togglePause",
&luascriptfunctions::time_togglePause,
{},
"",
"Toggles the pause function, i.e. temporarily setting the delta time to "
"0 and restoring it afterwards"
@@ -198,7 +192,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"interpolateTime",
&luascriptfunctions::time_interpolateTime,
{},
"{number, string} [, number]",
"Sets the current simulation time to the specified value. "
"If the first parameter is a number, the target is the number "
@@ -211,7 +204,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"interpolateTimeRelative",
&luascriptfunctions::time_interpolateTimeRelative,
{},
"number [, number]",
"Increments the current simulation time by the specified number of "
"seconds. If a second input value is given, the interpolation is done "
@@ -220,7 +212,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"interpolateDeltaTime",
&luascriptfunctions::time_interpolateDeltaTime,
{},
"number [, number]",
"Sets the amount of simulation time that happens in one second of real "
"time. If a second input value is given, the interpolation is done "
@@ -229,7 +220,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"setNextDeltaTimeStep",
&luascriptfunctions::time_setNextDeltaTimeStep,
{},
"",
"Immediately set the simulation speed to the first delta time step in "
"the list that is larger than the current choice of simulation speed, "
@@ -238,7 +228,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"setPreviousDeltaTimeStep",
&luascriptfunctions::time_setPreviousDeltaTimeStep,
{},
"",
"Immediately set the simulation speed to the first delta time step in "
"the list that is smaller than the current choice of simulation speed. "
@@ -247,7 +236,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"interpolateNextDeltaTimeStep",
&luascriptfunctions::time_interpolateNextDeltaTimeStep,
{},
"[number]",
"Interpolate the simulation speed to the first delta time step in the "
"list that is larger than the current simulation speed, if any. If an "
@@ -257,7 +245,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"interpolatePreviousDeltaTimeStep",
&luascriptfunctions::time_interpolatePreviousDeltaTimeStep,
{},
"[number]",
"Interpolate the simulation speed to the first delta time step in the "
"list that is smaller than the current simulation speed, if any. If an "
@@ -267,7 +254,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"interpolatePause",
&luascriptfunctions::time_interpolatePause,
{},
"bool [, number]",
"Pauses the simulation time or restores the delta time. If a second "
"input value is given, the interpolation is done over the specified "
@@ -276,7 +262,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"interpolateTogglePause",
&luascriptfunctions::time_interpolateTogglePause,
{},
"[number]",
"Toggles the pause function, i.e. temporarily setting the delta time to 0"
" and restoring it afterwards. If an input value is given, the "
@@ -285,7 +270,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"pauseToggleViaKeyboard",
&luascriptfunctions::time_pauseToggleViaKeyboard,
{},
"",
"Toggles the pause function from a keypress. This function behaves like"
" interpolateTogglePause during normal mode, and behaves like"
@@ -294,7 +278,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"currentTime",
&luascriptfunctions::time_currentTime,
{},
"",
"Returns the current time as the number of seconds since "
"the J2000 epoch"
@@ -302,7 +285,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"UTC",
&luascriptfunctions::time_currentTimeUTC,
{},
"",
"Returns the current time as an ISO 8601 date string "
"(YYYY-MM-DDTHH:MN:SS)"
@@ -310,7 +292,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"currentWallTime",
&luascriptfunctions::time_currentWallTime,
{},
"",
"Returns the current wall time as an ISO 8601 date string "
"(YYYY-MM-DDTHH-MN-SS) in the UTC timezone"
@@ -318,7 +299,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"currentApplicationTime",
&luascriptfunctions::time_currentApplicationTime,
{},
"",
"Returns the current application time as the number of seconds "
"since the OpenSpace application started"
@@ -326,7 +306,6 @@ scripting::LuaLibrary Time::luaLibrary() {
{
"advancedTime",
&luascriptfunctions::time_advancedTime,
{},
"string or number, string or number",
"Modifies the passed time (first argument) by the delta time (second "
"argument). The first argument can either be an ISO 8601 date string or "
@@ -87,9 +87,11 @@ function (set_openspace_compile_settings target)
"/GL" # Whole program optimization
)
else ()
set(MSVC_WARNINGS ${MSVC_WARNINGS}
"/ZI" # Edit and continue support
)
if (GHOUL_ENABLE_EDIT_CONTINUE)
set(MSVC_WARNINGS ${MSVC_WARNINGS}
"/ZI" # Edit and continue support
)
endif ()
endif ()
set(CLANG_WARNINGS