Tubez
01-04-2007 15:00:31
Dear all,
I have a rather complex entity that uses bones to do rudimentary damage visuals. Basically, when a part gets damaged I need to hide the geometry attached to a bone and unhide the geometry attached to another that shares its physical location.
It sounds simple enough, but i'm getting tangled up in static typing issues.
Let's walk over the skeleton:
getChild() returns a Node (not a SceneNode). So, while i can walk all through the tree, I cant setVisible on the geometry attached to it.
I understand that this is a generic problem of interfacing static and dynamic type systems. It's also very annoying
Possible solutions I see are either ensuring that the correct type is passed back from C++ using RTTI functions (e.g. dynamic_cast) or having pointer conversion functions (open to masive footshooting).
I'm not sure if there's something in py++ that makes this easy to resolve though!
I have a rather complex entity that uses bones to do rudimentary damage visuals. Basically, when a part gets damaged I need to hide the geometry attached to a bone and unhide the geometry attached to another that shares its physical location.
It sounds simple enough, but i'm getting tangled up in static typing issues.
Let's walk over the skeleton:
skel = box1.getSkeleton()
for i in range( skel.numBones):
bone = skel.getBone(i)
for j in range(bone.numChildren()):
# Child bones, one per part than can be damaged
child = bone.getChild(j)
for k in range(child.numChildren()):
# Grandchild bones, one damaged and one undamaged
# These guys have geometry attached, should therefore be SceneNodes
print child.getChild(k)
getChild() returns a Node (not a SceneNode). So, while i can walk all through the tree, I cant setVisible on the geometry attached to it.
I understand that this is a generic problem of interfacing static and dynamic type systems. It's also very annoying

Possible solutions I see are either ensuring that the correct type is passed back from C++ using RTTI functions (e.g. dynamic_cast) or having pointer conversion functions (open to masive footshooting).
I'm not sure if there's something in py++ that makes this easy to resolve though!