forcing cache bypass with texture names

Software: Away3D 4.x

maneatingsheep, Newbie
Posted: 25 June 2012 12:08 PM   Total Posts: 12

I load a bunch of 3ds files and their textures are loaded automatically.
All my assets are managed by an addition of “?ver=xx” suffix to their url, that way i can dynamically force to bypass cache and load a newer version of each asset. My question is: How can i do it for the texture file names, that come from the 3ds file?

   

Avatar
Matse, Sr. Member
Posted: 25 June 2012 12:44 PM   Total Posts: 149   [ # 1 ]

Hi, you can do that with AssetLoaderContext class by using mapUrl() and / or mapUrlToData() methods.

http://away3d[dot]com/livedocs/away3d/4.0/away3d/loaders/misc/AssetLoaderContext.html

replace [dot] with a dot since the forum considers links to away3d dot com as spam (pretty sure I could put a link to some crappy ad website though… I’ve asked countless times the reason for this as it’s incredibly annoying to be unable to link directly to a forum post or to the documentation but I still have to hear about it raspberry )

   

maneatingsheep, Newbie
Posted: 25 June 2012 01:08 PM   Total Posts: 12   [ # 2 ]

Thanks. That’s only half the solution, since i don’t know the original urls. I need to get inside the parsing process or somehow to catch the moment of the asset url string generation and add my params to it

   

Avatar
theMightyAtom, Sr. Member
Posted: 25 June 2012 01:21 PM   Total Posts: 669   [ # 3 ]

Why not have assign your materials dynamically the first time, rather than having them in the 3d file? Just assign a plain color material before you save them. That’s what I always do if I need to manipulate materials in the program == always!

Good Luck!

oh, and plus1 for the forum link bug. Drives me bonkers (you listening Jens?? :O)

   

Richard Olsson, Administrator
Posted: 25 June 2012 03:46 PM   Total Posts: 1192   [ # 4 ]

There is unfortunately no mechanism for this available in the engine today.

I would encourage you to look at potentially augmenting AssetLoaderContext yourself with a RegEx URL rewriter. You could just add a function to store the URL rewrite patterns in AssetLoaderContext, and then modify the existing hasMappingForUrl() and getRemappedUrl() to look in your custom list of patterns. The rest will work automatically.

If you do get around to implementing this, we’d be very interested in looking at potentially merging it into the engine. It’s something that I’ve wanted to do at some point in the future for a long time, but haven’t prioritized over other, more pressing issues.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X