for those doing it externally, you get the first “locations” url in the json data returned from the request and download the file at the location, this returns an XML file to which you get the id here:
Same process as above, however, it returns an RBXM file (you have to add the extension manually).
NOTE: this request REQUIRES a roblox cookie that can access the assets to be present in the cookies.
This means for externally gaining the mesh id, you must parse the rbxm, find the target mesh part (so take it into studio first to see the structure of the import) and take the mesh id that way.
Using this tool you can convert it to an rbxmx (xml format) and extract the meshid through reading the file’s content:
decompress rbxm / rbxl
# note: the rbxm has to be in the same directory as the rbxmk.exe
import os
FILE_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
COMMAND = 'echo fs.write("{}", fs.read("{}")) | rbxmk run -'
def to_rbxmx( input_filename : str, output_filename : str ) -> None:
process = subprocess.Popen(COMMAND.format(output_filename, input_filename), shell=True, cwd=FILE_DIRECTORY)
process.wait()
to_rbxmx( "the_downloaded_file_filename_xdddd.rbxm", "output_filename_xdddd.rbxmx" )
# if the above does not raise an exception, it was successful
For those wanted more of a code sample of what you would do
ASSET_DELIVERY_API = "https://assetdelivery.roblox.com/v2/asset?id={}"
-- pull_mesh_id_from_rblx_xml is using ElementTree from the xml package + recursive loops with tag checks
2024, we have EditableImage now, but still don’t have this. Still needed. Would be nice if we could see the original size too, currently possible only in Studio.
Trying to currently make a sticker script that allows users to put their own decals in, and basing it off the spraycan tool on the catalog.
Turns out that won’t work as the spraycan tool used a very hacky old method to get the image: simply subtracting 1 from the decal.
This was made at a time when Roblox didn’t have bots mass creating clothing, so a decals image would naturally be the ID immediately before it, but now with assets being created at the speed of the Roblox servers, image IDs are usually a random amount behind the decal. Could be 5, could be 20, at worst I’ve seen them be beyond 50 IDs down.
Having a proper function or API that exposed something studio does automatically for you would be significantly appreciated as, to my knowledge, there is no non-hacky method to get an image from a decal (as I’d rather not do janky stuff like creating a decal instance for the sole purpose of getting an ID and then removing it, or putting in paragraphs of code poking to multiple likely ratelimited APIs just for a few numbers)
And no, the code you provided is objectively useless as loadasset straight up refuses to do anything unless you own or created the decal in question.
The thing is, all decals (and other images for that matter) are just RBXMX documents with the ID inside them, I cant imagine this is that difficult to do even if a web proxy fetching the XML document was used.
If they moved to the binary format, I made LXM for that I guess?
Astonishing that we still have to ask players to “Keep subtracting one until you get the Image ID and then paste it in the box to display your decal!” When it can take up to 50 subtractions+ to get there. There should have been an API for this years ago, or just do away with decals entirely, what’s their purpose if you need the image ID to actually display them anyways?