“**/hand” is a collide group im my model. But when i run the code i got:
File “BlenderImport.py”, line 20, in init
magic.find("**/hand").node().setIntoCollideNode(BitMask32.bit(0))
AssertionError: !is_empty() at line 269 of c:\p\panda3d-1.5.4\panda\src\pgraph\nodePath.I
It means the node that “magic” points to is empty. That’s usually the result of a find() operation that failed.
It just means it failed to find the node “hand”. Are you sure an EggGroup named like that exists in the model, and with that exact name? I believe it’s case-sensitive.
I put the collide tag in file because i don´t know how to make Chiken (i use blender for modelling) put collide in EGG files. I ever see this topic in Chiken Help then i think put the Collision tag by myself. This could be wrong …
How to solve this?
Thanks for advice
As pro-rsoft points out, the result of find() is always a NodePath, so it always evaluates true, whether or not the find() succeeded. So the above code will always print “allright” in every case.
Another developer pointed out that this common mistake can be reduced by the simple expedient of making an empty NodePath (such as is returned by a failed find) evaluate to false. So I’ve just checked in the necessary code to do this, and it will presumably become a part of 1.6.0. This will make the code above behave as expected.
Of course, if you write code like this:
if magic.find("**/hand") != None:
print "allright"
This change won’t help you. You do still need to be careful what assumptions you make about the return values of functions.
Actually, as drwr pointed out, even if the node doesn’t get found it returns a NodePath object, and thus in all cases it will print out “allright”. You should use this instead:
if not self.magik.find("**/casca").isEmpty():
print "allright"
else:
print "Not Yet"
Perhaps the dart tag blocks the search indeed, as ynjh_jo pointed out.
In magikCube.egg i put away the collide tag created by myself.
It seens i try use a Actor like a Model and (i guess) this is the origin of all trouble. I compare my magikCube.egg and ralph.egg (from Roaming Ralph tutorial) and see the ralph got no … i guess this tag is only for static Models.
Hello, I think I’m having a similar problem and still can’t manage to get it working.
I’m trying to attach a collisions to an actor. I’ve managed to do this fine with a static model (by taking out the { 1 } in the .egg file) but using the same method with an actor thats loaded with animation and interactivity doesnt work, it requires the tag to function correctly it would seem.
Collision structures aren’t supported within an animated model, at least not directly. If you really want animated collisions, you can load the collision structures separately, then expose the joints that should animate them, and parent the collision structures to the appropriate joint nodes.
gladCol and glad are essentially the same .egg file but I’ve removed the tag in gladCol and created the GladiatorArm collide group of the vertixes of the gladiator’s arm to create the collision mesh. This will successfully create a collision mesh of the arm. If i try to reparent it to the arm geometry (##self.gladColc.reparentTo(self.gladTest)##) I get ‘isEmpty’ error. Any way round this?
“isEmpty” means that one of the NodePaths involved in the operation is an empty NodePath. An empty NodePath is like a NULL pointer, it doesn’t have any data in it.
Two common ways to get an empty NodePath is as the result of a failed loadModel() operation, or as the result of a failed find() operation. So, it seems that you didn’t find the node you were looking for.
You can check node.isEmpty() after a find() operation to verify that the find was successful.
Could we make empty node paths evaluate to False? We can still have it a nodepath for backward compatability but overload stuff like emptyNP == False to be true just like [] {} are false.