@Choons:
SVN is usually (and will continue to be) lagging behind a bit because
most of us are making our changes via Git. It is extremely obvious
right now because our changes have very big impact, but as we near a
final release the difference between SVN and Git will be smaller (even
if SVN will likely still be lagging behind.)

The error you are describing is definitely due to the fact that the
MTL can't be loaded from the URL it's assumed to be in, because the
OBJ format defines mtl file URLs as relative to the OBJ file, whereas
Flash loads files relative to the SWF file. This means that you have
to supply a base path for the MTL file, which with the old OBJParser
is done by passing a value for the resourcesURL to the constructor. In
the most recent version there is no need for this, because all URLs
are resolved by the AssetLoader as relative to the base file (OBJ file
in this regard) or to the dependencyBaseUrl if one is defined in the
AssetLoaderContext.

So, to fix this, either get the latest version from Git and it will
work out of the box with the code you already have, or instantiate
your OBJParser passing a resourcesURL to it's constructor and pass
that OBJ parser instance to the load call:

var parser : OBJParser;

parser = new OBJParser('path/to/');
AssetLibrary.load(new URLRequest('path/to/file.obj'), parser);


On a separate subject, don't think of the Loader3D class as the
opposite of the AssetLibrary. On the contrary, the Loader3D uses the
AssetLibrary internally by default, meaning that if you use Loader3D
you are most probably also using the AssetLibrary (perhaps without
knowing.) See the PDF I posted a while back which explains the way
that the new loading framework is designed.


Cheers
/R



On May 15, 8:21 pm, Choons <[email protected]> wrote:
> I have been using the SVN with TortoiseSVN, but it sounds like I
> should dump it for Git? Also, I want to take advantage of the Asset
> Library instead of using Loader3D. My code
>
> AssetLibrary.enableParser(OBJParser);
>
> AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE,
> onLoadComplete);
> AssetLibrary.load(new URLRequest("../some.obj);
>
> isn't throwing a code error, the output is: ObjParser MTL LOAD ERROR:
> unable to load .mtl file
>
> if I comment out the mtlib line in the obj file I can get the mesh to
> load so I know the URLRequest set up is working fine
> On May 15, 3:23 am, richardolsson <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > First of all, are you using Git and if so have you pulled since
> > yesterday? The OBJParser was previously using it's own internal loader
> > to load MTL files, which crippled the dependency URL resolution
> > system, and this was fixed the day before yesterday. If you are using
> > an older version you need to specify the "resourcesURL" constructor
> > parameter to the OBJParser (and pass the OBJParser instance to the
> > load() method instead of relying on the automatic file format
> > detection.)
>
> > In case you are using the updated system (you'll know because there is
> > no resourcesURL parameter in the OBJParser constructor anymore)
> > something is definitely wrong. Are you not getting any errors? Is the
> > MTL and the OBJ placed in the same folder?
>
> > Since the day before yesterday, this is all that's necessary to load
> > an OBJ file, including it's textures, and add it to stage:
>
> > var loader : Loader3D = new Loader3D();
> > loader.load(new URLRequest('path/to/model.obj'));
> > myScene.addChild(loader);
>
> > Cheers
> > /R
>
> > On May 15, 9:27 am, Choons <[email protected]> wrote:
>
> > > Hi- I'm trying to get an OBJ and MTL working in Broomstick using the
> > > new Asset Library approach but cannot get the mtl to load. I've tried
> > > a couple of different obj models and their associated mtl files but no
> > > go. Would some kind soul please enlighten me with a snippet of code on
> > > loading up an obj/mtl model?

Reply via email to