Skip to content

Latest commit

 

History

History
500 lines (194 loc) · 10.6 KB

File metadata and controls

500 lines (194 loc) · 10.6 KB

App

Summary

Various properties and methods that effect the entire app

Class Properties

NameReturn TypeDescription
timenumber
Read-only
The time in seconds since Open Brush was launched
framesnumber
Read-only
The number of frames that have been rendered since Open Brush was launched
physicsboolean
Read/Write
Whether physics simulation is active (defaults is off)
currentScalenumber
Read-only
The current scale of the scene
environmentstring
Read/Write
Get or set the current environment by name
clipboardTextstring
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
urlstringThe 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
activebooleanTrue means activate, false means deactivate

Example

App:StraightEdge(true)

App:AutoOrient(active)

Activate or deactivate auto orientation mode

Returns: nil

Parameters:

NameTypeDefaultDescription
activebooleanTrue means activate, false means deactivate

Example

App:AutoOrient(true)

App:ViewOnly(active)

Activate or deactivate view only mode

Returns: nil

Parameters:

NameTypeDefaultDescription
activebooleanTrue means activate, false means deactivate

Example

App:ViewOnly(true)

App:AutoSimplify(active)

Activate or deactivate auto simplification mode

Returns: nil

Parameters:

NameTypeDefaultDescription
activebooleanTrue means activate, false means deactivate

Example

App:AutoSimplify(true)

App:Disco(active)

Activate or deactivate disco mode

Returns: nil

Parameters:

NameTypeDefaultDescription
activebooleanTrue means activate, false means deactivate

Example

App:Disco(true)

App:Profiling(active)

Activate or deactivate profiling mode

Returns: nil

Parameters:

NameTypeDefaultDescription
activebooleanTrue means activate, false means deactivate

Example

App:Profiling(true)

App:PostProcessing(active)

Activate or deactivate post-processing

Returns: nil

Parameters:

NameTypeDefaultDescription
activebooleanTrue 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
activebooleanTrue 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
pathstringThe 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
messagestringThe 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
fontDatastringFont 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
trTransformDetermines the position and orientation of the camera used to take the snapshot
filenamestringThe filename to use for the saved snapshot
widthnumberImage width
heightnumberImage height
superSamplingnumber1The supersampling strength to apply (between 0.125 and 4.0)
renderDepthbooleanfalseIf true then render the depth buffer instead of the image
removeBackgroundbooleanfalse

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
trTransformDetermines the position and orientation of the camera used to take the snapshot
filenamestringThe filename to use for the saved snapshot
widthnumber4096The width of the image

Example

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