|
Hello,
I’m working on an add-on to help users tag animations using some of our in-house data. I’ve employed a method to leverage the FBPropertyVector4d type to hold three floating-point values and then an extraneous piece of relational data. The implementation requires that the FBPropertyVector4d type be animatable, thus the call
newProperty = selectedComponent->PropertyCreate("Property Name", kFBPT_vector4D, ANIMATIONNODE_TYPE_VECTOR, true, true)
is invoked.
A legitimate property is produced—at least it appears to be valid. Next, I set the vector with valid data:
FBVector4d vector; vector.mValue[0] = (double) number; vector.mValue[1] = 0.0; vector.mValue[2] = 0.0; vector.mValue[3] = (double) id; newProperty->SetData(&vector)
If I call
newProperty->GetData(&vector, sizeof(FBVector4d))
immediately after the SetData call, I will get trash data without fail. This is my first problem. Am I acquiring the data from the property class appropriately? My suspicion is that the FBPropertyVector4d isn’t properly supported since it has an array.
Now, I continued past this to see how far I could get. The next step is to key this new property on the current frame:
HFBPropertyAnimatable lAnimatableProperty = (HFBPropertyAnimatable)newProperty; lAnimatableProperty->SetAnimated(true)
HFBAnimationNode lNode = lAnimatableProperty->GetAnimationNode()
FBVector4d data; newProperty->GetData((void*) &data, sizeof(FBVector4d))
lNode->KeyAdd((double*) &(data.mValue[0]))
At this point, the property is keyed at the current frame, although it’s values appear to reset back to the zero vector. What is weird about this behavior is that I can go to the “Properties” tab in the “Asset Browser” and see my valid data there for a split second before it is reset. If I do not key this property, the data will be correct and remain.
Another major issue I’ve experienced is that FBPropertyVector types do not have an FCurve. My guess (although this doesn’t appear documented) is that FBPropertyVector types’ sub-classes (x, y, z) have curves of their own. Is there any way to access those in the 2009 MotionBuilder SDK?
Has anyone else experienced similar issues with using FBPropertyVector types?
I’m currently at a loss on how to create these properly through the OpenReality SDK without having some wonky behavior. Any advice would be greatly appreciated.
|