Panda3D's level editor / scene editor

To get set up with this system, you would have to do the following things:

1: Get the chicken exporter

Just download it from sourceforge. It should be just a zip file.

2: Unzip it and put it in your blender scripts directory

This part is slightly difficult to get right. Your scripts folder is under the folder “.blender” and then in “scripts”, which if you’re using Linux, would be normally hidden (Windows should be visible, though). If it is hidden, press Ctrl-H in your file browser. For Windows, it should be in your Program Files under Blender Foundation (I think) and in Linux the “.blender” folder should be right at your home folder.

After looking at your zip file, you should see that it has the exporter script and 2 folders named “bpydata” and “bpymodules”. Your corresponding script folder (called “scripts” in the “.blender” folder) should also have the “bpydata” and “bpymodules” folders. Copy the contents of your zip file to those directories specified by the folder structure in the zip file (I’m making this sound really complicated, but once you get down to it, it’s obvious). You should only be copying files, not folders.

Once it is all in there, fire up Blender. Split up your workspace by right-clicking along a window border, and then change the window type to “Scripts Window” by clicking on the icon in the lower-left corner of the window. Then, go to Scripts -> Export -> Chicken R91 (.egg)… The script should just run, giving you a GUI of some sort.

Actually Setting Up a Level

Normally when you set up a level using this method, you typically only want to export placeholders whereby in the script you can substitute those placeholders for game objects. That way, you are only exporting positions, rotations, and scales instead of all of the vertex, texture, and geometry data. To do this, you need to be able to know how to name your objects and how to add properties to them. To name the object, go the Objects panel (F7), go to the Object and Links pane, and right next to the OB: thing, click it and change the name to whatever is more descriptive. To see the name in your 3d window, click on the Name button under Draw Extra in the same panel (but in the Draw pane).

Any object you use in Blender can be made as a placeholder, but you have to tell the Chicken exporter that this is what you want. To do so, go to the Logic panel (F4) and click on Add Property. Switch the data type to Bool, name it “ForceEmpty”, and mark it True. Now the Chicken exporter will treat that object as an empty, a point in space that’s rotated and scaled.

The “Add Property” button mentioned earlier is also how one can apply tags to their objects. I would usually use Strings, but I’m pretty sure it supports all data types.

To export the level, select everything by pressing A, click “Update Selection” in the Chicken GUI, select your file destination, and click Export. This .egg file how holds your level data.

Accessing Objects from Your Level Data

First, you must load your level .egg file using loader.loadModel(). Then, for debug purposes, you would want to print out the contents of your level file using .ls()

level = loader.loadModel('Level1')
level.ls()

Every node should be listed, and any tags that a node has will be shown as [] on the same line. To get a handle for an object in your level just do the following (using an example):

level = loader.loadModel('Level1')

# Show level
level.ls()

# Load my player
player = loader.loadModel('Player')

# Get my player placeholder in the level (I named my holder "Player Placeholder")
placeholder = level.find('**/PlayerPlaceholder')

# Set my player according to my placeholder
player.setPos(placeholder.getPos())
player.setHpr(placeholder.getHpr())
player.setSx(placeholder.getSx())
player.setSy(placeholder.getSy())
player.setSz(placeholder.getSz())

# Get the the value of my "health" tag from my placeholder
health = placeholder.getTag('health')

If you need clarification, just ask me.
[/code]