protected void CheckCameraSettings(FbxCamera origCamera, FbxCamera importCamera, FbxNode origCameraNode, FbxNode importCameraNode) { Assert.AreEqual(origCamera.ProjectionType.Get(), importCamera.ProjectionType.Get()); Assert.AreEqual(origCamera.AspectWidth.Get(), importCamera.AspectWidth.Get()); Assert.AreEqual(origCamera.AspectHeight.Get(), importCamera.AspectHeight.Get()); Assert.AreEqual(origCamera.GetAspectRatioMode(), importCamera.GetAspectRatioMode()); Assert.AreEqual(origCamera.FilmAspectRatio.Get(), importCamera.FilmAspectRatio.Get()); Assert.AreEqual(origCamera.GetApertureWidth(), importCamera.GetApertureWidth()); Assert.AreEqual(origCamera.GetApertureHeight(), importCamera.GetApertureHeight()); Assert.AreEqual(origCamera.GetApertureMode(), origCamera.GetApertureMode()); Assert.AreEqual(origCamera.FocalLength.Get(), importCamera.FocalLength.Get()); Assert.AreEqual(origCamera.GetNearPlane(), importCamera.GetNearPlane()); Assert.AreEqual(origCamera.GetFarPlane(), importCamera.GetFarPlane()); foreach (var customProp in new string[] { "backgroundColor", "clearFlags" }) { FbxProperty property = origCameraNode.FindProperty(customProp); Assert.IsNotNull(property); Assert.IsTrue(property.IsValid()); FbxProperty importBgColorProp = importCameraNode.FindProperty(customProp); Assert.IsNotNull(importBgColorProp); Assert.IsTrue(importBgColorProp.IsValid()); if (property.GetPropertyDataType().Equals(Globals.FbxColor4DT)) { Assert.AreEqual(property.GetFbxColor(), property.GetFbxColor()); } else if (property.GetPropertyDataType().Equals(Globals.FbxIntDT)) { Assert.AreEqual(property.GetInt(), property.GetInt()); } Assert.AreEqual(property.GetFlag(FbxPropertyFlags.EFlags.eUserDefined), importBgColorProp.GetFlag(FbxPropertyFlags.EFlags.eUserDefined)); Assert.AreEqual(property.GetFlag(FbxPropertyFlags.EFlags.eAnimatable), importBgColorProp.GetFlag(FbxPropertyFlags.EFlags.eAnimatable)); } }
protected void CreateAnimCurves( FbxObject animObject, FbxAnimLayer animLayer, List <PropertyComponentPair> properties, System.Func <int, double> calcTime, // lambda function for calculating time based on index System.Func <int, float> calcValue, // lambda function for calculating value based on index FbxNodeAttribute animNodeAttr = null) { foreach (var pair in properties) { FbxProperty fbxProperty = animObject.FindProperty(pair.propertyName, false); if (animNodeAttr != null && (fbxProperty == null || !fbxProperty.IsValid())) { // backup method for finding the property if we can't find it on the node itself fbxProperty = animNodeAttr.FindProperty(pair.propertyName, false); } Assert.IsNotNull(fbxProperty); Assert.IsTrue(fbxProperty.IsValid()); Assert.That(fbxProperty.GetFlag(FbxPropertyFlags.EFlags.eAnimatable), Is.True); foreach (var component in pair.componentList) { // Create the AnimCurve on the channel FbxAnimCurve fbxAnimCurve = fbxProperty.GetCurve(animLayer, component, true); Assert.IsNotNull(fbxAnimCurve); fbxAnimCurve.KeyModifyBegin(); for (int keyIndex = 0; keyIndex < m_keyCount; ++keyIndex) { FbxTime fbxTime = FbxTime.FromSecondDouble(calcTime(keyIndex)); fbxAnimCurve.KeyAdd(fbxTime); fbxAnimCurve.KeySet(keyIndex, fbxTime, calcValue(keyIndex)); } fbxAnimCurve.KeyModifyEnd(); } } }