Panda3D
animationConvert.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file animationConvert.cxx
10  * @author drose
11  * @date 2003-01-21
12  */
13 
14 #include "animationConvert.h"
15 
16 #include "string_utils.h"
17 #include "pnotify.h"
18 
19 /**
20  * Returns the string corresponding to this method.
21  */
22 std::string
24  switch (convert) {
25  case AC_invalid:
26  return "invalid";
27 
28  case AC_none:
29  return "none";
30 
31  case AC_pose:
32  return "pose";
33 
34  case AC_flip:
35  return "flip";
36 
37  case AC_strobe:
38  return "strobe";
39 
40  case AC_model:
41  return "model";
42 
43  case AC_chan:
44  return "chan";
45 
46  case AC_both:
47  return "both";
48  }
49  nout << "**unexpected AnimationConvert value: (" << (int)convert << ")**";
50  return "**";
51 }
52 
53 /**
54  *
55  */
56 std::ostream &
57 operator << (std::ostream &out, AnimationConvert convert) {
58  return out << format_animation_convert(convert);
59 }
60 
61 /**
62  * Converts from a string, as might be input by the user, to one of the known
63  * AnimationConvert types. Returns AC_invalid if the string is unknown.
64  */
66 string_animation_convert(const std::string &str) {
67  if (cmp_nocase(str, "none") == 0) {
68  return AC_none;
69 
70  } else if (cmp_nocase(str, "pose") == 0) {
71  return AC_pose;
72 
73  } else if (cmp_nocase(str, "flip") == 0) {
74  return AC_flip;
75 
76  } else if (cmp_nocase(str, "strobe") == 0) {
77  return AC_strobe;
78 
79  } else if (cmp_nocase(str, "model") == 0) {
80  return AC_model;
81 
82  } else if (cmp_nocase(str, "chan") == 0) {
83  return AC_chan;
84 
85  } else if (cmp_nocase(str, "both") == 0) {
86  return AC_both;
87 
88  } else {
89  return AC_invalid;
90  }
91 }
AnimationConvert
This enumerated type lists the methods by which animation from an animation package might be represen...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::string format_animation_convert(AnimationConvert convert)
Returns the string corresponding to this method.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
AnimationConvert string_animation_convert(const std::string &str)
Converts from a string, as might be input by the user, to one of the known AnimationConvert types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.