Cannot create cull-bins via config.prc

Hi,

I’d like to add some additional cull-bins, but I somehow fail to do this via config.prc.

Here’s what I do (pasted from the interactive python prompt)

>>> from pandac.PandaModules import loadPrcFile
>>> loadPrcFile("test.prc")
ConfigPage /c/TeamVienna/landc/Development/trunk/test.prc, 1 declarations.
>>> import direct.directbase.DirectStart
DirectStart: Starting the game.
Warning: DirectNotify: category 'Interval' already exists
Known pipe types:
  wdxGraphicsPipe9
(3 aux display modules not yet loaded.)
>>> from pandac.PandaModules import CullBinManager
>>> cbm = CullBinManager.getGlobalPtr()
>>> print cbm
background, fixed, 10
opaque, state_sorted, 20
transparent, back_to_front, 30
fixed, fixed, 40
unsorted, unsorted, 50
gui-popup, unsorted, 60

the contents of my prc file is as follows:

cull-bin erik 70 unsorted

So, to sum it up:

  • I try to add a bin named “erik”
  • I load the prc file before doing the directStart
  • The bin doesn’t show up in the cullbin manager.

Hm. what am I doing wrong?

Thanks,

Erik

Hi,

I just ran some more experiments and noted the following:

The problem seems to be rooted in the fact that I load my own prc file.
I mean, instead of modifying /etc/config.prc directly, I have my own prc file which I load explicitly.

If I add the cull-bin in the original config.prc, it works.

Do I need to do something else than loading the config.prc before executing the DirectStart to make it work?

Cheers,

Erik

The cull-bin variable is one of several that are queried once, at application start. After application start, you have to add bins using the CullBinManager::add_bin() method instead.

Or, you can put this line in your prc file, but instead of loading your prc file via runtime commands, ensure that it gets loaded by defining PRC_DIR and/or PRC_PATH to locate it correctly.

This is the way the prc system is really intended to be used. You can define these variables either as runtime environment variables (I think they’re called PANDA_PRC_DIR and PANDA_PRC_PATH as makepanda builds Panda), or you can compile them into Panda itself if you build your own Panda.

David

Oh, and by application start, I mean the very first import of PandaModules, not DirectStart. There’s no way to insert a loadPrcFile() command before application start.

David