bool CreateCellDatas(SpriteStudioBaker baker)
        {
            baker.cellMaps = new Dictionary<string, List<SSCell>>();

            if (baker.cellMapList == null)
                return true;

            int mapId = 0;

            string message = null;
            try
            {
                for (int i = 0; i < baker.cellMapList.Count; i++)
                {
                    SpriteStudioCellMap cellMap = baker.cellMapList [i];
                    message = cellMap.name;
                    EditorUtility.DisplayProgressBar("Sprite Studio For Unity", "Create CellData(" + (i + 1) + "/" + baker.cellMapList.Count + ") : " + cellMap.name, 0.7f);
                    baker.CreateCellData(cellMap, mapId);
                    mapId++;
                }
            } catch (Exception e)
            {
                EditorUtility.DisplayDialog("Error", "Create CellData : " + message, "OK");
                Debug.Log(e.StackTrace);
                return false;
            }
            return true;
        }
        bool CreateAnimations(SpriteStudioBaker baker)
        {
            string message = null;

            if (baker.animePackList == null)
                return true;

            try
            {
                for (int i = 0; i < baker.animePackList.Count; i++)
                {
                    SpriteStudioAnimePack animePack = baker.animePackList [i];
                    message = animePack.name;
                    EditorUtility.DisplayProgressBar("Sprite Studio For Unity", "Create Animator(" + (i + 1) + "/" + baker.animePackList.Count + ") : " + animePack.name, 0.9f);
                    baker.CreateAnimator(animePack);
                }
            } catch (Exception e)
            {
                EditorUtility.DisplayDialog("Error", "Create Animator : " + message, "OK");
                Debug.Log(e.StackTrace);
                return false;
            }
            return true;
        }
        bool CreateEffects(SpriteStudioBaker baker)
        {
            if (baker.effectList == null)
                return true;

            string message = null;
            try
            {
                for (int i = 0; i < baker.effectList.Count; i++)
                {
                    SpriteStudioEffect effect = baker.effectList [i];
                    message = effect.name;
                    EditorUtility.DisplayProgressBar("Sprite Studio For Unity", "Create Effect(" + (i + 1) + "/" + baker.effectList.Count + ") : " + effect.name, 0.8f);
                    baker.CreateEffect(effect);
                }
            } catch (Exception e)
            {
                EditorUtility.DisplayDialog("Error", "Create Effect : " + message, "OK");
                Debug.Log(e.StackTrace);
                return false;
            }
            return true;
        }
        void Import()
        {
            bool result;

            SpriteStudioBaker baker = new SpriteStudioBaker();
            baker.pixelPerUnit = pixelPerUnit;
            baker.sourceDirectory = Path.GetDirectoryName(projectFilePath);

            baker.tangentMode = this.interpolation == Interpolation.Step ? TangentMode.Stepped : TangentMode.Linear;

            result = DeserializeProject(baker);

            if (result)
                result = DeserializeCellMaps(baker);
            if (result)
                result = DeserializeEffects(baker);
            if (result)
                result = DeserializeAnimePacks(baker);

            string guid = AssetDatabase.CreateFolder("Assets", outputFolderName);
            baker.destDirectory = AssetDatabase.GUIDToAssetPath (guid);

            if (result) {
                if(baker.cellMapList.Count != 0) {
                    guid = AssetDatabase.CreateFolder(baker.destDirectory, "Textures");
                    baker.texturesDirectory = AssetDatabase.GUIDToAssetPath(guid);
                    result = CreateTextures (baker);
                }
            }
            if (result) {
                if(baker.cellMapList.Count != 0) {
                    guid = AssetDatabase.CreateFolder(baker.destDirectory, "Materials");
                    baker.materialsDirectory = AssetDatabase.GUIDToAssetPath(guid);
                    result = CreateMaterials (baker);
                }
            }
            if (result) {
                if(baker.cellMapList.Count != 0) {
                    guid = AssetDatabase.CreateFolder(baker.destDirectory, "Cells");
                    baker.cellDataDirectory = AssetDatabase.GUIDToAssetPath(guid);
                    result = CreateCellDatas (baker);
                }
            }
            if (result) {
                if(baker.effectList.Count != 0) {
                    guid = AssetDatabase.CreateFolder(baker.destDirectory, "Effects");
                    baker.effectDirectory = AssetDatabase.GUIDToAssetPath(guid);
                    result = CreateEffects (baker);
                }
            }
            if (result) {
                if(baker.animePackList.Count != 0) {
                    guid = AssetDatabase.CreateFolder(baker.destDirectory, "Animations");
                    baker.animationsDirectory = AssetDatabase.GUIDToAssetPath(guid);
                    guid = AssetDatabase.CreateFolder(baker.destDirectory, "Prefabs");
                    baker.prefabsDirectory = AssetDatabase.GUIDToAssetPath(guid);
                    result = CreateAnimations (baker);
                }
            }

            AssetDatabase.Refresh();
            EditorUtility.ClearProgressBar();

            if (result)
                EditorUtility.DisplayDialog("Sprite Studio For Unity", "Complate", "OK");
        }
 bool DeserializeProject(SpriteStudioBaker baker)
 {
     string message = null;
     try
     {
         message = projectFilePath;
         EditorUtility.DisplayProgressBar("Sprite Studio For Unity", "Deserialize Project : " + projectFilePath, 0.1f);
         baker.DeserializeProject(projectFilePath);
     } catch (Exception e)
     {
         EditorUtility.DisplayDialog("Error", "Deserialize Project : " + message, "OK");
         Debug.Log(e.StackTrace);
         return false;
     }
     return true;
 }
        bool DeserializeEffects(SpriteStudioBaker baker)
        {
            baker.effectList = new List<SpriteStudioEffect>();

            if (baker.projectData.effectFileNames == null)
                return true;

            string message = null;
            try
            {
                for (int i = 0; i < baker.projectData.effectFileNames.Length; i++)
                {
                    string effectFileName = baker.projectData.effectFileNames [i];
                    message = effectFileName;
                    EditorUtility.DisplayProgressBar("Sprite Studio For Unity", "Deserialize Effect(" + (i + 1) + "/" + baker.projectData.effectFileNames.Length + ") : " + effectFileName, 0.3f);
                    baker.DeserializeEffect(baker.sourceDirectory + "/" + effectFileName);
                }
            } catch (Exception e)
            {
                EditorUtility.DisplayDialog("Error", "Deserialize Effect : " + message, "OK");
                Debug.Log(e.StackTrace);
                return false;
            }
            return true;
        }
        bool CreateTextures(SpriteStudioBaker baker)
        {
            string message = null;

            if (baker.cellMapList == null)
                return true;

            try
            {
                for (int i = 0; i < baker.cellMapList.Count; i++)
                {
                    SpriteStudioCellMap cellMap = baker.cellMapList [i];
                    message = cellMap.imagePath;
                    EditorUtility.DisplayProgressBar("Sprite Studio For Unity", "Create Texture(" + (i + 1) + "/" + baker.cellMapList.Count + ") : " + cellMap.name, 0.5f);
                    baker.CreateTexture(cellMap);
                }
            } catch (Exception e)
            {
                EditorUtility.DisplayDialog("Error", "Create Texture : " + message, "OK");
                Debug.Log(e.StackTrace);
                return false;
            }
            return true;
        }
        bool CreateMaterials(SpriteStudioBaker baker)
        {
            baker.addMaterialDict = new Dictionary<string, Material>();
            baker.mixMaterialDict = new Dictionary<string, Material>();
            baker.mulMaterialDict = new Dictionary<string, Material>();
            baker.subMaterialDict = new Dictionary<string, Material>();

            if (baker.cellMapList == null)
                return true;

            string message = null;
            try
            {
                for (int i = 0; i < baker.cellMapList.Count; i++)
                {
                    SpriteStudioCellMap cellMap = baker.cellMapList [i];
                    message = cellMap.imagePath;
                    EditorUtility.DisplayProgressBar("Sprite Studio For Unity", "Create Material(" + (i + 1) + "/" + baker.cellMapList.Count + ") : " + cellMap.name, 0.6f);
                    baker.CreateMaterials(cellMap);
                }
            } catch (Exception e)
            {
                EditorUtility.DisplayDialog("Error", "Create Material : " + message, "OK");
                Debug.Log(e.StackTrace);
                return false;
            }
            return true;
        }