2021-12-31 01:03:56 +00:00
local wea = worldeditadditions
local parse_static = dofile ( wea.modpath .. " /lib/sculpt/parse_static.lua " )
2023-08-03 01:42:46 +00:00
---
-- @module worldeditadditions.sculpt
2021-12-31 01:03:56 +00:00
--- Reads and parses the brush stored in the specified file.
2023-07-02 19:05:46 +00:00
-- @name import_static
-- @internal
2021-12-31 01:03:56 +00:00
-- @param filepath string The path to file that contains the static brush to read in.
-- @returns true,table,Vector3|false,string A success boolean, followed either by an error message as a string or the brush (as a table) and it's size (as an X/Y Vector3)
return function ( filepath )
local handle = io.open ( filepath )
2022-09-19 00:16:22 +00:00
2021-12-31 01:03:56 +00:00
if not handle then
2022-09-19 00:16:22 +00:00
if handle ~= nil then handle : close ( ) end
2021-12-31 01:03:56 +00:00
return false , " Error: Failed to open the static brush file at ' " .. filepath .. " '. "
end
local data = handle : read ( " *all " )
handle : close ( )
local success , brush , brush_size = parse_static ( data )
if not success then return success , brush end
return true , brush , brush_size
end