openspace

Functions overview

Name

Documentation

absPath

Passes the argument to FileSystem::absolutePath, which resolves occuring path tokens and returns the absolute path

addCustomProperty

Creates a new property that lives in the UserProperty group

addSceneGraphNode

Loads the SceneGraphNode described in the table and adds it to the SceneGraph

addScreenSpaceRenderable

/ Will create a ScreenSpaceRenderable from a lua Table and add it in the RenderEngine

addTag

Adds a Tag to a SceneGraphNode identified by the provided uri

addToPropertyValue

Add a value to the property with the given identifier

appendToListProperty

Add a value to the list property with the given identifier

bindKey

Binds a key to Lua command to both execute locally and broadcast to all clients if this node is hosting a parallel connection

boundingSphere

Returns the bounding sphere of the scene graph node with the given string as identifier

clearKey

Unbinds the key or keys that have been provided

clearKeys

Clear all key bindings

configuration

Returns the whole configuration object as a Dictionary

createDirectory

Creates a directory at the provided path, returns true if directory was newly created and false otherwise

createSingleColorImage

Creates a 1 pixel image with a certain color in the cache folder and returns the path to the file

directoryExists

Checks whether the provided directory exists

directoryForPath

This function extracts the directory part of the passed path

downloadFile

Downloads a file from Lua interpreter

dpiScaling

Extracts the DPI scaling for either the GUI window or if there is no dedicated GUI window, the first window

fadeIn

Fades in the node(s) with the given identifier over the given time in seconds

fadeOut

Fades out the node(s) with the given identifier over the given time in seconds

fileExists

Checks whether the provided file exists

getProperty

Returns a list of property identifiers that match the passed regular expression

getPropertyValue

Returns the value the property, identified by the provided URI

guiOrder

Get a dictionary containing the current map with custom orderings for the Scene GUI tree

hasMission

Returns whether a mission with the provided name has been loaded

hasProperty

Returns whether a property with the given URI exists

hasSceneGraphNode

Checks whether the specifies SceneGraphNode is present in the current scene

interactionSphere

Returns the interaction sphere of the scene graph node with the given string as identifier

invertBooleanProperty

Inverts the value of a boolean property with the given identifier

isEmpty

A utility function to check whether an object is empty or not

isMaster

Returns whether the current OpenSpace instance is the master node of a cluster configuration

keyBindings

Returns the strings of the script that are bound to the passed key and whether they were local or remote key binds

layerServer

Returns the current layer server from the configuration

loadJson

Loads the provided JSON file and returns it back to the caller

loadMission

Load mission phases from file

makeIdentifier

Create a valid identifier from the provided input string

markInterestingNodes

This function marks the scene graph nodes identified by name as interesting, which will provide shortcut access to focus buttons and featured properties

markInterestingTimes

This function marks interesting times for the current scene, which will create shortcuts for a quick access

nodeByRenderableType

Returns a list of all scene graph nodes in the scene that have a renderable of the specific type

printDebug

Logs the passed value to the installed LogManager with a LogLevel of ‘Debug’

printError

Logs the passed value to the installed LogManager with a LogLevel of ‘Error’

printFatal

Logs the passed value to the installed LogManager with a LogLevel of ‘Fatal’

printInfo

Logs the passed value to the installed LogManager with a LogLevel of ‘Info’

printTrace

Logs the passed value to the installed LogManager with a LogLevel of ‘Trace’

printWarning

Logs the passed value to the installed LogManager with a LogLevel of ‘Warning’

property

Returns a list of property identifiers that match the passed regular expression

propertyValue

Returns the value of the property identified by the provided URI

ramInUse

Returns the number of bytes of system memory that is currently being used

readCSVFile

Loads the CSV file provided as a parameter and returns it as a vector containing the values of the each row

readFile

Reads a file from disk and return its contents

readFileLines

Reads a file from disk and return its as a list of lines

rebindKey

Rebinds all scripts from the old key (first argument) to the new key (second argument)

registerRepeatedScript

This function registers another Lua script that will be periodically executed as long as the application is running

removeCustomProperty

removeInterestingNodes

This function removes unmarks the scene graph nodes identified by name as interesting, thus removing the shortcuts from the features properties list

removeRepeatedScript

Removes a previously registered repeated script (see #registerRepeatedScript)

removeSceneGraphNode

Removes the SceneGraphNode identified by name or by extracting the ‘Identifier’ key if the parameter is a table

removeSceneGraphNodesFromRegex

Removes all SceneGraphNodes with identifiers matching the input regular expression

removeScreenSpaceRenderable

Given a ScreenSpaceRenderable name this script will remove it from the RenderEngine

removeTag

Removes a tag (second argument) from a scene graph node (first argument)

resetCamera

Resets the camera position to the same position where the profile originally started

resetScreenshotNumber

Reset screenshot index to 0

resolveShortcut

Returns the target path for a Windows shortcut file

saveSettingsToProfile

Collects all changes that have been made since startup, including all property changes and assets required, requested, or removed

sceneGraphNodes

Returns a list of all scene graph nodes in the scene

scheduleScript

Schedules a script to be run in delay seconds

screenSpaceRenderables

Returns a list of all screen-space renderables

setCurrentMission

Set the currnet mission

setDefaultDashboard

This function sets the default values for the dashboard consisting of ‘DashboardItemDate’, ‘DashboardItemSimulationIncrement’, ‘DashboardItemDistance’, ‘DashboardItemFramerate’, and ‘DashboardItemParallelConnection’

setGuiOrder

Set a custom ordering of the items in a specific branch in the Scene GUI tree, i

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

setPathToken

Registers the path token provided by the first argument to the path in the second argument

setPropertyValue

Sets the property or properties identified by the URI to the specified value

setPropertyValueSingle

Sets the single property identified by the URI to the specified value

setScreenshotFolder

Sets the folder used for storing screenshots or session recording frames

takeScreenshot

Take a screenshot and return the screenshot number

ternary

A utility function to return a specific value based on a True/False condition

toggleFade

Toggles the fade state of the node(s) with the given identifier over the given time in seconds

toggleShutdown

Toggles the shutdown mode that will close the application after the countdown timer is reached

unloadMission

Unloads a previously loaded mission

unzipFile

This function extracts the contents of a zip file

version

This function returns information about the current OpenSpace version

vramInUse

Returns the number of bytes of video memory that is currently being used

walkDirectory

Walks a directory and returns the contents of the directory as absolute paths

walkDirectoryFiles

Walks a directory and returns the files of the directory as absolute paths

walkDirectoryFolders

Walks a directory and returns the subfolders of the directory as absolute paths

worldPosition

Returns the world position of the scene graph node with the given string as identifier

worldRotation

Returns the world rotation matrix of the scene graph node with the given string as identifier

writeDocumentation

Writes out documentation files

Functions

absPath

Passes the argument to FileSystem::absolutePath, which resolves occuring path tokens and returns the absolute path.

Parameters
  • path String

Return type: Path

Signature
openspace.absPath(path)

addCustomProperty

Creates a new property that lives in the UserProperty group.

Parameters
  • 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

Signature
openspace.addCustomProperty(identifier, type, guiName, description, onChange)

addSceneGraphNode

Loads the SceneGraphNode described in the table and adds it to the SceneGraph.

Parameters
  • node Table

Return type: void

Signature
openspace.addSceneGraphNode(node)

addScreenSpaceRenderable

/ Will create a ScreenSpaceRenderable from a lua Table and add it in the RenderEngine

Parameters
  • screenSpace Table

Return type: void

Signature
openspace.addScreenSpaceRenderable(screenSpace)

addTag

Adds a Tag to a SceneGraphNode identified by the provided uri

Parameters
  • uri String

  • tag String

Return type: void

Signature
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.

Parameters
  • identifier String

  • value String | Number

Return type: void

Signature
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.

Parameters
  • identifier String

  • value any

Return type: void

Signature
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.

Parameters
  • key String

  • action String

Return type: void

Signature
openspace.bindKey(key, action)

boundingSphere

Returns the bounding sphere of the scene graph node with the given string as identifier.

Parameters
  • identifier String

Return type: Number

Signature
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.

Parameters
  • key String | String[]

Return type: void

Signature
openspace.clearKey(key)

clearKeys

Clear all key bindings

Return type: void

Signature
openspace.clearKeys()

configuration

Returns the whole configuration object as a Dictionary

Return type: Table

Signature
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

Parameters
  • path Path

  • recursive Boolean? - Default value: false

Return type: Boolean

Signature
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.

Parameters
  • name String

  • color vec3

Return type: Path

Signature
openspace.createSingleColorImage(name, color)

directoryExists

Checks whether the provided directory exists.

Parameters
  • file Path

Return type: Boolean

Signature
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’.

Parameters
  • file Path

Return type: Path

Signature
openspace.directoryForPath(file)

downloadFile

Downloads a file from Lua interpreter

Parameters
  • url String

  • savePath String

  • waitForCompletion Boolean? - Default value: false

Return type: void

Signature
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

Signature
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.

Parameters
  • identifier String

  • fadeTime Number?

  • endScript String?

Return type: void

Signature
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.

Parameters
  • identifier String

  • fadeTime Number?

  • endScript String?

Return type: void

Signature
openspace.fadeOut(identifier, fadeTime, endScript)

fileExists

Checks whether the provided file exists.

Parameters
  • file String

Return type: Boolean

Signature
openspace.fileExists(file)

getProperty

Returns a list of property identifiers that match the passed regular expression

Parameters
  • regex String

Return type: String[]

Signature
openspace.getProperty(regex)

getPropertyValue

Returns the value the property, identified by the provided URI. Deprecated in favor of the ‘propertyValue’ function

Parameters
  • uri String

Return type: String | Number | Boolean | Table

Signature
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

Signature
openspace.guiOrder()

hasMission

Returns whether a mission with the provided name has been loaded.

Parameters
  • identifier String

Return type: Boolean

Signature
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.

Parameters
  • 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

Signature
openspace.hasProperty(uri)

hasSceneGraphNode

Checks whether the specifies SceneGraphNode is present in the current scene.

Parameters
  • nodeName String

Return type: Boolean

Signature
openspace.hasSceneGraphNode(nodeName)

interactionSphere

Returns the interaction sphere of the scene graph node with the given string as identifier.

Parameters
  • identifier String

Return type: Number

Signature
openspace.interactionSphere(identifier)

invertBooleanProperty

Inverts the value of a boolean property with the given identifier.

Parameters
  • identifier String

Return type: void

Signature
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.

Parameters
  • object any

    • The object to check

Return type: Boolean A Boolean that specifies if the object is empty or not

Signature
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

Signature
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.

Parameters
  • key String

Return type: String[]

Signature
openspace.keyBindings(key)

layerServer

Returns the current layer server from the configuration

Return type: String

Signature
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.

Parameters
  • path Path

Return type: Table

Signature
openspace.loadJson(path)

loadMission

Load mission phases from file.

Parameters
  • mission Table

Return type: void

Signature
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

Parameters
  • input String

Return type: String

Signature
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.

Parameters
  • sceneGraphNodes String[]

Return type: void

Signature
openspace.markInterestingNodes(sceneGraphNodes)

markInterestingTimes

This function marks interesting times for the current scene, which will create shortcuts for a quick access.

Parameters
  • times Table[]

Return type: void

Signature
openspace.markInterestingTimes(times)

nodeByRenderableType

Returns a list of all scene graph nodes in the scene that have a renderable of the specific type

Parameters
  • type String

Return type: String[]

Signature
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

Parameters
  • Unnamed parameter of type *

Return type: void

Signature
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

Parameters
  • Unnamed parameter of type *

Return type: void

Signature
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

Parameters
  • Unnamed parameter of type *

Return type: void

Signature
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

Parameters
  • Unnamed parameter of type *

Return type: void

Signature
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

Parameters
  • Unnamed parameter of type *

Return type: void

Signature
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

Parameters
  • Unnamed parameter of type *

Return type: void

Signature
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.

Parameters
  • 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[]

Signature
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.

Parameters
  • uri String

Return type: String | Number | Boolean | Table

Signature
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

Signature
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

Parameters
  • file Path

  • includeFirstLine Boolean? - Default value: false

Return type: String[][]

Signature
openspace.readCSVFile(file, includeFirstLine)

readFile

Reads a file from disk and return its contents.

Parameters
  • file Path

Return type: String

Signature
openspace.readFile(file)

readFileLines

Reads a file from disk and return its as a list of lines.

Parameters
  • file Path

Return type: String[]

Signature
openspace.readFileLines(file)

rebindKey

Rebinds all scripts from the old key (first argument) to the new key (second argument).

Parameters
  • oldKey String

  • newKey String

Return type: void

Signature
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.

Parameters
  • identifier String

  • script String

  • timeout Number? - Default value: 0.0

  • preScript String? - Default value: ""

  • postScript String? - Default value: ""

Return type: void

Signature
openspace.registerRepeatedScript(identifier, script, timeout, preScript, postScript)

removeCustomProperty

Parameters
  • identifier String

Return type: void

Signature
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.

Parameters
  • sceneGraphNodes String[]

Return type: void

Signature
openspace.removeInterestingNodes(sceneGraphNodes)

removeRepeatedScript

Removes a previously registered repeated script (see #registerRepeatedScript)

Parameters
  • identifier String

Return type: void

Signature
openspace.removeRepeatedScript(identifier)

removeSceneGraphNode

Removes the SceneGraphNode identified by name or by extracting the ‘Identifier’ key if the parameter is a table.

Parameters
  • node String | Table

Return type: void

Signature
openspace.removeSceneGraphNode(node)

removeSceneGraphNodesFromRegex

Removes all SceneGraphNodes with identifiers matching the input regular expression.

Parameters
  • regex String

Return type: void

Signature
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.

Parameters
  • identifier String | Table

Return type: void

Signature
openspace.removeScreenSpaceRenderable(identifier)

removeTag

Removes a tag (second argument) from a scene graph node (first argument)

Parameters
  • uri String

  • tag String

Return type: void

Signature
openspace.removeTag(uri, tag)

resetCamera

Resets the camera position to the same position where the profile originally started

Return type: void

Signature
openspace.resetCamera()

resetScreenshotNumber

Reset screenshot index to 0.

Return type: void

Signature
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.

Parameters
  • path Path

Return type: Path

Signature
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.

Parameters
  • saveFilePath String?

  • overwrite Boolean? - Default value: true

Return type: void

Signature
openspace.saveSettingsToProfile(saveFilePath, overwrite)

sceneGraphNodes

Returns a list of all scene graph nodes in the scene

Return type: String[]

Signature
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.

Parameters
  • script String

  • delay Number

Return type: void

Signature
openspace.scheduleScript(script, delay)

screenSpaceRenderables

Returns a list of all screen-space renderables

Return type: String[]

Signature
openspace.screenSpaceRenderables()

setCurrentMission

Set the currnet mission.

Parameters
  • identifier String

Return type: void

Signature
openspace.setCurrentMission(identifier)

setDefaultDashboard

This function sets the default values for the dashboard consisting of ‘DashboardItemDate’, ‘DashboardItemSimulationIncrement’, ‘DashboardItemDistance’, ‘DashboardItemFramerate’, and ‘DashboardItemParallelConnection’.

Return type: void

Signature
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.

Parameters
  • 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

Signature
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.

Parameters
  • identifier String

  • newParent String

Return type: void

Signature
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.

Parameters
  • pathToken String

  • path Path

Return type: void

Signature
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.

Parameters
  • 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

Signature
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.

Parameters
  • 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

Signature
openspace.setPropertyValueSingle(uri, value, duration, easing, postscript)

setScreenshotFolder

Sets the folder used for storing screenshots or session recording frames

Parameters
  • newFolder String

Return type: void

Signature
openspace.setScreenshotFolder(newFolder)

takeScreenshot

Take a screenshot and return the screenshot number. The screenshot will be stored in the ${SCREENSHOTS} folder.

Return type: Integer

Signature
openspace.takeScreenshot()

ternary

A utility function to return a specific value based on a True/False condition.

Parameters
  • 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

Signature
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.

Parameters
  • identifier String

  • fadeTime Number?

  • endScript String?

Return type: void

Signature
openspace.toggleFade(identifier, fadeTime, endScript)

toggleShutdown

Toggles the shutdown mode that will close the application after the countdown timer is reached

Return type: void

Signature
openspace.toggleShutdown()

unloadMission

Unloads a previously loaded mission.

Parameters
  • identifierOrMission String | Table

Return type: void

Signature
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.

Parameters
  • source String

  • destination String

  • deleteSource Boolean? - Default value: false

Return type: void

Signature
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

Signature
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

Signature
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”.

Parameters
  • path Path

  • recursive Boolean? - Default value: false

  • sorted Boolean? - Default value: false

Return type: Path[]

Signature
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”.

Parameters
  • path Path

  • recursive Boolean? - Default value: false

  • sorted Boolean? - Default value: false

Return type: Path[]

Signature
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”.

Parameters
  • path Path

  • recursive Boolean? - Default value: false

  • sorted Boolean? - Default value: false

Return type: Path[]

Signature
openspace.walkDirectoryFolders(path, recursive, sorted)

worldPosition

Returns the world position of the scene graph node with the given string as identifier.

Parameters
  • identifier String

Return type: vec3

Signature
openspace.worldPosition(identifier)

worldRotation

Returns the world rotation matrix of the scene graph node with the given string as identifier.

Parameters
  • identifier String

Return type: mat3x3

Signature
openspace.worldRotation(identifier)

writeDocumentation

Writes out documentation files

Return type: void

Signature
openspace.writeDocumentation()