public boolean produceAtlas() {
        try {
            drawablePairs.clear();
            
            if (!atlasData.atlasCurrent) {
                if (atlas != null) {
                    atlas.dispose();
                    atlas = null;
                }
                FileHandle defaultsFile = Main.appFolder.child("texturepacker/atlas-internal-settings.json");
                atlasData.writeAtlas(defaultsFile);
                atlasData.atlasCurrent = true;
                
                //clear all regions in any tenPatchData
                for (var data : atlasData.getDrawables()) {
                    if (data.tenPatchData != null) {
                        data.tenPatchData.regions = null;
                    }
                }
            }
            atlas = atlasData.getAtlas();
            
            var combined = new Array<>(getDrawables());
            combined.addAll(getFontDrawables());
            
            for (DrawableData data : combined) {
                Drawable drawable;
                if (data.type == DrawableType.CUSTOM) {
                    drawable = skin.getDrawable("custom");
                } else if (data.type == DrawableType.PIXEL) {
                    drawable = ((TextureRegionDrawable) skin.getDrawable("white")).tint(jsonData.getColorByName(data.tintName).color);
                    drawable.setMinWidth(data.minWidth);
                    drawable.setMinHeight(data.minHeight);
                } else if (data.type == DrawableType.TVG) {
                    var tvg = tinyVGAssetLoader.load(data.file.read());
                    var tinyVGDrawable = new TinyVGDrawable(tvg, shapeDrawer);
                    drawable = tinyVGDrawable;
                } else if (data.type == DrawableType.TENPATCH) {
                    var region = atlas.findRegion(DrawableData.proper(data.file.name()));
                    var tenPatchDrawable = new TenPatchDrawable(data.tenPatchData.horizontalStretchAreas.toArray(),
                            data.tenPatchData.verticalStretchAreas.toArray(), data.tenPatchData.tile, region);
                    
                    drawable = tenPatchDrawable;
                    
                    if (tenPatchDrawable.horizontalStretchAreas.length == 0) {
                        tenPatchDrawable.horizontalStretchAreas = new int[] {0, region.getRegionWidth() - 1};
                    }
                    if (tenPatchDrawable.verticalStretchAreas.length == 0) {
                        tenPatchDrawable.verticalStretchAreas = new int[] {0, region.getRegionHeight() - 1};
                    }
                    
                    for (int i = 0; i < tenPatchDrawable.horizontalStretchAreas.length; i += 2) {
                        int area = tenPatchDrawable.horizontalStretchAreas[i];
                        if (area >= tenPatchDrawable.getRegion().getRegionWidth()) {
                            tenPatchDrawable.horizontalStretchAreas = Arrays.copyOfRange(tenPatchDrawable.horizontalStretchAreas, 0 , Math.max(i - 2, 0));
                            break;
                        }
                        
                        area = tenPatchDrawable.horizontalStretchAreas[i + 1];
                        if (area >= tenPatchDrawable.getRegion().getRegionWidth()) {
                            tenPatchDrawable.horizontalStretchAreas = Arrays.copyOfRange(tenPatchDrawable.horizontalStretchAreas, 0 , Math.max(i - 2, 0));
                            break;
                        }
                    }
    
                    for (int i = 0; i < tenPatchDrawable.verticalStretchAreas.length; i += 2) {
                        int area = tenPatchDrawable.verticalStretchAreas[i];
                        if (area >= tenPatchDrawable.getRegion().getRegionWidth()) {
                            tenPatchDrawable.verticalStretchAreas = Arrays.copyOfRange(tenPatchDrawable.verticalStretchAreas, 0 , Math.max(i - 2, 0));
                            break;
                        }
        
                        area = tenPatchDrawable.verticalStretchAreas[i + 1];
                        if (area >= tenPatchDrawable.getRegion().getRegionWidth()) {
                            tenPatchDrawable.verticalStretchAreas = Arrays.copyOfRange(tenPatchDrawable.verticalStretchAreas, 0 , Math.max(i - 2, 0));
                            break;
                        }
                    }
                    
                    drawable.setLeftWidth(data.tenPatchData.contentLeft);
                    drawable.setRightWidth(data.tenPatchData.contentRight);
                    drawable.setTopHeight(data.tenPatchData.contentTop);
                    drawable.setBottomHeight(data.tenPatchData.contentBottom);
                    
                    if (!MathUtils.isEqual(data.minWidth, -1)) drawable.setMinWidth(data.minWidth);
                    if (!MathUtils.isEqual(data.minHeight, -1)) drawable.setMinHeight(data.minHeight);
                    if (data.tenPatchData.colorName != null) ((TenPatchDrawable) drawable).setColor(jsonData.getColorByName(data.tenPatchData.colorName).color);
                    if (data.tenPatchData.color1Name != null) ((TenPatchDrawable) drawable).setColor1(jsonData.getColorByName(data.tenPatchData.color1Name).color);
                    if (data.tenPatchData.color2Name != null) ((TenPatchDrawable) drawable).setColor2(jsonData.getColorByName(data.tenPatchData.color2Name).color);
                    if (data.tenPatchData.color3Name != null) ((TenPatchDrawable) drawable).setColor3(jsonData.getColorByName(data.tenPatchData.color3Name).color);
                    if (data.tenPatchData.color4Name != null) ((TenPatchDrawable) drawable).setColor4(jsonData.getColorByName(data.tenPatchData.color4Name).color);
                    ((TenPatchDrawable) drawable).setOffsetX(data.tenPatchData.offsetX);
                    ((TenPatchDrawable) drawable).setOffsetY(data.tenPatchData.offsetY);
                    ((TenPatchDrawable) drawable).setOffsetXspeed(data.tenPatchData.offsetXspeed);
                    ((TenPatchDrawable) drawable).setOffsetYspeed(data.tenPatchData.offsetYspeed);
                    ((TenPatchDrawable) drawable).setFrameDuration(data.tenPatchData.frameDuration);
                    ((TenPatchDrawable) drawable).setPlayMode(data.tenPatchData.playMode);
                    ((TenPatchDrawable) drawable).crushMode = data.tenPatchData.crushMode;
                    if (data.tenPatchData.regions == null) {
                        data.tenPatchData.regions = new Array<>();
                        for (var name : data.tenPatchData.regionNames) {
                            data.tenPatchData.regions.add(atlas.findRegion(name));
                        }
                    }
                    ((TenPatchDrawable) drawable).setRegions(data.tenPatchData.regions);
                } else if (data.type == DrawableType.TILED) {
                    String name = data.file.name();
                    name = DrawableData.proper(name);
                    drawable = new TiledDrawable(atlas.findRegion(name));
                    drawable.setMinWidth(data.minWidth);
                    drawable.setMinHeight(data.minHeight);
                    ((TiledDrawable) drawable).getColor().set(jsonData.getColorByName(data.tintName).color);
                } else if (data.type == DrawableType.NINE_PATCH) {
                    String name = data.file.name();
                    name = DrawableData.proper(name);
                    drawable = new NinePatchDrawable(atlas.createPatch(name));
                    if (data.tint != null) {
                        drawable = ((NinePatchDrawable) drawable).tint(data.tint);
                    } else if (data.tintName != null) {
                        drawable = ((NinePatchDrawable) drawable).tint(jsonData.getColorByName(data.tintName).color);
                    }
                    if (!MathUtils.isEqual(data.minWidth, -1)) drawable.setMinWidth(data.minWidth);
                    if (!MathUtils.isEqual(data.minHeight, -1)) drawable.setMinHeight(data.minHeight);
                } else if (data.type == DrawableType.TINTED) {
                    String name = DrawableData.proper(data.file.name());
                    if (Utils.isNinePatch(data.file.name())) {
                        NinePatchDrawable ninePatchDrawable = new NinePatchDrawable(atlas.createPatch(name));
                        drawable = ninePatchDrawable.tint(data.tint);
                    }
                    else {
                        SpriteDrawable spriteDrawable = new SpriteDrawable(atlas.createSprite(name));
                        drawable = spriteDrawable.tint(data.tint);
                    }
                    if (!MathUtils.isEqual(data.minWidth, -1)) drawable.setMinWidth(data.minWidth);
                    if (!MathUtils.isEqual(data.minHeight, -1)) drawable.setMinHeight(data.minHeight);
                } else if (data.type == DrawableType.TINTED_FROM_COLOR_DATA) {
                    String name = DrawableData.proper(data.file.name());
                    if (Utils.isNinePatch(data.file.name())) {
                        NinePatchDrawable ninePatchDrawable = new NinePatchDrawable(atlas.createPatch(name));
                        drawable = ninePatchDrawable.tint(jsonData.getColorByName(data.tintName).color);
                    }
                    else {
                        SpriteDrawable spriteDrawable = new SpriteDrawable(atlas.createSprite(name));
                        drawable = spriteDrawable.tint(jsonData.getColorByName(data.tintName).color);
                    }
                    if (!MathUtils.isEqual(data.minWidth, -1)) drawable.setMinWidth(data.minWidth);
                    if (!MathUtils.isEqual(data.minHeight, -1)) drawable.setMinHeight(data.minHeight);
                } else {
                    String name = data.file.name();
                    name = DrawableData.proper(name);
                    drawable = new SpriteDrawable(atlas.createSprite(name));
                    if (!MathUtils.isEqual(data.minWidth, -1)) drawable.setMinWidth(data.minWidth);
                    if (!MathUtils.isEqual(data.minHeight, -1)) drawable.setMinHeight(data.minHeight);
                }
                
                drawablePairs.put(data, drawable);
            }
            return true;
        } catch (Exception e) {
            Gdx.app.error(getClass().getName(), "Error while attempting to generate drawables.", e);
            dialogFactory.showDialogError("Atlas Error...","Error while attempting to generate drawables.\n\nOpen log?");
            return false;
        }
    }
Writes a TextureAtlas based on drawables list. Creates drawables to be
displayed on screen
@return
core/src/com/ray3k/skincomposer/data/AtlasData.java