Skip to content

Commit 1359344

Browse files
committed
Automatic merge of T1.6-rc2-41-gacd714487 and 10 pull requests
- Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc) - Pull request #1091 at 2391bc0: Automatic speed control - Pull request #1107 at f5eb3dc: Fix DPMode when last remote is moved to front. - Pull request #1110 at 387388e: Fix Activity Runner persists after loading exception - Pull request #1114 at 9a4a873: Fix color of DB in DrivingInfo when in setup with DPU fenced. - Pull request #1115 at 01c0838: Do not activate ETS switch if no suitable cars are attached - Pull request #1116 at 721d118: Fix Potential Hang in AnimatedPart.SetFrameWrap - Pull request #1082 at 5845a1a: Allow variable water level in glass gauge - Pull request #1104 at f9691cf: Handle simple adhesion within the axle module - Pull request #1081 at 689494b: Brake cuts power unification
12 parents 3940e13 + acd7144 + e10390b + 2391bc0 + f5eb3dc + 387388e + 9a4a873 + 01c0838 + 721d118 + 5845a1a + f9691cf + 689494b commit 1359344

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Source/RunActivity/Viewer3D/AnimatedPart.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,16 @@ public void SetFrameCycle(float frame)
130130
public void SetFrameWrap(float frame)
131131
{
132132
// Wrap the frame around 0-MaxFrame without hanging when MaxFrame=0.
133-
while (MaxFrame > 0 && frame < 0) frame += MaxFrame;
134-
if (frame < 0) frame = 0;
135-
frame %= MaxFrame;
133+
if (MaxFrame > 0)
134+
{
135+
frame %= MaxFrame;
136+
// If frame was negative (eg: animation run in reverse), it will still be negative
137+
// and needs one additional offset by MaxFrame to be in the correct range
138+
if (frame < 0)
139+
frame += MaxFrame;
140+
}
141+
else if (frame < 0)
142+
frame = 0;
136143
SetFrame(frame);
137144
}
138145

0 commit comments

Comments
 (0)