Modifying scripts

Yeah. Some of these scripts are just meant to be examples for people to learn from rather than useful in their own right. I need to add a simple way to copy the built in scripts to the user's Open Brush folder for further editing.
5 Replies
andybak
andybakOP2y ago
GitHub
open-brush/Assets/Resources/LuaScriptExamples at experiments/moonsh...
Open Source Fork of Tilt Brush. Contribute to IxxyXR/open-brush development by creating an account on GitHub.
andybak
andybakOP2y ago
For example here's "ManyAround":
Settings = {
space="widget"
}

Widgets = {
copies={label="Number of copies", type="int", min=0, max=36, default=4},
hueShift={label="Hue Shift", type="float", min=0, max=1, default=0}
}

function Main()
pointers = {}
Colors = {}
theta = 360.0 / copies
for i = 1, copies - 1 do
table.insert(pointers, {position={0, 0, -i/4.0}, rotation={0, i * theta, 0}})
if hueShift > 0 then
newColor = brush.lastColorPicked;
table.insert(Colors, color.newColor)
end
end
return pointers
end
Settings = {
space="widget"
}

Widgets = {
copies={label="Number of copies", type="int", min=0, max=36, default=4},
hueShift={label="Hue Shift", type="float", min=0, max=1, default=0}
}

function Main()
pointers = {}
Colors = {}
theta = 360.0 / copies
for i = 1, copies - 1 do
table.insert(pointers, {position={0, 0, -i/4.0}, rotation={0, i * theta, 0}})
if hueShift > 0 then
newColor = brush.lastColorPicked;
table.insert(Colors, color.newColor)
end
end
return pointers
end
andybak
andybakOP2y ago
I've actually forgotten to wire up Hue Shift so it's not currently doing anything. There's a simplified version of this script in the docs: https://docs.openbrush.app/alternate-and-experimental-builds/runtime-scripting#symmetry-scripts
andybak
andybakOP2y ago
function Main()
copies = 12
pointers = {}
theta = 360.0 / copies
for i = 1, copies - 1 do
table.insert(pointers, {position={0, 0, 0}, rotation={0, i * theta, 0}})
end
return pointers
end
function Main()
copies = 12
pointers = {}
theta = 360.0 / copies
for i = 1, copies - 1 do
table.insert(pointers, {position={0, 0, 0}, rotation={0, i * theta, 0}})
end
return pointers
end
Could benefit by the ability to set distance between strokes
try this one. it should behave the same as the 4 way mirror in Experimental Mode. It's a good script to learn from as it's so simple.
AncientWorlds
AncientWorlds2y ago
Very interesting. What's the table.insert function do?
Want results from more Discord servers?
Add your server