コード例 #1
0
        public int TestConstraintAnimation(System.Type componentType, float[] keyTimes, float[] keyValues, string propertyName)
        {
            var go     = new GameObject("root");
            var source = new GameObject("source");

            source.transform.parent = go.transform;

            var constraint = go.AddComponent(componentType) as IConstraint;

            Assert.That(constraint, Is.Not.Null);

            var cSource = new ConstraintSource();

            cSource.sourceTransform = source.transform;

            int index = constraint.AddSource(cSource);

            Assert.That(index, Is.EqualTo(0));

            var keyData = new FbxAnimationTest.PropertyKeyData
            {
                targetObject   = go,
                componentType  = componentType,
                propertyName   = propertyName,
                keyTimes       = keyTimes,
                keyFloatValues = keyValues
            };
            var tester = new FbxAnimationTest.AnimTester {
                keyData = keyData, testName = "ConstraintAnim_" + propertyName, path = GetRandomFbxFilePath()
            };

            return(tester.DoIt());
        }
コード例 #2
0
        public void AnimationWithLightColorTest()
        {
            var keyTimes      = new float[] { 0f, 1f, 2f };
            var propertyNames = new string[] { "m_Color.r", "m_Color.g", "m_Color.b" };

            var ran = new System.Random();

            float [] keyValues = Enumerable.Range(1, keyTimes.Length).Select(x => (float)ran.NextDouble()).ToArray();

            foreach (var v in keyValues)
            {
                Debug.Log("random value: " + v);
            }

            var keyData = new FbxAnimationTest.MultiPropertyKeyData
            {
                componentType = typeof(Light),
                propertyNames = propertyNames,
                keyTimes      = keyTimes,
                keyValues     = keyValues
            };
            var tester = new FbxAnimationTest.AnimTester {
                keyData = keyData, testName = "LightAnim_Color", path = GetRandomFbxFilePath()
            };

            tester.DoIt();
        }
コード例 #3
0
        public void AnimationWithCameraFOVTest()
        {
            var keyData = new FbxAnimationTest.PropertyKeyData
            {
                componentType  = typeof(Camera),
                propertyName   = "field of view",
                keyTimes       = new float[] { 0f, 1f, 2f },
                keyFloatValues = new float[] { 1f, 2f, 3f }
            };
            var tester = new FbxAnimationTest.AnimTester {
                keyData = keyData, testName = "CameraFOV", path = GetRandomFbxFilePath()
            };

            tester.DoIt();
        }
コード例 #4
0
        public int AnimationWithLightTest(float[] keyTimes, float[] keyValues, string propertyName)
        {
            var keyData = new FbxAnimationTest.PropertyKeyData
            {
                componentType  = typeof(Light),
                propertyName   = propertyName,
                keyTimes       = keyTimes,
                keyFloatValues = keyValues
            };
            var tester = new FbxAnimationTest.AnimTester {
                keyData = keyData, testName = "LightAnim_" + propertyName, path = GetRandomFbxFilePath()
            };

            return(tester.DoIt());
        }