Hi Fabrice,

Man, You are fast... I had to delete from my post whining why I cant
load obj without mtl ;)

Ive used Your code and it works. Thanks!

Problems I've encountered:
- When using model with mtl created in prefab Ive encountered error
in: OBJParser line 212 _currentGroup variable is null. When I click
continue it works fine.
This is model which I used:
http://www.todesign.pl/myModel21.zip

(not necessary important):
- parsing failure = URL Not Found //for obj loader
- 3DS file probably damaged = URL Not Found //for 3ds loader


Before the fix I helped myself using Prefab.

Ive imported my obj file into prefab, selected and imported external
map. Then Ive exported it using prefab into obj. Prefab generated the
mtl file, added usemtl into obj file. Put it nicely in one folder.
Nothing more to ask. When I open this mtl in prefab the uvmap is
loaded automatically = should work. So using this model I've "edited"
Loader3DSTest giving him my url and it worked. I'm working in
Lightwave so my obj differ a bit from 3dsmax's ones. So passing it
through Prefab resolves all my problems.

Ive started my adventure with Prefab from its first version, I have to
say it come a long way. Great tool.

P.


On 30 Mar, 10:51, Fabrice3D <[email protected]> wrote:
> k, looked at parser and it was very easy to let it load your file even if its 
> a faulty formating
>
> uploaded fix, update from svn
> add this code snippet in your class. It will display your file.
>
> make sure the camera distance to the mesh + lens.far is set accordingly
>
>                         
> ResourceManager.instance.addEventListener(ResourceEvent.RESOURCE_RETRIEVED, 
> onResourceRetrieved);
>                         
> ResourceManager.instance.addEventListener(LoaderEvent.LOAD_ERROR, 
> onResourceLoadingError);
>                         
> ResourceManager.instance.addEventListener(LoaderEvent.LOAD_MAP_ERROR, 
> onResourceMapsLoadingError);
>
>                         var url:String = "pathtoyourfiles/obj10/obj10.obj";
>
>                         ResourceManager.instance.getResource(url);
>
>                 }
>
>                 private function onResourceLoadingError(e:LoaderEvent) : void
>                 {
>                          trace("model load failed: ["+e.url+"]");
>                 }
>
>                 private function onResourceMapsLoadingError(e:LoaderEvent) : 
> void
>                 {
>                          trace("a map failed to load in this model: 
> ["+e.url+"]");
>                 }
>
>                 private function onResourceRetrieved(e:ResourceEvent) : void
>                 {
>                          trace("file loaded");
>                         /*
>                         insert here a map update if no mtl was provided
>                         case embedded map
>                         BitmapMaterial(e.resource.material).bitmapData = new 
> MyDiffuseMap().bitmapData;
>                         custom map
>                         BitmapMaterial(e.resource.material).bitmapData = new 
> BitmapData(256,256, false, 0xFF0000);
>                         */
>
>                         _view.scene.addChild(e.resource);
>                 }
>
> cheers,
>
> Fabrice
>
> On Mar 30, 2011, at 7:56 AM, Paweł Stanisławczuk wrote:
>
>
>
>
>
>
>
> > Hi
>
> > I'm trying to load my obj files into new Away3d 4.0 but with no luck.
> > I've imported them into prefab (are displayed properly) and export.
>
> > Even then they fail to load.
>
> > I'm using LoaderOBJTest as base for testing.
> > It stops at: ResourceManager line 194 with: "Unespected parser error";
>
> > I also tried:
> > _container =
> > ObjectContainer3D(ResourceManager.instance.getResource("head/
> > head.obj"));
>
> > But even the LoaderOBJTest wont compile leaving me with "parsing
> > error".
>
> > In Away3D 3.x my obj worked OK.
>
> > My files:
> >http://www.todesign.pl/obj10.zip
>
> > P.

Reply via email to