From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a02210.html | 1360 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1360 insertions(+) create mode 100644 docs/doxygen/nel/a02210.html (limited to 'docs/doxygen/nel/a02210.html') diff --git a/docs/doxygen/nel/a02210.html b/docs/doxygen/nel/a02210.html new file mode 100644 index 00000000..60ce7ce2 --- /dev/null +++ b/docs/doxygen/nel/a02210.html @@ -0,0 +1,1360 @@ + + +NeL: NL3D::CAnimationSet class Reference + + + +
+

NL3D::CAnimationSet Class Reference

#include <animation_set.h> +

+

Inheritance diagram for NL3D::CAnimationSet: +

+ +NLMISC::CRefCount + +

Detailed Description

+An CAnimationSet is set of CAnimation. It manages global channel ID for a set of animations with many tracks. An Id is associed with each track name.

+

Author:
Cyril 'Hulud' Corvazier

+Nevrax France

+
Date:
2001
+ +

+ +

+Definition at line 54 of file animation_set.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Types

enum  { NotFound = 0xffffffff + }

Public Member Functions

uint addAnimation (const char *name, CAnimation *animation)
uint addSkeletonWeight (const char *name, CSkeletonWeight *skeletonWeight)
void build ()
CAnimationgetAnimation (uint animationId)
const CAnimationgetAnimation (uint animationId) const
uint getAnimationIdByName (const std::string &name) const
const std::string & getAnimationName (uint animationId) const
uint getChannelIdByName (const std::string &name) const
uint getNumAnimation () const
uint getNumChannelId () const
uint getNumSkeletonWeight () const
const sintgetRefCount () const
CSkeletonWeightgetSkeletonWeight (uint skeletonId)
const CSkeletonWeightgetSkeletonWeight (uint skeletonId) const
uint getSkeletonWeightIdByName (const std::string &name) const
const std::string & getSkeletonWeightName (uint skeletonId) const
bool loadFromFiles (const std::string &path, bool recurse=true, const char *ext="anim", bool wantWarningMessage=true)
void reset ()
void serial (NLMISC::IStream &f)
 Serial the template.

 ~CAnimationSet ()

Data Fields

sint crefs
CPtrInfo * pinfo

Static Public Attributes

CPtrInfo NullPtrInfo

Private Attributes

std::vector< CAnimation * > _Animation
std::map< std::string, uint32_AnimationIdByName
std::vector< std::string > _AnimationName
std::map< std::string, uint32_ChannelIdByName
std::vector< CSkeletonWeight * > _SkeletonWeight
std::map< std::string, uint32_SkeletonWeightIdByName
std::vector< std::string > _SkeletonWeightName

Friends

struct CPtrInfo
+


Member Enumeration Documentation

+

+ + + + +
+ + +
anonymous enum +
+
+ + + + + +
+   + + +

+

Enumeration values:
+ + +
NotFound  +
+
+ +

+Definition at line 58 of file animation_set.h. +

+

00058 { NotFound=0xffffffff };
+
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NL3D::CAnimationSet::~CAnimationSet  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 43 of file animation_set.cpp. +

+References _Animation, s, and uint. +

+

00044 {
+00045         // Erase all animations.
+00046         for (uint a=0; a<_Animation.size(); a++)
+00047                 delete _Animation[a];
+00048         for (uint s=0; s<_SkeletonWeight.size(); s++)
+00049                 delete _SkeletonWeight[s];
+00050 }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
uint NL3D::CAnimationSet::addAnimation const char *  name,
CAnimation animation
+
+ + + + + +
+   + + +

+Add an animation to the set. The pointer of the animation must be allocated with new. It is then handled by the animation set.

+

Parameters:
+ + + +
name is the name of the animation.
animation is the animation pointer.
+
+
Returns:
the id of the new animation.
+ +

+Definition at line 61 of file animation_set.cpp. +

+References _Animation, _AnimationIdByName, _AnimationName, and uint. +

+Referenced by NL3D::CLodCharacterBuilder::addAnim(), and loadFromFiles(). +

+

00062 {
+00063         // Add an animation
+00064         _Animation.push_back (animation);
+00065         _AnimationName.push_back (name);
+00066 
+00067         // Add an entry name / animation
+00068         _AnimationIdByName.insert (std::map <std::string, uint32>::value_type (name, _Animation.size()-1));
+00069 
+00070         // Return animation id
+00071         return _Animation.size()-1;
+00072 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
uint NL3D::CAnimationSet::addSkeletonWeight const char *  name,
CSkeletonWeight skeletonWeight
+
+ + + + + +
+   + + +

+Add a skeleton weight to the set. The pointer of the skeletonWeight must be allocated with new. It is then handled by the animation set.

+

Returns:
the id of the new skeleton.
+ +

+Definition at line 76 of file animation_set.cpp. +

+References _SkeletonWeightIdByName, _SkeletonWeightName, and uint. +

+

00077 {
+00078         // Add an animation
+00079         _SkeletonWeight.push_back (skeletonWeight);
+00080         _SkeletonWeightName.push_back (name);
+00081 
+00082         // Add an entry name / animation
+00083         _SkeletonWeightIdByName.insert (std::map <std::string, uint32>::value_type (name, _SkeletonWeight.size()-1));
+00084 
+00085         // Return animation id
+00086         return _SkeletonWeight.size()-1;
+00087 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CAnimationSet::build  ) 
+
+ + + + + +
+   + + +

+Final build of the animation set.

+First, for each animation you want to add to the set, you must add the animation in the set.

+When all animations are built, call this method to finlize the set. +

+Definition at line 104 of file animation_set.cpp. +

+References _Animation, _ChannelIdByName, getAnimation(), NL3D::CAnimation::getTrackNames(), and uint. +

+Referenced by NL3D::CLodCharacterBuilder::addAnim(), and loadFromFiles(). +

+

00105 {
+00106         // Clear the channel map
+00107         _ChannelIdByName.clear ();
+00108 
+00109         // Set of names
+00110         std::set<std::string> channelNames;
+00111 
+00112         // For each animation in the set
+00113         for (uint a=0; a<_Animation.size(); a++)
+00114         {
+00115                 // Fill the set of channel names
+00116                 getAnimation (a)->getTrackNames (channelNames);
+00117         }
+00118 
+00119         // Add this name in the map with there iD
+00120         uint id=0;
+00121         std::set<std::string>::iterator ite=channelNames.begin ();
+00122         while (ite!=channelNames.end ())
+00123         {
+00124                 // Insert an entry
+00125                 _ChannelIdByName.insert (std::map <std::string, uint32>::value_type (*ite, id++));
+00126 
+00127                 // Next entry
+00128                 ite++;
+00129         }
+00130 }
+
+

+ + + + +
+ + + + + + + + + + +
CAnimation* NL3D::CAnimationSet::getAnimation uint  animationId  )  [inline]
+
+ + + + + +
+   + + +

+Get a writable animation pointer. +

+Definition at line 120 of file animation_set.h. +

+References _Animation, and uint. +

+

00121         {
+00122                 return _Animation[animationId];
+00123         }
+
+

+ + + + +
+ + + + + + + + + + +
const CAnimation* NL3D::CAnimationSet::getAnimation uint  animationId  )  const [inline]
+
+ + + + + +
+   + + +

+Get a read only animation pointer. +

+Definition at line 112 of file animation_set.h. +

+References _Animation, and uint. +

+Referenced by build(), NL3D::CAnimationPlaylist::getLocalTime(), NL3D::CChannelMixer::setSlotAnimation(), and NL3D::CAnimationPlaylist::setupMixer(). +

+

00113         {
+00114                 return _Animation[animationId];
+00115         }
+
+

+ + + + +
+ + + + + + + + + + +
uint NL3D::CAnimationSet::getAnimationIdByName const std::string &  name  )  const [inline]
+
+ + + + + +
+   + + +

+Get a animation ID by name. If no channel is found, method returns NotFound. +

+Definition at line 83 of file animation_set.h. +

+References _AnimationIdByName, and uint. +

+Referenced by NL3D::CLodCharacterBuilder::addAnim(). +

+

00084         {
+00085                 // Look for an id with this name
+00086                 std::map <std::string, uint32>::const_iterator ite=_AnimationIdByName.find (name);
+00087                 if (ite!=_AnimationIdByName.end ())
+00088                         return ite->second;
+00089                 else
+00090                         return NotFound;
+00091         }
+
+

+ + + + +
+ + + + + + + + + + +
const std::string& NL3D::CAnimationSet::getAnimationName uint  animationId  )  const [inline]
+
+ + + + + +
+   + + +

+Get animation name. +

+Definition at line 104 of file animation_set.h. +

+References _AnimationName, and uint. +

+

00105         {
+00106                 return _AnimationName[animationId];
+00107         }
+
+

+ + + + +
+ + + + + + + + + + +
uint NL3D::CAnimationSet::getChannelIdByName const std::string &  name  )  const [inline]
+
+ + + + + +
+   + + +

+Get a channel ID with its name. If no channel is found, method returns NotFound. +

+Definition at line 70 of file animation_set.h. +

+References _ChannelIdByName, and uint. +

+Referenced by NL3D::CChannelMixer::addChannel(), and NL3D::CChannelMixer::applySkeletonWeight(). +

+

00071         {
+00072                 // Look for an id with this name
+00073                 std::map <std::string, uint32>::const_iterator ite=_ChannelIdByName.find (name);
+00074                 if (ite!=_ChannelIdByName.end ())
+00075                         return ite->second;
+00076                 else
+00077                         return NotFound;
+00078         }
+
+

+ + + + +
+ + + + + + + + + +
uint NL3D::CAnimationSet::getNumAnimation  )  const [inline]
+
+ + + + + +
+   + + +

+Get animations count. +

+Definition at line 96 of file animation_set.h. +

+References _Animation, and uint. +

+

00097         {
+00098                 return _Animation.size();
+00099         }
+
+

+ + + + +
+ + + + + + + + + +
uint NL3D::CAnimationSet::getNumChannelId  )  const
+
+ + + + + +
+   + + +

+Get channel ID count. This number is the count of different track name in the animation set. +

+Definition at line 54 of file animation_set.cpp. +

+References _ChannelIdByName, and uint. +

+

00055 {
+00056         return _ChannelIdByName.size ();
+00057 }
+
+

+ + + + +
+ + + + + + + + + +
uint NL3D::CAnimationSet::getNumSkeletonWeight  )  const [inline]
+
+ + + + + +
+   + + +

+Get skeleton weight count. +

+Definition at line 128 of file animation_set.h. +

+References uint. +

+

00129         {
+00130                 return _SkeletonWeight.size();
+00131         }
+
+

+ + + + +
+ + + + + + + + + +
const sint& NLMISC::CRefCount::getRefCount  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 70 of file smart_ptr.h. +

+References NLMISC::CRefCount::crefs, and sint. +

+

00071         {
+00072                 return  crefs;
+00073         }
+
+

+ + + + +
+ + + + + + + + + + +
CSkeletonWeight* NL3D::CAnimationSet::getSkeletonWeight uint  skeletonId  )  [inline]
+
+ + + + + +
+   + + +

+Get a writable skeleton weight pointer. +

+Definition at line 165 of file animation_set.h. +

+References uint. +

+

00166         {
+00167                 return _SkeletonWeight[skeletonId];
+00168         }
+
+

+ + + + +
+ + + + + + + + + + +
const CSkeletonWeight* NL3D::CAnimationSet::getSkeletonWeight uint  skeletonId  )  const [inline]
+
+ + + + + +
+   + + +

+Get a read only skeleton weight pointer. +

+Definition at line 157 of file animation_set.h. +

+References uint. +

+Referenced by NL3D::CChannelMixer::applySkeletonWeight(). +

+

00158         {
+00159                 return _SkeletonWeight[skeletonId];
+00160         }
+
+

+ + + + +
+ + + + + + + + + + +
uint NL3D::CAnimationSet::getSkeletonWeightIdByName const std::string &  name  )  const [inline]
+
+ + + + + +
+   + + +

+Get a skeleton weight ID by name. If no skeleton weight is found, method returns NotFound. +

+Definition at line 136 of file animation_set.h. +

+References _SkeletonWeightIdByName, and uint. +

+

00137         {
+00138                 // Look for an id with this name
+00139                 std::map <std::string, uint32>::const_iterator ite=_SkeletonWeightIdByName.find (name);
+00140                 if (ite!=_SkeletonWeightIdByName.end ())
+00141                         return ite->second;
+00142                 else
+00143                         return NotFound;
+00144         }
+
+

+ + + + +
+ + + + + + + + + + +
const std::string& NL3D::CAnimationSet::getSkeletonWeightName uint  skeletonId  )  const [inline]
+
+ + + + + +
+   + + +

+Get skeleton template name. +

+Definition at line 149 of file animation_set.h. +

+References _SkeletonWeightName, and uint. +

+

00150         {
+00151                 return _SkeletonWeightName[skeletonId];
+00152         }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NL3D::CAnimationSet::loadFromFiles const std::string &  path,
bool  recurse = true,
const char *  ext = "anim",
bool  wantWarningMessage = true
+
+ + + + + +
+   + + +

+Helper method. Load an animation set from animation files in a directory, then call build().

Parameters:
+ + + + + +
path Path to look at for animations
recurse wether to recurse to load animation in sub folders
ext the extension for animation files
wantWarningMessage displays warning if some of the files could not be loaded
+
+
Returns:
true if everything loaded ok
+ +

+Definition at line 155 of file animation_set.cpp. +

+References addAnimation(), build(), NLMISC::CIFile::close(), NLMISC::CFile::getExtension(), NLMISC::CPath::getPathContent(), nlinfo, NLMISC::CIFile::open(), and uint. +

+

00156 {
+00157         bool everythingOk = true;
+00158         std::vector<std::string> anims;
+00159         NLMISC::CPath::getPathContent(path, recurse, false, true, anims);
+00160         for (uint k = 0; k < anims.size(); ++k)
+00161         {
+00162                 std::string fileExt = NLMISC::CFile::getExtension(anims[k]);
+00163                 if (fileExt == ext) // an animation file ?
+00164                 {
+00165                         try
+00166                         {
+00167                                 NLMISC::CIFile  iFile;
+00168                                 iFile.open(anims[k]);
+00169                                 std::auto_ptr<CAnimation> anim(new CAnimation);
+00170                                 anim->serial(iFile);
+00171                                 addAnimation(NLMISC::CFile::getFilenameWithoutExtension(anims[k]).c_str(), anim.release());
+00172                                 iFile.close();
+00173 
+00174                         }
+00175                         catch (NLMISC::EStream &e)
+00176                         {
+00177                                 if (wantWarningMessage)
+00178                                 {
+00179                                         nlinfo("Unable to load an automatic animation : %s", e.what());
+00180                                 }
+00181                                 everythingOk = false;
+00182                         }
+00183                 }
+00184         }
+00185         build();
+00186         return everythingOk;
+00187 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CAnimationSet::reset  ) 
+
+ + + + + +
+   + + +

+Reset the animation set. +

+Definition at line 91 of file animation_set.cpp. +

+References _Animation, _AnimationIdByName, _AnimationName, _ChannelIdByName, _SkeletonWeightIdByName, and _SkeletonWeightName. +

+

00092 {
+00093         _Animation.clear();
+00094         _SkeletonWeight.clear();
+00095         _AnimationName.clear();
+00096         _SkeletonWeightName.clear();
+00097         _ChannelIdByName.clear();
+00098         _AnimationIdByName.clear();
+00099         _SkeletonWeightIdByName.clear();
+00100 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CAnimationSet::serial NLMISC::IStream f  ) 
+
+ + + + + +
+   + + +

+Serial the template. +

+ +

+Definition at line 134 of file animation_set.cpp. +

+References _Animation, _AnimationIdByName, _AnimationName, _ChannelIdByName, _SkeletonWeightIdByName, _SkeletonWeightName, NLMISC::IStream::serialCheck(), NLMISC::IStream::serialCont(), NLMISC::IStream::serialContPtr(), NLMISC::IStream::serialVersion(), and uint32. +

+

00135 {
+00136         // Serial an header
+00137         f.serialCheck ((uint32)'_LEN');
+00138         f.serialCheck ((uint32)'MINA');
+00139         f.serialCheck ((uint32)'TES_');
+00140 
+00141         // Serial a version
+00142         (void)f.serialVersion (0);
+00143 
+00144         // Serial the class
+00145         f.serialContPtr (_Animation);
+00146         f.serialContPtr (_SkeletonWeight);
+00147         f.serialCont (_AnimationName);
+00148         f.serialCont (_SkeletonWeightName);
+00149         f.serialCont(_ChannelIdByName);
+00150         f.serialCont(_AnimationIdByName);
+00151         f.serialCont(_SkeletonWeightIdByName);
+00152 }
+
+


Friends And Related Function Documentation

+

+ + + + +
+ + +
friend struct CPtrInfo [friend, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 67 of file smart_ptr.h.

+


Field Documentation

+

+ + + + +
+ + +
std::vector<CAnimation*> NL3D::CAnimationSet::_Animation [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 223 of file animation_set.h. +

+Referenced by addAnimation(), build(), getAnimation(), getNumAnimation(), reset(), serial(), and ~CAnimationSet().

+

+ + + + +
+ + +
std::map<std::string, uint32> NL3D::CAnimationSet::_AnimationIdByName [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 228 of file animation_set.h. +

+Referenced by addAnimation(), getAnimationIdByName(), reset(), and serial().

+

+ + + + +
+ + +
std::vector<std::string> NL3D::CAnimationSet::_AnimationName [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 225 of file animation_set.h. +

+Referenced by addAnimation(), getAnimationName(), reset(), and serial().

+

+ + + + +
+ + +
std::map<std::string, uint32> NL3D::CAnimationSet::_ChannelIdByName [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 227 of file animation_set.h. +

+Referenced by build(), getChannelIdByName(), getNumChannelId(), reset(), and serial().

+

+ + + + +
+ + +
std::vector<CSkeletonWeight*> NL3D::CAnimationSet::_SkeletonWeight [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 224 of file animation_set.h.

+

+ + + + +
+ + +
std::map<std::string, uint32> NL3D::CAnimationSet::_SkeletonWeightIdByName [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 229 of file animation_set.h. +

+Referenced by addSkeletonWeight(), getSkeletonWeightIdByName(), reset(), and serial().

+

+ + + + +
+ + +
std::vector<std::string> NL3D::CAnimationSet::_SkeletonWeightName [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 226 of file animation_set.h. +

+Referenced by addSkeletonWeight(), getSkeletonWeightName(), reset(), and serial().

+

+ + + + +
+ + +
sint NLMISC::CRefCount::crefs [mutable, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 79 of file smart_ptr.h. +

+Referenced by NLMISC::CRefCount::CRefCount(), NLMISC::CRefCount::getRefCount(), and NLMISC::CRefCount::~CRefCount().

+

+ + + + +
+ + +
CRefCount::CPtrInfo NLMISC::CRefCount::NullPtrInfo [static, inherited] +
+
+ + + + + +
+   + + +

+ +

+Referenced by NLMISC::CRefCount::CRefCount().

+

+ + + + +
+ + +
CPtrInfo* NLMISC::CRefCount::pinfo [mutable, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 80 of file smart_ptr.h. +

+Referenced by NLMISC::CRefCount::CRefCount(), and NLMISC::CRefCount::~CRefCount().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 06:44:28 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1