Can't load data from Multifiles

Hi everyone, i tried to load a model from a multifile but if i try rendering it i can’t see it and the nodepath output on the console is always not found like there is no such model.

here are the parts of the code used to load the multifile

VirtualFileSystem *vfs = new VirtualFileSystem();

//inside the main function
vfs->mount("./", ".", VirtualFileSystem::MF_read_only);
NodePath model = window->load_model( framework.get_models( ), "avatar.egg" );

cout << model << endl; // output is  **not found**

model.reparent_to( window->get_render( ) );

Is here something missing to load the mf?
P.S. The multifile works fine when loading it within python

Looks all right to me.

I’d suggest (a) checking the return value of vfs->mount() to be sure it succeeded, and (b) ensuring that “.” is on your model-path.

Edit: Oh, wait–there is a problem there.

This line:

VirtualFileSystem *vfs = new VirtualFileSystem();

constructs a new instance of VirtualFileSystem, instead of using the global one that Panda uses for loading models. So you’re mounting your multifile with the wrong object.

This line:


does nothing at all. You sould replace both of them with:

VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();


Thanks a lot, this works perfect.