mirror of
https://github.com/Nexoniarz/Fry3DX.git
synced 2026-11-03 04:24:26 +00:00
Plug-in mouse tools (fry.tool{name, help, click(at, normal, object)}): listed in the Toolbox, a click in the view calls it (one undo); Stamp comes as an example; the Plug-ins window: look for one, make your own copy of one that comes with Fry3DX
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e0831563b7
commit
b9b6932d0e
4 changed files with 155 additions and 4 deletions
22
content/Fry3DX/plugins/stamp.lua
Normal file
22
content/Fry3DX/plugins/stamp.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
-- Stamp: a mouse tool. Click on anything (or the ground) and a copy of the picked object is put
|
||||
-- there, standing on the surface. Shows how a plug-in adds a tool to the Toolbox (fry.tool).
|
||||
fry.plugin{name = "Stamp", about = "A tool: click to put copies of the picked object on what you click, standing on it."}
|
||||
|
||||
fry.tool{
|
||||
name = "Stamp copies",
|
||||
help = "Click to put a copy of the picked object there, standing on the surface (pick one first).",
|
||||
click = function(at, normal, onto)
|
||||
local picked = fry.selected()
|
||||
local o = picked[#picked]
|
||||
if not o or (onto and o.id == onto.id) then
|
||||
-- nothing picked to copy (or clicking on it): a little ball, to show where
|
||||
o = fry.add("sphere", {radius = 0.1})
|
||||
o.position = at + normal * 0.1
|
||||
return
|
||||
end
|
||||
local c = o:copy()
|
||||
local lo, hi = o:bounds()
|
||||
c.position = at + normal * ((hi.z - lo.z) / 2)
|
||||
o:select()
|
||||
end,
|
||||
}
|
||||
Loading…
Reference in a new issue