Răsfoiți Sursa

add AC_strobe

David Rose 22 ani în urmă
părinte
comite
39a63feecb

+ 2 - 2
pandatool/src/eggbase/somethingToEgg.cxx

@@ -106,8 +106,8 @@ add_animation_options() {
     ("a", "animation-mode", 40,
      "Specifies how animation from the " + _format_name + " file is "
      "converted to egg, if at all.  At present, the following keywords "
-     "are supported: none, pose, flip, model, chan, or both.  The default "
-     "is none, which means not to convert animation.",
+     "are supported: none, pose, flip, strobe, model, chan, or both.  "
+     "The default is none, which means not to convert animation.",
      &SomethingToEgg::dispatch_animation_convert, NULL, &_animation_convert);
 
   add_option

+ 8 - 5
pandatool/src/mayaegg/mayaToEggConverter.cxx

@@ -254,8 +254,9 @@ convert_maya(bool from_selection) {
       break;
       
     case AC_flip:
-      // flip: get out a series of static models, one per frame, under a
-      // sequence node.
+    case AC_strobe:
+      // flip or strobe: get out a series of static models, one per
+      // frame, under a sequence node for AC_flip.
       all_ok = convert_flip(start_frame, end_frame, frame_inc,
                             output_frame_rate);
       break;
@@ -347,8 +348,10 @@ convert_flip(double start_frame, double end_frame, double frame_inc,
 
   EggGroup *sequence_node = new EggGroup(_character_name);
   get_egg_data().add_child(sequence_node);
-  sequence_node->set_switch_flag(true);
-  sequence_node->set_switch_fps(output_frame_rate / frame_inc);
+  if (_animation_convert == AC_flip) { 
+    sequence_node->set_switch_flag(true);
+    sequence_node->set_switch_fps(output_frame_rate / frame_inc);
+  }
 
   MTime frame(start_frame, MTime::uiUnit());
   MTime frame_stop(end_frame, MTime::uiUnit());
@@ -361,7 +364,7 @@ convert_flip(double start_frame, double end_frame, double frame_inc,
     sequence_node->add_child(frame_root);
 
     MGlobal::viewFrame(frame);
-    if (!convert_hierarchy(&get_egg_data())) {
+    if (!convert_hierarchy(frame_root)) {
       all_ok = false;
     }
 

+ 6 - 0
pandatool/src/pandatoolbase/animationConvert.cxx

@@ -40,6 +40,9 @@ format_animation_convert(AnimationConvert convert) {
   case AC_flip:
     return "flip";
 
+  case AC_strobe:
+    return "strobe";
+
   case AC_model:
     return "model";
 
@@ -79,6 +82,9 @@ string_animation_convert(const string &str) {
   } else if (cmp_nocase(str, "flip") == 0) {
     return AC_flip;
 
+  } else if (cmp_nocase(str, "strobe") == 0) {
+    return AC_strobe;
+
   } else if (cmp_nocase(str, "model") == 0) {
     return AC_model;
 

+ 1 - 0
pandatool/src/pandatoolbase/animationConvert.h

@@ -32,6 +32,7 @@ enum AnimationConvert {
   AC_none,     // No animation: static geometry only.
   AC_pose,     // Pose to one frame, then get static geometry.
   AC_flip,     // A flip (sequence) of static geometry models.
+  AC_strobe,   // All frames of a flip visible at the same time.
   AC_model,    // A character model, with joints.
   AC_chan,     // Animation tables for the above model.
   AC_both,     // A character model and tables in the same file.