[SOLVED]cast floats to AnyNumericValues?

saladin

29-10-2007 12:09:23

Hi,

I'm trying to use numericAnimations to control some time related values. And I haven't had much luck converting a float to an ogre.AnyNumericValue.
Code:
ogre.AnyNumeric(3.0)
Traceback (most recent call last):
File "<input>", line 1, in <module>
ArgumentError: Python argument types in
AnyNumeric.__init__(AnyNumeric, float)
did not match C++ signature:
__init__(struct _object *, class Ogre::AnyNumeric other)
__init__(struct _object *, class Ogre::AnyNumeric value)
__init__(struct _object *)
__init__(struct _object *)


Is there any way I can work around it?

Cheers.

andy

29-10-2007 19:37:15

Can you send through a bit more of an example -- ie where does the AnyNumeric get used? etc

In looking at the wrapper code there is probably an issue which I'll resolve

Regards

Andy

saladin

30-10-2007 03:51:53

Can you send through a bit more of an example -- ie where does the AnyNumeric get used? etc

In looking at the wrapper code there is probably an issue which I'll resolve

Regards

Andy

Sorry I should have given more details.
It's to be used in a numericAnimationTrack.
So the code looks something like
anim = sceneManager.createAnimation("test")
nt = anim.createNumericTrack(1)
kf = nt.createNumericKeyFrame(0)
kf.setValue(ogre.AnyNumeric(113))

andy

30-10-2007 04:21:47

I'll probably have to fix this in the next patch release..

In the mean time you could use NodeKeyFrames as in Demo_CameraTracking.py demo (if this works for you).....

Andy

andy

01-11-2007 01:48:52

A quick update on this -- I have found the issue and it is resolved - fix will be in the next binary release and in the SVN soon..

Problem was that Ogre::Any and Ogre::AnyNumeric are implemented using templates and so I had to specifically create dummy variables (for each 'type' that needed to be exposed, using python_ogre_sizeof.h) to ensure the necessary constructors were created in the wrappers..

Regards

Andy

saladin

01-11-2007 09:45:17

Well done.
Cheers.