Skip to content

Commit

Permalink
Update scripts to use new widgets
Browse files Browse the repository at this point in the history
[CI BUILD]
  • Loading branch information
andybak committed Jan 10, 2024
1 parent 4a98f04 commit 8d7887d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Parameters = {
numPointsWidth={label="Number of points along width", type="int", min=2, max=32, default=5},
numPointsHeight={label="Number of points along height", type="int", min=2, max=32, default=5},
spacing={label="Spacing", type="float", min=0.001 , max=1, default=.2},
exteriorOnly={label="Exterior Only", type="int", min=0, max=1, default=1},
exteriorOnly={label="Exterior Only?", type="toggle", default=true},
}

symmetryHueShift = require "symmetryHueShift"
Expand All @@ -17,7 +17,7 @@ end

function Main()

if Parameters.exteriorOnly==1 then
if Parameters.exteriorOnly then
points = calculateRectangleExteriorPoints()
else
points = calculateRectanglePoints()
Expand Down
18 changes: 11 additions & 7 deletions Assets/Resources/LuaScriptExamples/ToolScript.Words.lua
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
Settings = {
description="Draws words that follows your brush. Tries to access the clipboard so try copying in some text.",
description="Draws words that follows your brush",
space="canvas"
}

Parameters = {
size={label="Size", type="float", min=0.01, max=1, default=0.25},
spacing={label="Spacing", type="float", min=0.01, max=1, default=0.25},
text={label="Text", type="text", default="Hello World"},
useClipboard={label="Use Clipboard Text?", type="toggle", default=false},
}

function Main()

if Brush.triggerPressedThisFrame then

text = App.clipboardText
if text == nil or string.len(text) == 0 then
text = "Hello World"
if Parameters.useClipboard then
chosenText = App.clipboardText
else
chosenText = Parameters.text
end
text = text .. " "

chosenText = chosenText .. " "
letterCount = 0
distance = 0
distanceLastFrame = 0
Expand All @@ -27,14 +31,14 @@ function Main()
distance = distance + distanceMovedThisFrame
if distance > Parameters.spacing then
letterCount = letterCount + 1
letter = string.sub(text, letterCount, letterCount)
letter = string.sub(chosenText, letterCount, letterCount)
rot = Brush.rotation
transform = Transform:New(Brush.position, rot, Parameters.size)
paths = PathList:FromText(letter)
paths:TransformBy(transform)
paths:SampleByDistance(0.01)
paths:Draw()
letterCount = letterCount % string.len(text)
letterCount = letterCount % string.len(chosenText)
distance = 0
end
end
Expand Down

0 comments on commit 8d7887d

Please sign in to comment.