fix bug when canceling file chooser

add bugs section to readme
This commit is contained in:
EliyaFishman 2022-12-04 19:58:39 +02:00
parent 93790a0c34
commit 897180c51f
2 changed files with 25 additions and 18 deletions

View file

@ -110,26 +110,29 @@ namespace Bread2Unity
{ {
//Choose png and bccad files //Choose png and bccad files
var bccadFilePath = EditorUtility.OpenFilePanel("Open BCCAD File", null, "bccad"); var bccadFilePath = EditorUtility.OpenFilePanel("Open BCCAD File", null, "bccad");
var bccadFileFolder = Path.GetDirectoryName(bccadFilePath); if (!string.IsNullOrEmpty(bccadFilePath))
var pngFilePath = EditorUtility.OpenFilePanel("Open Texture File", bccadFileFolder, "png");
if (bccadFilePath != null && pngFilePath != null)
{ {
var bccad = BCCAD.Read(File.ReadAllBytes(bccadFilePath)); var bccadFileFolder = Path.GetDirectoryName(bccadFilePath);
var spriteTexture = SpriteCreator.ComputeSprites(bccad, pngFilePath, _prefab.name, shouldRotate); var pngFilePath = EditorUtility.OpenFilePanel("Open Texture File", bccadFileFolder, "png");
//Create prefab from prefab data if (!string.IsNullOrEmpty(pngFilePath))
for (int i = 0; i < _prefabDataList.Count; i++)
{ {
List<int> animationIndexes; var bccad = BCCAD.Read(File.ReadAllBytes(bccadFilePath));
var prefabData = _prefabDataList[i]; var spriteTexture = SpriteCreator.ComputeSprites(bccad, pngFilePath, _prefab.name, shouldRotate);
if (_animationsIndexes[i].Equals("")) //Create prefab from prefab data
animationIndexes = new List<int>(); for (int i = 0; i < _prefabDataList.Count; i++)
else {
animationIndexes = _animationsIndexes[i].Split(',').Select(int.Parse).ToList(); List<int> animationIndexes;
prefabData.Animations = var prefabData = _prefabDataList[i];
animationIndexes.Select(index => bccad.animations[index]).ToList(); if (_animationsIndexes[i].Equals(""))
} animationIndexes = new List<int>();
else
animationIndexes = _animationsIndexes[i].Split(',').Select(int.Parse).ToList();
prefabData.Animations =
animationIndexes.Select(index => bccad.animations[index]).ToList();
}
PrefabCreator.CreatePrefab(_prefab, bccad, _prefabDataList, spriteTexture); PrefabCreator.CreatePrefab(_prefab, bccad, _prefabDataList, spriteTexture);
}
} }
} }

View file

@ -21,4 +21,8 @@ Rhythm Heaven animation to Unity animation converter
- [ ] change window height and width - [ ] change window height and width
- [ ] write a normal readme - [ ] write a normal readme
### Bugs
- [ ] fix camera taking pictures
- [ ] mices are on top of frame (photo 16)