Exemple #1
0
    public static void RemoveFromAtlas(MadAtlas atlas, MadAtlas.Item item)
    {
        var liveItems = LiveItems(atlas);
        var newItems  = (from el in liveItems where el != item select el).ToList();

        atlas.ClearItems();

        var allTextures = from el in newItems select MadAtlasUtil.GetItemOrigin(el);

        string atlasTexturePath = AssetDatabase.GetAssetPath(atlas.atlasTexture);

        PackTextures(allTextures.ToArray(), atlasTexturePath, ref newItems);

        atlas.ClearItems();
        atlas.AddItemRange(newItems);
    }
    private static void RebuildAtlas(MadAtlas atlas, List <Texture2D> allTextures, List <MadAtlas.Item> liveItems)
    {
        var modified = MakeReadable(allTextures);

        try {
            string atlasTexturePath = AssetDatabase.GetAssetPath(atlas.atlasTexture);
            PackTextures(allTextures.ToArray(), atlasTexturePath, ref liveItems);

            atlas.ClearItems();
            atlas.AddItemRange(liveItems);

            EditorUtility.SetDirty(atlas);
        } finally {
            RevertReadable(modified);
            AssetDatabase.Refresh();
        }
    }
Exemple #3
0
    public static void AddToAtlas(MadAtlas atlas, Texture2D[] textures)
    {
        List <MadAtlas.Item> liveItems   = LiveItems(atlas);
        List <Texture2D>     allTextures = new List <Texture2D>();

        allTextures.AddRange(from i in liveItems select MadAtlasUtil.GetItemOrigin(i));
        allTextures.AddRange(textures);

        var modified = MakeReadable(allTextures);

        try {
            string atlasTexturePath = AssetDatabase.GetAssetPath(atlas.atlasTexture);
            PackTextures(allTextures.ToArray(), atlasTexturePath, ref liveItems);

            atlas.ClearItems();
            atlas.AddItemRange(liveItems);

            EditorUtility.SetDirty(atlas);
        } finally {
            RevertReadable(modified);
            AssetDatabase.Refresh();
        }
    }
    public static void RemoveFromAtlas(MadAtlas atlas, MadAtlas.Item item)
    {
        var liveItems = LiveItems(atlas);
        var newItems  = (from el in liveItems where el != item select el).ToList();

        atlas.ClearItems();

        var allTextures = from el in newItems select MadAtlasUtil.GetItemOrigin(el);

        var modified = MakeReadable(allTextures);

        try {
            string atlasTexturePath = AssetDatabase.GetAssetPath(atlas.atlasTexture);
            PackTextures(allTextures.ToArray(), atlasTexturePath, ref newItems);

            atlas.ClearItems();
            atlas.AddItemRange(newItems);

            EditorUtility.SetDirty(atlas);
        } finally {
            RevertReadable(modified);
            AssetDatabase.Refresh();
        }
    }
    public static void RemoveFromAtlas(MadAtlas atlas, MadAtlas.Item item) {
        var liveItems = LiveItems(atlas);
        var newItems = (from el in liveItems where el != item select el).ToList();
        
        atlas.ClearItems();
        
        var allTextures = from el in newItems select MadAtlasUtil.GetItemOrigin(el);

        var modified = MakeReadable(allTextures);
        try {
            string atlasTexturePath = AssetDatabase.GetAssetPath(atlas.atlasTexture);
            PackTextures(allTextures.ToArray(), atlasTexturePath, ref newItems);

            atlas.ClearItems();
            atlas.AddItemRange(newItems);

            EditorUtility.SetDirty(atlas);
        } finally {
            RevertReadable(modified);
            AssetDatabase.Refresh();
        }
    }
    private static void RebuildAtlas(MadAtlas atlas, List<Texture2D> allTextures, List<MadAtlas.Item> liveItems) {
        var modified = MakeReadable(allTextures);
        try {
            string atlasTexturePath = AssetDatabase.GetAssetPath(atlas.atlasTexture);
            PackTextures(allTextures.ToArray(), atlasTexturePath, ref liveItems);

            atlas.ClearItems();
            atlas.AddItemRange(liveItems);

            EditorUtility.SetDirty(atlas);
        } finally {
            RevertReadable(modified);
            AssetDatabase.Refresh();
        }
    }
Exemple #7
0
 public static void RemoveFromAtlas(MadAtlas atlas, MadAtlas.Item item) {
     var liveItems = LiveItems(atlas);
     var newItems = (from el in liveItems where el != item select el).ToList();
     
     atlas.ClearItems();
     
     var allTextures = from el in newItems select MadAtlasUtil.GetItemOrigin(el);
     
     string atlasTexturePath = AssetDatabase.GetAssetPath(atlas.atlasTexture);
     PackTextures(allTextures.ToArray(), atlasTexturePath, ref newItems);
     
     atlas.ClearItems();
     atlas.AddItemRange(newItems);
 }
Exemple #8
0
    public static void AddToAtlas(MadAtlas atlas, Texture2D[] textures) {
        List<MadAtlas.Item> liveItems = LiveItems(atlas);
        List<Texture2D> allTextures = new List<Texture2D>();

        allTextures.AddRange(from i in liveItems select MadAtlasUtil.GetItemOrigin(i));
        allTextures.AddRange(textures);

        var modified = MakeReadable(allTextures);
        try {
            string atlasTexturePath = AssetDatabase.GetAssetPath(atlas.atlasTexture);
            PackTextures(allTextures.ToArray(), atlasTexturePath, ref liveItems);

            atlas.ClearItems();
            atlas.AddItemRange(liveItems);

            EditorUtility.SetDirty(atlas);
        } finally {
            RevertReadable(modified);
            AssetDatabase.Refresh();
        }
    }