openspace
Functions overview
Name |
Documentation |
---|---|
Passes the argument to FileSystem::absolutePath, which resolves occuring path tokens and returns the absolute path |
|
Creates a new property that lives in the |
|
Loads the SceneGraphNode described in the table and adds it to the SceneGraph |
|
/ Will create a ScreenSpaceRenderable from a lua Table and add it in the RenderEngine |
|
Adds a Tag to a SceneGraphNode identified by the provided uri |
|
Add a value to the property with the given identifier |
|
Add a value to the list property with the given identifier |
|
Binds a key to Lua command to both execute locally and broadcast to all clients if this node is hosting a parallel connection |
|
Returns the bounding sphere of the scene graph node with the given string as identifier |
|
Unbinds the key or keys that have been provided |
|
Clear all key bindings |
|
Returns the whole configuration object as a Dictionary |
|
Creates a directory at the provided path, returns true if directory was newly created and false otherwise |
|
Creates a 1 pixel image with a certain color in the cache folder and returns the path to the file |
|
Checks whether the provided directory exists |
|
This function extracts the directory part of the passed path |
|
Downloads a file from Lua interpreter |
|
Extracts the DPI scaling for either the GUI window or if there is no dedicated GUI window, the first window |
|
Fades in the node(s) with the given identifier over the given time in seconds |
|
Fades out the node(s) with the given identifier over the given time in seconds |
|
Checks whether the provided file exists |
|
Returns a list of property identifiers that match the passed regular expression |
|
Returns the value the property, identified by the provided URI |
|
Returns whether a mission with the provided name has been loaded |
|
Returns whether a property with the given URI exists |
|
Checks whether the specifies SceneGraphNode is present in the current scene |
|
Returns the interaction sphere of the scene graph node with the given string as identifier |
|
Inverts the value of a boolean property with the given identifier |
|
Returns whether the current OpenSpace instance is the master node of a cluster configuration |
|
Returns the strings of the script that are bound to the passed key and whether they were local or remote key binds |
|
Returns the current layer server from the configuration |
|
Loads the provided JSON file and returns it back to the caller |
|
Load mission phases from file |
|
Create a valid identifier from the provided input string |
|
This function marks the scene graph nodes identified by name as interesting, which will provide shortcut access to focus buttons and featured properties |
|
This function marks interesting times for the current scene, which will create shortcuts for a quick access |
|
Returns a list of all scene graph nodes in the scene that have a renderable of the specific type |
|
Logs the passed value to the installed LogManager with a LogLevel of ‘Debug’ |
|
Logs the passed value to the installed LogManager with a LogLevel of ‘Error’ |
|
Logs the passed value to the installed LogManager with a LogLevel of ‘Fatal’ |
|
Logs the passed value to the installed LogManager with a LogLevel of ‘Info’ |
|
Logs the passed value to the installed LogManager with a LogLevel of ‘Trace’ |
|
Logs the passed value to the installed LogManager with a LogLevel of ‘Warning’ |
|
Returns a list of property identifiers that match the passed regular expression |
|
Returns the value the property, identified by the provided URI |
|
Loads the CSV file provided as a parameter and returns it as a vector containing the values of the each row |
|
Reads a file from disk and return its contents |
|
Rebinds all scripts from the old key (first argument) to the new key (second argument) |
|
This function removes unmarks the scene graph nodes identified by name as interesting, thus removing the shortcuts from the features properties list |
|
Removes the SceneGraphNode identified by name or by extracting the ‘Identifier’ key if the parameter is a table |
|
Removes all SceneGraphNodes with identifiers matching the input regular expression |
|
Given a ScreenSpaceRenderable name this script will remove it from the RenderEngine |
|
Removes a tag (second argument) from a scene graph node (first argument) |
|
Resets the camera position to the same position where the profile originally started |
|
Reset screenshot index to 0 |
|
Collects all changes that have been made since startup, including all property changes and assets required, requested, or removed |
|
Returns a list of all scene graph nodes in the scene |
|
Returns a list of all screen-space renderables |
|
Set the currnet mission |
|
This function sets the default values for the dashboard consisting of ‘DashboardItemDate’, ‘DashboardItemSimulationIncrement’, ‘DashboardItemDistance’, ‘DashboardItemFramerate’, and ‘DashboardItemParallelConnection’ |
|
This function sets the default GUI sorting for the space environment to increasing size, from solar system, through Milky Way, Universe and finishing with other elements |
|
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 |
|
Registers the path token provided by the first argument to the path in the second argument |
|
Sets all property(s) identified by the URI (with potential wildcards) in the first argument |
|
Sets the property identified by the URI in the first argument |
|
Sets the folder used for storing screenshots or session recording frames |
|
Take a screenshot and return the screenshot number |
|
Toggles the fade state of the node(s) with the given identifier over the given time in seconds |
|
Toggles the shutdown mode that will close the application after the countdown timer is reached |
|
Unloads a previously loaded mission |
|
This function extracts the contents of a zip file |
|
This function returns information about the current OpenSpace version |
|
Walks a directory and returns the contents of the directory as absolute paths |
|
Walks a directory and returns the files of the directory as absolute paths |
|
Walks a directory and returns the subfolders of the directory as absolute paths |
|
Returns the world position of the scene graph node with the given string as identifier |
|
Returns the world rotation matrix of the scene graph node with the given string as identifier |
|
Writes out documentation files |
Functions
absPath
Passes the argument to FileSystem::absolutePath, which resolves occuring path tokens and returns the absolute path.
path
String
Return type: Path
openspace.absPath(path)
addCustomProperty
Creates a new property that lives in the UserProperty
group.
identifier
String
The identifier that is going to be used for the new property
type
CustomPropertyType
The type of the property, has to be one of “DMat2Property”, “DMat3Property”, “DMat4Property”, “Mat2Property”, “Mat3Property”, “Mat4Property”, “BoolProperty”, “DoubleProperty”, “FloatProperty”, “IntProperty”, “StringProperty”, “StringListProperty”, “LongProperty”, “ShortProperty”, “UIntProperty”, “ULongProperty”, “DVec2Property”, “DVec3Property”, “DVec4Property”, “IVec2Property”, “IVec3Property”, “IVec4Property”, “UVec2Property”, “UVec3Property”, “UVec4Property”, “Vec2Property”, “Vec3Property”, “Vec4Property”
guiName
String?
The name that the property uses in the user interface. If this value is not provided, the
identifier
is used instead
description
String?
A description what the property is used for
onChange
String?
A Lua script that will be executed whenever the property changes
Return type: void
openspace.addCustomProperty(identifier, type, guiName, description, onChange)
addSceneGraphNode
Loads the SceneGraphNode described in the table and adds it to the SceneGraph.
node
Table
Return type: void
openspace.addSceneGraphNode(node)
addScreenSpaceRenderable
/ Will create a ScreenSpaceRenderable from a lua Table and add it in the RenderEngine
screenSpace
Table
Return type: void
openspace.addScreenSpaceRenderable(screenSpace)
addTag
Adds a Tag to a SceneGraphNode identified by the provided uri
uri
String
tag
String
Return type: void
openspace.addTag(uri, tag)
addToPropertyValue
Add a value to the property with the given identifier. Works on both numerical and string properties, where adding to a string property means appending the given string value to the existing string value.
identifier
String
value
String | Number
Return type: void
openspace.addToPropertyValue(identifier, value)
appendToListProperty
Add a value to the list property with the given identifier. The value can be any type, as long as it is the correct type for the given property. Note that a number will be converted to a string automatically.
identifier
String
value
any
Return type: void
openspace.appendToListProperty(identifier, value)
bindKey
Binds a key to Lua command to both execute locally and broadcast to all clients if this node is hosting a parallel connection.
key
String
action
String
Return type: void
openspace.bindKey(key, action)
boundingSphere
Returns the bounding sphere of the scene graph node with the given string as identifier.
identifier
String
Return type: Number
openspace.boundingSphere(identifier)
clearKey
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 provided keys at once.
key
String | String[]
Return type: void
openspace.clearKey(key)
clearKeys
Clear all key bindings
Return type: void
openspace.clearKeys()
configuration
Returns the whole configuration object as a Dictionary
Return type: Table
openspace.configuration()
createDirectory
Creates a directory at the provided path, returns true if directory was newly created and false otherwise. If recursive
flag is set to true, it will automatically create any missing parent folder as well
path
Path
recursive
Boolean?
- Default value:false
Return type: Boolean
openspace.createDirectory(path, recursive)
createSingleColorImage
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 already exists, the path to that file is returned. The first argument is the name of the file, without extension. The second is the RGB color, given as {r, g, b} with values between 0 and 1.
name
String
color
vec3
Return type: Path
openspace.createSingleColorImage(name, color)
directoryExists
Checks whether the provided directory exists.
file
Path
Return type: Boolean
openspace.directoryExists(file)
directoryForPath
This function extracts the directory part of the passed path. For example, if the parameter is ‘C:\OpenSpace\foobar\foo.txt’, this function returns ‘C:\OpenSpace\foobar’.
file
Path
Return type: Path
openspace.directoryForPath(file)
downloadFile
Downloads a file from Lua interpreter
url
String
savePath
String
waitForCompletion
Boolean?
- Default value:false
Return type: void
openspace.downloadFile(url, savePath, waitForCompletion)
dpiScaling
Extracts the DPI scaling for either the GUI window or if there is no dedicated GUI window, the first window.
Return type: Number
openspace.dpiScaling()
fadeIn
Fades in the node(s) with the given identifier over the given time in seconds. The identifier can contain a tag and/or a wildcard to target several nodes. If the fade time is not provided then the ‘OpenSpaceEngine.FadeDuration’ property will be used instead. If the third argument (endScript) is provided then that script will be run after the fade is finished.
identifier
String
fadeTime
Number?
endScript
String?
Return type: void
openspace.fadeIn(identifier, fadeTime, endScript)
fadeOut
Fades out the node(s) with the given identifier over the given time in seconds. The identifier can contain a tag and/or a wildcard to target several nodes. If the fade time is not provided then the ‘OpenSpaceEngine.FadeDuration’ property will be used instead. If the third argument (endScript) is provided then that script will be run after the fade is finished.
identifier
String
fadeTime
Number?
endScript
String?
Return type: void
openspace.fadeOut(identifier, fadeTime, endScript)
fileExists
Checks whether the provided file exists.
file
String
Return type: Boolean
openspace.fileExists(file)
getProperty
Returns a list of property identifiers that match the passed regular expression
regex
String
Return type: String[]
openspace.getProperty(regex)
getPropertyValue
Returns the value the property, identified by the provided URI. Deprecated in favor of the ‘propertyValue’ function
Return type: void
openspace.getPropertyValue()
hasMission
Returns whether a mission with the provided name has been loaded.
missionName
String
Return type: Boolean
openspace.hasMission(missionName)
hasProperty
Returns whether a property with the given URI exists
uri
String
Return type: Boolean
openspace.hasProperty(uri)
hasSceneGraphNode
Checks whether the specifies SceneGraphNode is present in the current scene.
nodeName
String
Return type: Boolean
openspace.hasSceneGraphNode(nodeName)
interactionSphere
Returns the interaction sphere of the scene graph node with the given string as identifier.
identifier
String
Return type: Number
openspace.interactionSphere(identifier)
invertBooleanProperty
Inverts the value of a boolean property with the given identifier
identifier
String
Return type: void
openspace.invertBooleanProperty(identifier)
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 function also returns ‘true’.
Return type: Boolean
openspace.isMaster()
keyBindings
Returns the strings of the script that are bound to the passed key and whether they were local or remote key binds.
key
String
Return type: String[]
openspace.keyBindings(key)
layerServer
Returns the current layer server from the configuration
Return type: String
openspace.layerServer()
loadJson
Loads the provided JSON file and returns it back to the caller. Please note that if the JSON contains keys that array of an array type, they are converted into a Dictionary with numerical keys and the numerical keys start with 1.
path
Path
Return type: Table
openspace.loadJson(path)
loadMission
Load mission phases from file.
mission
Table
Return type: void
openspace.loadMission(mission)
makeIdentifier
Create a valid identifier from the provided input string. Will replace invalid characters like whitespaces and some punctuation marks with valid alternatives
input
String
Return type: String
openspace.makeIdentifier(input)
markInterestingNodes
This function marks the scene graph nodes identified by name as interesting, which will provide shortcut access to focus buttons and featured properties
sceneGraphNodes
String[]
Return type: void
openspace.markInterestingNodes(sceneGraphNodes)
markInterestingTimes
This function marks interesting times for the current scene, which will create shortcuts for a quick access
times
Table[]
Return type: void
openspace.markInterestingTimes(times)
nodeByRenderableType
Returns a list of all scene graph nodes in the scene that have a renderable of the specific type
type
String
Return type: String[]
openspace.nodeByRenderableType(type)
printDebug
Logs the passed value to the installed LogManager with a LogLevel of ‘Debug’. For Boolean, numbers, and strings, the internal values are printed, for all other types, the type is printed instead
Unnamed parameter of type *
Return type: void
openspace.printDebug()
printError
Logs the passed value to the installed LogManager with a LogLevel of ‘Error’. For Boolean, numbers, and strings, the internal values are printed, for all other types, the type is printed instead
Unnamed parameter of type *
Return type: void
openspace.printError()
printFatal
Logs the passed value to the installed LogManager with a LogLevel of ‘Fatal’. For Boolean, numbers, and strings, the internal values are printed, for all other types, the type is printed instead
Unnamed parameter of type *
Return type: void
openspace.printFatal()
printInfo
Logs the passed value to the installed LogManager with a LogLevel of ‘Info’. For Boolean, numbers, and strings, the internal values are printed, for all other types, the type is printed instead
Unnamed parameter of type *
Return type: void
openspace.printInfo()
printTrace
Logs the passed value to the installed LogManager with a LogLevel of ‘Trace’. For Boolean, numbers, and strings, the internal values are printed, for all other types, the type is printed instead
Unnamed parameter of type *
Return type: void
openspace.printTrace()
printWarning
Logs the passed value to the installed LogManager with a LogLevel of ‘Warning’. For Boolean, numbers, and strings, the internal values are printed, for all other types, the type is printed instead
Unnamed parameter of type *
Return type: void
openspace.printWarning()
property
Returns a list of property identifiers that match the passed regular expression
regex
String
Return type: String[]
openspace.property(regex)
propertyValue
Returns the value the property, identified by the provided URI. Deprecated in favor of the ‘propertyValue’ function
Return type: void
openspace.propertyValue()
readCSVFile
Loads the CSV file provided as a parameter and returns it as a vector containing the values of the each row. The inner vector has the same number of values as the CSV has columns. The second parameter controls whether the first entry in the returned outer vector is containing the names of the columns
file
Path
includeFirstLine
Boolean?
- Default value:false
Return type: String[][]
openspace.readCSVFile(file, includeFirstLine)
readFile
Reads a file from disk and return its contents.
file
Path
Return type: String
openspace.readFile(file)
rebindKey
Rebinds all scripts from the old key (first argument) to the new key (second argument)
oldKey
String
newKey
String
Return type: void
openspace.rebindKey(oldKey, newKey)
removeCustomProperty
identifier
String
Return type: void
openspace.removeCustomProperty(identifier)
removeInterestingNodes
This function removes unmarks the scene graph nodes identified by name as interesting, thus removing the shortcuts from the features properties list
sceneGraphNodes
String[]
Return type: void
openspace.removeInterestingNodes(sceneGraphNodes)
removeSceneGraphNode
Removes the SceneGraphNode identified by name or by extracting the ‘Identifier’ key if the parameter is a table.
node
String | Table
Return type: void
openspace.removeSceneGraphNode(node)
removeSceneGraphNodesFromRegex
Removes all SceneGraphNodes with identifiers matching the input regular expression.
name
String
Return type: void
openspace.removeSceneGraphNodesFromRegex(name)
removeScreenSpaceRenderable
Given a ScreenSpaceRenderable name this script will remove it from the RenderEngine. The parameter can also be a table in which case the ‘Identifier’ key is used to look up the name from the table.
identifier
String | Table
Return type: void
openspace.removeScreenSpaceRenderable(identifier)
removeTag
Removes a tag (second argument) from a scene graph node (first argument)
uri
String
tag
String
Return type: void
openspace.removeTag(uri, tag)
resetCamera
Resets the camera position to the same position where the profile originally started
Return type: void
openspace.resetCamera()
resetScreenshotNumber
Reset screenshot index to 0.
Return type: void
openspace.resetScreenshotNumber()
saveSettingsToProfile
Collects all changes that have been made since startup, including all property changes and assets required, requested, or removed. All changes will be added to the profile that OpenSpace was started with, and the new saved file will contain all of this information. If the argument is provided, the settings will be saved into new profile with that name. If the argument is blank, the current profile will be saved to a backup file and the original profile will be overwritten. The second argument determines if a file that already exists should be overwritten, which is ‘false’ by default.
saveFilePath
String?
overwrite
Boolean?
- Default value:true
Return type: void
openspace.saveSettingsToProfile(saveFilePath, overwrite)
sceneGraphNodes
Returns a list of all scene graph nodes in the scene
Return type: String[]
openspace.sceneGraphNodes()
screenSpaceRenderables
Returns a list of all screen-space renderables
Return type: String[]
openspace.screenSpaceRenderables()
setCurrentMission
Set the currnet mission.
missionName
String
Return type: void
openspace.setCurrentMission(missionName)
setDefaultDashboard
This function sets the default values for the dashboard consisting of ‘DashboardItemDate’, ‘DashboardItemSimulationIncrement’, ‘DashboardItemDistance’, ‘DashboardItemFramerate’, and ‘DashboardItemParallelConnection’
Return type: void
openspace.setDefaultDashboard()
setDefaultGuiSorting
This function sets the default GUI sorting for the space environment to increasing size, from solar system, through Milky Way, Universe and finishing with other elements
Return type: void
openspace.setDefaultGuiSorting()
setParent
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.
identifier
String
newParent
String
Return type: void
openspace.setParent(identifier, newParent)
setPathToken
Registers the path token provided by the first argument to the path in the second argument. If the path token already exists, it will be silently overridden.
pathToken
String
path
Path
Return type: void
openspace.setPathToken(pathToken, path)
setPropertyValue
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 to match the type that the property (or properties) expect. If the third is not present or is ‘0’, the value changes instantly, otherwise the change will take that many seconds and the value is interpolated at each step in between. The fourth parameter is an optional easing function if a ‘duration’ has been specified. If ‘duration’ is 0, this parameter value is ignored. Otherwise, it can be one of many supported easing functions. See easing.h for available functions. The fifth argument is another Lua script that will be executed when the interpolation provided in parameter 3 finishes. The URI is interpreted using a wildcard in which ‘’ is expanded to ‘(.)’ and bracketed components ‘{ }’ are interpreted as group tag names. Then, the passed value will be set on all properties that fit the regex + group name combination.
Return type: void
openspace.setPropertyValue()
setPropertyValueSingle
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 property expects. If the third is not present or is ‘0’, the value changes instantly, otherwise the change will take that many seconds and the value is interpolated at each step in between. The fourth parameter is an optional easing function if a ‘duration’ has been specified. If ‘duration’ is 0, this parameter value is ignored. Otherwise, it has to be one of the easing functions defined in the list below. This is the same as calling the setValue method and passing ‘single’ as the fourth argument to setPropertyValue. The fifth argument is another Lua script that will be executed when the interpolation provided in parameter 3 finishes. Avaiable easing functions: Linear, QuadraticEaseIn, QuadraticEaseOut, QuadraticEaseInOut, CubicEaseIn, CubicEaseOut, CubicEaseInOut, QuarticEaseIn, QuarticEaseOut, QuarticEaseInOut, QuinticEaseIn, QuinticEaseOut, QuinticEaseInOut, SineEaseIn, SineEaseOut, SineEaseInOut, CircularEaseIn, CircularEaseOut, CircularEaseInOut, ExponentialEaseIn, ExponentialEaseOut, ExponentialEaseInOut, ElasticEaseIn, ElasticEaseOut, ElasticEaseInOut, BounceEaseIn, BounceEaseOut, BounceEaseInOut
Return type: void
openspace.setPropertyValueSingle()
setScreenshotFolder
Sets the folder used for storing screenshots or session recording frames
newFolder
String
Return type: void
openspace.setScreenshotFolder(newFolder)
takeScreenshot
Take a screenshot and return the screenshot number. The screenshot will be stored in the ${SCREENSHOTS} folder.
Return type: Integer
openspace.takeScreenshot()
toggleFade
Toggles the fade state of the node(s) with the given identifier over the given time in seconds. The identifier can contain a tag and/or a wildcard to target several nodes. If the fade time is not provided then the “OpenSpaceEngine.FadeDuration” property will be used instead. If the third argument (endScript) is provided then that script will be run after the fade is finished.
identifier
String
fadeTime
Number?
endScript
String?
Return type: void
openspace.toggleFade(identifier, fadeTime, endScript)
toggleShutdown
Toggles the shutdown mode that will close the application after the countdown timer is reached
Return type: void
openspace.toggleShutdown()
unloadMission
Unloads a previously loaded mission.
missionName
String
Return type: void
openspace.unloadMission(missionName)
unzipFile
This function extracts the contents of a zip file. The first argument is the path to the zip file. The second argument is the directory where to put the extracted files. If the third argument is true, the compressed file will be deleted after the decompression is finished.
source
String
destination
String
deleteSource
Boolean?
- Default value:false
Return type: void
openspace.unzipFile(source, destination, deleteSource)
version
This function returns information about the current OpenSpace version. The resulting table has the structure:
Version = { Major = <number> Minor = <number> Patch = <number> }, Commit = <string> Branch = <string>
Return type: Table
openspace.version()
walkDirectory
Walks a directory and returns the contents of the directory as absolute paths. The first argument is the path of the directory that should be walked, the second argument determines if the walk is recursive and will continue in contained directories. The default value for this parameter is “false”. The third argument determines whether the table that is returned is sorted. The default value for this parameter is “false”.
path
Path
recursive
Boolean?
- Default value:false
sorted
Boolean?
- Default value:false
Return type: Path[]
openspace.walkDirectory(path, recursive, sorted)
walkDirectoryFiles
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 walked, the second argument determines if the walk is recursive and will continue in contained directories. The default value for this parameter is “false”. The third argument determines whether the table that is returned is sorted. The default value for this parameter is “false”.
path
Path
recursive
Boolean?
- Default value:false
sorted
Boolean?
- Default value:false
Return type: Path[]
openspace.walkDirectoryFiles(path, recursive, sorted)
walkDirectoryFolders
Walks a directory and returns the subfolders of the directory as absolute paths. The first argument is the path of the directory that should be walked, the second argument determines if the walk is recursive and will continue in contained directories. The default value for this parameter is “false”. The third argument determines whether the table that is returned is sorted. The default value for this parameter is “false”.
path
Path
recursive
Boolean?
- Default value:false
sorted
Boolean?
- Default value:false
Return type: Path[]
openspace.walkDirectoryFolders(path, recursive, sorted)
worldPosition
Returns the world position of the scene graph node with the given string as identifier.
identifier
String
Return type: vec3
openspace.worldPosition(identifier)
worldRotation
Returns the world rotation matrix of the scene graph node with the given string as identifier.
identifier
String
Return type: mat3x3
openspace.worldRotation(identifier)
writeDocumentation
Writes out documentation files
Return type: void
openspace.writeDocumentation()