Trying to get package contents

I’m trying to keep an up to date collection of models using the package system; if I want to add more models to the game, I create a patch.

However, I can’t seem to get a handle on the models. I’ve tried

vfs.scanDirectory('PACKAGENAME_ROOT')

but I can’t seem to locate the files. How can I reference them if I don’t know them all by name?

root = Filename.expandFrom("$PACKAGENAME_ROOT")

Odd that that’s not mentioned in the manual.

Yes, it is odd, isn’t it? There are many interesting things about Panda that haven’t yet been added to the manual. Where do you think this particular tidbit of information should appear in the manual?

David

Here:

panda3d.org/manual/index.php … g_packages

Or here:

panda3d.org/manual/index.php … g_packages

I agree with your first choice. Note that this page does already explain that you can use the syntax ExecutionEnvironment.getEnvironmentVariable(‘PANDA3D_ROOT’), which is an alternate syntax that returns the same thing as Filename.expandFrom(’$PANDA3D_ROOT’). So it’s not that the information was missing, but perhaps it was just not explained in a clear enough way for someone who wasn’t very familiar with the use of environment variables and filenames?

David

When I tried to list the contents of that path, it gave me nothing but dlls and xmls. I couldn’t find the actual images or models.

OK, so some detective work is in order here.

You say: I want to locate the models that are in my package. I tried looking in the place that I thought should hold the files in my package, but all I saw were dlls and xmls.

So, there are two possibilities: either (a) you were not looking in the right place, and the files you were looking at had nothing to do with the contents of your package, or (b) you were looking in the right place, but the models that you expected to be in your package weren’t actually in your package after all.

So, let’s try to figure out whether it’s (a) or (b), and then we can go from there to figure out what to do about it.

The easiest way to figure out whether it’s (a) or (b) is to compare the list of files that you saw in that location with the list of files that is actually in your package.

You can get the list of files in your package by looking at the import.xml file that your package built, or by using the multify command on your package’s .mf file (you might need to punzip the .mf file first, depending on where you’re looking at it). Are the models that you expect to find actually listed in the package?

Now, what are the dlls and xmls you’re seeing? Are they files that were listed in the package, or are they some different files? What filenames are they exactly?

David

Nevermind, I discovered why it was the wrong list of files. I copied and pasted the ExecutionEnvironment line but forgot to change the package name, so it was set to PANDA3D_ROOT.

I hate it when I make errors that don’t break the game.