Просмотр исходного кода

remove assertion; pose should automatically wrap

David Rose 23 лет назад
Родитель
Сommit
8fc1ac9321
1 измененных файлов с 5 добавлено и 2 удалено
  1. 5 2
      panda/src/chan/animControl.cxx

+ 5 - 2
panda/src/chan/animControl.cxx

@@ -254,9 +254,12 @@ stop() {
 ////////////////////////////////////////////////////////////////////
 void AnimControl::
 pose(int frame) {
-  nassertv(get_num_frames() > 0);
+  int num_frames = get_num_frames();
+  nassertv(num_frames > 0);
 
-  nassertv(frame >= 0 && frame < get_num_frames());
+  // Modulo the number of frames.
+  frame = frame - cfloor(frame / num_frames) * num_frames;
+  nassertv(frame >= 0 && frame < num_frames);
   _as_of_time = ClockObject::get_global_clock()->get_frame_time();
   _playing = false;