Esempio n. 1
0
        public static void CreateAnimationKey(string objectName, string channel, int channelIndex, int frame, float value, int interpolation)
        {
            AnimatableProperty property = BlenderToVRtistAnimationProperty(channel, channelIndex);

            if (property == AnimatableProperty.Unknown)
            {
                Debug.LogError("Unknown Animation Property " + objectName + " " + channel + " " + channelIndex);
                return;
            }

            Node node = SyncData.nodes[objectName];

            // Apply to instances
            foreach (Tuple <GameObject, string> t in node.instances)
            {
                GameObject   gobj         = t.Item1;
                AnimationSet animationSet = GlobalState.Animation.GetOrCreateObjectAnimation(gobj);
                Curve        curve        = animationSet.GetCurve(property);

                if (property == AnimatableProperty.RotationX || property == AnimatableProperty.RotationY || property == AnimatableProperty.RotationZ)
                {
                    value = Mathf.Rad2Deg * value;
                }

                curve.AddKey(new AnimationKey(frame, value, (Interpolation)interpolation));
            }
        }
Esempio n. 2
0
        public static void MoveAnimationKey(string objectName, string channel, int channelIndex, int frame, int newFrame)
        {
            AnimatableProperty property = BlenderToVRtistAnimationProperty(channel, channelIndex);

            if (property == AnimatableProperty.Unknown)
            {
                Debug.LogError("Unknown Animation Property " + objectName + " " + channel + " " + channelIndex);
                return;
            }

            Node node = SyncData.nodes[objectName];

            // Apply to instances
            foreach (Tuple <GameObject, string> t in node.instances)
            {
                GameObject   gobj         = t.Item1;
                AnimationSet animationSet = GlobalState.Animation.GetOrCreateObjectAnimation(gobj);
                Curve        curve        = animationSet.GetCurve(property);
                curve.MoveKey(frame, newFrame);
            }
        }