Loading textures and models from a zip file

Hi, people.

I have almost completed the chess module i was working on. As it’s really a module of the main application (a plugin, i mean), i thought it could be nice if i could encapsulate the module in a single zip file.

I have been able to load the game as a package from inside the zip and make the game engine work, but i have hit a brick wall:

PandaLoader doesn’t seems to load files from inside the file. I mean, things like loadTexture and loadModel fail when i try to load files that are inside the zip structure (let’s say in chess.zip/chess/frontend/models/boardframe.egg). Is there any way i can elude this difficulty?

Of course, it won’t be such a big deal if i cannot run it from the zip file (the users will be asked to decompress it in the proper directory simply.), but, as said, i would like to do it if it’s possible (and not very difficult).

Andreas.

there is no way to run it from a ‘normal’ zip file. But you can use the panda multifile (which can be zipped and encrypted). You can to mount the multifile and create it with the multifile tools

Yes, i had seen some references to it… but, if i haven’t misunderstood it, you would need Panda3d manage the opening of the multifile, and that’s not an acceptable solution for me, as that multifile would contain files not related to the Panda3d interface, and i deem a bad design decision to make them depend on Panda3d’s functionality. I prefer to compress it in a zip file and make the user decompress it in a specified directory (i always can add some automation to the process in the future).

Thanks for the answer anyway.

Yes multifiles are there to create data files for 3d resources such as models textures and sounds. Zip files are still a method of distribution.

I was working on python import hook (similar to zip file import hook) that allowed you to import and execute python code inside multifiles but that is a story for another day.