I just DL’d a bunch of sprites. They were in a folder on iCloud Drive. Since apparently Codea can’t access iCloud Drive, I moved the folder into Codea’ dropbox.assets. But When looking for a sprite, Codea doesn’t show folders. So I had to move all 60 files into the top level of dropbox.assets.
@RonJeffries You can have folders in the Codea Dropbox folder, they just don’t show when you look in Codea. From the Files app, I created a folder Drop1 in the Dropbox folder and moved a png file into it. In Codea, I looked in the Dropbox folder but didn’t see the Drop1 folder, but as I keyed the asset.documents.Dropbox. in the sprite() command, the folder Drop1 showed and when I keyed Drop1. , the sprites showed.
I have an issue with Dropbox but I think it is of my own making. Ensure you don’t have directories with the same name just differing with the first letter - using both small and upper case ie img and Img as Codea will show the lower case in preference. You can get round it by just replacing the lower case letter with the upper case
Also remember to sync your folders after any changes.
Organise - don’t end up like me with a real Dropbox mess.
p.s. I think the issue above is probably due to the order of display ie small case before upper case. The latter is probably off screen.
@Simeon - Dumb idea - could we have a drop down list of options which scroll, kinda like Visual Basic. If necessary overlapping the keyboard which would not be required during selection.
@RonJeffries - you can manage to display your path by editing, as I said above, or by typing out the target section eliminating some of the other options. I regularly have to refer to the Dropbox or filer app to ensure I get my target file.
when you do, for example, a sprite statement, the folder gives a view of the pictures. asset syntax only gives names. the pic view should include folders and allow clicking in.
Yeah, I picked up on the sprites - so graphics files are visible but many text based files aren’t. Also, Dropbox has only a limited file recognition which may be a limitation for Codea.
Here’s another program to show all the files and folders in Codea. From the Files app, I created files inside folders inside folders inside folders inside a folder in the Codea Dropbox folder to see if this would show all the files and folders within folders, and it did. Run the code and scroll down to see all the files and folders. Files and folders within folders are indented to show their relationship. Not sure if this is useful or not, but I just wanted to mess with the asset structure using recursion.
PS. Added code to show more files that I forgot about.
viewer.mode=STANDARD
function setup()
textMode(CORNER)
fill(255)
dy=0
indent=0
tab1={}
tab={"documents","builtin","downloaded"}
for a,b in pairs(tab) do
table.insert(tab1," ")
table.insert(tab1,b.." ( folder )")
table.insert(tab1," ")
aa(asset[b])
end
print(#tab1.." table entries")
end
function draw()
background(0)
for a,b in pairs(tab1) do
text(b,30,HEIGHT-a*25+dy)
end
end
function touched(t)
if t.state==CHANGED then
dy=dy+t.deltaY
if dy<0 then
dy=0
end
end
end
function aa(str1)
for a,b in pairs(str1.all) do
if b.type=="folder" then
indent=indent+5
ss=string.rep("- ",indent)
table.insert(tab1,ss..b.name.." ( "..b.type.." )")
ss=string.rep("- ",indent)
local str2=str1[b.name]
aa(str2)
indent=indent-5
ss=string.rep("- ",indent)
else
indent=indent+5
ss=string.rep("- ",indent)
table.insert(tab1,ss..b.name.." ( "..b.type.." )")
g=str1[b.name].all
if g~=nil then
indent=indent+5
ss=string.rep("- ",indent)
for d,e in pairs(g) do
ss=string.rep("- ",indent)
table.insert(tab1,ss..e.name.." ( "..e.type.." )")
end
indent=indent-5
end
indent=indent-5
end
end
end
@Bri_G Here’s another version that just displays a small section of the table instead of the whole table at once. Since you have so many entries, I allowed for a variable scroll speed. Depending on where your finger is when you scroll, depends on the scroll speed. The closer your finger is to the left side of the screen, the faster the scroll speed. I also added entry numbers so you know where you are.
Let me know if this works or also crashes.
viewer.mode=FULLSCREEN
function setup()
textMode(CORNER)
fill(255)
dy=0
indent=0
tab1={}
tab={"documents","builtin","downloaded"}
for a,b in pairs(tab) do
table.insert(tab1," ")
table.insert(tab1,b.." ( folder )")
table.insert(tab1," ")
aa(asset[b])
end
print(#tab1.." table entries")
end
function draw()
background(0)
count=0
start=(dy*25)//1+1
for z=start,start+100 do
if z<=#tab1 then
count=count+1
text(string.format("%4.0f",z),130,HEIGHT-count*25+dy)
text(tab1[z],180,HEIGHT-count*25+dy)
end
end
end
function touched(t)
if t.state==CHANGED and t.x>1 then
speed=t.x/10
dy=dy+t.deltaY/speed
if dy<0 then
dy=0
elseif dy>#tab1//25 then
dy=#tab1//25
end
end
end
function aa(str1)
for a,b in pairs(str1.all) do
if b.type=="folder" then
indent=indent+5
ss=string.rep("- ",indent)
table.insert(tab1,ss..b.name.." ( "..b.type.." )")
ss=string.rep("- ",indent)
local str2=str1[b.name]
aa(str2)
indent=indent-5
ss=string.rep("- ",indent)
else
indent=indent+5
ss=string.rep("- ",indent)
table.insert(tab1,ss..b.name.." ( "..b.type.." )")
g=str1[b.name].all
if g~=nil then
indent=indent+5
ss=string.rep("- ",indent)
for d,e in pairs(g) do
ss=string.rep("- ",indent)
table.insert(tab1,ss..e.name.." ( "..e.type.." )")
end
indent=indent-5
end
indent=indent-5
end
end
end
@dave1707 - that works fine, very interesting results. It reflects the file details in a Dropbox folder of mine - ie file.obj. Visible by Dropbox, Files and File Explorer. But, I can only successfully address the file as file_obj.
Folders in the project would be useful, too, for a game with lots of tiles, as one example. And yes, accessible from the asset picker, and from Files app.