@@ -53,8 +53,6 @@ enum CreateMode
5353 int _ioHeight ;
5454 System . Numerics . Vector4 _ioColor ;
5555 int _ioTimeline ;
56- bool _ioIsLoop ;
57- bool _ioIsReverse ;
5856 private Camera _camera ;
5957 bool _dialogFilePicker = false ;
6058 bool _dialogCompatibility = false ;
@@ -108,12 +106,11 @@ protected override void OnLoad()
108106
109107 _camera = new Camera ( Vector3 . UnitZ * 3 , Size . X / ( float ) Size . Y ) ;
110108
111- _ioIsLoop = false ;
112- _ioIsReverse = false ;
113109 _ioIsPlaying = false ;
114110
115111 _ioFps = 24 ;
116112 _secondsEllapsed = 0 ;
113+ _ioTimeline = 1 ;
117114
118115 // TODO: default values for io
119116 }
@@ -646,7 +643,7 @@ protected override void OnMouseWheel(MouseWheelEventArgs e)
646643 public int LinearInterpolate ( int x , int x1 , int x2 , int y1 , int y2 )
647644 {
648645 float y ;
649- y = y1 + ( x - x1 ) * ( ( y2 - y1 ) / ( ( x2 - x1 ) == 0 ? 1 : ( x2 - x1 ) ) ) ;
646+ y = y1 + ( x - x1 ) * ( ( y2 - y1 ) / ( ( x2 - x1 ) == 0 ? 1 : ( float ) ( x2 - x1 ) ) ) ;
650647 //if (y1 < y2)
651648 // y = y1 + (x - x1) * ((y2 - y1) / (x2 - x1));
652649 //else
@@ -1012,14 +1009,6 @@ public void ShowUI()
10121009 _ioFps = Math . Clamp ( _ioFps , 1 , 120 ) ; // TODO: please dont hardcode this
10131010 ImGui . PopItemWidth ( ) ;
10141011
1015- if ( ImGui . Checkbox ( "Loop" , ref _ioIsLoop ) )
1016- _ioIsReverse = _ioIsLoop ;
1017- ImGui . Indent ( ) ;
1018- if ( ImGui . Checkbox ( "Reverse" , ref _ioIsReverse ) )
1019- if ( _ioIsLoop == false )
1020- _ioIsLoop = _ioIsReverse ;
1021- ImGui . Unindent ( ) ;
1022-
10231012 if ( ImGui . Button ( _ioIsPlaying == false ? "Play" : "Pause" ) )
10241013 _ioIsPlaying = ! _ioIsPlaying ;
10251014
@@ -1179,6 +1168,7 @@ public void RenderInterpolation()
11791168 {
11801169 // Draw the current one in this list
11811170 Shape sibling = _timeline [ _ioTimeline ] . Find ( x => x . Id == shape . Id ) ! ;
1171+ Console . WriteLine ( "One already exist" ) ;
11821172
11831173 shape . X = sibling . X ;
11841174 shape . Y = sibling . Y ;
@@ -1203,31 +1193,25 @@ public void RenderInterpolation()
12031193
12041194 int timelineIndex = _ioTimeline ;
12051195
1206- if ( _ioIsLoop )
1207- {
1208- int delta = keys [ keys . Length - 1 ] - keys [ 0 ] ;
1209- timelineIndex = timelineIndex - ( delta * ( int ) Math . Floor ( ( double ) timelineIndex / delta ) ) ;
1210- }
1196+
12111197
12121198 if ( timelineIndex >= keys [ keys . Length - 1 ] )
12131199 {
1200+ Console . WriteLine ( "ihhhh ioTimeline == {0}" , timelineIndex ) ;
12141201 nearest . first = keys [ keys . Length - 1 ] ;
12151202 nearest . second = keys [ keys . Length - 1 ] ;
1216- //if (_ioIsLoop)
1217- // nearest.first = keys[0];
12181203 }
12191204 else if ( timelineIndex <= keys [ 0 ] )
12201205 {
1206+ Console . WriteLine ( "ohhh ioTimeline == {0}" , timelineIndex ) ;
12211207 nearest . first = keys [ 0 ] ;
12221208 nearest . second = keys [ 0 ] ;
1223- //if (_ioIsLoop)
1224- // nearest.second = keys[keys.Length - 1];
12251209 }
12261210 else
12271211 {
12281212 for ( int i = 0 ; i < keys . Length ; i ++ )
12291213 {
1230- Console . WriteLine ( "key[{0}] = {1}" , i , keys [ i ] ) ;
1214+ // Console.WriteLine("key[{0}] = {1}", i, keys[i]);
12311215 if ( keys [ i ] >= timelineIndex )
12321216 {
12331217 nearest . second = keys [ i ] ;
@@ -1240,6 +1224,7 @@ public void RenderInterpolation()
12401224
12411225
12421226
1227+
12431228 Console . WriteLine ( "HHHHHHHHHHHHHHHHHHHHHHHHHHHHH first: {0} second: {1}" , nearest . first , nearest . second ) ;
12441229 //foreach (int key in keys)
12451230 //{
@@ -1263,20 +1248,7 @@ public void RenderInterpolation()
12631248 Shape first = _timeline [ nearest . first ] . Find ( x => x . Id == shape . Id ) ! ; // can't be null
12641249 Shape second = _timeline [ nearest . second ] . Find ( x => x . Id == shape . Id ) ! ; // can't be null;
12651250 // If reverse and loop invert the two shape every odd
1266- if ( _ioIsLoop && _ioIsReverse )
1267- {
1268- if ( keys . Length > 1 )
1269- {
1270- int delta = keys [ keys . Length - 1 ] - keys [ 0 ] ;
1271- Console . WriteLine ( "(timelineIndex:{0} / delta:{1}) {2} % 2 == 1 =>>>> {3}" , _ioTimeline , delta , _ioTimeline / delta , ( int ) Math . Floor ( ( double ) _ioTimeline / delta ) % 2 == 1 ) ;
1272- if ( ( int ) Math . Floor ( ( double ) _ioTimeline / delta ) % 2 == 1 ) // if odd
1273- {
1274- Console . WriteLine ( "Invertttttttttttttt" ) ;
1275- second = _timeline [ nearest . first ] . Find ( x => x . Id == shape . Id ) ! ; // can't be null
1276- first = _timeline [ nearest . second ] . Find ( x => x . Id == shape . Id ) ! ; // can't be null
1277- }
1278- }
1279- }
1251+
12801252
12811253 //if (first != null && second != null)
12821254 {
@@ -1324,6 +1296,7 @@ public void RenderInterpolation()
13241296 else
13251297 {
13261298 // doesnt exist somewhere else, so just draw the one on the screen.
1299+ Console . WriteLine ( "Draw the current one" ) ;
13271300 shape . ImplementObject ( ) ;
13281301 }
13291302 }
0 commit comments