Code style cleanup

#837
This commit is contained in:
Wojtek Figat
2022-11-28 23:35:27 +01:00
parent 853fa482f6
commit 3f3697fbfa
4 changed files with 41 additions and 47 deletions

View File

@@ -1275,25 +1275,17 @@ bool ModelTool::ImportModel(const String& path, ModelData& meshData, Options& op
// Trim the animation keyframes range if need to
if (options.Duration == AnimationDuration::Custom)
{
// PE: This is wrong, FramesRange is Frame Index start end, not the frame time.
// PE: To extract Frame Index you has to enter Frame*FramesPerSecond or it will not work.
// PE: This also makes another problem as the "length" get wrong and your not able to loop animatons.
// const float start = (float)(options.FramesRange.X / data.Animation.FramesPerSecond);
// const float end = (float)(options.FramesRange.Y / data.Animation.FramesPerSecond);
// data.Animation.Duration = (end - start); // *data.Animation.FramesPerSecond;
// PE: Custom animation import , frame index start and end, is now correct and the real index.
const float start = (float)(options.FramesRange.X);
const float end = (float)(options.FramesRange.Y);
// Custom animation import, frame index start and end
const float start = options.FramesRange.X;
const float end = options.FramesRange.Y;
for (int32 i = 0; i < data.Animation.Channels.Count(); i++)
{
auto& anim = data.Animation.Channels[i];
anim.Position.Trim(start, end);
anim.Rotation.Trim(start, end);
anim.Scale.Trim(start, end);
}
data.Animation.Duration = (end - start);
data.Animation.Duration = end - start;
}
// Change the sampling rate if need to