Example #1
0
        public static void TestAllAnimSize()
        {
            var support = 0;
            var correct = 0;

            var animationClipGuids     = AssetDatabase.FindAssets("t:AnimationClip");
            var animationClipGuidCount = animationClipGuids.Length;

            for (var i = 0; i < animationClipGuidCount; ++i)
            {
                var animationClipGuid = animationClipGuids[i];
                var animationClipPath = AssetDatabase.GUIDToAssetPath(animationClipGuid);
                var animationClip     =
                    AssetDatabase.LoadAssetAtPath(animationClipPath, typeof(AnimationClip)) as AnimationClip;
                var stats = AnimationClipStatsPublic.Get(animationClip);
                if (!IsSupport(stats))
                {
                    continue;
                }

                try
                {
                    EditorUtility.DisplayProgressBar("Process",
                                                     string.Format("[{0}/{1}] {2}\n", i, animationClipGuidCount, animationClip.name),
                                                     ((float)i) / animationClipGuidCount);

                    var builder = new AnimationClipBuilder(animationClip);
                    var mystats = builder.GetStats();

                    support++;
                    if (stats.size == mystats.size)
                    {
                        correct++;
                        continue;
                    }

                    Debug.Log(
                        string.Format("{0}\t{1}\t{2}\t{3}", animationClip.name, stats.size, mystats.size,
                                      stats.size - mystats.size), animationClip);
                }
                catch (Exception e)
                {
                    Debug.Log(string.Format("{0}, Exception:{1}", animationClip.name, e.Message), animationClip);
                }
            }

            Debug.LogFormat("Total: {0} Support: {1} Correct:{2}", animationClipGuidCount, support, correct);
            EditorUtility.ClearProgressBar();
        }
Example #2
0
        public static void TestAnimSize()
        {
            var animationClip = Selection.activeObject as AnimationClip;

            if (animationClip == null)
            {
                Debug.Log("AnimationClip not selected");
                return;
            }

            var stats = AnimationClipStatsPublic.Get(animationClip);

            if (!IsSupport(stats))
            {
                Debug.Log("Unsupported AnimationClip");
                return;
            }

            var builder = new AnimationClipBuilder(animationClip);
            var mystats = builder.GetStats();

            Debug.LogFormat("{0}\t{1}\t{2}\t{3}", animationClip.name, stats.size, mystats.size,
                            stats.size - mystats.size);
        }