|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Member |
I have a keyframe animation that, for the sake of argument, moves an instance from one place in the scene to another. So over a period of time, the object's coordinates (loc_ property) are changing.
Is it possible with the SDK to somehow get notifed whenever the location changes. Like an event or callback? I need to report the coordinates over time, but they are being generated by the keys and interpolators in the animation. I don't want to have to calculate them myself. TIA, Loz. |
||
|
| <Niko>
|
the brackets have been removed....
the line: CXPRefPtr myProp = new CXPCOMObj; should be ssen like: CXPRefPtr[MyPropertyNotifier] myProp = new CXPCOMObj[MyPropertyNotifier]; where '[' and ']' are the lessthan and morethan signs |
||
|
|
Member |
Niko,
First of all, I had to add: BEGIN_CXPCOM_MAP() END_CXPCOM_MAP() to the MyPropertyNotifier class to get it to compile. But then I was getting another compiler error on the last line of the example you gave to me: NIK_AttachAttribute(instance, "Translation", myProp); There is no function signiture that matches that in Client.h. The closest I found was: NIK_AttachAttribute(instance, myProp); When I set the property's value, using: NIK_Attribute(...).Set(...); *my* Set routine is called. Perfect!!!! But, in my animator I need to reference the property that is going to be updated in the base animator's SetTargetAndProperty method. But that only accepts an old style property id ('loc_'). How do I tell it to change "Translation" instead? I tried getting the code for my new property using RuntimeCode() but when it delegated the call to the real "Translation" property the returned value was 0xCCCCCCCC, which doesn't work. Am I going down the right line of thinking? Thanks a lot for your help, Loz. |
|||
|
|
Member |
Update....
The animator *is* calling the new class routines. The id returned from RuntimeCode() is 0xFF000002, I think. But I get a stack problem when the following happens (the first time Set() is called with a CXPPoint3d): 1. New code (as you described) in the Set() method: return p.GetPropertyInfo()->Set(obj, p); 2. New code (as you described) in the RuntimeCode() method: return p.GetPropertyInfo()->RuntimeCode(); 3. Valid id returned (0xFF000002)... but later the system returns *to* an invalid address... like the stack got overwritten. I didn't call RuntimeCode() this time, the NIK logic did. Any ideas? TIA, Loz. |
|||
|
| <Niko>
|
i am not sure if i follow.
what is 1,2 and 3 ? you placed some breakpoints and it is were you stop ? if your "Set" fuinction is called by the animator (and now that i think about it, it should) i really don't see what could be a problem. try: return p.GetPropertyInfo()->Set(p.GetObjectInfo(), p); now that i see that, maybe there is a mix up with the 'p' (actually i am surprised it would compile) can you change the NIK_Property p; data member to something called, let's say, mP; and then try with mP.GetPropertyInfo->Set(mP.GetObjectInfo(), p); |
||
|
| <Niko>
|
other question, are you sure you are doing:
NIK_Property p = NIK_Attribute(instance, "Translation"); myProp->mP = p; before: NIK_AttachAttribute(instance, myProp); ? because if you inverse the lines, you will end up in an infinite loop, since you will keep redispatching to yourself |
||
|
|
Member |
Niko,
I had already spotted the mix up with the p variables !!! It turned out that my overridden Set() method was causing the problem. It was like this: boolean CxyzProp::Set( NIK_IObjectInfo *pIOInfo, const void *pValue) { return(pProp.GetPropertyInfo()->Set(pIOInfo, pValue)); } but should have been like this: boolean CxyzProp::Set( NIK_IObjectInfo *pIOInfo, const void *pValue) { return(pProp.GetPropertyInfo()->Set(pProp.GetObjectInfo(), pValue)); } The object information pointer being used was refering to the new property, instead of the original property. But of course, because it just delegates calls to the original, its own internal state had never been initialized. The wrong pointer caused the stack to get overwritten with the new CXPPoint3d Everything works fine now.... thanks for all your help and ideas. Loz. |
|||
|
| Powered by Eve Community |
| Please Wait. Your request is being processed... |
|

