gehn
12-02-2006 23:11:54
How do I use StringVectorPtr in pyOgre? I specifically am trying to do this:
But since findResourceNames() returns a StringVectorPtr, I can't iterate over it pythonically. So I tried:
But despite the pydocs saying otherwise, StringVectorPtrs don't have a __len__. Trying to add .get() for the StringVector itself causes a segfault.
So what's the proper way to do this? Or should I just stay away from trying to use these methods in python?
manager = ogre.ResourceGroupManager.getSingleton()
for mesh in manager.findResourceNames( "mygroup", "*.mesh" ):
manager.declareResource( mesh, "Mesh", "mygroup" )
But since findResourceNames() returns a StringVectorPtr, I can't iterate over it pythonically. So I tried:
manager = ogre.ResourceGroupManager.getSingleton()
meshes = manager.findResourceNames( "mygroup", "*.mesh" )
for i in range(len(meshes)):
manager.declareResource( meshes[i], "Mesh", "mygroup" )
But despite the pydocs saying otherwise, StringVectorPtrs don't have a __len__. Trying to add .get() for the StringVector itself causes a segfault.
So what's the proper way to do this? Or should I just stay away from trying to use these methods in python?