Here’s something I thru together trying to get used to using the new assets format. I don’t know if this will be useful or not to anyone. I didn’t set out to write this, I just ended up with it as I was playing with the different assets formats and commands. This is best viewed when run in portrait orientation. If this is useful to anyone, I can probably make it easier to use by eliminating some of the text input fields. The instructions will explain how to use it when you run it.
I put this in the beta category for now since this will only work with the beta code.
displayMode(STANDARD)
function setup()
dy=0
xx={}
fill(255)
textMode(CORNER)
parameter.action("show builtin files",showBuiltin)
parameter.text("builtin ext")
parameter.action("list mtl",showMtl)
parameter.action("list obj",showObj)
parameter.text("folder")
parameter.text("name")
print("slide print area down if name isnt showing")
print("mtl and obj text dump will show in this print area")
end
function draw()
background(0)
inst()
cnt=0
h=""
if #xx>0 then
for a,b in pairs(xx) do
cnt=cnt+1
s=string.find(b,".....",1,true)
s1=string.sub(b,1,s-1)
if s1~=h then
cnt=cnt+2
end
text(b,10,HEIGHT-cnt*25+dy)
h=s1
end
end
end
function touched(t)
if t.state==MOVING then
dy=dy+t.deltaY
if dy<0 then
dy=0
end
end
end
function showMtl()
output.clear()
if folder=="" or name=="" then
print("folder or name error")
return
end
tab=assets.builtin[folder].all
for c,d in pairs(tab) do
if string.find(c,name) and string.find(c,"mtl") then
str=readText(d)
print(name.." ============")
print(str)
end
end
end
function showObj()
output.clear()
if folder=="" or name=="" then
print("folder or name error")
return
end
tab1=assets.builtin.all
for a,b in pairs(tab1) do
s=string.find(a,".",1,true)
n=string.sub(a,1,s-1)
n=string.gsub(n," ","_")
tab=assets.builtin[n].all
for c,d in pairs(tab) do
if string.find(c,name) and string.find(c,"obj") then
str=readText(d)
print(name.." ============")
print(str)
end
end
end
end
function showBuiltin()
shown=true
dy=0
output.clear()
print("Creating list")
xx={}
tab1=assets.builtin.all
for a,b in pairs(tab1) do
s=string.find(a,".",1,true)
n=string.sub(a,1,s-1)
n=string.gsub(n," ","_")
tab=assets.builtin[n].all
for c,d in pairs(tab) do
if builtin_ext=="" then
table.insert(xx,a.."............"..c)
elseif string.find(c,"."..builtin_ext) then
table.insert(xx,a.."............"..c)
end
end
table.sort(xx)
end
end
function inst()
if not shown then
text("Instructions",50,HEIGHT-50)
text("show builtin files: shows a list of files",100,HEIGHT-100)
text("builtin_ext: can be one of",100,HEIGHT-125)
text("mtl, obj, png, shader, plist",150,HEIGHT-150)
text("if blank, shows all extensions",150,HEIGHT-175)
text("list mtl: shows contents of a mtl file",100,HEIGHT-250)
text("list obj: shows contents of an obj file",100,HEIGHT-275)
text("folder: name of folder, can be one of",100,HEIGHT-300)
text(" Basic, Blocks, Blocky Characters, etc.. ",150,HEIGHT-325)
text(" if blank, prints folder or name error",150,HEIGHT-350)
text("name: name of file",100,HEIGHT-375)
text(" if blank, prints folder or name error",150,HEIGHT-400)
text("To start, just press show builtin files",100,HEIGHT-450)
text(" then scroll the list up/down",100,HEIGHT-475)
text("Run in portrait orientation for more room",100,HEIGHT-550)
end
end