NL3D::CAnimationSetUser Class Reference

#include <animation_set_user.h>

Inheritance diagram for NL3D::CAnimationSetUser:

NL3D::UAnimationSet

Detailed Description

UAnimationSet implementation
Author:
Lionel Berenguier

Nevrax France

Date:
2001

Definition at line 55 of file animation_set_user.h.

Public Types

enum  { NotFound = 0xffffffff }

Public Member Functions

uint addAnimation (const char *fileName, const char *animName)
virtual uint addSkeletonWeight (const char *fileName, const char *skelName)
virtual void build ()
 CAnimationSetUser (NLMISC::IStream &f)
 Constructor.

 CAnimationSetUser ()
 Constructor.

const CAnimationSetgetAnimationSet () const
Animations mgt.
virtual UAnimationgetAnimation (uint animationId)
virtual uint getAnimationIdByName (const std::string &name) const
virtual const std::string & getAnimationName (uint animationId) const
virtual uint getNumAnimation () const
Channel mgt.
virtual uint getChannelIdByName (const std::string &name) const
SkeletonWeight mgt.
virtual uint getNumSkeletonWeight () const
virtual uint getSkeletonWeightIdByName (const std::string &name) const
virtual const std::string & getSkeletonWeightName (uint skeletonId) const

Private Attributes

NLMISC::CSmartPtr< CAnimationSet_AnimationSet

Friends

class CPlayListManagerUser
class CSceneUser


Member Enumeration Documentation

anonymous enum [inherited]
 

Enumeration values:
NotFound 

Definition at line 56 of file u_animation_set.h.

00056 { NotFound=0xffffffff };


Constructor & Destructor Documentation

NL3D::CAnimationSetUser::CAnimationSetUser  )  [inline]
 

Constructor.

Definition at line 65 of file animation_set_user.h.

References _AnimationSet, NL3D_MEM_ANIMATION_SET, nlassert, and uint.

00066         {
00067                 NL3D_MEM_ANIMATION_SET
00068 
00069                 nlassert((uint)UAnimationSet::NotFound == (uint)CAnimationSet::NotFound );
00070 
00071                 // create a smartptred animation set.
00072                 _AnimationSet= new CAnimationSet;
00073         }

NL3D::CAnimationSetUser::CAnimationSetUser NLMISC::IStream f  )  [inline]
 

Constructor.

Definition at line 76 of file animation_set_user.h.

References _AnimationSet, NL3D_MEM_ANIMATION_SET, nlassert, and uint.

00077         {
00078                 NL3D_MEM_ANIMATION_SET
00079 
00080                 nlassert((uint)UAnimationSet::NotFound == (uint)CAnimationSet::NotFound );
00081 
00082                 // create a smartptred animation set.
00083                 _AnimationSet= new CAnimationSet;
00084 
00085                 _AnimationSet->serial(f);
00086         }


Member Function Documentation

uint NL3D::CAnimationSetUser::addAnimation const char *  fileName,
const char *  animName
[inline, virtual]
 

Add an animation in the animation set. After adding all your animations, call build().

Parameters:
fileName is the animation filename
animName is the name of the animation in the animation set.
Returns:
NotFound if the file is not found.

Implements NL3D::UAnimationSet.

Definition at line 95 of file animation_set_user.h.

References _AnimationSet, file, NLMISC::CPath::lookup(), NL3D_MEM_ANIMATION_SET, and uint.

00096         {
00097                 NL3D_MEM_ANIMATION_SET
00098 
00099                 // Allocate an animation
00100                 std::auto_ptr<CAnimation> anim (new CAnimation);
00101 
00102                 // Read it
00103                 NLMISC::CIFile file;
00104                 std::string path = NLMISC::CPath::lookup (fileName, false, true);
00105                 if (path.empty())
00106                         path = fileName;
00107                 if ( file.open ( path ) )
00108                 {
00109                         // Serial the animation
00110                         file.serial (*anim);
00111 
00112                         // Add the animation
00113                         uint id=_AnimationSet->addAnimation (animName, anim.release());
00114 
00115                         // Return id
00116                         return id;
00117                 }
00118                 else return UAnimationSet::NotFound;
00119         }

virtual uint NL3D::CAnimationSetUser::addSkeletonWeight const char *  fileName,
const char *  skelName
[inline, virtual]
 

Add a skeleton weight in the animation set. This method use CPath to search the skeleton file.

Parameters:
fileName is the skeleton weight filename
animName is the name of the skeleton weight in the animation set.
Returns:
the id of the new skeleton or NotFound if the file is not found.

Implements NL3D::UAnimationSet.

Definition at line 139 of file animation_set_user.h.

References _AnimationSet, file, NL3D_MEM_ANIMATION_SET, and uint.

00140         {
00141                 NL3D_MEM_ANIMATION_SET
00142 
00143                 // Allocate an animation
00144                 std::auto_ptr<CSkeletonWeight> skeletonWeight (new CSkeletonWeight);
00145 
00146                 // Read it
00147                 NLMISC::CIFile file;
00148                 if (file.open ( NLMISC::CPath::lookup( fileName ) ) )
00149                 {
00150                         // Serial the animation
00151                         file.serial (*skeletonWeight);
00152 
00153                         // Add the animation
00154                         uint id=_AnimationSet->addSkeletonWeight (skelName, skeletonWeight.release());
00155 
00156                         // Return id
00157                         return id;
00158                 }
00159                 else return UAnimationSet::NotFound;
00160         }

virtual void NL3D::CAnimationSetUser::build  )  [inline, virtual]
 

Build the animation set. Call build after adding all your animations.

Implements NL3D::UAnimationSet.

Definition at line 124 of file animation_set_user.h.

References _AnimationSet, and NL3D_MEM_ANIMATION_SET.

00125         {
00126                 NL3D_MEM_ANIMATION_SET
00127 
00128                 _AnimationSet->build ();
00129         }

UAnimation * NL3D::CAnimationSetUser::getAnimation uint  animationId  )  [virtual]
 

Get a writable animation pointer.

Returns:
the end time.

Implements NL3D::UAnimationSet.

Definition at line 36 of file animation_set_user.cpp.

References _AnimationSet, NL3D_MEM_ANIMATION_SET, and uint.

00037 {
00038         NL3D_MEM_ANIMATION_SET
00039 
00040         return _AnimationSet->getAnimation (animationId);
00041 }

virtual uint NL3D::CAnimationSetUser::getAnimationIdByName const std::string &  name  )  const [inline, virtual]
 

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

Implements NL3D::UAnimationSet.

Definition at line 177 of file animation_set_user.h.

References _AnimationSet, NL3D_MEM_ANIMATION_SET, and uint.

00178         {
00179                 NL3D_MEM_ANIMATION_SET
00180 
00181                 return _AnimationSet->getAnimationIdByName(name);
00182         }

virtual const std::string& NL3D::CAnimationSetUser::getAnimationName uint  animationId  )  const [inline, virtual]
 

Get animation name.

Implements NL3D::UAnimationSet.

Definition at line 187 of file animation_set_user.h.

References _AnimationSet, getNumAnimation(), NL3D_MEM_ANIMATION_SET, nlerror, and uint.

00188         {
00189                 NL3D_MEM_ANIMATION_SET
00190 
00191                 if(animationId>=getNumAnimation())
00192                         nlerror("getAnimation*(): bad animation Id");
00193                 return _AnimationSet->getAnimationName(animationId);
00194         }

const CAnimationSet * NL3D::CAnimationSetUser::getAnimationSet  )  const
 

Definition at line 45 of file animation_set_user.cpp.

References _AnimationSet, and NL3D_MEM_ANIMATION_SET.

Referenced by NL3D::H_AUTO_DECL().

00046 {
00047         NL3D_MEM_ANIMATION_SET
00048 
00049         return _AnimationSet;
00050 }

virtual uint NL3D::CAnimationSetUser::getChannelIdByName const std::string &  name  )  const [inline, virtual]
 

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

Implements NL3D::UAnimationSet.

Definition at line 246 of file animation_set_user.h.

References _AnimationSet, NL3D_MEM_ANIMATION_SET, and uint.

00247         {
00248                 NL3D_MEM_ANIMATION_SET
00249 
00250                 return _AnimationSet->getChannelIdByName(name);
00251         }

virtual uint NL3D::CAnimationSetUser::getNumAnimation  )  const [inline, virtual]
 

Get animations count.

Implements NL3D::UAnimationSet.

Definition at line 167 of file animation_set_user.h.

References _AnimationSet, NL3D_MEM_ANIMATION_SET, and uint.

Referenced by getAnimationName().

00168         {
00169                 NL3D_MEM_ANIMATION_SET
00170 
00171                 return _AnimationSet->getNumAnimation();
00172         }

virtual uint NL3D::CAnimationSetUser::getNumSkeletonWeight  )  const [inline, virtual]
 

Get skeleton weight count.

Implements NL3D::UAnimationSet.

Definition at line 211 of file animation_set_user.h.

References _AnimationSet, NL3D_MEM_ANIMATION_SET, and uint.

Referenced by getSkeletonWeightName().

00212         {
00213                 NL3D_MEM_ANIMATION_SET
00214 
00215                 return _AnimationSet->getNumSkeletonWeight();
00216         }

virtual uint NL3D::CAnimationSetUser::getSkeletonWeightIdByName const std::string &  name  )  const [inline, virtual]
 

Get a SkeletonWeight ID by name. If no SkeletonWeight is found, method returns NotFound.

Implements NL3D::UAnimationSet.

Definition at line 221 of file animation_set_user.h.

References _AnimationSet, NL3D_MEM_ANIMATION_SET, and uint.

00222         {
00223                 NL3D_MEM_ANIMATION_SET
00224 
00225                 return _AnimationSet->getSkeletonWeightIdByName(name);
00226         }

virtual const std::string& NL3D::CAnimationSetUser::getSkeletonWeightName uint  skeletonId  )  const [inline, virtual]
 

Get skeleton template name.

Implements NL3D::UAnimationSet.

Definition at line 231 of file animation_set_user.h.

References _AnimationSet, getNumSkeletonWeight(), NL3D_MEM_ANIMATION_SET, nlerror, and uint.

00232         {
00233                 NL3D_MEM_ANIMATION_SET
00234 
00235                 if(skeletonId>=getNumSkeletonWeight())
00236                         nlerror("getSkeletonWeight*(): bad SkeletonWeight Id");
00237                 return _AnimationSet->getSkeletonWeightName(skeletonId);
00238         }


Friends And Related Function Documentation

friend class CPlayListManagerUser [friend]
 

Definition at line 59 of file animation_set_user.h.

friend class CSceneUser [friend]
 

Definition at line 60 of file animation_set_user.h.


Field Documentation

NLMISC::CSmartPtr<CAnimationSet> NL3D::CAnimationSetUser::_AnimationSet [private]
 

Definition at line 58 of file animation_set_user.h.

Referenced by addAnimation(), addSkeletonWeight(), build(), CAnimationSetUser(), getAnimation(), getAnimationIdByName(), getAnimationName(), getAnimationSet(), getChannelIdByName(), getNumAnimation(), getNumSkeletonWeight(), getSkeletonWeightIdByName(), getSkeletonWeightName(), and NL3D::CSceneUser::setAutomaticAnimationSet().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 06:44:29 2004 for NeL by doxygen 1.3.6