dermont
24-02-2009 09:06:35
Does anyone have an example of creating a custom MovableObjectFactory. I appear to be having a problem overriding the getType method.
Example Class:
Creating Factory:
Error:
Example Class:
class TestMovableObjectFactory(ogre.MovableObjectFactory):
FACTORY_TYPE_NAME = None
def __init__(self):
ogre.MovableObjectFactory.__init__(self)
print self.getTypeFlags()
print self.FACTORY_TYPE_NAME
def __del__(self):
pass
def createInstanceImpl( self, name, params ):
return ogre.MovableObject()
def getType(self):
return self.FACTORY_TYPE_NAME
def destroyInstance(self, obj ):
del obj
TestMovableObjectFactory.FACTORY_TYPE_NAME = "TestMovableFactory"
Creating Factory:
...
self.testMovableObjectFactory = TestMovableObjectFactory()
if not self.root.getSingleton().hasMovableObjectFactory("TestMovableFactory"):
self.root.getSingleton().addMovableObjectFactory( self.testMovableObjectFactory )
..
Error:
RuntimeError: warning W1049: This method could not be overriden in Python - method returns reference to local variable!