Exemple #1
0
        /// <summary>
        /// Sets the Stored values to the Sprite's actual values and adds the Sprite and its Texture2D to the ListWindow
        /// </summary>
        /// <param name="spriteToSetAndAdd"></param>
        /// <param name="pixelSize"></param>
        public static void SetStoredAddToSE(ISpriteEditorObject spriteToSetAndAdd, float pixelSize)
        {
            if (pixelSize > 0)
            {
                spriteToSetAndAdd.PixelSize = pixelSize;
            }

            // if the Sprite references a null texture, we don't want to try to add that null texture to the texture box
            if (spriteToSetAndAdd is Sprite)
            {
                if (((Sprite)spriteToSetAndAdd).Texture != null)
                {
                    GuiData.ListWindow.Add(((Sprite)spriteToSetAndAdd).Texture);
                }

                mScene.Sprites.Add((Sprite)spriteToSetAndAdd);

                UndoManager.AddToThisFramesUndo(new AddSpriteUndo(spriteToSetAndAdd as Sprite));
            }

            ListUnlistedAnimationChains();
        }