-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added SMD to CHR0 Importing #19
base: master
Are you sure you want to change the base?
Conversation
I just hope i didn't forget any file :c
Here is an overview of what got changed by this pull request: 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use line.Equals("skeleton", StringComparison.OrdinalIgnoreCase)
} | ||
|
||
chr0.FrameCount = keynum; | ||
chr0.Loop = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.