Пример #1
0
 private static void SetClip(SpriteAnimation spriteAnimation, SpriteAnimationClip clip)
 {
     //Selection.activeObject = clip;
     EditorGUIUtility.PingObject(clip);
     if (spriteAnimation)
     {
         spriteAnimation.clips = clip;
     }
 }
Пример #2
0
 private void Reset()
 {
     image = GetComponent <Image>();
     if (image.sprite)
     {
         SpriteAnimationClip.CreateSpriteAnimationClip(this, image.sprite);
         if (clips.Length > 0)
         {
             if (clips.clips[0].sprites.Length < 3)
             {
                 frameAnimation.FPS = 3;
             }
         }
     }
 }
Пример #3
0
        public override void OnInspectorGUI()
        {
            if (targets.Length == 1)
            {
                if (GUILayout.Button("Find/Create Clip By Image.sprite"))
                {
                    ImageAnimation s     = target as ImageAnimation;
                    Image          image = s.GetComponent <Image>();
                    if (!image)
                    {
                        Debug.LogWarning("Image if null");
                        return;
                    }

                    if (!image.sprite)
                    {
                        Debug.LogWarning("Image.sprite if null");
                        return;
                    }

                    SpriteAnimationClip.CreateSpriteAnimationClip(s, image.sprite);
                }
            }

            if (GUILayout.Button("Setup First Frame"))
            {
                for (int i = 0; i < targets.Length; i++)
                {
                    ImageAnimation s = targets[i] as ImageAnimation;
                    s.image = s.GetComponent <Image>();
                    if (s.image)
                    {
                        Undo.RecordObject(s.image, "Setup First Frame");
                        s.image.sprite = s.clips[0].sprites[0];
                        s.image.SetNativeSize();
                    }
                }
            }

            base.OnInspectorGUI();
        }
Пример #4
0
        public override void OnInspectorGUI()
        {
            if (targets.Length == 1)
            {
                if (GUILayout.Button("Find/Create Clip By SpriteRenderer.sprite"))
                {
                    SpriteRendererAnimation s = target as SpriteRendererAnimation;
                    SpriteRenderer          spriteRenderer = s.GetComponent <SpriteRenderer>();
                    s.spriteRenderer = spriteRenderer;
                    if (!spriteRenderer)
                    {
                        Debug.LogWarning("SpriteRenderer if null");
                        return;
                    }

                    if (!spriteRenderer.sprite)
                    {
                        Debug.LogWarning("SpriteRenderer.sprite if null");
                        return;
                    }

                    SpriteAnimationClip.CreateSpriteAnimationClip(s, spriteRenderer.sprite);
                }
            }

            if (GUILayout.Button("Setup First Frame"))
            {
                for (int i = 0; i < targets.Length; i++)
                {
                    SpriteRendererAnimation s = targets[i] as SpriteRendererAnimation;
                    s.spriteRenderer = s.GetComponent <SpriteRenderer>();
                    if (s.spriteRenderer)
                    {
                        s.spriteRenderer.sprite = s.clips[0].sprites[0];
                    }
                }
            }

            base.OnInspectorGUI();
        }
Пример #5
0
        public override void OnInspectorGUI()
        {
            //if (GUILayout.Button("Sort"))
            //{
            //    for (int i = 0; i < targets.Length; i++)
            //    {
            //        SpriteAnimationClip s = targets[i] as SpriteAnimationClip;
            //        s.Sort();
            //    }
            //}

            if (GUILayout.Button("Load by First Frame"))
            {
                for (int i = 0; i < targets.Length; i++)
                {
                    SpriteAnimationClip s = targets[i] as SpriteAnimationClip;
                    s.LoadByFirstFrame();
                }
            }

            base.OnInspectorGUI();
        }
Пример #6
0
 private static void CreateSpriteAnimationClip()
 {
     SpriteAnimationClip.CreateSpriteAnimationClip("NewClip");
 }