All the classes can be accessed from it, and it can be passed to a different context.
Properties:
Name | Type | Description |
---|---|---|
debug_level |
int | The debug level of the DOM. |
batchMode |
bool | Deactivate all ui and incompatible functions to ensure scripts run in batch. |
file |
string | The openHarmony base file - THIS! |
getScene |
$.oScene | The harmony scene. |
scene |
$.oScene | The harmony scene. |
scn |
$.oScene | The harmony scene. |
s |
$.oScene | The harmony scene. |
getApplication |
$.oApp | The Harmony Application Object. |
application |
$.oApp | The Harmony Application Object. |
app |
$.oApp | The Harmony Application Object. |
network |
$.oNetwork | Access point for all the functions of the $.oNetwork class |
utils |
$.oUtils | Access point for all the functions of the $.oUtils class |
dialog |
$.oDialog | Access point for all the functions of the $.oDialog class |
global |
Object | The global scope. |
Example
// To access the functions, first call the $ object. It is made available after loading openHarmony like so:
include ("openHarmony.js");
var doc = $.scn; // grabbing the scene document
$.log("hello"); // prints out a message to the MessageLog.
var myPoint = new $.oPoint(0,0,0); // create a new class instance from an openHarmony class.
// function members of the $ objects get published to the global scope, which means $ can be ommited
log("hello");
var myPoint = new oPoint(0,0,0); // This is all valid
var doc = scn; // "scn" isn't a function so this one isn't
Classes
- oActionButton
- oApp
- oArtLayer
- oAttribute
- oBackdrop
- oBox
- oColor
- oColorButton
- oColorOverrideNode
- oColorValue
- oColumn
- oColumnLayer
- oContour
- oDatabase
- oDialog
- oDrawing
- oDrawingColumn
- oDrawingLayer
- oDrawingNode
- oElement
- oFile
- oFillStyle
- oFolder
- oFrame
- oGroupNode
- oLayer
- oLineStyle
- oLink
- oLinkPath
- oList
- oMatrix
- oMetadata
- oNetwork
- oNode
- oNodeLayer
- oNodeLink
- oPalette
- oPathPoint
- oPegNode
- oPieButton
- oPieMenu
- oPieSubMenu
- oPoint
- oPrefButton
- oPreference
- oPreferences
- oProcess
- oProgressDialog
- oScene
- oScriptButton
- oShape
- oSignal
- oStencil
- oStroke
- oThread
- oTimeline
- oTool
- oToolbar
- oToolButton
- oTransformNamesObject
- oTransformSwitchNode
- oVector
- oVertex
- oXml
Members
-
DEBUG_LEVEL
-
Enum to set the debug level of debug statements.
-
directorystring
-
The openHarmony main Install directory
-
useCachebool
-
change this value to allow self caching across openHarmony when initialising objects.
Methods
-
static$.chooseFile(text, filter, getExisting, acceptMultiple, startDirectory){Array.<oFile>}
openHarmony.js, line 322 -
Prompts with a file selector window
Name Type Default Description text
string "Select a file:" optional The title of the file browser dialog. filter
string "*" optional The filter for the file type and/or file name that can be selected. Accepts wildcard charater "*". getExisting
string true optional Whether to select an existing file or a save location acceptMultiple
string false optional Whether or not selecting more than one file is ok. Is ignored if getExisting is false. startDirectory
string optional The directory showed at the opening of the dialog. Returns:
Type Description Array.<oFile> An oFile array, or 'undefined' if the dialog is cancelled -
static$.chooseFolder(text, startDirectory){oFolder}
openHarmony.js, line 332 -
Prompts with a browse for folder dialog.
Name Type Description text
string optional The title of the file browser dialog. startDirectory
string optional The directory showed at the opening of the dialog. Returns:
Type Description oFolder An oFolder for the selected folder, or undefined if dialog was cancelled -
static$.clearOpenHarmonyCache()
openHarmony.js, line 483 -
invalidate all cache for classes that are self caching. Will be run at each include('openHarmony.js') statement.
-
static$.getInstanceFromCache()
openHarmony.js, line 450 -
function to call in constructors of classes so that instances of this class are cached and unique based on constructor arguments.
Returns:
a cached class instance or null if no cached instance exists. -
static$.lerp(a, b, t){float}
openHarmony.js, line 504 -
Linear interpolation between two floating point numerical values
Name Type Description a
float the first value to interpolate from b
float the second value to interpolate towards t
float a number between 0 (returns a) and 1 (returns b) Returns:
Type Description float the value interpolated between a and b at the proportion t -
static$.oUtils()
openHarmony/openHarmony_misc.js, line 60 -
The $.oUtils helper class -- providing generic utilities. Doesn't need instanciation.
-
alert(labelText, title, okButtonText)
openHarmony.js, line 237 -
Prompts with an alert dialog (informational).
Name Type Description labelText
string optional The label/internal text of the dialog. title
string optional The title of the confirmation dialog. okButtonText
string optional The text on the OK button of the dialog. -
alertBox(labelText, title, okButtonText)
openHarmony.js, line 249 -
Prompts with an alert dialog with a text box which can be selected (informational).
Name Type Description labelText
string optional The label/internal text of the dialog. title
string optional The title of the confirmation dialog. okButtonText
string optional The text on the OK button of the dialog. -
beginUndo(undoName)
openHarmony.js, line 354 -
Starts the tracking of the undo accumulation, all subsequent actions are done in a single undo operation.
Close the undo accum with $.endUndo(). If this function is called multiple time, only the first time will count. (this prevents small functions wrapped in their own undo block to interfere with global script undo)Name Type Description undoName
string The name of the operation that is being done in the undo accum. - See:
-
- $.endUndo
-
browseForFile(text, filter, getExisting, acceptMultiple, startDirectory){Array.<string>}
openHarmony.js, line 285 -
Prompts with a file selector window
Name Type Default Description text
string "Select a file:" optional The title of the file select dialog. filter
string "*" optional The filter for the file type and/or file name that can be selected. Accepts wildcard character "*". getExisting
string true optional Whether to select an existing file or a save location acceptMultiple
string false optional Whether or not selecting more than one file is ok. Is ignored if getExisting is false. startDirectory
string optional The directory showed at the opening of the dialog. Returns:
Type Description Array.<string> The list of selected Files, 'undefined' if the dialog is cancelled -
browseForFolder(text, startDirectory){string}
openHarmony.js, line 300 -
Prompts with a folder selector window.
Name Type Description text
string optional The title of the confirmation dialog. startDirectory
string optional The directory showed at the opening of the dialog. Returns:
Type Description string The path of the selected folder, 'undefined' if the dialog is cancelled -
cancelUndo()
openHarmony.js, line 371 -
Cancels the tracking of the undo accumulation, everything between this and the start of the accumulation is undone.
-
confirm(labelText, title, okButtonText, cancelButtonText){bool}
openHarmony.js, line 223 -
Prompts with a confirmation dialog (yes/no choice).
Name Type Description labelText
string optional The label/internal text of the dialog. title
string optional The title of the confirmation dialog. okButtonText
string optional The text on the OK button of the dialog. cancelButtonText
string optional The text on the CANCEL button of the dialog. Returns:
Type Description bool Result of the confirmation dialog. -
debug(obj, level)
openHarmony.js, line 157 -
The standard debug that uses logic and level to write to the messagelog. Everything should just call this to write internally to a log in OpenHarmony.
Name Type Description obj
obj Description. level
int The debug level of the incoming message to log. -
endUndo()
openHarmony.js, line 380 -
Stops the tracking of the undo accumulation, everything between this and the start of the accumulation behaves as a single undo operation. If beginUndo function is called multiple time, each call must be matched with this function. (this prevents small functions wrapped in their own undo block to interfere with global script undo)
- See:
-
- $.beginUndo
-
getHarmonyUIWidget(name, parentName)
openHarmony.js, line 335 -
Gets access to a widget from the Harmony Interface.
Name Type Description name
string The name of the widget to look for. parentName
string optional The name of the parent widget to look into, in case of duplicates. -
getPreferences()
openHarmony.js, line 419 -
Gets the preferences from the Harmony stage.
-
log(str)
openHarmony.js, line 176 -
Log the string to the MessageLog.
Name Type Description str
string Text to log. -
logObj(object, debugLevel)
openHarmony.js, line 188 -
Log the object and its contents.
Name Type Description object
object The object to log. debugLevel
int The debug level. -
prompt(labelText, title, prefilledText)
openHarmony.js, line 274 -
Prompts for a user input.
Name Type Description labelText
string optional The label/internal text of the dialog. title
string optional The title of the confirmation dialog. prefilledText
string optional The text to display in the input area. -
redo(dist)
openHarmony.js, line 407 -
Redoes the last n operations. If n is not specified, it will be 1
Name Type Description dist
int The amount of operations to undo. -
toast(labelText, position, duration, color)
openHarmony.js, line 261 -
Prompts with an toast alert. This is a small message that can't be clicked and only stays on the screen for the duration specified.
Name Type Default Description labelText
string The label/internal text of the dialog. position
$.oPoint optional The position on the screen where the toast will appear (by default, slightly under the middle of the screen). duration
float 2000 optional The duration of the display (in milliseconds). color
$.oColorValue "#000000" optional The color of the background (a 50% alpha value will be applied). -
undo(dist)
openHarmony.js, line 396 -
Undoes the last n operations. If n is not specified, it will be 1
Name Type Description dist
int The amount of operations to undo.