level editor improvements
This commit is contained in:
parent
886679816b
commit
a8b469876d
41 changed files with 8367 additions and 8312 deletions
|
|
@ -297,8 +297,10 @@ end
|
|||
|
||||
function saveAsset()
|
||||
gameAssets[selectedAsset] = assetProperties
|
||||
local save = TSerial.pack(gameAssets, nil, true)
|
||||
love.filesystem.write("assets.prop", save)
|
||||
-- the asset's class lives in its .meta next to the art (source of truth,
|
||||
-- read back by getAllAssets); write it there
|
||||
local metaPath = "art/" .. assetProperties.directory .. "/" .. selectedAsset .. ".meta"
|
||||
writeToSource(metaPath, TSerial.pack({ class = assetProperties.class }, nil, true))
|
||||
assetsView()
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -24,14 +24,22 @@ function getAllAssets()
|
|||
|
||||
local name = fileToAnalyze:sub(1, fileToAnalyze:len() - 6)
|
||||
|
||||
if not globalAssetProperties[name] then
|
||||
if not globalAssetProperties[name] then
|
||||
globalAssetProperties[name] = {}
|
||||
globalAssetProperties[name].directory = folder
|
||||
globalAssetProperties[name].sprites = {}
|
||||
globalAssetProperties[name].class = "unmoveable"
|
||||
globalAssetProperties[name].preload = false
|
||||
end
|
||||
|
||||
-- class comes from a <name>.meta sitting next to the art
|
||||
-- (authoritative); default to immoveable if none exists
|
||||
local metaPath = topFolder .. "/" .. folder .. "/" .. name .. ".meta"
|
||||
if love.filesystem.exists(metaPath) then
|
||||
globalAssetProperties[name].class = TSerial.unpack(love.filesystem.read(metaPath)).class
|
||||
elseif not globalAssetProperties[name].class then
|
||||
globalAssetProperties[name].class = "immoveable"
|
||||
end
|
||||
|
||||
local sprite = topFolder .. "/" .. folder .. "/" .. fileToAnalyze
|
||||
globalAssetProperties[name].sprites[color] = sprite
|
||||
|
||||
|
|
@ -45,7 +53,5 @@ function getAllAssets()
|
|||
end
|
||||
end
|
||||
|
||||
str = TSerial.pack(globalAssetProperties, nil, true)
|
||||
love.filesystem.write("assets.prop", str)
|
||||
return globalAssetProperties
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue