Emergency 2017 Dokumentation  v3.0.1
qsf::game::CharacterAnimationComponent Class Reference

Character controller component class. More...

#include <CharacterAnimationComponent.h>

Public Member Functions

 CharacterAnimationComponent (Prototype *prototype)
 Constructor. More...
 
virtual ~CharacterAnimationComponent ()
 Destructor. More...
 
void forceUpdate ()
 Forces an update to the animation. No blending is used. More...
 
void forceUpdateWithBlending ()
 
const std::string & getAnimationSetName () const
 Return the name of the character animation set asset to use. More...
 
void setAnimationSetNameByName (const std::string &animationSetName)
 Set the name of the character animation set asset to use. More...
 
const std::vector< CharacterAnimationSet::AnimationData > & getAnimations () const
 Return the current configuration, i.e. the animations defined. More...
 
void clearAnimations ()
 Clear the list of animation definitions. More...
 
void reloadAnimationSet ()
 Reloads the list of animations from the animation set. More...
 
CharacterAnimationSet::AnimationDataaddAnimation (const AssetProxy &skeleton, float minimumSpeed, float defaultSpeed=0.0f, Time blendTime=Time::fromSeconds(0.4f))
 Add a new animation definition. More...
 
CharacterAnimationSet::AnimationDataaccessAnimation (uint32 index)
 Access an animation definition for reading or writing. More...
 
virtual void serialize (qsf::BinarySerializer &serializer) override
 Serialize or deserialize the component using a binary serializer. More...
 
- Public Member Functions inherited from qsf::Component
virtual ~Component ()
 Destructor. More...
 
PrototypegetPrototype () const
 Return the prototype this component is in. More...
 
EntitygetEntity () const
 Return a reference to the entity this component is in. More...
 
uint32 getId () const
 Return the unique component identifier. More...
 
ComponentManagergetComponentManager () const
 Return the component manager that's responsible for this component instance. More...
 
ComponentCollectiongetComponentCollection () const
 Return the component collection that's responsible for this component instance. More...
 
bool isSimulating () const
 Return whether or not the component is in simulating mode. More...
 
bool isActive () const
 Return whether or not the component is considered to be active. More...
 
void setActive (bool active)
 Set whether or not the component is considered to be active. More...
 
bool isDebug () const
 Return whether or not the component is considered to be in debug mode. More...
 
bool isHidden () const
 Return whether or not the component is hidden. More...
 
void setHidden (bool hidden)
 Set whether or not the component is hidden. More...
 
bool isGloballyHidden () const
 Return whether or not the component is globally hidden. More...
 
void setGloballyHidden (bool globallyHidden)
 Set whether or not the component is globally hidden. More...
 
bool isReallyHidden () const
 Return whether or not the component is really hidden. More...
 
bool startup ()
 Startup the component. More...
 
bool isRunning () const
 Return whether or not the component is up-and-running. More...
 
void shutdown ()
 Shutdown the component. More...
 
uint64 getPrototypeId () const
 Return the ID of the prototype this component is in. More...
 
uint64 getEntityId () const
 Return the ID of the entity this component is in. More...
 
virtual void onInvalidation ()
 Invalidate the component. More...
 
virtual void setDebug (bool debugMode)
 Set whether or not the component is considered to be in debug mode. More...
 
- Public Member Functions inherited from qsf::InheritedObject
void copyPropertyOverrideStateFrom (const InheritedObject &object, bool add=false)
 
void setAllPropertyOverrideFlags (bool value)
 
void autoCreatePropertyOverrideState ()
 
virtual camp::Value getPropertyDefaultValue (const StringHash &propertyId) const override
 
virtual PropertyOverrideState getPropertyOverrideState (const StringHash &propertyId) const override
 
virtual bool setPropertyOverrideState (const StringHash &propertyId, PropertyOverrideState overrideState) override
 
- Public Member Functions inherited from qsf::Object
virtual ~Object ()
 Destructor. More...
 
const camp::Class & getCampClass () const
 Return the CAMP class. More...
 
int getPropertyIndexById (const StringHash &propertyId) const
 Return the CAMP property index by using the unique class property ID. More...
 
uint32 getPropertyIdByIndex (int index) const
 Return the unique class property ID with the given index. More...
 
std::string getPropertyNameById (const StringHash &propertyId) const
 Return the CAMP property name by using the unique class property ID. More...
 
const camp::Property * getCampPropertyById (const StringHash &propertyId) const
 Return the CAMP property by using the unique class property ID. More...
 
void setPropertyValuesByString (const std::string &values)
 Set CAMP reflection property values by using a given string. More...
 
void setPropertiesToDefaultValues ()
 Set all CAMP reflection system properties to their default values. More...
 
void serializeToBoostPTree (boost::property_tree::ptree &pTree, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
void serializeToBoostPTree (boost::property_tree::ptree &pTree, const camp::Class &campClass, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
bool deserializeFromBoostPTree (const boost::property_tree::ptree &pTree, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL)
 
bool deserializeFromBoostPTree (const boost::property_tree::ptree &pTree, const camp::Class &campClass, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL)
 
void serializeToBinarySerializer (BinarySerializer &serializer, SerializationMode mode=MODE_MINIMAL, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
void deserializeFromBinarySerializer (BinarySerializer &serializer, SerializationMode mode=MODE_MINIMAL, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL, bool setOverrideState=true)
 
virtual void onPreDeserialize ()
 Called right before the object is deserialized using any of the above methods. Default implementation is empty. More...
 
virtual void onPostDeserialize ()
 Called right after the object was deserialized using any of the above methods. Default implementation is empty. More...
 
virtual ScriptgetAssociatedScript () const
 Return the script instance associated with this object instance. More...
 
- Public Member Functions inherited from qsf::JobProxyMovableObjectRenderingListener
 JobProxyMovableObjectRenderingListener ()
 Constructor. More...
 
virtual ~JobProxyMovableObjectRenderingListener ()
 Destructor. More...
 
const TimegetNonvisibleUpdateTimeout () const
 Return the nonvisible update timeout. More...
 
void setNonvisibleUpdateTimeout (const Time &nonvisibleUpdateTimeout)
 Set the nonvisible update timeout. More...
 
- Public Member Functions inherited from qsf::MovableObjectRenderingListener
 MovableObjectRenderingListener ()
 Constructor. More...
 
virtual ~MovableObjectRenderingListener ()
 Destructor. More...
 
bool isMovableObjectRenderingListenerRegistered () const
 Return whether or not the movable object rendering listener is registered. More...
 
State getState () const
 Return the state of the listener. More...
 

Static Public Attributes

static const uint32 COMPONENT_ID
 "qsf::game::CharacterAnimationComponent" unique component ID More...
 
- Static Public Attributes inherited from qsf::Component
static const uint32 COMPONENT_ID
 "qsf::Component" unique component ID More...
 

Protected Member Functions

virtual void onUpdate (const JobArguments &jobArguments)
 
virtual float getCurrentSpeed ()
 
virtual bool onStartup () override
 Startup the component. More...
 
virtual void onSetActive (bool active) override
 Set whether or not the component is considered to be active. More...
 
virtual void onSetSimulating (bool simulating) override
 Set whether or not the component is in simulating mode. More...
 
virtual void onObjectRenderingStartup () override
 Called when an OGRE movable object is about to be rendered for the first time after it has not been rendered for some time. More...
 
virtual void onObjectRenderingShutdown () override
 Called when an OGRE movable object is no longer be rendered for some time. More...
 
- Protected Member Functions inherited from qsf::Component
 Component (Prototype *prototype)
 Constructor. More...
 
void promotePropertyChange (uint32 propertyId)
 A component property value was changed. More...
 
template<typename T , typename S >
bool assignAndPromoteChange (T &variable, const S &newValue, uint32 propertyId)
 Comfort function for updating an exported member variable and promoting any change that happened. More...
 
void setRegisterForSimulationTransformChanges (bool enable)
 Register or unregister this component as simulation transform listener. More...
 
void setRegisterForAnimationTransformChanges (bool enable)
 Register or unregister this component as animation transform listener. More...
 
virtual const ObjectgetPropertyDefaultsProvider () const override
 
virtual bool implementsOnComponentPropertyChange () const
 Signal whether this component needs the "onComponentPropertyChange" callback at all. More...
 
virtual void onComponentPropertyChange (const Component &component, uint32 propertyId)
 Called in case a component property value was changed. More...
 
virtual void onComponentTransformChange (const Transform &transform, TransformChangeFlags flags)
 Called in case a component transformation value was changed. More...
 
virtual void onSetDebug (bool debug)
 Set whether or not the component is considered to be in debug mode. More...
 
virtual void onSetHidden (bool hidden)
 Set whether or not the component is considered to be hidden. More...
 
virtual void onShutdown ()
 Shutdown the component. More...
 
- Protected Member Functions inherited from qsf::InheritedObject
 InheritedObject ()
 Default constructor. More...
 
- Protected Member Functions inherited from qsf::Object
 Object ()
 Default constructor. More...
 
- Protected Member Functions inherited from qsf::WeakPtrTarget
 WeakPtrTarget ()
 Default constructor. More...
 
 WeakPtrTarget (const WeakPtrTarget &other)
 Copy constructor. More...
 
 WeakPtrTarget (WeakPtrTarget &&)=delete
 Delete the move constructor, as WeakPtrTarget would need a proper move constructor-implementation that ensures that its pointer gets updated in the WeakPtrBase as well. More...
 
 ~WeakPtrTarget ()
 Destructor. More...
 
void invalidateAllWeakPtr ()
 Invalidate all weak pointers to this object. More...
 
void operator= (const WeakPtrTarget &other)
 Copy operator. More...
 
- Protected Member Functions inherited from qsf::JobProxyMovableObjectRenderingListener
virtual void onUpdateMovableObjectRenderingJob (const JobArguments &jobArguments)
 Main update function that is passed to the job manager. More...
 
virtual void onObjectRendering (const Component &component, const Ogre::Camera &ogreCamera) override
 Called when an OGRE movable object of the camera to be used for rendering. More...
 
- Protected Member Functions inherited from qsf::MovableObjectRenderingListener
virtual ComponentgetMovableObjectRenderingListenerComponent ()
 Return the component the listener will spy on. More...
 
virtual void registerMovableObjectRenderingListener ()
 Register movable object rendering listener. More...
 
virtual void unregisterMovableObjectRenderingListener ()
 Unregister movable object rendering listener. More...
 
virtual void onObjectDestroyed ()
 Movable object has been destroyed. More...
 

Additional Inherited Members

- Public Types inherited from qsf::Component
enum  TransformChangeFlag {
  TRANSFORM_CHANGE_POSITION = 0x01, TRANSFORM_CHANGE_ROTATION = 0x02, TRANSFORM_CHANGE_SCALE = 0x04, TRANSFORM_CHANGE_TRANSFORM = 0x07,
  TRANSFORM_CHANGE_FOR_SIMULATION = 0x08, TRANSFORM_CHANGE_FOR_ANIMATION = 0x10
}
 
typedef BitFlagSet< uint8, TransformChangeFlagTransformChangeFlags
 
- Public Types inherited from qsf::Object
enum  PropertyOverrideState { PROPERTY_INVALID, PROPERTY_DEFAULT, PROPERTY_OVERRIDE, PROPERTY_REMOVED }
 
enum  SerializationMethod { SERIALIZE_FLAT, SERIALIZE_COMPLETE, SERIALIZE_DIFFERENTIAL, SERIALIZE_IGNORE_UNKNOWN }
 
enum  SerializationMode { MODE_MINIMAL, MODE_COMPATIBLE }
 
- Public Types inherited from qsf::MovableObjectRenderingListener
enum  State { SLEEPING, AWAKE }
 State of the listener. More...
 
- Protected Attributes inherited from qsf::InheritedObject
std::bitset< 128 > mPropertyOverrideFlags
 One bit for each property; if set, the property is overridden. More...
 
- Protected Attributes inherited from qsf::JobProxyMovableObjectRenderingListener
JobProxy mAnimationJobProxy
 Regular animation job proxy; for updates once a frame. More...
 
- Protected Attributes inherited from qsf::MovableObjectRenderingListener
bool mAllowRegistration = true
 

Detailed Description

Character controller component class.

Remarks
This component assigns animations to characters depending on their current movement speed (see "qsf::MovableComponent"). Feed it with animation definitions that setup animations for standing and different move speeds. Each animation definition holds a minimum speed required for this animation to be considered at all. From all those, the one with the highest minimum speed gets chosen.
Todo:
  • TODO(fw): There is currently no support for masked animations

Definition at line 59 of file CharacterAnimationComponent.h.

Constructor & Destructor Documentation

qsf::game::CharacterAnimationComponent::CharacterAnimationComponent ( Prototype prototype)
explicit

Constructor.

Parameters
[in]prototypeThe prototype this component is in, no null pointer allowed
virtual qsf::game::CharacterAnimationComponent::~CharacterAnimationComponent ( )
virtual

Destructor.

Member Function Documentation

CharacterAnimationSet::AnimationData& qsf::game::CharacterAnimationComponent::accessAnimation ( uint32  index)

Access an animation definition for reading or writing.

Returns
The animation definition
Note
  • Throws an exception in case the index is not valid
CharacterAnimationSet::AnimationData& qsf::game::CharacterAnimationComponent::addAnimation ( const AssetProxy skeleton,
float  minimumSpeed,
float  defaultSpeed = 0.0f,
Time  blendTime = Time::fromSeconds(0.4f) 
)

Add a new animation definition.

Parameters
[in]skeletonThe skeleton asset to use as animation
[in]minimumSpeedMinimum character move speed for this animation to be used
[in]defaultSpeedCharacter move speed at which the animation should use normal playback speed
[in]blendTimeTime to blend into this animation
Returns
The newly created animation definition
void qsf::game::CharacterAnimationComponent::clearAnimations ( )

Clear the list of animation definitions.

void qsf::game::CharacterAnimationComponent::forceUpdate ( )

Forces an update to the animation. No blending is used.

void qsf::game::CharacterAnimationComponent::forceUpdateWithBlending ( )
const std::vector<CharacterAnimationSet::AnimationData>& qsf::game::CharacterAnimationComponent::getAnimations ( ) const

Return the current configuration, i.e. the animations defined.

Returns
The list of animation definitions
const std::string& qsf::game::CharacterAnimationComponent::getAnimationSetName ( ) const

Return the name of the character animation set asset to use.

Note
  • Connected to the CAMP reflection system
virtual float qsf::game::CharacterAnimationComponent::getCurrentSpeed ( )
protectedvirtual
virtual void qsf::game::CharacterAnimationComponent::onObjectRenderingShutdown ( )
overrideprotectedvirtual

Called when an OGRE movable object is no longer be rendered for some time.

Note
  • The default implementation is sets the listener state to sleeping
  • Automatically called in case the listener is unregistered while not sleeping, derived listeners with additional logic might e.g. call this method in case the object has not been visible for a certain amount of time

Reimplemented from qsf::JobProxyMovableObjectRenderingListener.

virtual void qsf::game::CharacterAnimationComponent::onObjectRenderingStartup ( )
overrideprotectedvirtual

Called when an OGRE movable object is about to be rendered for the first time after it has not been rendered for some time.

Note
  • The default implementation is empty

Reimplemented from qsf::JobProxyMovableObjectRenderingListener.

virtual void qsf::game::CharacterAnimationComponent::onSetActive ( bool  active)
overrideprotectedvirtual

Set whether or not the component is considered to be active.

Parameters
[in]active"true" if the component is considered to be active, else "false"
Note
  • The default implementation is empty
  • This method is only called in case there's a real state change
  • This method is also called in case the component is currently not running
See also
  • "qsf::Component::setActive()"

Reimplemented from qsf::Component.

virtual void qsf::game::CharacterAnimationComponent::onSetSimulating ( bool  simulating)
overrideprotectedvirtual

Set whether or not the component is in simulating mode.

Parameters
[in]active"true" if the component is in simulating mode, else "false"
Note
  • The default implementation is empty
  • This method is only called in case there's a real state change
  • In contrast to internal flags (e.g. Active, Debug), the simulating mode state can only be changed globally for a whole map
  • On component shutdown and simulating enabled, "onSetSimulating()" is automatically called with "false" before calling "onShutdown()"

Reimplemented from qsf::Component.

virtual bool qsf::game::CharacterAnimationComponent::onStartup ( )
overrideprotectedvirtual

Startup the component.

Returns
"true" if all went fine, else "false"
Note
  • The default implementation is empty
  • Only components which are part of entities (concrete prototype instances) get started
  • When this method gets called, the properties might still be on default values but it's also possible that properties already have customized values. Take this into account when implementing your method.

Reimplemented from qsf::Component.

virtual void qsf::game::CharacterAnimationComponent::onUpdate ( const JobArguments jobArguments)
protectedvirtual
void qsf::game::CharacterAnimationComponent::reloadAnimationSet ( )

Reloads the list of animations from the animation set.

virtual void qsf::game::CharacterAnimationComponent::serialize ( qsf::BinarySerializer serializer)
overridevirtual

Serialize or deserialize the component using a binary serializer.

Parameters
[in]serializerThe serializer, which can be either in read or write mode

Reimplemented from qsf::Component.

void qsf::game::CharacterAnimationComponent::setAnimationSetNameByName ( const std::string &  animationSetName)

Set the name of the character animation set asset to use.

Note
  • Connected to the CAMP reflection system

Member Data Documentation

const uint32 qsf::game::CharacterAnimationComponent::COMPONENT_ID
static

"qsf::game::CharacterAnimationComponent" unique component ID

Definition at line 67 of file CharacterAnimationComponent.h.


The documentation for this class was generated from the following file: