getUserObjectBindings().setUserAny() not working

filmore

30-06-2011 20:05:51

I'm trying to set some userdata to my entities like this:

entity.getUserObjectBindings().setUserAny(ogre.Any('hello'))
print entity.getUserObjectBindings().getUserAny().getData()

I get ('none', 0).

When I do:

entity.setUserAny(ogre.Any('hello'))
print entity.getUserAny().getData()

I get ('p', 'hello').

However, the second method is deprecated. Any ideas?

filmore

03-07-2011 21:34:54

It also crashes when using setUserAny() directly on an entity if the Any object is a tuple. I really need to find a way to set some user data.

dermont

06-07-2011 14:59:03

It also crashes when using setUserAny() directly on an entity if the Any object is a tuple. I really need to find a way to set some user data.

You need to post a simple program with an example of how you are using ogre.Any. At a guess I would say you were doing something like the following, if so try keeping a reference to your tuple.


def _createScene(self):
..
### entity.setUserAny(ogre.Any((1,2,3,self.sceneManager)))

self.myList = (1,2,3,self.sceneManager)
entity.setUserAny(ogre.Any(self.myList))

def whatever(self):

print entity.getUserAny().getData()


Also check the following link for other ways of using ogre.Any:
viewtopic.php?f=3&t=11320

filmore

06-07-2011 16:31:45

Yup, it was a reference problem. Thanks.