question about the Panda3D Manual: Instancing

Hello everyone, I follow the manual, but i got an error like this:

Assertion failed: !is_empty() at line 335 of panda/src/pgraph/nodePath.cxx
Traceback (most recent call last):
File “/home/username/workspace/panda3d/src/”, line 149, in
AssertionError: !is_empty() at line 335 of panda/src/pgraph/nodePath.cxx

I am wondering if there is a error in my code,but could’n figure it out.
Here is my code, I used the panda to be my actor:

import direct.directbase.DirectStart
from pandac.PandaModules import *
from import Actor

pandaActor = Actor.Actor("models/panda-model",{"walk_a":"models/panda-walk4"})
pandaActor.setScale(0.005, 0.005, 0.005)
chorusline = NodePath()
for i in range(50):
    placeholder_q = chorusline.attachNewNode("Dancer-Placeholder")
    placeholder_q.setPos(i * 5,0,0)

for i in range(3):
    placeholder_a = render.attachNewNode("Line-Placeholder")
    placeholder_a.setPos(0,i * 10,0)


Thanks for the replying.

Ubuntu 7.10
Eclipse 3.3.2
Panda 1.5.3

The line:

chorusline = NodePath()

creates a NodePath that contains no node. It is like a NULL pointer; it is an error to do anything with it. You can’t attach nodes to it, and you can’t reparent it to render.

Instead, try this line:

chorusline = NodePath('chorusline')

This line has a very different meaning. Instead of a NodePath with no node, it creates a default PandaNode named ‘chorusline’, and then creates a NodePath to that node. You can then use this NodePath for all the purposes you have in mind.

Incidentally, there’s no point to the line:


because the line is about to be instanced to render three times below.

I’m not sure that the instancing page of the manual was really intended to be a cut-and-paste example; it was mainly trying to explain the concepts of instancing. But I suppose it can be useful to type in some code and see what it actually does. :slight_smile:


Oh, I got it now. Thanks! :smiley: