Minetest-WorldEditAdditions/worldeditadditions/lib/sculpt/preview_brush.lua

23 lines
1.0 KiB
Lua
Raw Normal View History

local wea = worldeditadditions
2022-09-19 02:16:22 +02:00
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
local make_brush = dofile(wea.modpath.."/lib/sculpt/make_brush.lua")
2021-12-28 18:45:20 +01:00
local make_preview = dofile(wea.modpath.."/lib/sculpt/make_preview.lua")
--- Generates a textual preview of a given brush.
-- @param brush_name string The name of the brush to create a preview for.
-- @param target_size Vector3 The target size of the brush to create. Default: (10, 10, 0).
-- @returns bool,string If the operation was successful, true followed by a preview of the brush as a string. If the operation was not successful, false and an error message string is returned instead.
local function preview_brush(brush_name, target_size, framed)
if framed == nil then framed = true end
if not target_size then target_size = Vector3.new(10, 10, 0) end
2021-12-28 18:45:20 +01:00
local success, brush, brush_size = make_brush(brush_name, target_size)
if not success then return success, brush end
2021-12-28 18:45:20 +01:00
return true, make_preview(brush, brush_size, framed)
end
return preview_brush