« Return to Thread: Max3DS parser broken? - can't get materials

Re: Max3DS parser broken? - can't get materials

by andysk8er :: Rate this Message:

Reply to Author | View in Thread

Okay, after more investigation, here is what I've found:

You can create a materialsList with the names of materials in the 3DS model and send the materialslist to the model in the constructor as follows:

fmat = new ColorMaterial(0x0000ff);
fmat2 = new ColorMaterial(0xffff00);
matList =  new MaterialsList();
matList.addMaterial(fmat, "redmaterial"); //redmaterial is the material name in my 3DS file
matList.addMaterial(fmat2, "blackmaterial"); //blackmaterial is the material name in my 3DS file
shape = new Max3DS();
shape.load("models/wagon4.3DS", matList);
holder.addChild(shape);

This correctly assigns the colormaterials and I can trace the material data with this:
trace(shape.materials.toString()); //THIS WORKS!

or this:
trace(shape.materials.numMaterials);

So, here are my questions:

1) If I load my model without a materialslist as follows:
shape.load("models/wagon4.3DS");
...then my traces (see above) don't work. I get no materials tracing and the numMaterials returns zero.

WTF? Shouldn't I be able to see the materials without assigning a materialslist? It displays the wireframe, so why doesn't it return wireframe materials? Is this a bug in the parser?

Speaking of bugs in the parser, why can't I assign a FlatShadeMaterial to the Max3DS materials list? It throws a bunch of errors when I do this. It has no trouble with ColorMaterials.

Tim, do you have any insight on this? I know you ported this parser from Away3D.

Thanks,
Andy

       


andysk8er wrote:
Hey,
Is anyone successfully using the Max3DS parser? I can't get my model materials from it and I think it is a problem in the class itself. If I add a trace inside the Max3DS class, it traces my materials, but if I try to use ANY of the inherited functions (like materialsList() or materials.toString() ) from another class, I get an empty materialsList.

If anyone has done this successfully, please let me know what the code is.
Thanks,
Andy
===============================================
Check out my blog for Flash, AS3, and web development stuff:
http://www.wastedpotential.com

 « Return to Thread: Max3DS parser broken? - can't get materials