panda3d.org/manual/index.php … cene_Graph
Tags allow me to use Blender+Chicken and the egg format for my levels.
In this example, the egg nodes are browsed and searched for tags, when a tag is found and it’s in the tags dictionary, the corresponding function is ran.
Ive used only few tags here as example, you can ultimately have a “trigger” tag to call a corresponding function (based on the value string). You can use that for doors, buttons, or anything you’d want from a level editor.
import direct.directbase.DirectStart
from pandac.PandaModules import *
scene = loader.loadModel('scene')
scene.reparentTo(render)
def setBillboard(myNodePath, value):
if value == "axis":
myNodePath.setBillboardAxis()
elif value == "World":
myNodePath.setBillboardPointWorld()
else:
myNodePath.setBillboardPointEye()
def setPoint(myNodePath, value):
myNodePath.setRenderMode(RenderModeAttrib.MPoint, float(value))
def setWire(myNodePath, value):
myNodePath.setRenderMode(RenderModeAttrib.MWireframe, float(value))
def setShadeless(myNodePath):
myNodePath.setLightOff()
def setBackground(myNodePath, value):
myNodePath.setBin('background', int(value))
tags = {
'billboard' : setBillboard,
'point' : setPoint,
'wire' : setWire,
'shadeless' : setShadeless,
'background' : setBackground}
for tag in tags.keys():
for node in myNodePath.findAllMatches('**/=' + tag):
tags[tag](node, node.getTag(tag))
run()
Look in the chicken exporter manual to find out how to set tags in Blender.