Ejemplo n.º 1
0
        private static void AddAnimData(AnimBone animBone, SBKeyGroup <float> keys, ControlType ctype, TrackType ttype)
        {
            AnimData d = new AnimData();

            d.controlType = ctype;
            d.type        = ttype;
            if (IsAngular(ctype))
            {
                d.output = OutputType.angular;
            }

            float value = 0;

            if (keys.Keys.Count > 0)
            {
                value = keys.Keys[0].Value;
            }

            bool IsConstant = true;

            foreach (var key in keys.Keys)
            {
                if (key.Value != value)
                {
                    IsConstant = false;
                    break;
                }
            }
            foreach (var key in keys.Keys)
            {
                AnimKey animKey = new AnimKey()
                {
                    input  = key.Frame + 1,
                    output = IsAngular(ctype) ? (MayaSettings.UseRadians ? key.Value : (float)(key.Value * (180 / Math.PI))) : key.Value,
                };
                if (key.InterpolationType == InterpolationType.Hermite)
                {
                    animKey.intan  = "fixed";
                    animKey.outtan = "fixed";
                    animKey.t1     = key.InTan;
                    animKey.t2     = key.OutTan;
                }
                d.keys.Add(animKey);
                if (IsConstant)
                {
                    break;
                }
            }

            if (d.keys.Count > 0)
            {
                animBone.atts.Add(d);
            }
        }
Ejemplo n.º 2
0
        private static void AddAnimData(AnimBone animBone, SBKeyGroup <Matrix4> node, ControlType ctype, TrackType ttype)
        {
            AnimData d = new AnimData();

            d.controlType = ctype;
            d.type        = ttype;
            foreach (var key in node.Keys)
            {
                AnimKey animKey = new AnimKey()
                {
                    input  = key.Frame + 1,
                    output = GetValue(key.Value, ctype, ttype)
                };
                d.keys.Add(animKey);
            }

            if (d.keys.Count > 0)
            {
                animBone.atts.Add(d);
            }
        }