public int ContinuousRotationAnimTest(RotationCurveType rotCurveType, float [] keyTimesInSeconds, Vector3 [] keyEulerValues) { System.Type componentType = typeof(Transform); string[] propertyNames = null; string testName = componentType.ToString() + "_ContinuousRotations"; bool compareOriginalKeys = false; switch (rotCurveType) { case RotationCurveType.kEuler: testName += "_Euler"; propertyNames = AnimationTestDataClass.m_rotationEulerNames.ToArray(); break; case RotationCurveType.kQuaternion: compareOriginalKeys = true; testName += "_Quaternion"; propertyNames = AnimationTestDataClass.m_rotationQuaternionNames.ToArray(); break; } KeyData keyData = new TransformKeyData { importSettings = new { resampleCurves = false, animationType = ModelImporterAnimationType.Legacy, animationCompression = ModelImporterAnimationCompression.Off, importConstraints = true }, compareOriginalKeys = compareOriginalKeys, RotationType = rotCurveType, propertyNames = propertyNames, componentType = componentType, keyTimes = keyTimesInSeconds, keyEulerValues = keyEulerValues }; var tester = new AnimTester { keyData = keyData, testName = testName, path = GetRandomFbxFilePath() }; return(tester.DoIt()); }
public int BlendshapeAnimTest(float [] keyTimesInSeconds, float [] keyValues, System.Type componentType, string componentName) { var prefabPath = FindPathInUnitTests("Models/blendshape.fbx"); Assert.That(prefabPath, Is.Not.Null); // add prefab to scene GameObject originalGO = AddAssetToScene(prefabPath); KeyData keyData = new PropertyKeyData { targetObject = originalGO, propertyName = componentName, componentType = componentType, keyTimes = keyTimesInSeconds, keyFloatValues = keyValues }; var tester = new AnimTester { keyData = keyData, testName = componentName, path = GetRandomFbxFilePath() }; var exportOptions = new ExportModelSettingsSerialize(); exportOptions.SetAnimatedSkinnedMesh(true); tester.exportOptions = exportOptions; return(tester.DoIt()); }
public int GimbalConditionsAnimTest(float [] keyTimesInSeconds, Vector3 [] keyValues, System.Type componentType, string [] componentNames) { KeyData keyData = new QuaternionKeyData { propertyNames = componentNames, componentType = componentType, keyTimes = keyTimesInSeconds, keyEulerValues = keyValues }; var tester = new AnimTester { keyData = keyData, testName = componentType.ToString() + "_Gimbal", path = GetRandomFbxFilePath() }; return(tester.DoIt()); }
public int QuaternionPropertyAnimTest(float [] keyTimesInSeconds, Vector3 [] keyValues, System.Type componentType, string[] componentNames) { KeyData keyData = new QuaternionKeyData { compareOriginalKeys = true, propertyNames = componentNames, componentType = componentType, keyTimes = keyTimesInSeconds, keyEulerValues = keyValues }; var tester = new AnimTester { keyData = keyData, testName = (componentType.ToString() + "_Quaternion"), path = GetRandomFbxFilePath() }; return(tester.DoIt()); }
public int SimplePropertyAnimTest(float [] keyTimesInSeconds, float [] keyValues, System.Type componentType, string componentName) { KeyData keyData = new PropertyKeyData { propertyName = componentName, componentType = componentType, keyTimes = keyTimesInSeconds, keyFloatValues = keyValues }; var tester = new AnimTester { keyData = keyData, testName = componentName, path = GetRandomFbxFilePath() }; return(tester.DoIt()); }
public int ComponentAnimTest(System.Type componentType) { #if DEBUG_UNITTEST Debug.Log(string.Format("ComponentAnimTest {0}", componentType.ToString())); #endif if (!ModelExporter.MapsToFbxObject.ContainsKey(componentType)) { #if DEBUG_UNITTEST Debug.Log(string.Format("skipping {0}; fbx export not supported", componentType.ToString())); #endif return(1); } string testName = "ComponentAnimTest_" + componentType.ToString(); GameObject targetObject = AnimTester.CreateTargetObject(testName, componentType); string [] propertyNames = (from b in AnimationUtility.GetAnimatableBindings(targetObject, targetObject) where b.type == componentType select b.propertyName).ToArray(); if (propertyNames.Length == 0) { #if DEBUG_UNITTEST Debug.Log(string.Format("skipping {0}; no animatable Single properties found", componentType.ToString())); #endif return(1); } float [] keyTimesInSeconds = new float [3] { 1f, 2f, 3f }; var ran = new System.Random(); float [] keyValues = Enumerable.Range(1, keyTimesInSeconds.Length).Select(x => (float)ran.NextDouble()).ToArray(); KeyData keyData = new MultiPropertyKeyData { propertyNames = propertyNames, componentType = componentType, keyTimes = keyTimesInSeconds, keyValues = keyValues, targetObject = targetObject }; var tester = new AnimTester { keyData = keyData, testName = testName, path = GetRandomFbxFilePath() }; return(tester.DoIt() <= propertyNames.Length ? 1 : 0); }