[SOLVED] Multifiles and textures

I’m currently experimenting with the multifile system in Panda3D (which is pretty nifty). Regarding textures and their references in eggs: We have several egg files that reference a texture relatively from the location of the egg file itself. These references seem to break when the eggs are in a multifile; if I change the references to start relative to the top of the multifile archive, they work.

Is there a way to get the functionality of the egg-relative texture reference when I’m pulling in an egg from the VFS, or should I update all my texture paths to be relative to the top of the VFS?

Take care,
Mark

Not sure what you’re describing. That sounds like a bug, but it’s one I’ve never seen before. Egg files within a multifile, that reference textures within the multifile, should still reference textures relative to the egg file itself, not to the root of the multifile.

Although I haven’t tested this lately, I know it used to work this way; and thinking about how the system works, it’s difficult to imagine how a bug could even cause it to work the way you describe. So, are you sure? If so, I’ll take a closer look and see if I can repro the problem here.

David

I double-checked and confirmed it. Here’s the situation:

I created a multifile (trivial_test.mf) containing the following:

Assets/models/tank.egg
Assets/textures/tank.jpg

Tank.egg references its texture through the following path.

…/textures/tank.jpg

Now I mount the multifile:

vfs = VirtualFileSystem.getGlobalPtr()
vfs.mount(Filename('trivial_test.mf'), '.', VirtualFileSystem.MFReadOnly)

Now when I load the egg file from the multifile, I get the following error:

:gobj(error): Unable to find texture "../textures/tank.jpg" on
 texture_path .;/c/Panda3D-1.2.3/etc/..;/c/Panda3D-1.2.3/etc/../models or model_
path .;/c/Panda3D-1.2.3/etc/..;/c/Panda3D-1.2.3/etc/../models

However, if I change the texture reference in the egg file to

Assets/textures/tank.jpg

… then the texture is seen and loaded correctly.

Take care,
Mark

(I also need to rename the source Assets directory in the Windows filesystem; otherwise the existence of the Assets directory overrides my multifile mount and I get the files out of Assets instead of out of the multifile).

Ah, you are correct; I was able to repro it, and it was indeed a bug. I’ve just checked in a fix. My apologies for the bug, but thanks for finding it and reporting it.

There are a couple of possible workarounds, if you’re not interested in building the latest Panda for yourself; one is, as you’ve suggested, to make all of your textures relative to the root of the multifile; another is to put all of the various directories in which textures can be found on your model-path (or at least texture-path).

A third workaround would be to store bam files in your .mf, rather than egg files, since this bug only affected egg files.

David