how to get access to a NodePath subclass

Try this trick:

s.setPythonTag('trueClass', s)

Then:

b = render.find('**/name')
s = b.getPythonTag('trueClass')

which will return the Python object you associated with the NodePath under the tag “trueClass”.

Or even:

s = b.getNetPythonTag('trueClass')

which is the same as getPythonTag(), but it will walk up the tree if necessary to find the first parent that contains a definition for the tag “trueClass”, which is particularly useful if you got the NodePath via picking (which is likely to return a child of your root NodePath).

Caution! Note that when you do this:

s.setPythonTag('trueClass', s)

You have created a reference count loop. s now contains a reference to itself, and so it will never be freed by Python’s reference-counting mechanism. Worse, for various fiddly reasons having to do with the way Python’s garbage collector works, it will never be garbage collected either. So this will create a memory leak, unless you remember to do:

s.clearPythonTag('trueClass')

when you are done with it.

David