Loading MY3D files from a ZIP ARCHIVE

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Guest

Post by Guest »

I just tried it with a simple mesh and it still doesn't work.


1.in 3dsmax7 I created a single cube. Flipped it's normals (to make it a room)
2.Loaded a single texture - applied it to the cube and set a uvmap.
3.add a single omni light
4.rendered to texture using a lightingmap set at 512x512 (I normally use much smaller maps)
5.Saved as embedded 24/RLE

It loaded fine from the normal workdirectory: "work\\gfx\\cube.my3d"

I moved the mesh and the single texture into the archive and DELETED them from the workdirectory.

The mesh loads but again the texture is NOT FOUND with some strange chars printed in the logger.

I then moved the mesh and texture from the root of the archive into a sub directory ("gfx/") . now the mesh will not load because it says "CAN NOT FIND MY_TEX_DATA_HEADER_ID".. followed by loading failed, mesh doesn't appear to be valid format etc.

So even a simple mesh like this refuse to load.

May I ask what you used for your test above?? and is it possible that the max7 exporter is at fault - messing with paths or adding "\\" and not stripping them etc??

thanks again
ZDimitor
Posts: 202
Joined: Fri Jul 16, 2004 3:27 am
Location: Russia

Post by ZDimitor »

There is everything what you need in that example (posted above), i'm sure you just missed something...
If you don't want to send me you scene, than post your code of loading your
my3d scene here. I want to look at it.

BTW: In that example, i used my3d with standalone lightmaps, i still not tried to load my3d scenes with embedded lightmaps from archieve.
Guest

Post by Guest »

nah, I didn't miss anything. I have been using irrlicht for a while now and worked around most problems but this has me beat. Really, if you look at your code you posted you can strip out all the irrelevent stuff and get it down to the basics needed. This is "My basics" that are taken directly from one of my apps in development that has this problem:

Code: Select all

// after normal initialisation etc

// setup of filesystem (shortened)
	
if ((gFileSys = gDevice->getFileSystem()) == NULL)
	WriteLog("\n\n[ERROR ] Could not create virtual files system!");

if (!(gFileSys->addZipFileArchive("data.zip",true,false)))
	WriteLog("\n\n[ERROR ] Could not open data package!");



// Scene setup/load

gSmgr->getParameters()->setParameter(MY3D_TEXTURE_PATH,"");  // this is actually pointless as it is ignored but there to be sure!

gArea = gSmgr->addAnimatedMeshSceneNode(gSmgr->getMesh("gfx/testcube.my3d"));
	gArea->setMaterialFlag(EMF_LIGHTING, false);
	gArea->setMaterialType(EMT_LIGHTMAP);
	if (gTextureFilterType == 2) 
		gArea->setMaterialFlag(EMF_TRILINEAR_FILTER,true);

// note 'g' defines previously defined global variable.

That is simply all there is to my loading. The exact same loading works perfectly with my3ds NOT in a zip archive and with every other format I have tried (3ds/X etc) INSIDE an archive.

I wonder if the poster who also couldn't get this to work further up the thread could confirm this is not just some "newb" oversight ;)

I see when I edit the my3d file exported from max7 in a hex editor that all the texture filenames have a '!' infront of them compared to some other formats that have stripped out '\\' or replaced with '/' but this may be completely wide of the mark.

I will do some more tests tommorow with a fresh d/l of irrlicht and your my3d examples.

Note My problems were the same with embedded or seperate lightmaps so that is a red herring (except with seperate lightmaps it could not find them either when in the root of the archive in the lightmaps dir next to the file and textures - moved into a subdir in the archive, embedded or not would still give the HEADER error stuff).

thanks again for looking, I apreciate the help and have found your format very useful anyway :)

[/code]
Guest

Post by Guest »

Also... maybe you can tell me if there would be any problems with certain types of archives created with different apps? I use winrar (3 something) for instance. I know some archivers use different standards and maybe it is nothing to do with it (afterall everything else loads fine in irrlicht).

Also - why did Niko remove the use of setting the texture path? was this causing troubles? If I could re-enable this in the source and explicitly set it to "gfx/" or "data/" or whatever instead of it trying to be clever and loading from where it finds the mesh (because frankly it finds the mesh in data/ but seems to look for the textures in '\\' type directory.. at least that is what appears to happen.
ZDimitor
Posts: 202
Joined: Fri Jul 16, 2004 3:27 am
Location: Russia

Post by ZDimitor »

Now i want to look inside your data.zip archieve, post here its structure.

I think he must have this structure:

Code: Select all

data.zip
    |
     gfx/
        |
         Lightmaps/  
        |    |
        |     *LightingMap.*
        |     ...
        |     *LightingMap.*
        |
         testcube.my3d
         DiffuseTexture1.*
Guest

Post by Guest »

yes I have tried two ways:

1.

Code: Select all

data.zip
          |
          gfx/
              |
              testcube.my3d
              thediffusetexture.png // hope png is not the cause?

which is with embedded lightmaps, the one with seperate lightmaps looks exactly like what you posted. And neither of which work, both giving the MAT_HEADER or TEX_HEADER errors (whatever I posted before)

2.

Code: Select all

data.zip
         |
          testcube.my3d
          thediffusetexture.png // hope png is not the cause?

This time as you can see there is NO sub dir so I would load the mesh in irrlicht with

Code: Select all


gArea = gSmgr->addAnimatedMeshSceneNode(gSmgr->getMesh("testcube.my3d")); 

And this time the MESH is actually LOADED however the console debug messages say that NONE of the textures can be found (it gives an error for each one) and the mesh is loaded in without textures (grey or black depending on lighting etc - though if it has EMBEDDED lightmaps you can see the mesh has the correct lightmaps applied to it - so this is CLOSE but still those textures that are sitting right next to it in the archive are just NOT FOUND/LOADED!)

Rgds
[/code]
ZDimitor
Posts: 202
Joined: Fri Jul 16, 2004 3:27 am
Location: Russia

Post by ZDimitor »

Well!
Than send me this test scene (my3d and max files) with scene loading code, i need to look at it more closely.
ZDimitor
Posts: 202
Joined: Fri Jul 16, 2004 3:27 am
Location: Russia

Post by ZDimitor »

BTW:

Why don't register in forum.
Guest

Post by Guest »

I am registered I just don't log on when asking stupid questions ;)

can't you just try as I did the above with max7? assuming you have it? if not then as I said I am going to try the fresh download again on a

Still can't send any files even "testcubes" at this moment.

I will try max6 export to see if it happens, and then re-download 0,12 irrlicht + my3D fresh and play with examples to see if they work as expected.

But.. there must surely be something, somewhere not quite right - I hope you can look into it regardless of my help.
ZDimitor
Posts: 202
Joined: Fri Jul 16, 2004 3:27 am
Location: Russia

Post by ZDimitor »

Better i'll wait for your test scene (i dont have max7 installed right now). When you'll be ready, send me test scene with which you having problems discussed above.
Guest

Post by Guest »

again.. ANY test scene has the same problems. It is NOT my scene. :)

Judging by the amount of views this topic has had and NO-ONE has posted that they have had success loading my3d from an archive I think that means it IS a proper bug and would be great if you could look at it (forget about my scene as ANY scene will do)

What did you make yours in giles? max5? are you saying it works fine in those and is probaby just a max 7 problem? What did the other poster use who also can not load from archives?

I think it is obviously an error in the file parsing and path stripping or the exporter code itself.

if anyone else has this problem, please send Z a test scene from max7 to try as I can't.
Grey Lantern
Posts: 34
Joined: Sat Jul 30, 2005 9:45 am
Contact:

Post by Grey Lantern »

I hope this can be sorted out. Even a hint on what might be wrong would be helpful and I'll look at it myself.

rgds
Guest

Post by Guest »

so Niko - did you look at this for 0.14.0? before I try and look again myself, if you haven't then does anyone else have any ideas / fixes thnx.
Grey Lantern
Posts: 34
Joined: Sat Jul 30, 2005 9:45 am
Contact:

Post by Grey Lantern »

I know this is old news now, but it was due to a bug reading certain kinds of zips files (created with for ex winrar) using regular windows zip files they work and load fine. :)
Post Reply