Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/pandatoolbase/animationConvert.cxx

Go to the documentation of this file.
00001 // Filename: animationConvert.cxx
00002 // Created by:  drose (21Jan03)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #include "animationConvert.h"
00020 
00021 #include "string_utils.h"
00022 #include "notify.h"
00023 
00024 ////////////////////////////////////////////////////////////////////
00025 //     Function: format_animation_convert
00026 //  Description: Returns the string corresponding to this method.
00027 ////////////////////////////////////////////////////////////////////
00028 string
00029 format_animation_convert(AnimationConvert convert) {
00030   switch (convert) {
00031   case AC_invalid:
00032     return "invalid";
00033 
00034   case AC_none:
00035     return "none";
00036 
00037   case AC_pose:
00038     return "pose";
00039 
00040   case AC_flip:
00041     return "flip";
00042 
00043   case AC_model:
00044     return "model";
00045 
00046   case AC_chan:
00047     return "chan";
00048 
00049   case AC_both:
00050     return "both";
00051   }
00052   nout << "**unexpected AnimationConvert value: (" << (int)convert << ")**";
00053   return "**";
00054 }
00055 
00056 ////////////////////////////////////////////////////////////////////
00057 //     Function: AnimationConvert output operator
00058 //  Description:
00059 ////////////////////////////////////////////////////////////////////
00060 ostream &
00061 operator << (ostream &out, AnimationConvert convert) {
00062   return out << format_animation_convert(convert);
00063 }
00064 
00065 ////////////////////////////////////////////////////////////////////
00066 //     Function: string_animation_convert
00067 //  Description: Converts from a string, as might be input by the
00068 //               user, to one of the known AnimationConvert types.
00069 //               Returns AC_invalid if the string is unknown.
00070 ////////////////////////////////////////////////////////////////////
00071 AnimationConvert
00072 string_animation_convert(const string &str) {
00073   if (cmp_nocase(str, "none") == 0) {
00074     return AC_none;
00075 
00076   } else if (cmp_nocase(str, "pose") == 0) {
00077     return AC_pose;
00078 
00079   } else if (cmp_nocase(str, "flip") == 0) {
00080     return AC_flip;
00081 
00082   } else if (cmp_nocase(str, "model") == 0) {
00083     return AC_model;
00084 
00085   } else if (cmp_nocase(str, "chan") == 0) {
00086     return AC_chan;
00087 
00088   } else if (cmp_nocase(str, "both") == 0) {
00089     return AC_both;
00090 
00091   } else {
00092     return AC_invalid;
00093   }
00094 }

Generated on Fri May 2 03:21:27 2003 for Panda-Tool by doxygen1.3