newconfig.prc at run time

Hello !
I’m still going here for help. I’m starting to fell bad that I only came when I’ve got questions and problems.
I want to say that I haven’t got much time, but that’s no excuse. :frowning:

back to the problem in progress:

I have imported special tag in my egg file ( from maya, using the mel script).
I want them to be understood in panda. I started by creating a prc file in panda3d\etc.

That works.

The problem I’m having is that I don’t want to put the file there. I want to have a explicit place where the file is stored, and I don’t want to modify in anyway the panda configuration.

In a perfect world, I want to do:

I found that doing:
page = configPageManger.getGlobalPtr().makeExplicitPage(‘myfile’)
should be that I want.
but readPrc require an istream which I don’t know how to produce.

Is there A way to have and istream from my file ? or an easier way that I overlooked ?

Not sure whether that’s the right way to do it, but you can create an istream by using VirtualFileSystem.openReadFile:

myIstream = VirtualFileSystem.getGlobalPtr().openReadFile(Filename("/c/myfile.prc"))

thank, I will try that immediately

Doesn’t the method in the manual work?

from pandac.PandaModules import loadPrcFile

oups ! :wink:
Yeah, that’s will probably works too.

Since I probably need to unload it after some time, it’s a good thing I learn how to use the ConfigPageManager anyway,…

The intended design of Panda is that each application has its own place to put prc files that will be read automatically at startup time. The PRC_PATH is supposed to support that. In particular, you can set PRC_PATH (or, I guess, PANDA_PRC_PATH as it is called by makepanda for some reason) to point to a directory that includes your personal prc files.

But it’s really supposed to be more automatic than that. The default PRC_PATH should include your application’s directory as well as the standard /panda/etc directory. This is the way it’s supposed to be set up, but I don’t think Josh necessarily saw that. We should probably change makepanda to make sure that the default PRC_PATH includes the current directory.


Actually, makepanda sets the default dir to etc, which will automatically traverse through some dirs (dunno which exactly) but I think if you place a prc file in ./etc it should be recognized.

I think etc is just intended to locate the current Panda installation. It’s based on wherever it finds libp3dtool.dll, and isn’t related to the current directory.

In any case, it should be searching something like “./etc;etc”, so that it searches both the current directory and the /c/panda/etc directories. One directory alone isn’t really sufficient, because you want to be able to specify custom configurations in your application’s directory, plus allow the system configurations to be picked up.

Actually, there should be a third directory as well, for user customizations, which won’t be lost when a new version of Panda is installed. The home directory, maybe, something like $HOME?


Okay, should I change the DEFAULT_PRC_PATH to that then? And should I add ~/ as well?

Hmm, might be more complicated than that. There might not be a DEFAULT_PRC_PATH setting, just a DEFAULT_PRC_DIR. Give me a little bit to investigate further.