Skip to content

Commit 1c0d6f9

Browse files
authored
3DSMax exporter to avoid negative frame index for animation (#1019)
* guard negative frame index * put a guard on animation key frame
1 parent 7585adb commit 1c0d6f9

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

3ds Max/Max2Babylon/Exporter/BabylonExporter.Animation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,9 @@ private List<BabylonAnimationKey> ExportBabylonKeysFromGameController(IIGameCont
303303
#else
304304
var gameKey = gameKeyTab[new IntPtr(indexKey)];
305305
#endif
306-
307306
var key = new BabylonAnimationKey()
308307
{
308+
// ensure the frame if not negative.
309309
frame = gameKey.T / Loader.Global.TicksPerFrame,
310310
values = extractValueFunc(gameKey)
311311
};

SharedProjects/BabylonExport.Entities/BabylonAnimationKey.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ namespace BabylonExport.Entities
88
[DataContract]
99
public class BabylonAnimationKey : IComparable<BabylonAnimationKey>, ICloneable
1010
{
11+
private float _f;
12+
1113
[DataMember]
12-
public float frame { get; set; }
14+
// guard for negative value.
15+
public float frame { get => _f; set => _f = value < 0 ? 0 : value; }
1316

1417
[DataMember]
1518
public float[] values { get; set; }

0 commit comments

Comments
 (0)