OK after further experimentation with the AnimBlendTest example, I
managed to get it to load the model from the lostsoul.md5mesh file
with
AssetLibrary.enableParser(MD5MeshParser);
AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE,
onMeshComplete);
AssetLibrary.load(new URLRequest("..assets/lostsoul/
lostsoul.md5mesh"));
function onMeshComplete((event : AssetEvent) : void {
if (event.asset.assetType == AssetType.MESH) {
mesh = event.asset as Mesh;
}
}
however, tracing event.asset.name when onMeshComplete fires only
returns 'untitled' so clearly a name isn't getting picked up by the
loader from the input file. I was able to assign and trace back a name
by using event.asset.name = "lostsoul_mesh" but don't know yet whether
it has scope outside of onMeshComplete
On May 14, 3: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 :)