From 897180c51fb3357ec3c56be758ba5e5530c46c67 Mon Sep 17 00:00:00 2001 From: EliyaFishman <45822259+EliyaFishman@users.noreply.github.com> Date: Sun, 4 Dec 2022 19:58:39 +0200 Subject: [PATCH] fix bug when canceling file chooser add bugs section to readme --- Assets/Editor/bread2unity/Bread2Unity.cs | 37 +++++++++++++----------- Assets/Editor/bread2unity/README.md | 6 +++- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/Assets/Editor/bread2unity/Bread2Unity.cs b/Assets/Editor/bread2unity/Bread2Unity.cs index aa9338b29..e5f960e41 100644 --- a/Assets/Editor/bread2unity/Bread2Unity.cs +++ b/Assets/Editor/bread2unity/Bread2Unity.cs @@ -110,26 +110,29 @@ namespace Bread2Unity { //Choose png and bccad files var bccadFilePath = EditorUtility.OpenFilePanel("Open BCCAD File", null, "bccad"); - var bccadFileFolder = Path.GetDirectoryName(bccadFilePath); - var pngFilePath = EditorUtility.OpenFilePanel("Open Texture File", bccadFileFolder, "png"); - if (bccadFilePath != null && pngFilePath != null) + if (!string.IsNullOrEmpty(bccadFilePath)) { - var bccad = BCCAD.Read(File.ReadAllBytes(bccadFilePath)); - var spriteTexture = SpriteCreator.ComputeSprites(bccad, pngFilePath, _prefab.name, shouldRotate); - //Create prefab from prefab data - for (int i = 0; i < _prefabDataList.Count; i++) + var bccadFileFolder = Path.GetDirectoryName(bccadFilePath); + var pngFilePath = EditorUtility.OpenFilePanel("Open Texture File", bccadFileFolder, "png"); + if (!string.IsNullOrEmpty(pngFilePath)) { - List animationIndexes; - var prefabData = _prefabDataList[i]; - if (_animationsIndexes[i].Equals("")) - animationIndexes = new List(); - else - animationIndexes = _animationsIndexes[i].Split(',').Select(int.Parse).ToList(); - prefabData.Animations = - animationIndexes.Select(index => bccad.animations[index]).ToList(); - } + var bccad = BCCAD.Read(File.ReadAllBytes(bccadFilePath)); + var spriteTexture = SpriteCreator.ComputeSprites(bccad, pngFilePath, _prefab.name, shouldRotate); + //Create prefab from prefab data + for (int i = 0; i < _prefabDataList.Count; i++) + { + List animationIndexes; + var prefabData = _prefabDataList[i]; + if (_animationsIndexes[i].Equals("")) + animationIndexes = new List(); + 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); + } } } diff --git a/Assets/Editor/bread2unity/README.md b/Assets/Editor/bread2unity/README.md index f3cd9f767..03b017c73 100644 --- a/Assets/Editor/bread2unity/README.md +++ b/Assets/Editor/bread2unity/README.md @@ -21,4 +21,8 @@ Rhythm Heaven animation to Unity animation converter - [ ] change window height and width -- [ ] write a normal readme \ No newline at end of file +- [ ] write a normal readme + +### Bugs +- [ ] fix camera taking pictures +- [ ] mices are on top of frame (photo 16) \ No newline at end of file