Added SMD to CHR0 Importing#19
Conversation
I just hope i didn't forget any file :c
|
Issues
======
- Added 5
Complexity increasing per file
==============================
- BrawlLib/Wii/Animations/CHR0SMDImporter.cs 13
See the complete overview on Codacy |
|
You should be using Equals() (likely with StringComparison.OrdinalIgnoreCase) rather than CompareTo(). Fix this and I'll merge. |
| int currentFrameID = new int(); | ||
| float radianFloat = 57.29579143313326f; //Angles are given in radians. To convert them into degrees, multiply them by this float. | ||
| List<SMDFrame> allFrames = new List<SMDFrame>(); | ||
| for (TextReader reader = new StreamReader(input); reader.Peek() != -1;) //Writing data into Lists |
There was a problem hiding this comment.
lineNumber should be incremented in the for loop declaration, or this should be changed to a while loop
|
|
||
| if (lineNumber == 0) //First Line | ||
| { | ||
| if (line.CompareTo("version 1") != 0) //The first line contains the version number. It needs to be 1. |
There was a problem hiding this comment.
Use !line.Equals("version 1", StringComparison.OrdinalIgnoreCase)
| } | ||
| } | ||
|
|
||
| if (line.CompareTo("nodes") == 0) //When reaching this line, we start reading bones names |
There was a problem hiding this comment.
Use line.Equals("nodes", StringComparison.OrdinalIgnoreCase)
| isReadingBones = true; | ||
| } | ||
|
|
||
| if (line.CompareTo("skeleton") == 0) //When reaching this line, we start reading frames |
There was a problem hiding this comment.
Use line.Equals("skeleton", StringComparison.OrdinalIgnoreCase)
| } | ||
|
|
||
| chr0.FrameCount = keynum; | ||
| chr0.Loop = true; |
There was a problem hiding this comment.
This should not be set repeatedly. Set it in the declaration (you currently set it to false there)
| } | ||
| } | ||
|
|
||
| chr0.FrameCount = keynum; |
There was a problem hiding this comment.
Don't repeatedly set FrameCount, unless you have checks in place to prevent the animation from shrinking
| { | ||
| string line = reader.ReadLine(); | ||
|
|
||
| if (line.CompareTo("end") == 0) //When reaching this line, we stop reading what we were reading |
There was a problem hiding this comment.
Use line.Equals("end", StringComparison.OrdinalIgnoreCase)
It's not perfect, but from what i tested, it works.
Note that SMD Animation files don't support scale editing.
If you make your tests with Blender-exported SMD Animation files, keep it mind blender breaks these sometimes.