Issues with asset

It seemed it might be useful to list issues with the new asset code as we find them.

asset.builtin.Blocky_Characters.

has a prompt list wider than the screen and the list can’t be scrolled. probably general issue with long prompt lists.

all of asset and the things you get when you append dot and anything that’s prompted are user data, and there’s no indication how to use them.

function setup()
    aa=asset.builtin.Blocky_Characters.all
    for a,b in pairs(aa) do
        print("name = "..b.name)
        print("type = "..b.type)
        print("ext = "..b.ext)
        print("path = "..b.path)
    end
end

i’m a programmer, dave, not a mind reader. :slight_smile:

are there more than those? how would one know?

@RonJeffries When you type asset. you get an autocomplete list of valid words. If the list is too long and goes off the right side, then type the letter a and see what shows. Then type b, then c, then d, then e, etc to see what’s valid. Those 4 that I show above will be used to get specific things from the asset.

yes. not exactly ideal.

@RonJeffries Here’s an example that might help a little. Prints different assets.

displayMode(STANDARD)

function setup()
    fill(255)
    tyTab={"all extensions","jpg","json","mtl","obj","pdf","plist","png","shader"}
    parameter.integer("pos",1,#tyTab,create)
end

function draw()
    background(0)
    text(tyTab[pos],WIDTH/2,HEIGHT/2)
end

function create()
    output.clear()
    tab={}
    as=asset.builtin.all
    for a,b in pairs(as) do
        aa=asset.builtin[b.name].all
        p=false
        for c,d in pairs(aa) do
            if d.ext==tyTab[pos] or pos==1 then
                if not p then
                    table.insert(tab,"   ")
                    table.insert(tab,"   ")
                    table.insert(tab,b.name)
                    table.insert(tab,"===================")
                    p=true
                end
                table.insert(tab,d.name)
            end
        end
    end 
    print(table.concat(tab,"\
"))  
end

nice, and TIL you can use a pdf – as a sprite, i guess.

@RonJeffries sorry about the autocomplete UI not being updated in sync with the new asset API. I decided to release 3.1 now because it was taking too long to release. I spent months updating the asset system and then didn’t want to leave everyone without an update for much longer

I figured once the API was where I wanted it to be (and out in the real world) I could start working on new UI around how to select and view assets, improving the way autocomplete works, and so on

The plans for autocomplete are:

  • Show icons for different asset types in the list
  • Filter the list of completions to types that make sense for the current function (i.e., if you type asset. inside sprite() you should only get completions for folders and image types
  • Allow the autocomplete list to be scrolled or include a “view all” to see all the contents visually and pick the asset

I’d also like to add editor annotations to any use of asset.x.y.z so that you can tap them to select from other assets in that folder right from the code editor

sounds good. i’m sure it’ll get better, and i’m not sure if rushing it out was just the thing. your call, of course,