Custom egg-object-type and egg2bam

Our project’s main python run script that we use to start the game calls loadPrcFile to load our custom prc settings, including some custom egg-object-type definitions.

# egg-object-type substitutions
egg-object-type-sphere             <Collide> { Sphere descend }
egg-object-type-sphere-trigger     <Collide> { Sphere descend intangible }
egg-object-type-capsule            <Collide> { Tube descend }
egg-object-type-capsule-trigger    <Collide> { Tube descend intangible }
egg-object-type-plane              <Collide> { Plane descend }
egg-object-type-plane-trigger      <Collide> { Plane descend intangible }
egg-object-type-mesh               <Collide> { Polyset descend }
egg-object-type-mesh-visible       <Collide> { Polyset keep descend }

Later in our main script, we start a process that grabs all of our egg files and converts them to bams. This python code is making os.system calls to egg2bam.

The problem is that the egg2bam runs don’t seem to be aware of the egg-object-type entries in our prc file.

I realize that one solution would be to put our egg-object-type definitions in the prc file(s) that Panda3D loads by default. But, I was wondering if there is a way for our loadPrcFile-loaded egg-object-type entries to be recognized by egg2bam.

With some help from some co-workers a solution was found. Just modify the “PRC_PATH” environment variable that Panda uses as the search path for prc files. For example, in python:

os.environ["PRC_PATH"] += ";%s" % prcPath

…where prcPath the the path to the folder containing any prc files you want loaded before egg2bam is run.