-
Notifications
You must be signed in to change notification settings - Fork 26
Application control
Last revision: ver. 6.2 1 February 2015
These functions control execution and can be used to start stop and clean scripts, and to execute deferred code.
Sets the color used to clear the frame buffer. See Color
Enables or disables color buffer clearing at the beginning of each frame
Enables or disables depth buffer clearing at the beginning of each frame
Exits the application
Returns True
if the script is executing on the master node of a cluster display system.
Returns True
if the application is running in headless mode, i.e. without a display
system.
Queues a script command for execution. The command will be executed during the next update cycle.
For cluster systems only. When executed on the master node, it tells all the slaves (and itself) to execute the specified command. Useful to implement event handlers after some code executed only on the master node (i.e. caching of remote data).
A broadcastCommand
call executed on a slave node does nothing. A call on a non-cluster environment behaves like queueCommand
.
Example:
import urllib
# On the master node, fetch an image somewhere on the internet
if(isMaster())
urllib.urlretrieve("http://www.digimouth.com/news/media/2011/09/google-logo.jpg", "local-image.jpg")
# Call this when you are done
broadcastCommand('onImageLoaded()')
# This will be called on all nodes once the image is loaded. You can open the image here.
# (Assuming use of a shared filesystem in your cluster installation)
def onImageLoaded():
img = loadImage("local-image.jpg")
Spawns a new process which executed the specified command. The command can be the name of another executable or operating system command.
Runs an external script. The script is executed immediately. The script path accepts two macros:
-
OMEGA_DATA_ROOT
will be substituted with the default data directory for the omegalib installation -
OMEGA_APP_ROOT
will be substituted with the application directory for the installation (set throguh CMake at build configuration time)
Stops the current script, cleans the engine and get everything back to its initial state.
Like orun, but performs a cleanup first. Useful for runtime switching to a different application.
(v5.1) Returns the path to the current omegalib executable.
Returns a MissionControlClient instance if this application is running a mission control client. Returns None otherwise. Applications can start a mission control client when launched with the --mc client
or --mc @host:port
options specified. See the and CommandLine pages for more information.
Gets the name of the host running the slave instance of omegalib
Returns true if the specified host owns at least a tile in the specified tile rectangle. Example:
# Prints TRUE on hosts that are within the tile rectangle [1,1 -> 2,1]
if(isHostInTileSection(getHostname(), 1, 1, 2, 1) print('TRUE')
Enables or disables rendering for the specified tile region. Tiles need to be part of a tile grid to be controllable with this function.
Enables tiles based on their name. Accepts a string of space-separated tile names. Any tile not passed in the string will be disabled.
TODO
requires v6.0
Quick commands can be used as shortcuts to longer scripts. A quick command is defined by a short command string, a call string, number of arguments and optional description. The call string can contain tokens in the form %n%
that will be substituted by arguments passed to the quick command. The last argument to a quick command will be formed by joining all remaining tokens in the quick command call, allowing to pass long string containing spaces.
> addQuickCommand('add', 'print("%1% + %2% = {0}".format(%1% + %2%))', 2, 'addition')
> :add 1 2
1 + 2 = 3
> addQuickCommand('s', 'print("%1% - %2% - %3%")', 3, '')
> :s arg1 arg2 remainder argments here
arg1 - arg2 - remainder argments here
Method(s) | Description |
---|---|
addQuickCommand(string cmd, string call, int args, string description) |
Adds a new quick command with name cmd executing code call with the specified number of arguments and description |
removeQuickCommand(cmd) |
Removes quick command cmd
|