@Choons:
The name can come from wherever (just set it through the name
property) but usually it will likely be coming from the parsers (and
ultimately the files that they parse). The problem is that some file
formats don't provide names for the contained asset(s). MD5 is one of
those. That's a shortcoming of the file format and not something that
we can reliably solve in Away3D without completely shifting control
away from you, and that's usually a bad idea since we are after all
creating a library for programmers. :)

So what you need to do if you want to use a file format in which there
are no names (or the names are not satisfactory) is to listen for the
ASSET_COMPLETE event, and rename the assets as they come in according
to some scheme of your choice. When you get a mesh
(event.asset.assetType == AssetType.MESH) you can for example rename
it "nameOfMyMesh" and then you'll be able to fetch it by that name
from the asset library.

Something similar will soon be done automatically by the parsers, i.e.
if there is no name for an asset the parser will give it a name
according to it's type (e.g. just "mesh" for meshes.) This way you
know that regardless of the file format, originally unnamed assets
will have a consistent scheme for fallback names.

I am at this very moment working on the mechanisms that will make sure
that there are no collisions between name/namespace pairs in an asset
library. This, along with the parser tweak mentioned above will likely
be pushed before the end of today (CET).


Cheers
/R


On May 14, 10:36 am, Choons <[email protected]> wrote:
> I've been struggling with the new AssetLibrary this evening-
>
> Mesh = Mesh(AssetLibrary.getAsset('nameOfMyMesh'));
>
> if I understand correctly, the name comes from within the file that is
> loaded. Experimenting with the lostsoul.md5mesh from the examples, I'm
> not clear on where a name would come from looking at the contents of
> that file. It's not a format I am familiar with. How do I query the
> Asset Library from code to get a list of the names of the assets in
> the library?
>
> On May 13, 1:31 pm, richardolsson <[email protected]> wrote:
>
>
>
>
>
>
>
> > @John:
>
> > Just wanted to let you know that today I pushed the dependency-loading
> > improvement that I mentioned before. It's on GitHub now and should be
> > propagated to SVN before too long.
>
> > This means that you will no longer be able to specify a "resourcesUrl"
> > for OBJParser. Instead, you should rely on the regular
> > AssetLoaderContext.dependencyBaseUrl property to define where the
> > loader should look for MTL and texture files.
>
> > If you need greater granularity than that we have also recently added
> > a AssetLoaderContext.mapUrl() method to map one dependency URL to
> > another. You can also still map a URL to embedded data using the
> > AssetLoaderContext.mapUrlToData() if you prefer to embed your
> > dependencies.
>
> > Let us know if you have any thoughts about Away3D in general or the
> > loading framework in particular! :)
>
> > Cheers
> > /R
>
> > On May 6, 10:08 pm, John Brookes <[email protected]> wrote:
>
> > > Think I've solved the obj mtl issue
>
> > > before I was doing AssetLibrary.load(new URLRequest(LEVEL_URL)) and it
> > > failed.
>
> > > This is working, no missing mtl error.
> > > eg
> > > private var LEVEL_URL:String = '../src/indi001/object/IndiEstate6exp.obj';
> > > levelfile =    AssetLibrary.load(new URLRequest(LEVEL_URL),new
> > > OBJParser("../src/indi001/object/"));
>
> > > But then after doing that realised that I would have to add each part of 
> > > the
> > > level. As there isn't (or I dont know) how to say just add the whole 
> > > thang.
> > > Plus not knowing what the part names are makes it a nightmare. 
> > > (obj1...30).
> > > Tried grouping the whole model and then adchild(obj0) but that didnt work.
>
> > > Anyhoo
> > > Im only using obj as it good for a quick test going from maya, so for now
> > > Ill change that bit to a basic loader3d.
>
> > > carry on :)

Reply via email to