App

Summary

Various properties and methods that effect the entire app

Class Properties

NameReturn TypeDescription

time

number Read-only

The time in seconds since Open Brush was launched

frames

number Read-only

The number of frames that have been rendered since Open Brush was launched

physics

boolean Read/Write

Whether physics simulation is active (defaults is off)

currentScale

number Read-only

The current scale of the scene

environment

string Read/Write

Get or set the current environment by name

clipboardText

string Read/Write

Get or set the clipboard text

Class Methods

App:Undo()

Undo the last action

Returns: nil

Example

App:Undo()

App:Redo()

Redo the previously undone action

Returns: nil

Example

App:Redo()

App:AddListener(url)

Adds a url that should be sent the data for each stroke as soon as the user finishes drawing it

Returns: nil

Parameters:

NameTypeDefaultDescription

url

string

The url to send the stroke data to

Example

App:AddListener("http://example.com")

App:ResetPanels()

Reset all panels

Returns: nil

Example

App:ResetPanels()

App:ShowScriptsFolder()

Opens an Explorer/Finder window outside of VR showing the user's Scripts folder on the desktop (Mac/Windows only)

Returns: nil

Example

App:ShowScriptsFolder()

App:ShowExportFolder()

Opens an Explorer/Finder window outside of VR showing the user's Export folder on the desktop (Mac/Windows only)

Returns: nil

Example

App:ShowExportFolder()

App:ShowSketchesFolder()

Opens an Explorer/Finder window outside of VR showing the user's Sketches folder on the desktop (Mac/Windows only)

Returns: nil

Example

App:ShowSketchesFolder()

App:StraightEdge(active)

Activate or deactivate straight edge mode

Returns: nil

Parameters:

NameTypeDefaultDescription

active

boolean

True means activate, false means deactivate

Example

App:StraightEdge(true)

App:AutoOrient(active)

Activate or deactivate auto orientation mode

Returns: nil

Parameters:

NameTypeDefaultDescription

active

boolean

True means activate, false means deactivate

Example

App:AutoOrient(true)

App:ViewOnly(active)

Activate or deactivate view only mode

Returns: nil

Parameters:

NameTypeDefaultDescription

active

boolean

True means activate, false means deactivate

Example

App:ViewOnly(true)

App:AutoSimplify(active)

Activate or deactivate auto simplification mode

Returns: nil

Parameters:

NameTypeDefaultDescription

active

boolean

True means activate, false means deactivate

Example

App:AutoSimplify(true)

App:Disco(active)

Activate or deactivate disco mode

Returns: nil

Parameters:

NameTypeDefaultDescription

active

boolean

True means activate, false means deactivate

Example

App:Disco(true)

App:Profiling(active)

Activate or deactivate profiling mode

Returns: nil

Parameters:

NameTypeDefaultDescription

active

boolean

True means activate, false means deactivate

Example

App:Profiling(true)

App:PostProcessing(active)

Activate or deactivate post-processing

Returns: nil

Parameters:

NameTypeDefaultDescription

active

boolean

True means activate, false means deactivate

Example

App:PostProcessing(true)

App:DraftingVisible()

Set the drafting mode to visible

Returns: nil

Example

App:DraftingVisible()

App:DraftingTransparent()

Set the drafting mode to transparent

Returns: nil

Example

App:DraftingTransparent()

App:DraftingHidden()

Set the drafting mode to hidden

Returns: nil

Example

App:DraftingHidden()

App:Watermark(active)

Activate or deactivate the watermark

Returns: nil

Parameters:

NameTypeDefaultDescription

active

boolean

True means activate, false means deactivate

Example

App:Watermark(true)

App:ReadFile(path)

Read the contents of a file

Returns: string (The contents of the file as a string)

Parameters:

NameTypeDefaultDescription

path

string

The file path to read from. It must be relative to and contined within the Scripts folder

Example

App:ReadFile("path/to/file.txt")

App:Error(message)

Displays an error message on the back of the user's brush controller

Returns: nil

Parameters:

NameTypeDefaultDescription

message

string

The error message to display

Example

App:Error("This is an error message.")

App:SetFont(fontData)

Set the font used for drawing text

Returns: nil

Parameters:

NameTypeDefaultDescription

fontData

string

Font data in .chr format

Example

App:SetFont("fontData")

App:TakeSnapshot(tr, filename, width, height, superSampling, renderDepth, removeBackground)

Take a snapshot of your scene and save it to your Snapshots folder

Returns: nil

Parameters:

NameTypeDefaultDescription

tr

Determines the position and orientation of the camera used to take the snapshot

filename

string

The filename to use for the saved snapshot

width

number

Image width

height

number

Image height

superSampling

number

1

The supersampling strength to apply (between 0.125 and 4.0)

renderDepth

boolean

false

If true then render the depth buffer instead of the image

removeBackground

boolean

false

Example

App:TakeSnapshop(Transform:New(0, 12, 3), "mysnapshot.png", 1024, 768, true)

App:Take360Snapshot(tr, filename, width)

Take a 360-degree snapshot of the scene and save it

Returns: nil

Parameters:

NameTypeDefaultDescription

tr

Determines the position and orientation of the camera used to take the snapshot

filename

string

The filename to use for the saved snapshot

width

number

4096

The width of the image

Example

App:Take360Snapshot(Transform:Position(0, 12, 3), "my360snapshot.png", 4096)

Last updated