Esempio n. 1
0
    public static void ReadBlendShapes(string s, out List <Dictionary <string, float> > list, out List <float> times, out List <Vector3> pos, out List <Quaternion> rot, out List <Quaternion> camrot)
    {
        list   = new List <Dictionary <string, float> > ();
        times  = new List <float> ();
        pos    = new List <Vector3>();
        rot    = new List <Quaternion>();
        camrot = new List <Quaternion>();

        if (s.Length > 3)
        {
            string[] str = Parse.CaretSV(s);

            Debug.Log("TotalBlendShapeFrames: " + str.Length);
            for (int i = 0; i < str.Length; i++)
            {
                string[] sstar     = Parse.StarSV(str[i]);
                string   processed = sstar [0];

                string[] csv = Parse.CSV(processed);
                float    t   = Mathf2.String2Float(csv [0]);
                processed = DumpDelimiterAfter(1, ",", csv);

                list.Add(ParseBlendlet(processed));

                times.Add(t);

                if (sstar.Length > 1)
                {
                    string[] ttemp = Parse.TSV(sstar[1]);
                    pos.Add(Mathf2.String2Vector3(ttemp[0]));
                    rot.Add(Mathf2.String2Quat(ttemp[1]));
                    if (ttemp.Length > 2)
                    {
                        camrot.Add(Mathf2.String2Quat(ttemp[2]));
                    }
                }

                /*		if (i == 0)
                 *                      Debug.Log(DumpAppleKeys (processed));
                 * if (i == 0)
                 *  Debug.Log(DumpAppleKeysEnum(processed));*/
            }

            if (times [0] > 1f)
            {
                int timedelta = Mathf.FloorToInt(times[0]);

                for (int i = 0; i < times.Count; i++)
                {
                    times [i] -= timedelta;
                }
            }
        }
        else
        {
            Debug.Log(s.Length);
        }
    }
Esempio n. 2
0
    static Dictionary <string, float> ParseBlendlet(string s)
    {
        Dictionary <string, float> blendlet = new Dictionary <string, float> ();

        string[] str = Parse.SSV(s);
        for (int i = 0; i < str.Length; i++)
        {
            //	Debug.Log (str [i]);
            string[] str2 = Parse.CSV(str [i]);
            blendlet.Add(str2[0], Mathf2.String2Float(str2[1]));
        }
        return(blendlet);
    }