Community
void CreateUserProperties(KFbxSdkManager*& pSdkManager, KFbxNode *pNode) {
// Now we create the user properties
KFbxProperty p1 = KFbxProperty::Create(pNode,"MyBooleanProperty", DTBool, "My Bool");
KFbxProperty p2 = KFbxProperty::Create(pNode,"MyRealProperty", DTFloat, "My floating point number");
KFbxProperty p3 = KFbxProperty::Create(pNode,"MyColorProperty", DTColor3, "My Color");
KFbxProperty p4 = KFbxProperty::Create(pNode,"MyInteger", DTInteger, "My Integer");
KFbxProperty p5 = KFbxProperty::Create(pNode,"MyVector", DTDouble4, "My Vector");
KFbxProperty p6 = KFbxProperty::Create(pNode,"MyList", DTStringList, "My List");
/*
NOTE: The properties labels exists only while the property object is in memory.
The label is not saved in the FBX file. When loading properties from the FBX file
it will take the same value as the property name.
*/
// we now fill the properties. All the properties are user properties so we set the
// correct flag
p1.ModifyFlag(KFbxUserProperty::eUSER, true);
p2.ModifyFlag(KFbxUserProperty::eUSER, true);
p3.ModifyFlag(KFbxUserProperty::eUSER, true);
p4.ModifyFlag(KFbxUserProperty::eUSER, true);
p5.ModifyFlag(KFbxUserProperty::eUSER, true);
p6.ModifyFlag(KFbxUserProperty::eUSER, true);
// let's make MyColorProperty, MyVector and MyList animatables
p3.ModifyFlag(KFbxUserProperty::eANIMATABLE, true);
p5.ModifyFlag(KFbxUserProperty::eANIMATABLE, true);
p6.ModifyFlag(KFbxUserProperty::eANIMATABLE, true);
// we set the default values
KFbxColor lRed(1.0, 0.0, 0.0);
p1.Set(false);
p2.Set(3.33);
p3.Set(lRed);
p4.Set(11);
p5.Set(fbxDouble3(-1.1, 2.2, -3.3));
p6.Set(2);
// and some limits
p4.SetLimits(-5.0, 9.0);
p5.SetLimits(0.0, 2.1);
// add elements to the list
p6.AddEnumValue("one");
p6.AddEnumValue("two");
p6.AddEnumValue("three");
p6.AddEnumValue("Four");
p6.InsertEnumValue(0, "zero");
}
Can't find what you're looking for? Ask the community or share your knowledge.