Skip to content

Latest commit

 

History

History
327 lines (140 loc) · 9.36 KB

File metadata and controls

327 lines (140 loc) · 9.36 KB

Brush

Summary

The user's brush

Class Properties

NameReturn TypeDescription
timeSincePressednumber
Read-only
Time in seconds since the brush trigger was last pressed
timeSinceReleasednumber
Read-only
Time in seconds since the brush trigger was last released
triggerIsPressedboolean
Read-only
Check whether the brush trigger is currently pressed
triggerPressedThisFrameboolean
Read-only
Check whether the brush trigger was pressed during the current frame
triggerReleasedThisFrameboolean
Read-only
Check whether the brush trigger was released during the current frame
distanceMovednumber
Read-only
The distance moved by the brush
distanceDrawnnumber
Read-only
The distance drawn by the brush (i.e. distance since the trigger was last pressed)
positionVector3
Read/Write
The 3D position of the Brush Controller's tip
rotationRotation
Read/Write
The 3D orientation of the Brush Controller's tip
directionVector3
Read-only
The vector representing the forward direction of the brush
sizenumber
Read/Write
The current brush size
pressurenumber
Read/Write
Brush pressure is determined by how far the trigger is pressed in
typestring
Read/Write
The current brush type
typesstring[]
Read-only
All brush types available via the UI
speednumber
Read-only
How fast the brush is currently moving
colorRgbColor
Read/Write
Gets or set brush color
colorHsvVector3
Read/Write
Gets or set brush color using a Vector3 representing hue, saturation and brightness
colorHtmlstring
Read/Write
The color of the brush as a valid HTML color string (either hex values or a color name)
lastColorPickedColor
Read-only
The last color picked by the brush.
LastColorPickedHsvVector3
Read-only
The last color picked by the brush in HSV.
currentPathPath
Read/Write
The current path of the brush. Assumes a stroke is in progress.

Class Methods

Brush:GetTypes(includeTags, excludeTags)

Brush types filtered by chosen tags

Returns: string[] (A filtered list of brush types)

Parameters:

NameTypeDefaultDescription
includeTagsstring[]Include brushes that have any of these tags
excludeTagsstring[]Exclude brushes that have any of these tags

Example

brushList = Brush:GetTypes({"audioreactive"}, {"particle"})

Brush:JitterColor()

Applies the current jitter settings to the brush color

Returns: nil

Example

Brush:JitterColor()

Brush:ResizeHistory(size)

Clears the history and sets it's size

Returns: nil

Parameters:

NameTypeDefaultDescription
sizenumberHow many frames of position/rotation to remember

Example

Brush:ResizeHistory(10)

Brush:SetHistorySize(size)

Sets the size of the history. Only clears it if the size has changed

Returns: nil

Parameters:

NameTypeDefaultDescription
sizenumberHow many frames of position/rotation to remember

Example

Brush:SetHistorySize(10)

Brush:GetPastPosition(back)

Recalls previous positions of the Brush from the history buffer

Returns: Vector3 (The position of the brush during the specified frame)

Parameters:

NameTypeDefaultDescription
backnumberHow many frames back in the history to look

Example

Brush:GetPastPosition(3)

Brush:GetPastRotation(back)

Recalls previous orientations of the Brush from the history buffer

Returns: Rotation (The rotation of the brush during the specified frame)

Parameters:

NameTypeDefaultDescription
backnumberHow many frames back in the history to look

Example

Brush:GetPastRotation(3)

Brush:ForcePaintingOn(active)

If set to true then the brush will draw strokes even if the trigger isn't being pressed.

Returns: nil

Parameters:

NameTypeDefaultDescription
activebooleanTrue means forced painting, false is normal behaviour

Example

Brush:ForcePaintingOn(true)

Brush:ForcePaintingOff(active)

If set to true then the brush will stop drawing strokes even if the trigger is still pressed.

Returns: nil

Parameters:

NameTypeDefaultDescription
activebooleanTrue means painting is forced off, false is normal behaviour

Example

Brush:ForcePaintingOff(true)

Brush:ForceNewStroke()

Forces the start of a new stroke - will stop painting this frame and start again the next.

Returns: nil

Example

Brush:ForceNewStroke()

Brush:GetShaderFloatParameters(type)

Gets a list of float property names for a brush

Returns: string[] (A list of float property names usable with Stroke:SetShaderFloat)

Parameters:

NameTypeDefaultDescription
typestringThe brush name

Example

Brush:GetShaderFloatParameters("Ink")

Brush:GetShaderColorParameters(type)

Gets a list of color property names for a brush

Returns: string[] (A list of color property names usable with Stroke:SetShaderColor)

Parameters:

NameTypeDefaultDescription
typestringThe brush name

Example

Brush:GetShaderColorParameters("Ink")

Brush:GetShaderTextureParameters(type)

Gets a list of texture property names for a brush

Returns: string[] (A list of texture property names usable with Stroke:SetShaderTexture)

Parameters:

NameTypeDefaultDescription
typestringThe brush name

Example

Brush:GetShaderTextureParameters("Ink")

Brush:GetShaderVectorParameters(type)

Gets a list of vector property names for a brush

Returns: string[] (A list of vector property names usable with Stroke:SetShaderVector)

Parameters:

NameTypeDefaultDescription
typestringThe brush name

Example

Brush:GetShaderVectorParameters("Ink")