Ejemplo n.º 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);
    }
    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();
        }
    }
Ejemplo n.º 4
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();
        }
    }
Ejemplo n.º 5
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);

        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();
        }
    }
Ejemplo n.º 6
0
    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();
        }
    }
Ejemplo n.º 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);
 }
Ejemplo n.º 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();
        }
    }