mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
update voxel fragments lua api & replace structure.save command with fragment.save & add 'export' entry point
This commit is contained in:
parent
cc6891dde8
commit
fd2bd15658
9 changed files with 117 additions and 40 deletions
|
|
@ -151,8 +151,8 @@ console.add_command(
|
|||
)
|
||||
|
||||
console.add_command(
|
||||
"structure.save x:int y:int z:int w:int h:int d:int name:str='untitled'",
|
||||
"Save structure",
|
||||
"fragment.save x:int y:int z:int w:int h:int d:int name:str='untitled' crop:bool=false",
|
||||
"Save fragment",
|
||||
function(args, kwargs)
|
||||
local x = args[1]
|
||||
local y = args[2]
|
||||
|
|
@ -163,6 +163,14 @@ console.add_command(
|
|||
local d = args[6]
|
||||
|
||||
local name = args[7]
|
||||
generation.save_structure({x, y, z}, {x+w, y+h, z+d}, name..'.vox', false)
|
||||
local crop = args[8]
|
||||
|
||||
local fragment = generation.create_fragment(
|
||||
{x, y, z}, {x + w, y + h, z + d}, crop, false
|
||||
)
|
||||
local filename = 'export:'..name..'.vox'
|
||||
generation.save_fragment(fragment, filename, crop)
|
||||
console.log("fragment with size "..vec3.tostring(fragment.size)..
|
||||
" has been saved as "..file.resolve(filename))
|
||||
end
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue