mirror of
https://github.com/Nexoniarz/Fry3DX.git
synced 2026-11-03 04:24:26 +00:00
Scripts kept in the .fry (the Script panel lists the file's scripts: new, examples, open, duplicate, remove, rename); your own materials (Save its look as a material, kept for every file; fry.material in scripts); plug-ins: scripts in the plug-ins folder that stay loaded and add menu commands with settings (fry.command, fry.plugin), a Plug-ins window, three that come with it (stairs, scatter, more materials); a new About window; tests
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ffaa5e8001
commit
3bcd50033d
12 changed files with 969 additions and 93 deletions
13
content/Fry3DX/plugins/more_materials.lua
Normal file
13
content/Fry3DX/plugins/more_materials.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
-- More materials for the picker (Properties > Material), and for scripts: o.material = "marble".
|
||||
-- fry.material works in any script; in a plug-in they're there every time Fry3DX starts.
|
||||
fry.plugin{name = "More materials", about = "Marble, rose gold, titanium, carbon, jade, walnut and others."}
|
||||
|
||||
local list = {
|
||||
{"Marble", "#e8e4dc", 0, 0.15}, {"Black marble", "#1d1d20", 0, 0.12}, {"Rose gold", "#f2b6a0", 1, 0.2},
|
||||
{"Silver", "#f2f2f0", 1, 0.12}, {"Titanium", "#a8a6a0", 1, 0.35}, {"Carbon", "#202224", 0, 0.25},
|
||||
{"Jade", "#4f9e74", 0, 0.2}, {"Terracotta", "#c0603c", 0, 0.9}, {"Walnut", "#5b3a26", 0, 0.6},
|
||||
{"Oak", "#c49a64", 0, 0.65}, {"Red car paint", "#b0101a", 0.3, 0.1}, {"Teal plastic", "#1f9a96", 0, 0.35},
|
||||
}
|
||||
for _, m in ipairs(list) do
|
||||
fry.material{name = m[1], color = m[2], metal = m[3], rough = m[4]}
|
||||
end
|
||||
27
content/Fry3DX/plugins/scatter.lua
Normal file
27
content/Fry3DX/plugins/scatter.lua
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
-- Scatter: copies of what's picked, strewn round it on the ground, each turned and sized a bit
|
||||
-- differently (rocks, trees, crates). In the Object menu.
|
||||
fry.plugin{name = "Scatter", about = "Copies of the picked object strewn round it, each a little different."}
|
||||
|
||||
fry.command{
|
||||
name = "Scatter copies", menu = "object",
|
||||
help = "Copies of the last picked object round it on the ground.",
|
||||
settings = {{"copies", 12}, {"radius", 2}, {"size_change", 0.3}, {"seed", 1}},
|
||||
run = function(s)
|
||||
local picked = fry.selected()
|
||||
local o = picked[#picked]
|
||||
if not o then error("pick an object to scatter first") end
|
||||
math.randomseed(math.floor(s.seed))
|
||||
local base = o.position
|
||||
local made = {}
|
||||
for i = 1, math.max(1, math.floor(s.copies)) do
|
||||
local c = o:copy()
|
||||
local a, r = math.random() * 2 * math.pi, math.sqrt(math.random()) * s.radius
|
||||
c.position = {base.x + math.cos(a) * r, base.y + math.sin(a) * r, base.z}
|
||||
c:rotate(0, 0, math.random() * 360)
|
||||
c:scale(1 + (math.random() * 2 - 1) * s.size_change)
|
||||
made[#made + 1] = c
|
||||
end
|
||||
fry.group(o.name .. " scattered", made)
|
||||
fry.select(made)
|
||||
end,
|
||||
}
|
||||
40
content/Fry3DX/plugins/stairs.lua
Normal file
40
content/Fry3DX/plugins/stairs.lua
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
-- Stairs, straight or round a post: two commands in the Add menu, each asking for its sizes.
|
||||
-- A plug-in is a script that stays loaded: fry.command puts a command in a menu, and its run
|
||||
-- function is called (with the settings asked for) each time it's picked.
|
||||
fry.plugin{name = "Stairs", about = "Straight stairs and spiral stairs, from the Add menu."}
|
||||
|
||||
fry.command{
|
||||
name = "Stairs", menu = "add",
|
||||
help = "A flight of steps going up along Y.",
|
||||
settings = {{"steps", 12}, {"rise", 0.18}, {"going", 0.28}, {"width", 0.9}},
|
||||
run = function(s)
|
||||
local made = {}
|
||||
for i = 0, math.max(1, math.floor(s.steps)) - 1 do
|
||||
local step = fry.add("cube", {width = s.width, depth = s.going, height = s.rise * (i + 1), color = "#b07a4a", name = "Step"})
|
||||
step.position = {0, i * s.going, 0}
|
||||
step:drop() -- (its bottom on the ground)
|
||||
made[#made + 1] = step
|
||||
end
|
||||
fry.group("Stairs", made)
|
||||
fry.select(made)
|
||||
end,
|
||||
}
|
||||
|
||||
fry.command{
|
||||
name = "Spiral stairs", menu = "add",
|
||||
help = "Steps turning round a post.",
|
||||
settings = {{"steps", 18}, {"rise", 0.18}, {"turn", 22}, {"width", 0.9}},
|
||||
run = function(s)
|
||||
local steps = math.max(1, math.floor(s.steps))
|
||||
local made = {fry.add("pillar", {radius = 0.12, height = steps * s.rise + 0.3, color = "#8a8a90", name = "Post"})}
|
||||
for i = 0, steps - 1 do
|
||||
local step = fry.add("cube", {width = s.width, depth = 0.32, height = 0.05, color = "#b07a4a", name = "Step"})
|
||||
local a = math.rad(i * s.turn)
|
||||
step.turn = {0, 0, i * s.turn}
|
||||
step.position = {math.cos(a) * s.width / 2, math.sin(a) * s.width / 2, (i + 1) * s.rise}
|
||||
made[#made + 1] = step
|
||||
end
|
||||
fry.group("Spiral stairs", made)
|
||||
fry.select(made)
|
||||
end,
|
||||
}
|
||||
Loading…
Reference in a new issue