// ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    void CalculatePreviewScale()
    {
        // get the max width and max height
        float maxWidth  = -1.0f;
        float maxHeight = -1.0f;

        foreach (exSpriteAnimClip.FrameInfo frameInfo in curEdit.frameInfos)
        {
            float fiWidth  = 0.0f;
            float fiHeight = 0.0f;

            //
            exAtlasDB.ElementInfo elInfo = exAtlasDB.GetElementInfo(frameInfo.textureGUID);
            if (elInfo != null)
            {
                exAtlasInfo         atlasInfo = exEditorHelper.LoadAssetFromGUID <exAtlasInfo>(elInfo.guidAtlasInfo);
                exAtlasInfo.Element el        = atlasInfo.elements[elInfo.indexInAtlasInfo];
                // fiWidth = el.trimRect.width;
                // fiHeight = el.trimRect.height;
                fiWidth  = el.texture.width;
                fiHeight = el.texture.height;
            }
            else
            {
                string    texturePath = AssetDatabase.GUIDToAssetPath(frameInfo.textureGUID);
                Texture2D tex2D       = (Texture2D)AssetDatabase.LoadAssetAtPath(texturePath, typeof(Texture2D));
                fiWidth  = tex2D.width;
                fiHeight = tex2D.height;
            }

            //
            if (maxWidth <= fiWidth)
            {
                maxWidth = fiWidth;
            }
            if (maxHeight <= fiHeight)
            {
                maxHeight = fiHeight;
            }
        }

        // get the preview scale
        previewScale = 1.0f;
        float viewWidth  = curEdit.editorPreviewSize;
        float viewHeight = curEdit.editorPreviewSize;

        if (maxWidth > viewWidth && maxHeight > viewHeight)
        {
            previewScale = Mathf.Min(viewWidth / maxWidth, viewHeight / maxHeight);
        }
        else if (maxWidth > viewWidth)
        {
            previewScale = viewWidth / maxWidth;
        }
        else if (maxHeight > viewHeight)
        {
            previewScale = viewHeight / maxHeight;
        }
    }
Exemple #2
0
 static void SelectAtlasByActiveTexture()
 {
     if (Selection.activeObject is Texture2D)
     {
         exAtlasDB.ElementInfo elInfo = exAtlasDB.GetElementInfo(Selection.activeObject as Texture2D);
         if (elInfo != null)
         {
             Selection.activeObject
                 = exEditorHelper.LoadAssetFromGUID <exAtlasInfo>(elInfo.guidAtlasInfo);
             EditorGUIUtility.PingObject(Selection.activeObject);
         }
     }
 }
Exemple #3
0
    ///////////////////////////////////////////////////////////////////////////////
    // functions
    ///////////////////////////////////////////////////////////////////////////////

    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public static void UpdateAtlas(exSprite _sprite,
                                   exAtlasDB.ElementInfo _elInfo)
    {
        // get atlas and index from textureGUID
        if (_elInfo != null)
        {
            if (_elInfo.guidAtlas != exEditorHelper.AssetToGUID(_sprite.atlas) ||
                _elInfo.indexInAtlas != _sprite.index)
            {
                _sprite.SetSprite(exEditorHelper.LoadAssetFromGUID <exAtlas>(_elInfo.guidAtlas),
                                  _elInfo.indexInAtlas);
            }
        }
        else
        {
            _sprite.Clear();
        }
    }
    ///////////////////////////////////////////////////////////////////////////////
    // functions
    ///////////////////////////////////////////////////////////////////////////////

    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public static void UpdateAtlas(exSpriteBorder _spriteBorder,
                                   exAtlasDB.ElementInfo _elInfo)
    {
        // get atlas and index from textureGUID
        if (_elInfo != null)
        {
            if (_elInfo.guidAtlas != exEditorHelper.AssetToGUID(_spriteBorder.atlas) ||
                _elInfo.indexInAtlas != _spriteBorder.index)
            {
                _spriteBorder.SetBorder(_spriteBorder.guiBorder,
                                        exEditorHelper.LoadAssetFromGUID <exAtlas>(_elInfo.guidAtlas),
                                        _elInfo.indexInAtlas);
            }
        }
        else
        {
            exGUIBorder guiBorder = _spriteBorder.guiBorder;
            _spriteBorder.Clear();
            _spriteBorder.SetBorder(guiBorder, null, -1);
        }
    }
    // ------------------------------------------------------------------
    /// \param _animClip the sprite animatoin clip
    /// build the sprite animation clip
    // ------------------------------------------------------------------

    public static void Build(this exSpriteAnimClip _animClip)
    {
        try {
            EditorUtility.DisplayProgressBar("Building Sprite Animation Clip " + _animClip.name,
                                             "Building Frames...",
                                             0.1f);

            bool hasError = false;
            foreach (exSpriteAnimClip.FrameInfo fi in _animClip.frameInfos)
            {
                exAtlasDB.ElementInfo elInfo = exAtlasDB.GetElementInfo(fi.textureGUID);
                if (elInfo != null)
                {
                    fi.atlas = exEditorHelper.LoadAssetFromGUID <exAtlas>(elInfo.guidAtlas);
                    fi.index = elInfo.indexInAtlas;
                }
                else
                {
                    string    texturePath = AssetDatabase.GUIDToAssetPath(fi.textureGUID);
                    Texture2D tex2D       = (Texture2D)AssetDatabase.LoadAssetAtPath(texturePath, typeof(Texture2D));
                    Debug.LogError("Failed to build sprite animation clip: " + _animClip.name + ", can't find texture "
                                   + ((tex2D != null) ? tex2D.name : "null")
                                   + " in exAtlasInfo.");
                    fi.atlas = null;
                    fi.index = -1;
                    hasError = true;
                }
            }
            EditorUtility.ClearProgressBar();

            _animClip.editorNeedRebuild = hasError;
            EditorUtility.SetDirty(_animClip);
        }
        catch (System.Exception) {
            EditorUtility.ClearProgressBar();
            throw;
        }
    }
    // ------------------------------------------------------------------
    /// \param _animClip the sprite animatoin clip
    /// \param _tex the texture
    /// add texture to sprite animation clip as new frame
    // ------------------------------------------------------------------

    public static void AddFrame(this exSpriteAnimClip _animClip, Texture2D _tex)
    {
        exSpriteAnimClip.FrameInfo frameInfo = new exSpriteAnimClip.FrameInfo();
        frameInfo.length      = 10.0f / 60.0f;
        frameInfo.textureGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(_tex));
        exAtlasDB.ElementInfo elInfo = exAtlasDB.GetElementInfo(frameInfo.textureGUID);
        if (elInfo != null)
        {
            frameInfo.atlas = exEditorHelper.LoadAssetFromGUID <exAtlas>(elInfo.guidAtlas);
            frameInfo.index = elInfo.indexInAtlas;
        }
        else
        {
            frameInfo.atlas = null;
            frameInfo.index = -1;
        }
        _animClip.frameInfos.Add(frameInfo);
        _animClip.length += frameInfo.length;

        exSpriteAnimationDB.AddFrameInfo(_animClip, frameInfo);
        _animClip.editorNeedRebuild = true;
        EditorUtility.SetDirty(_animClip);
    }
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public override void OnInspectorGUI()
    {
        // ========================================================
        // Base GUI
        // ========================================================

        base.OnInspectorGUI();
        GUILayout.Space(20);

        // ========================================================
        // init values
        // ========================================================

        //
        bool needRebuild = false;

        // ========================================================
        // exGUIBorder object filed
        // ========================================================

        bool borderChanged = false;

        EditorGUI.indentLevel = 1;

        GUILayout.BeginHorizontal();
        GUI.enabled = !inAnimMode;
        exGUIBorder newGUIBorder = (exGUIBorder)EditorGUILayout.ObjectField("GUI Border"
                                                                            , editSpriteBorder.guiBorder
                                                                            , typeof(exGUIBorder)
                                                                            , false
                                                                            );

        if (newGUIBorder != editSpriteBorder.guiBorder)
        {
            borderChanged = true;
        }

        if (GUILayout.Button("Edit...", GUILayout.Width(40), GUILayout.Height(15)))
        {
            exGUIBorderEditor editor = exGUIBorderEditor.NewWindow();
            editor.Edit(editSpriteBorder.guiBorder);
        }
        GUI.enabled = true;
        GUILayout.EndHorizontal();
        GUILayout.Space(5);

        // get edit texture
        Texture2D editTexture = null;

        if (newGUIBorder)
        {
            editTexture = exEditorHelper.LoadAssetFromGUID <Texture2D>(newGUIBorder.textureGUID);

            // ========================================================
            // border preview
            // ========================================================

            Rect lastRect = GUILayoutUtility.GetLastRect();
            GUILayout.BeginHorizontal();
            GUILayout.Space(30);
            lastRect = GUILayoutUtility.GetLastRect();
            Rect previewRect = new Rect(lastRect.xMax,
                                        lastRect.yMax,
                                        Mathf.Max(100, newGUIBorder.border.horizontal),
                                        Mathf.Max(100, newGUIBorder.border.vertical));
            exGUIBorderEditor.TexturePreviewField(previewRect, newGUIBorder, editTexture);

            GUILayout.Space(10);
            lastRect    = GUILayoutUtility.GetLastRect();
            previewRect = new Rect(lastRect.x,
                                   lastRect.yMax,
                                   Mathf.Max(100, newGUIBorder.border.horizontal),
                                   Mathf.Max(100, newGUIBorder.border.vertical));
            exGUIBorderEditor.BorderPreviewField(previewRect, newGUIBorder, editTexture);

            if (GUILayout.Button("Select...", GUILayout.Width(60), GUILayout.Height(15)))
            {
                EditorGUIUtility.PingObject(editTexture);
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(5);
        }

        // ========================================================
        // get atlas element info from atlas database
        // ========================================================

        exAtlas editAtlas = null;
        int     editIndex = -1;

        exAtlasDB.ElementInfo elInfo = null;
        if (newGUIBorder)
        {
            elInfo = exAtlasDB.GetElementInfo(newGUIBorder.textureGUID);
        }

        if (elInfo != null)
        {
            editAtlas = exEditorHelper.LoadAssetFromGUID <exAtlas>(elInfo.guidAtlas);
            editIndex = elInfo.indexInAtlas;
        }
        bool useAtlas = editAtlas != null && editIndex != -1;

        // get atlas and index from textureGUID
        if (!EditorApplication.isPlaying)
        {
            // if we use atlas, check if the atlas,index changes
            if (useAtlas)
            {
                if (editAtlas != editSpriteBorder.atlas ||
                    editIndex != editSpriteBorder.index)
                {
                    borderChanged = true;
                }
            }
            // if we don't use atlas and current edit target use atlas, clear it.
            else
            {
                if (editSpriteBorder.useAtlas)
                {
                    borderChanged = true;
                }
            }

            // check if we are first time assignment
            if (useAtlas || editTexture != null)
            {
                if (isPrefab == false && editSpriteBorder.meshFilter.sharedMesh == null)
                {
                    needRebuild = true;
                }
            }
        }

        // set border
        if (borderChanged)
        {
            //
            if (newGUIBorder == null)
            {
                editSpriteBorder.Clear();
            }
            else
            {
                editSpriteBorder.SetBorder(newGUIBorder, editAtlas, editIndex);
                if (editSpriteBorder.useAtlas == false)
                {
                    editSpriteBorder.GetComponent <Renderer>().sharedMaterial = exEditorHelper.GetDefaultMaterial(editTexture, editTexture.name);
                    editSpriteBorder.updateFlags |= exPlane.UpdateFlags.UV;
                }
            }

            GUI.changed = true;
        }

        // ========================================================
        // color
        // ========================================================

        editSpriteBorder.color = EditorGUILayout.ColorField("Color", editSpriteBorder.color);

        // ========================================================
        // atlas & index
        // ========================================================

        GUILayout.BeginHorizontal();
        GUI.enabled = false;
        EditorGUILayout.ObjectField("Atlas"
                                    , editSpriteBorder.atlas
                                    , typeof(exAtlas)
                                    , false
                                    );
        GUI.enabled = true;

        GUI.enabled = !inAnimMode;
        if (GUILayout.Button("Edit...", GUILayout.Width(40), GUILayout.Height(15)))
        {
            exAtlasEditor editor = exAtlasEditor.NewWindow();
            editor.Edit(editSpriteBorder.atlas);
        }
        GUI.enabled = true;
        GUILayout.EndHorizontal();

        GUI.enabled = false;
        EditorGUILayout.IntField("Index", editSpriteBorder.index);
        GUI.enabled = true;

        // ========================================================
        // width & height
        // ========================================================

        GUI.enabled = !inAnimMode;
        // width
        float newWidth = EditorGUILayout.FloatField("Width", editSpriteBorder.width);

        if (newWidth != editSpriteBorder.width)
        {
            if (newWidth < 1.0f)
            {
                newWidth = 1.0f;
            }
            editSpriteBorder.width = newWidth;
        }

        // height
        float newHeight = EditorGUILayout.FloatField("Height", editSpriteBorder.height);

        if (newHeight != editSpriteBorder.height)
        {
            if (newHeight < 1.0f)
            {
                newHeight = 1.0f;
            }
            editSpriteBorder.height = newHeight;
        }
        GUI.enabled = true;

        // ========================================================
        // Rebuild button
        // ========================================================

        GUI.enabled = !inAnimMode;
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Rebuild...", GUILayout.Height(20)))
        {
            needRebuild = true;
        }
        GUILayout.EndHorizontal();
        GUI.enabled = true;
        GUILayout.Space(5);

        // if dirty, build it.
        if (!EditorApplication.isPlaying && !AnimationUtility.InAnimationMode())
        {
            if (needRebuild)
            {
                EditorUtility.ClearProgressBar();
                editSpriteBorder.Build(editTexture);
            }
            else if (GUI.changed)
            {
                if (editSpriteBorder.meshFilter.sharedMesh != null)
                {
                    editSpriteBorder.UpdateMesh(editSpriteBorder.meshFilter.sharedMesh);
                }
                EditorUtility.SetDirty(editSpriteBorder);
            }
        }
    }
Exemple #8
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public override void OnInspectorGUI()
    {
        // ========================================================
        // Base GUI
        // ========================================================

        base.OnInspectorGUI();
        GUILayout.Space(20);

        // ========================================================
        // init values
        // ========================================================

        //
        bool needRebuild = false;

        editSprite.spanim = editSprite.GetComponent <exSpriteAnimation>();

        // get ElementInfo first
        Texture2D editTexture = exEditorHelper.LoadAssetFromGUID <Texture2D>(editSprite.textureGUID);

        // ========================================================
        // Texture preview (input)
        // ========================================================

        bool textureChanged = false;

        GUI.enabled = !inAnimMode;
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        EditorGUIUtility.LookLikeControls();
        Texture2D newTexture = (Texture2D)EditorGUILayout.ObjectField(editTexture
                                                                      , typeof(Texture2D)
                                                                      , false
                                                                      , GUILayout.Width(100)
                                                                      , GUILayout.Height(100)
                                                                      );

        EditorGUIUtility.LookLikeInspector();
        if (newTexture != editTexture)
        {
            editTexture            = newTexture;
            editSprite.textureGUID = exEditorHelper.AssetToGUID(editTexture);
            textureChanged         = true;
            GUI.changed            = true;
        }
        GUILayout.Space(10);
        GUILayout.BeginVertical();
        GUILayout.Space(90);
        GUILayout.Label(editTexture ? editTexture.name : "None");
        GUILayout.EndVertical();
        GUILayout.EndHorizontal();
        GUI.enabled = true;

        // ========================================================
        // get atlas element info from atlas database
        // ========================================================

        exAtlas editAtlas = null;
        int     editIndex = -1;

        exAtlasDB.ElementInfo elInfo = exAtlasDB.GetElementInfo(editSprite.textureGUID);
        if (elInfo != null)
        {
            editAtlas = exEditorHelper.LoadAssetFromGUID <exAtlas>(elInfo.guidAtlas);
            editIndex = elInfo.indexInAtlas;
        }
        bool useAtlas = editAtlas != null && editIndex != -1;

        // get atlas and index from textureGUID
        if (!EditorApplication.isPlaying)
        {
            // if we don't use atlas and current edit target use atlas, clear it.
            if (editSprite.useAtlas != useAtlas)
            {
                editSprite.Clear();
            }

            // if we use atlas, check if the atlas,index changes
            if (useAtlas)
            {
                if (editAtlas != editSprite.atlas ||
                    editIndex != editSprite.index)
                {
                    editSprite.SetSprite(editAtlas, editIndex);
                    GUI.changed = true;
                }
            }

            // check if we are first time assignment
            if (useAtlas || editTexture != null)
            {
                if (isPrefab == false && editSprite.meshFilter.sharedMesh == null)
                {
                    needRebuild = true;
                }
            }
        }

        // ========================================================
        // get trimTexture
        // ========================================================

        GUI.enabled = !inAnimMode && !useAtlas;
        bool newTrimTexture = EditorGUILayout.Toggle("Trim Texture", editSprite.trimTexture);

        if (!useAtlas &&
            (textureChanged || newTrimTexture != editSprite.trimTexture))
        {
            editSprite.GetComponent <Renderer>().sharedMaterial = exEditorHelper.GetDefaultMaterial(editTexture, editTexture.name);
            editSprite.trimTexture = newTrimTexture;

            // get trimUV
            Rect trimUV = new Rect(0, 0, 1, 1);
            if (editTexture != null)
            {
                if (editSprite.trimTexture)
                {
                    if (exTextureHelper.IsValidForAtlas(editTexture) == false)
                    {
                        exTextureHelper.ImportTextureForAtlas(editTexture);
                    }
                    trimUV = exTextureHelper.GetTrimTextureRect(editTexture);
                    trimUV = new Rect(trimUV.x / editTexture.width,
                                      (editTexture.height - trimUV.height - trimUV.y) / editTexture.height,
                                      trimUV.width / editTexture.width,
                                      trimUV.height / editTexture.height);
                }

                if (editSprite.customSize == false)
                {
                    editSprite.width  = trimUV.width * editTexture.width;
                    editSprite.height = trimUV.height * editTexture.height;
                }
            }
            editSprite.trimUV       = trimUV;
            editSprite.updateFlags |= exPlane.UpdateFlags.UV;
            editSprite.updateFlags |= exPlane.UpdateFlags.Vertex;
        }
        GUI.enabled = true;

        // ========================================================
        // color
        // ========================================================

        editSprite.color = EditorGUILayout.ColorField("Color", editSprite.color);

        // ========================================================
        // atlas & index
        // ========================================================

        GUILayout.BeginHorizontal();
        GUI.enabled = false;
        EditorGUILayout.ObjectField("Atlas"
                                    , editSprite.atlas
                                    , typeof(exAtlas)
                                    , false
                                    );
        GUI.enabled = true;

        GUI.enabled = !inAnimMode;
        if (GUILayout.Button("Edit...", GUILayout.Width(40), GUILayout.Height(15)))
        {
            exAtlasEditor editor = exAtlasEditor.NewWindow();
            editor.Edit(editSprite.atlas);
        }
        GUI.enabled = true;
        GUILayout.EndHorizontal();

        GUI.enabled = false;
        EditorGUILayout.IntField("Index", editSprite.index);
        GUI.enabled = true;

        // ========================================================
        // custom size
        // ========================================================

        GUI.enabled           = !inAnimMode;
        editSprite.customSize = EditorGUILayout.Toggle("Custom Size", editSprite.customSize);
        GUI.enabled           = true;

        // ========================================================
        // width & height
        // ========================================================

        ++EditorGUI.indentLevel;
        GUI.enabled = !inAnimMode && editSprite.customSize;
        // width
        float newWidth = EditorGUILayout.FloatField("Width", editSprite.width);

        if (newWidth != editSprite.width)
        {
            if (newWidth < 1.0f)
            {
                newWidth = 1.0f;
            }
            editSprite.width = newWidth;
        }

        // height
        float newHeight = EditorGUILayout.FloatField("Height", editSprite.height);

        if (newHeight != editSprite.height)
        {
            if (newHeight < 1.0f)
            {
                newHeight = 1.0f;
            }
            editSprite.height = newHeight;
        }
        --EditorGUI.indentLevel;

        // ========================================================
        // Reset to original
        // ========================================================

        GUILayout.BeginHorizontal();
        GUILayout.Space(30);
        if (GUILayout.Button("Reset", GUILayout.Width(50)))
        {
            if (useAtlas)
            {
                exAtlas.Element el = editAtlas.elements[editIndex];
                editSprite.width  = el.trimRect.width;
                editSprite.height = el.trimRect.height;
            }
            else if (editTexture)
            {
                editSprite.width  = editSprite.trimUV.width * editTexture.width;
                editSprite.height = editSprite.trimUV.height * editTexture.height;
            }
            GUI.changed = true;
        }
        GUILayout.EndHorizontal();
        GUI.enabled = true;

        // ========================================================
        // Rebuild button
        // ========================================================

        GUI.enabled = !inAnimMode;
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Rebuild...", GUILayout.Height(20)))
        {
            needRebuild = true;
        }
        GUILayout.EndHorizontal();
        GUI.enabled = true;
        GUILayout.Space(5);

        // if dirty, build it.
        if (!EditorApplication.isPlaying && !AnimationUtility.InAnimationMode())
        {
            if (needRebuild)
            {
                EditorUtility.ClearProgressBar();
                editSprite.Build(editTexture);
            }
            else if (GUI.changed)
            {
                if (editSprite.meshFilter.sharedMesh != null)
                {
                    editSprite.UpdateMesh(editSprite.meshFilter.sharedMesh);
                }
                EditorUtility.SetDirty(editSprite);
            }
        }
    }
Exemple #9
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    void PreviewField(Rect _rect)
    {
        // ========================================================
        // preview
        // ========================================================

        int       borderSize      = 1;
        int       boxWidth        = (int)_rect.width + 2 * borderSize;  // box border
        int       boxHeight       = (int)_rect.height + 2 * borderSize; // box border
        Texture2D texCheckerboard = exEditorHelper.CheckerboardTexture();

        GUI.BeginGroup(_rect);
        int col = Mathf.CeilToInt(_rect.width / texCheckerboard.width);
        int row = Mathf.CeilToInt(_rect.height / texCheckerboard.height);

        for (int j = 0; j < row; ++j)
        {
            for (int i = 0; i < col; ++i)
            {
                Rect size = new Rect(i * texCheckerboard.width,
                                     j * texCheckerboard.height,
                                     texCheckerboard.width,
                                     texCheckerboard.height);
                GUI.DrawTexture(size, texCheckerboard);
            }
        }
        GUI.EndGroup();

        Color oldBGColor = GUI.backgroundColor;

        GUI.backgroundColor = Color.black;
        GUI.Box(new Rect(_rect.x - borderSize, _rect.y - borderSize, boxWidth, boxHeight),
                GUIContent.none,
                exEditorHelper.RectBorderStyle());
        GUI.backgroundColor = oldBGColor;

        // ========================================================
        // draw frame
        // ========================================================

        if (curEdit != null)
        {
            // draw the preview
            exSpriteAnimClip.FrameInfo fi = curEdit.GetFrameInfoBySeconds(curSeconds, curEdit.wrapMode);
            if (fi != null)
            {
                exAtlasDB.ElementInfo elInfo = exAtlasDB.GetElementInfo(fi.textureGUID);

                if (elInfo != null)
                {
                    exAtlasInfo         atlasInfo = exEditorHelper.LoadAssetFromGUID <exAtlasInfo>(elInfo.guidAtlasInfo);
                    exAtlasInfo.Element el        = atlasInfo.elements[elInfo.indexInAtlasInfo];

                    if (el.texture != null)
                    {
                        float width   = el.texture.width;
                        float height  = el.texture.height;
                        float offsetX = (width - el.trimRect.width) * 0.5f - el.trimRect.x;
                        float offsetY = (height - el.trimRect.height) * 0.5f - el.trimRect.y;

                        // DELME {
                        // Rect frameRect = new Rect( -el.trimRect.x * previewScale,
                        //                            -el.trimRect.y * previewScale,
                        //                            width * previewScale,
                        //                            height * previewScale );
                        // } DELME end
                        Rect rect2 = new Rect((_rect.width - el.trimRect.width * previewScale) * 0.5f - offsetX * previewScale,
                                              (_rect.height - el.trimRect.height * previewScale) * 0.5f - offsetY * previewScale,
                                              el.trimRect.width * previewScale,
                                              el.trimRect.height * previewScale);


                        // DISABLE: because we can't make sure all texture have same size, so ScaleToFit may play large texture {
                        // GUI.BeginGroup( _rect );
                        //     GUI.DrawTexture( new Rect( 0.0f, 0.0f, _rect.width, _rect.height ),
                        //                      el.texture,
                        //                      ScaleMode.ScaleToFit );
                        // GUI.EndGroup();
                        // } DISABLE end

                        GUI.BeginGroup(_rect);
                        // DELME {
                        // draw background
                        // Color old = GUI.color;
                        // GUI.color = new Color( 1.0f, 0.0f, 0.85f, 0.2f );
                        //     GUI.DrawTexture( rect2, exEditorHelper.WhiteTexture() );
                        // GUI.color = old;

                        // // draw texture
                        // GUI.BeginGroup( rect2 );
                        //     GUI.BeginGroup( new Rect( (rect2.width - el.trimRect.width * previewScale) * 0.5f,
                        //                               (rect2.height - el.trimRect.height * previewScale) * 0.5f,
                        //                               el.trimRect.width * previewScale,
                        //                               el.trimRect.height * previewScale ) );
                        //         GUI.DrawTexture( frameRect, el.texture );
                        //     GUI.EndGroup();
                        // GUI.EndGroup();
                        // } DELME end

                        Graphics.DrawTexture(rect2,
                                             el.texture,
                                             new Rect(el.trimRect.x / el.texture.width,
                                                      (el.texture.height - el.trimRect.y - el.trimRect.height) / el.texture.height,
                                                      el.trimRect.width / el.texture.width,
                                                      el.trimRect.height / el.texture.height),
                                             0, 0, 0, 0,
                                             Color.white / 2.0f);

                        // DELME {
                        // draw border
                        // Color oldBGColor = GUI.backgroundColor;
                        // GUI.backgroundColor = Color.black;
                        //     GUI.Box ( rect2, GUIContent.none, exEditorHelper.RectBorderStyle() );
                        // GUI.backgroundColor = oldBGColor;
                        // } DELME end
                        GUI.EndGroup();
                    }
                }
                else
                {
                    string    texturePath = AssetDatabase.GUIDToAssetPath(fi.textureGUID);
                    Texture2D tex2D       = (Texture2D)AssetDatabase.LoadAssetAtPath(texturePath, typeof(Texture2D));
                    if (tex2D != null)
                    {
                        Rect size = new Rect(0.0f,
                                             0.0f,
                                             tex2D.width * previewScale,
                                             tex2D.height * previewScale);
                        Rect rect2 = new Rect((_rect.width - size.width) * 0.5f,
                                              (_rect.height - size.height) * 0.5f,
                                              size.width,
                                              size.height);

                        GUI.BeginGroup(_rect);
                        GUI.BeginGroup(rect2);
                        GUI.DrawTexture(size, tex2D);
                        GUI.EndGroup();
                        GUI.EndGroup();
                    }
                }
            }
        }

        GUILayoutUtility.GetRect(_rect.width, _rect.height);
    }
Exemple #10
0
    // ------------------------------------------------------------------
    /// \param _objects
    /// get the Texture2D and exBitmapFont from a list of objects, import them into atlas
    // ------------------------------------------------------------------

    public void ImportObjects(Object[] _objects)
    {
        bool dirty = false;

        foreach (Object o in _objects)
        {
            if (o is Texture2D)
            {
                Texture2D             t      = o as Texture2D;
                exAtlasDB.ElementInfo elInfo = exAtlasDB.GetElementInfo(t);
                if (elInfo == null)
                {
                    AddElement(t, trimElements);
                    dirty = true;
                }
                else
                {
                    Debug.LogError("The texture [" + t.name + "]" +
                                   " has already been added in atlas: " +
                                   AssetDatabase.GUIDToAssetPath(elInfo.guidAtlasInfo));
                }
            }
            else if (o is exBitmapFont)
            {
                exBitmapFont f = o as exBitmapFont;
                if (f.inAtlas)
                {
                    // NOTE: it is still possible we have atlas font in the obj list since we use Selection.GetFiltered().
                    continue;
                }

                // multi-page atlas font is forbit
                if (f.pageInfos.Count > 1)
                {
                    Debug.LogError("Can't not create atlas font from " + f.name + ", it has multiple page info.");
                    continue;
                }

                // check if we have resource in the project
                string       assetPath      = AssetDatabase.GetAssetPath(texture);
                string       dirname        = Path.GetDirectoryName(assetPath);
                string       filename       = Path.GetFileNameWithoutExtension(assetPath);
                string       bitmapFontPath = Path.Combine(dirname, filename + " - " + f.name + ".asset");
                exBitmapFont f2             = (exBitmapFont)AssetDatabase.LoadAssetAtPath(bitmapFontPath,
                                                                                          typeof(exBitmapFont));
                if (f2 == null)
                {
                    f2            = (exBitmapFont)ScriptableObject.CreateInstance(typeof(exBitmapFont));
                    f2.inAtlas    = true;
                    f2.name       = f.name;
                    f2.lineHeight = f.lineHeight;

                    // add page info
                    exBitmapFont.PageInfo pageInfo = new exBitmapFont.PageInfo();
                    pageInfo.texture  = texture;
                    pageInfo.material = material;
                    f2.pageInfos.Add(pageInfo);

                    // add char info
                    foreach (exBitmapFont.CharInfo c in f.charInfos)
                    {
                        exBitmapFont.CharInfo c2 = new exBitmapFont.CharInfo(c);
                        f2.charInfos.Add(c2);
                    }

                    // add kerning info
                    foreach (exBitmapFont.KerningInfo k in f.kernings)
                    {
                        f2.kernings.Add(k);
                    }

                    AssetDatabase.CreateAsset(f2, bitmapFontPath);

                    //
                    foreach (exBitmapFont.CharInfo c in f2.charInfos)
                    {
                        if (c.id == -1)
                        {
                            continue;
                        }
                        AddFontElement(f, f2, c);
                    }
                }
                else
                {
                    Debug.LogError("You already add the BitmapFont in this Atlas");
                }

                //
                if (bitmapFonts.IndexOf(f2) == -1)
                {
                    bitmapFonts.Add(f2);
                }

                dirty = true;
            }
            if (dirty)
            {
                EditorUtility.SetDirty(this);
            }
        }
    }
Exemple #11
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    void FrameInfoField(Rect _rect, exSpriteAnimClip.FrameInfo _fi)
    {
        bool selected = selectedFrameInfos.IndexOf(_fi) != -1;

        exAtlasDB.ElementInfo elInfo = exAtlasDB.GetElementInfo(_fi.textureGUID);

        // ========================================================
        // draw background
        // ========================================================

        Color old = GUI.color;

        if (selected)
        {
            GUI.color = new Color(0.2f, 0.85f, 0.0f, 0.2f);
        }
        else if (elInfo == null)
        {
            GUI.color = new Color(1.0f, 0.0f, 0.0f, 0.2f);
        }
        else
        {
            GUI.color = new Color(1.0f, 0.0f, 0.85f, 0.2f);
        }
        GUI.DrawTexture(_rect, exEditorHelper.WhiteTexture());
        GUI.color = old;

        // ========================================================
        // draw texture
        // ========================================================

        if (elInfo != null)
        {
            exAtlasInfo         atlasInfo = exEditorHelper.LoadAssetFromGUID <exAtlasInfo>(elInfo.guidAtlasInfo);
            exAtlasInfo.Element el        = atlasInfo.elements[elInfo.indexInAtlasInfo];

            if (el.texture != null)
            {
                float width  = el.texture.width;
                float height = el.texture.height;

                // get the scale
                float scale = 1.0f;
                if (width > _rect.width && height > _rect.height)
                {
                    scale = Mathf.Min(_rect.width / width,
                                      _rect.height / height);
                }
                else if (width > _rect.width)
                {
                    scale = _rect.width / width;
                }
                else if (height > _rect.height)
                {
                    scale = _rect.height / height;
                }

                // draw
                Rect size = new Rect(-el.trimRect.x * scale,
                                     -el.trimRect.y * scale,
                                     width * scale,
                                     height * scale);
                GUI.BeginGroup(_rect);
                GUI.BeginGroup(new Rect((_rect.width - el.trimRect.width * scale) * 0.5f,
                                        (_rect.height - el.trimRect.height * scale) * 0.5f,
                                        el.trimRect.width * scale,
                                        el.trimRect.height * scale));
                GUI.DrawTexture(size, el.texture);
                GUI.EndGroup();
                GUI.EndGroup();
            }
        }
        else
        {
            Texture2D tex2D = exEditorHelper.LoadAssetFromGUID <Texture2D>(_fi.textureGUID);
            if (tex2D != null)
            {
                float width  = tex2D.width;
                float height = tex2D.height;

                // get the scale
                float scale = 1.0f;
                if (width > _rect.width && height > _rect.height)
                {
                    scale = Mathf.Min(_rect.width / width,
                                      _rect.height / height);
                }
                else if (width > _rect.width)
                {
                    scale = _rect.width / width;
                }
                else if (height > _rect.height)
                {
                    scale = _rect.height / height;
                }

                //
                Rect size  = new Rect(0.0f, 0.0f, width * scale, height * scale);
                Rect rect2 = new Rect((_rect.width - size.width) * 0.5f,
                                      (_rect.height - size.height) * 0.5f,
                                      size.width,
                                      size.height);

                //
                GUI.BeginGroup(_rect);
                GUI.BeginGroup(rect2);
                GUI.DrawTexture(size, tex2D);
                GUI.EndGroup();
                GUI.EndGroup();
            }
        }

        // ========================================================
        // draw border
        // ========================================================

        Color oldBGColor = GUI.backgroundColor;

        GUI.backgroundColor = Color.black;
        GUI.Box(_rect, GUIContent.none, exEditorHelper.RectBorderStyle());
        GUI.backgroundColor = oldBGColor;
    }
Exemple #12
0
    // ------------------------------------------------------------------
    /// \param _sprites the list of sprites to rebuild
    /// rebuild the listed sprites
    // ------------------------------------------------------------------

    public static void RebuildSprites(exSpriteBase[] _sprites)
    {
        try {
            EditorUtility.DisplayProgressBar("Rebuild Scene Sprites...",
                                             "Rebuild Scene Sprites...",
                                             0.5f);

            for (int i = 0; i < _sprites.Length; ++i)
            {
                exSpriteBase spBase = _sprites[i];
                // DISABLE: it is too slow {
                // float progress = (float)i/(float)_sprites.Length;
                // EditorUtility.DisplayProgressBar( "Rebuild Scene Sprites...",
                //                                   "Build Sprite " + spBase.gameObject.name, progress );
                // } DISABLE end

                // if sprite
                if (spBase is exSprite)
                {
                    exSprite sp = spBase as exSprite;
                    exAtlasDB.ElementInfo elInfo = exAtlasDB.GetElementInfo(sp.textureGUID);
                    exSpriteEditor.UpdateAtlas(sp, elInfo);

                    Texture2D texture = null;
                    if (sp.useAtlas == false)
                    {
                        texture = exEditorHelper.LoadAssetFromGUID <Texture2D>(sp.textureGUID);
                    }
                    sp.Build(texture);
                }

#if !(EX2D_EVALUATE)
                // if sprite font
                if (spBase is exSpriteFont)
                {
                    exSpriteFont spFont = spBase as exSpriteFont;
                    spFont.Build();
                }

                // if sprite border
                if (spBase is exSpriteBorder)
                {
                    exSpriteBorder spBorder = spBase as exSpriteBorder;

                    Texture2D texture = null;
                    if (spBorder.guiBorder)
                    {
                        exAtlasDB.ElementInfo elInfo = exAtlasDB.GetElementInfo(spBorder.guiBorder.textureGUID);
                        exSpriteBorderEditor.UpdateAtlas(spBorder, elInfo);

                        if (spBorder.useAtlas == false)
                        {
                            texture = exEditorHelper.LoadAssetFromGUID <Texture2D>(spBorder.guiBorder.textureGUID);
                        }
                    }
                    spBorder.Build(texture);
                }
#endif // EX2D_EVALUATE
            }
            EditorUtility.ClearProgressBar();
        }
        catch (System.Exception) {
            EditorUtility.ClearProgressBar();
            throw;
        }
    }
Exemple #13
0
    // ------------------------------------------------------------------
    /// \param _guiBorderList the list of gui-borders
    /// update sprite borders in current scene and in prefab by gui-border list
    // ------------------------------------------------------------------

    public static void UpdateSpriteBorders(List <exGUIBorder> _guiBorderList)
    {
        if (_guiBorderList.Count == 0)
        {
            return;
        }

        try {
            EditorUtility.DisplayProgressBar("Update Scene Sprites With Changed GUIBorders...", "Scanning...", 0.0f);
            // exSpriteBase[] sprites = GameObject.FindObjectsOfType(typeof(exSpriteBase)) as exSpriteBase[];
            exSpriteBase[] sprites = Resources.FindObjectsOfTypeAll(typeof(exSpriteBase)) as exSpriteBase[];
            for (int i = 0; i < sprites.Length; ++i)
            {
                exSpriteBase spBase = sprites[i];

#if !(EX2D_EVALUATE)
                // ========================================================
                // exSpriteBorder
                // ========================================================

                if (spBase is exSpriteBorder)
                {
                    exSpriteBorder spBorder    = spBase as exSpriteBorder;
                    bool           needRebuild = false;

                    // find if the spBorder's atalsInfo need rebuild
                    foreach (exGUIBorder guiBorder in _guiBorderList)
                    {
                        if (spBorder.guiBorder == guiBorder)
                        {
                            needRebuild = true;
                            break;
                        }
                    }

                    //
                    if (needRebuild)
                    {
                        exAtlasDB.ElementInfo elInfo = exAtlasDB.GetElementInfo(spBorder.guiBorder.textureGUID);
                        exSpriteBorderEditor.UpdateAtlas(spBorder, elInfo);
#if UNITY_3_4
                        bool isPrefab = (EditorUtility.GetPrefabType(spBase) == PrefabType.Prefab);
#else
                        bool isPrefab = (PrefabUtility.GetPrefabType(spBase) == PrefabType.Prefab);
#endif
                        if (isPrefab == false)
                        {
                            Texture2D texture = null;
                            if (spBorder.useAtlas == false)
                            {
                                texture = exEditorHelper.LoadAssetFromGUID <Texture2D>(spBorder.guiBorder.textureGUID);
                            }
                            spBorder.Build(texture);
                        }
                        EditorUtility.SetDirty(spBorder);
                    }
                }
#endif // !(EX2D_EVALUATE)
            }
            EditorUtility.ClearProgressBar();
        }
        catch (System.Exception) {
            EditorUtility.ClearProgressBar();
            throw;
        }
    }
Exemple #14
0
    // ------------------------------------------------------------------
    /// \param _atlasInfoGUIDs the list of atlas info guid
    /// update sprites in current scene and in prefab by atlas info list
    // ------------------------------------------------------------------

    public static void UpdateSprites(List <string> _atlasInfoGUIDs)
    {
        if (_atlasInfoGUIDs.Count == 0)
        {
            return;
        }

        try {
            EditorUtility.DisplayProgressBar("Update Scene Sprites With Changed Atlas...", "Scanning...", 0.0f);
            // exSpriteBase[] sprites = GameObject.FindObjectsOfType(typeof(exSpriteBase)) as exSpriteBase[];
            exSpriteBase[] sprites = Resources.FindObjectsOfTypeAll(typeof(exSpriteBase)) as exSpriteBase[];
            for (int i = 0; i < sprites.Length; ++i)
            {
                exSpriteBase spBase = sprites[i];

                // ========================================================
                // exSprite
                // ========================================================

                if (spBase is exSprite)
                {
                    exSprite sp = spBase as exSprite;
                    exAtlasDB.ElementInfo elInfo = exAtlasDB.GetElementInfo(sp.textureGUID);
                    bool needRebuild             = false;

                    // NOTE: we test sp.index is -1 or not instead of test atlas is null, because it is possible we delete an atlas and it will always be null
                    if (elInfo != null)
                    {
                        if (sp.index == -1)
                        {
                            needRebuild = true;
                        }
                        else
                        {
                            // find if the sp's atalsInfo need rebuild
                            foreach (string guidAtlasInfo in _atlasInfoGUIDs)
                            {
                                if (elInfo.guidAtlasInfo == guidAtlasInfo)
                                {
                                    needRebuild = true;
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        if (sp.index != -1)
                        {
                            needRebuild = true;
                        }
                    }

                    //
                    if (needRebuild)
                    {
                        exSpriteEditor.UpdateAtlas(sp, elInfo);
#if UNITY_3_4
                        bool isPrefab = (EditorUtility.GetPrefabType(spBase) == PrefabType.Prefab);
#else
                        bool isPrefab = (PrefabUtility.GetPrefabType(spBase) == PrefabType.Prefab);
#endif
                        if (isPrefab == false)
                        {
                            Texture2D texture = null;
                            if (sp.index == -1)
                            {
                                texture = exEditorHelper.LoadAssetFromGUID <Texture2D>(sp.textureGUID);
                            }
                            sp.Build(texture);
                        }
                        EditorUtility.SetDirty(sp);
                    }
                }

#if !(EX2D_EVALUATE)
                // ========================================================
                // exSpriteFont
                // ========================================================

                if (spBase is exSpriteFont)
                {
                    exSpriteFont spFont = spBase as exSpriteFont;

                    //
                    bool needRebuild = false;
                    if (spFont.fontInfo == null)
                    {
                        needRebuild = true;
                    }
                    else
                    {
                        foreach (string guidAtlasInfo in _atlasInfoGUIDs)
                        {
                            exAtlasInfo atlasInfo = exEditorHelper.LoadAssetFromGUID <exAtlasInfo>(guidAtlasInfo);
                            // NOTE: it is possible we process this in delete stage
                            if (atlasInfo == null)
                            {
                                continue;
                            }

                            foreach (exBitmapFont bmfont in atlasInfo.bitmapFonts)
                            {
                                if (spFont.fontInfo == bmfont)
                                {
                                    needRebuild = true;
                                    break;
                                }
                            }
                        }
                    }

                    //
                    if (needRebuild)
                    {
                        spFont.Build();
                    }
                }

                // ========================================================
                // exSpriteBorder
                // ========================================================

                if (spBase is exSpriteBorder)
                {
                    exSpriteBorder spBorder = spBase as exSpriteBorder;
                    if (spBorder.guiBorder != null)
                    {
                        exAtlasDB.ElementInfo elInfo = exAtlasDB.GetElementInfo(spBorder.guiBorder.textureGUID);
                        bool needRebuild             = false;

                        // NOTE: we test spBorder.index is -1 or not instead of test atlas is null, because it is possible we delete an atlas and it will always be null
                        if (elInfo != null)
                        {
                            if (spBorder.index == -1)
                            {
                                needRebuild = true;
                            }
                            else
                            {
                                // find if the spBorder's atalsInfo need rebuild
                                foreach (string guidAtlasInfo in _atlasInfoGUIDs)
                                {
                                    if (elInfo.guidAtlasInfo == guidAtlasInfo)
                                    {
                                        needRebuild = true;
                                        break;
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (spBorder.index != -1)
                            {
                                needRebuild = true;
                            }
                        }

                        //
                        if (needRebuild)
                        {
                            exSpriteBorderEditor.UpdateAtlas(spBorder, elInfo);
#if UNITY_3_4
                            bool isPrefab = (EditorUtility.GetPrefabType(spBase) == PrefabType.Prefab);
#else
                            bool isPrefab = (PrefabUtility.GetPrefabType(spBase) == PrefabType.Prefab);
#endif
                            if (isPrefab == false)
                            {
                                Texture2D texture = null;
                                if (spBorder.index == -1)
                                {
                                    texture = exEditorHelper.LoadAssetFromGUID <Texture2D>(spBorder.guiBorder.textureGUID);
                                }
                                spBorder.Build(texture);
                            }
                            EditorUtility.SetDirty(spBorder);
                        }
                    }
                }
#endif // !(EX2D_EVALUATE)

                // DISABLE: it is too slow {
                // float progress = (float)i/(float)sprites.Length;
                // EditorUtility.DisplayProgressBar( "Update Scene Sprites...",
                //                                   "Update Sprite " + spBase.gameObject.name, progress );
                // } DISABLE end
            }
            EditorUtility.ClearProgressBar();
        }
        catch (System.Exception) {
            EditorUtility.ClearProgressBar();
            throw;
        }
    }
Exemple #15
0
    ///////////////////////////////////////////////////////////////////////////////
    //
    ///////////////////////////////////////////////////////////////////////////////

    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    static void OnPostprocessAllAssets(string[] _importedAssets,
                                       string[] _deletedAssets,
                                       string[] _movedAssets,
                                       string[] _movedFromAssetPaths)
    {
        List <exAtlasInfo> updateAtlasInfos = new List <exAtlasInfo>();
        List <string>      atlasInfoGUIDs   = new List <string>();

        // ========================================================
        // import assets
        // ========================================================

        foreach (string path in _importedAssets)
        {
            // check if we are .ex2D_AtlasDB or .ex2D_SpriteAnimationDB
            if (string.Equals(path, exAtlasDB.dbPath, System.StringComparison.CurrentCultureIgnoreCase) ||
                string.Equals(path, exSpriteAnimationDB.dbPath, System.StringComparison.CurrentCultureIgnoreCase))
            {
                continue;
            }

            // check if we are asset
            string ext = Path.GetExtension(path);
            if (ext != ".asset" &&
                ext != ".png" &&
                ext != ".jpg" &&
                ext != ".tga")
            {
                continue;
            }

            //
            Object obj = (Object)AssetDatabase.LoadAssetAtPath(path, typeof(Object));
            if (obj == null)
            {
                continue;
            }

            // ========================================================
            // Texture2D
            // NOTE: if we are OnWillSaveAssets, it is possible we reimport
            //       textures if they are not valid for atlas. and when import it will
            //       trigger things here which will lead to infinite cycle.
            // ========================================================

            if (ex.onSavingAssets == false && obj is Texture2D)
            {
                Texture2D             tex2d = obj as Texture2D;
                exAtlasDB.ElementInfo ei    = exAtlasDB.GetElementInfo(tex2d);
                if (ei != null)
                {
                    exAtlasInfo atlasInfo = exEditorHelper.LoadAssetFromGUID <exAtlasInfo>(ei.guidAtlasInfo);
                    atlasInfo.UpdateElement(tex2d, true, true);
                    if (atlasInfo && updateAtlasInfos.IndexOf(atlasInfo) == -1)
                    {
                        atlasInfo.needLayout = true;
                        updateAtlasInfos.Add(atlasInfo);
                    }
                }
                continue;
            }

            // ========================================================
            // exAtlasInfo
            // ========================================================

            if (obj is exAtlasInfo)
            {
                exAtlasInfo atlasInfo = obj as exAtlasInfo;
                exAtlasDB.AddAtlasInfo(atlasInfo);
                // Debug.Log( "add atlas " + path ); // DEBUG
            }

            // ========================================================
            // exSpriteAnimClip
            // ========================================================

            if (obj is exSpriteAnimClip)
            {
                exSpriteAnimClip spAnimClip = obj as exSpriteAnimClip;
                exSpriteAnimationDB.AddSpriteAnimClip(spAnimClip);
                // Debug.Log( "add sprite anim clip " + path ); // DEBUG
            }
        }

        // build exAtlasInfo first
        foreach (exAtlasInfo atlasInfo in updateAtlasInfos)
        {
            // NOTE: Build atlas without import texture, without this, we will crash when changing import settings of a texture and rebuild it.
            exAtlasInfoUtility.Build(atlasInfo, true);
            // NOTE: no need to update scene sprite and sprite animation clip, because we didn't change index

            atlasInfoGUIDs.Add(exEditorHelper.AssetToGUID(atlasInfo));
        }

        // ========================================================
        // deleted assets
        // ========================================================

        foreach (string path in _deletedAssets)
        {
            // check if we are .ex2D_AtlasDB or .ex2D_SpriteAnimationDB
            if (string.Equals(path, exAtlasDB.dbPath, System.StringComparison.CurrentCultureIgnoreCase) ||
                string.Equals(path, exSpriteAnimationDB.dbPath, System.StringComparison.CurrentCultureIgnoreCase))
            {
                continue;
            }

            // check if we are asset
            if (Path.GetExtension(path) != ".asset")
            {
                continue;
            }

            //
            string guid = AssetDatabase.AssetPathToGUID(path);

            // check if we have the guid in the exAtlasInfo
            if (exAtlasDB.HasAtlasInfoGUID(guid))
            {
                exAtlasDB.RemoveAtlasInfo(guid);
                atlasInfoGUIDs.Add(guid);
                // Debug.Log( "remove atlas " + path ); // DEBUG
            }
            // check if we have the guid in the exSpriteAnimClip
            else if (exSpriteAnimationDB.HasSpriteAnimClipGUID(guid))
            {
                exSpriteAnimationDB.RemoveSpriteAnimClip(guid);
                // Debug.Log( "remove sprite anim clip " + path ); // DEBUG
            }
        }
        exSceneHelper.UpdateSprites(atlasInfoGUIDs);

        // DISABLE {
        // for ( int i = 0; i < _movedAssets.Length; ++i )
        //     Debug.Log("Moved Asset: " + _movedAssets[i] + " from: " + _movedFromAssetPaths[i]);
        // } DISABLE end
    }