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 |
|
Get a dictionary containing the current map with custom orderings for the Scene GUI tree |
|
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 |
|
A utility function to check whether an object is empty or not |
|
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 of the property identified by the provided URI |
|
Returns the number of bytes of system memory that is currently being used |
|
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 |
|
Reads a file from disk and return its as a list of lines |
|
Rebinds all scripts from the old key (first argument) to the new key (second argument) |
|
This function registers another Lua script that will be periodically executed as long as the application is running |
|
This function removes unmarks the scene graph nodes identified by name as interesting, thus removing the shortcuts from the features properties list |
|
Removes a previously registered repeated script (see #registerRepeatedScript) |
|
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 |
|
Returns the target path for a Windows shortcut file |
|
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 |
|
Schedules a |
|
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’ |
|
Set a custom ordering of the items in a specific branch in the Scene GUI tree, i |
|
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 the property or properties identified by the URI to the specified value |
|
Sets the single property identified by the URI to the specified value |
|
Sets the folder used for storing screenshots or session recording frames |
|
Take a screenshot and return the screenshot number |
|
A utility function to return a specific value based on a True/False condition |
|
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 |
|
Returns the number of bytes of video memory that is currently being used |
|
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
uri
String
Return type: String | Number | Boolean | Table
openspace.getPropertyValue(uri)
guiOrder
Get a dictionary containing the current map with custom orderings for the Scene GUI tree. Each key in the dictionary corresponds to a branch in the tree, i.e. a specific GUI path.
Return type: Table
openspace.guiOrder()
hasMission
Returns whether a mission with the provided name has been loaded.
identifier
String
Return type: Boolean
openspace.hasMission(identifier)
hasProperty
Returns whether a property with the given URI exists. The uri
identifies the property or properties that are checked by this function and can include both wildcards *
which match anything, as well as tags ({tag}
) which match scene graph nodes that have this tag. There is also the ability to combine two tags through the &
, |
, and ~
operators. {tag1&tag2}
will match anything that has the tag1 and the tag2. {tag1|tag2}
will match anything that has the tag1 or the tag 2, and {tag1~tag2}
will match anything that has tag1 but not tag2. If no wildcards or tags are provided at most one property value will be changed. With wildcards or tags all properties that match the URI are changed instead.
uri
String
The URI that identifies the property or properties whose values should be changed. The URI can contain 0 or 1 wildcard
*
characters or a tag expression ({tag}
) that identifies a property owner.
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)
isEmpty
A utility function to check whether an object is empty or not. Identifies nil
objects, Tables without any keys, and empty strings.
object
any
The object to check
Return type: Boolean
A Boolean that specifies if the object is empty or not
openspace.isEmpty(object)
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. The uri
identifies the property or properties that are returned by this function and can include both wildcards *
which match anything, as well as tags ({tag}
) which match scene graph nodes that have this tag. There is also the ability to combine two tags through the &
, |
, and ~
operators. {tag1&tag2}
will match anything that has the tag1 and the tag2. {tag1|tag2}
will match anything that has the tag1 or the tag 2, and {tag1~tag2}
will match anything that has tag1 but not tag2. If no wildcards or tags are provided at most one property value will be changed. With wildcards or tags all properties that match the URI are changed instead.
uri
String
The URI that identifies the property or properties whose values should be changed. The URI can contain 0 or 1 wildcard
*
characters or a tag expression ({tag}
) that identifies a property owner.
Return type: String[]
openspace.property(uri)
propertyValue
Returns the value of the property identified by the provided URI. This function will provide an error message if no property matching the URI is found.
uri
String
Return type: String | Number | Boolean | Table
openspace.propertyValue(uri)
ramInUse
Returns the number of bytes of system memory that is currently being used. This function only works on Windows.
Return type: Number
openspace.ramInUse()
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)
readFileLines
Reads a file from disk and return its as a list of lines.
file
Path
Return type: String[]
openspace.readFileLines(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)
registerRepeatedScript
This function registers another Lua script that will be periodically executed as long as the application is running. The identifier
is used to later remove the script. The script
is being executed every timeout
seconds. This timeout is only as accurate as the framerate at which the application is running. Optionally the preScript
Lua script is run when registering the repeated script and the postScript
is run when unregistering it or when the application closes. If the timeout
is 0, the script will be executed every frame. The identifier
has to be a unique name that cannot have been used to register a repeated script before. A registered script is removed with the #removeRepeatedScript function.
identifier
String
script
String
timeout
Number?
- Default value:0.0
preScript
String?
- Default value:""
postScript
String?
- Default value:""
Return type: void
openspace.registerRepeatedScript(identifier, script, timeout, preScript, postScript)
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)
removeRepeatedScript
Removes a previously registered repeated script (see #registerRepeatedScript)
identifier
String
Return type: void
openspace.removeRepeatedScript(identifier)
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.
regex
String
Return type: void
openspace.removeSceneGraphNodesFromRegex(regex)
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()
resolveShortcut
Returns the target path for a Windows shortcut file. This function will produce an error on non-Windows operating systems. The path
has to be a valid Windows Shell link file.
path
Path
Return type: Path
openspace.resolveShortcut(path)
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()
scheduleScript
Schedules a script
to be run in delay
seconds. The delay is measured in wallclock time, which is seconds that occur in the real world, not in relation to the in-game time.
script
String
delay
Number
Return type: void
openspace.scheduleScript(script, delay)
screenSpaceRenderables
Returns a list of all screen-space renderables
Return type: String[]
openspace.screenSpaceRenderables()
setCurrentMission
Set the currnet mission.
identifier
String
Return type: void
openspace.setCurrentMission(identifier)
setDefaultDashboard
This function sets the default values for the dashboard consisting of ‘DashboardItemDate’, ‘DashboardItemSimulationIncrement’, ‘DashboardItemDistance’, ‘DashboardItemFramerate’, and ‘DashboardItemParallelConnection’.
Return type: void
openspace.setDefaultDashboard()
setGuiOrder
Set a custom ordering of the items in a specific branch in the Scene GUI tree, i.e. for a specific GUI path.
guiPath
String
The GUI path for which the order should be set.
list
String[]
A list of names of scene graph nodes or subgroups in the GUI, in the order of which they should appear in the tree. The list does not have to include all items in the given GUI path. Any excluded items will be placed after the ones in the list.
Return type: void
openspace.setGuiOrder(guiPath, list)
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 the property or properties identified by the URI to the specified
value. The uri
identifies which property or properties are affected by this function
call and can include both wildcards *
which match anything, as well as tags ({tag}
)
which match scene graph nodes that have this tag. There is also the ability to combine two
tags through the &
, |
, and ~
operators. {tag1&tag2}
will match anything that has
the tag1 and the tag2. {tag1|tag2}
will match anything that has the tag1 or the tag 2,
and {tag1~tag2}
will match anything that has tag1 but not tag2. If no wildcards or tags
are provided at most one property value will be changed. With wildcards or tags all
properties that match the URI are changed instead. The second argument’s type must match
the type of the property or properties or an error is raised. If a duration is provided,
the requested change will occur over the provided number of seconds. If no duration is
provided or the duration is 0, the change occurs instantaneously.
For example openspace.setPropertyValue("*Trail.Renderable.Enabled", true)
will enable
any property that ends with “Trail.Renderable.Enabled”, for example
“StarTrail.Renderable.Enabled”, “EarthTrail.Renderable.Enabled”, but not
“EarthTrail.Renderable.Size”.
openspace.setPropertyValue("{tag1}.Renderable.Enabled", true)
will enable any node in
the scene that has the “tag1” assigned to it.
If you only want to change a single property value, also see the #setPropertyValueSingle
function as it will do so in a more efficient way. The setPropertyValue
function will
work for individual property value, but is more computationally expensive.
uri
String
The URI that identifies the property or properties whose values should be changed. The URI can contain 0 or 1 wildcard
*
characters or a tag expression ({tag}
) that identifies a property owner
value
String | Number | Boolean | Table
The new value to which the property/properties identified by the
uri
should be changed to. The type of this parameter must agree with the type of the selected property
duration
Number?
- Default value:0.0
The number of seconds over which the change will occur. If not provided or the provided value is 0, the change is instantaneously.
easing
EasingFunction?
- Default value:Linear
If a duration larger than 0 is provided, this parameter controls the manner in which the parameter is interpolated. Has to be one of “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”
postscript
String?
A Lua script that will be executed once the change of property value is completed. If a duration larger than 0 was provided, it is at the end of the interpolation. If 0 was provided, the script runs immediately.
Return type: void
openspace.setPropertyValue(uri, value, duration, easing, postscript)
setPropertyValueSingle
Sets the single property identified by the URI to the specified value.
The uri
identifies which property is affected by this function call. The second
argument’s type must match the type of the property or an error is raised. If a duration
is provided, the requested change will occur over the provided number of seconds. If no
duration is provided or the duration is 0, the change occurs instantaneously.
If you want to change multiple property values simultaneously, also see the
#setPropertyValue function. The setPropertyValueSingle
function however will work more
efficiently for individual property values.
uri
String
The URI that identifies the property
value
String | Number | Boolean | Table
The new value to which the property identified by the
uri
should be changed to. The type of this parameter must agree with the type of the selected property
duration
Number?
- Default value:0.0
The number of seconds over which the change will occur. If not provided or the provided value is 0, the change is instantaneously.
easing
EasingFunction?
- Default value:Linear
If a duration larger than 0 is provided, this parameter controls the manner in which the parameter is interpolated. Has to be one of “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”
postscript
String?
This parameter specifies a Lua script that will be executed once the change of property value is completed. If a duration larger than 0 was provided, it is at the end of the interpolation. If 0 was provided, the script runs immediately.
Return type: void
openspace.setPropertyValueSingle(uri, value, duration, easing, postscript)
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()
ternary
A utility function to return a specific value based on a True/False condition.
condition
Boolean
The condition to check against
trueValue
any
The value to return if the condition is True
falseValue
any
The value to return if the condition is False
Return type: any
Either the trueValue of falseValue, depending on if the condition is true
or not
openspace.ternary(condition, trueValue, falseValue)
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.
identifierOrMission
String | Table
Return type: void
openspace.unloadMission(identifierOrMission)
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()
vramInUse
Returns the number of bytes of video memory that is currently being used. This function only works on Windows.
Return type: Number
openspace.vramInUse()
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()