#include <OMKAwarenessAnimator.h>
Inheritance diagram for OMK::Vis::AwarenessAnimator< Type >:
Public Member Functions | |
template<> | |
void | selfProcessVis (const OMK::Type::StringType &value) |
template<> | |
void | selfProcessVis (const OMK::Type::BoolType &value) |
Protected Member Functions | |
virtual void | update (NodeMaterial *node) |
virtual Ogre::String | getMaterialName (const Ogre::String &name) const |
Protected Attributes | |
NodeMaterialOrig * | _node |
pointer to the node to animate | |
bool | _awareness |
Ogre::Vector4 | _color |
Private Member Functions | |
DECLARE_TEMPLATE_ANIMATOR_FACTORY (AwarenessAnimator, Type) | |
virtual void | selfProcessVis (const Type &value) |
Called by the partner to process the visualisation. | |
void | doIt (bool awareness) |
//Note that example value is the default value... Animator { myAwarenessAnimator { Class AwarenessAnimator NodeName Robot ListenedEvent awareness AwarenessColor [1.0 1.0 0.0 0.6] // Optional, Yellow is the default Color }
The first type, MaterialBoolAnimator class, is a boolean:
visuOgre { Class OgreVis ... Extensions { ... awarenessWithString { Class KeyStringEmitterExtension Key E VisuName visuOgre EventName "awarenessWithString" Values ["TOGGLE"] Signal on } awarenessWithBool { Class KeyBoolEmitterExtension Key A VisuName visuOgre EventName "awarenessWithBool" Values [ON OFF] Signal on } ... } UserParams { OgreHome "${OGRE_HOME}" ... VisualObject { ... scene { Class OgreObjectScene ... Animator { awarenessWithString { Class AwarenessAnimator NodeName FirstNODE AwarenessColor [0.0 1.0 1.0 0.6] ListenedEvent "awarenessWithString" } awarenessWithBool { Class AwarenessBoolAnimator NodeName SecondNODE AwarenessColor [1.0 0.0 1.0 0.6] ListenedEvent "awarenessWithBool" } } } ... } } }
Definition at line 135 of file OMKAwarenessAnimator.h.
OMK::Vis::AwarenessAnimator< Type >::DECLARE_TEMPLATE_ANIMATOR_FACTORY | ( | AwarenessAnimator< Type > | , | |
Type | ||||
) | [private] |
virtual void OMK::Vis::AwarenessAnimator< Type >::selfProcessVis | ( | const Type & | value | ) | [private, virtual] |
Called by the partner to process the visualisation.
Called by the public version if the value was changed. Must be overwrite by sons.
Implements OMK::Vis::AnimatorT< Type >.
void AwarenessAnimator::doIt | ( | bool | awareness | ) | [private] |
Definition at line 91 of file OMKAwarenessAnimator.cpp.
References OMK::Vis::AwarenessAnimator< Type >::_awareness, OMK::Vis::AwarenessAnimator< Type >::_node, OMK::Vis::NodeMaterialOrig::createCopyAndUpdateWith(), and OMK::Vis::NodeMaterialOrig::undoFor().
Referenced by OMK::Vis::AwarenessAnimator< Type >::selfProcessVis().
00092 { 00093 if( awareness != _awareness ) 00094 { 00095 _awareness = awareness ; 00096 if( _awareness ) 00097 { 00098 _node->createCopyAndUpdateWith( this ) ; 00099 } 00100 else 00101 { 00102 _node->undoFor( this, true ) ; 00103 } 00104 } 00105 }
void AwarenessAnimator::update | ( | NodeMaterial * | node | ) | [protected, virtual] |
Implements OMK::Vis::IUpdateMaterial.
Definition at line 111 of file OMKAwarenessAnimator.cpp.
References OMK::Vis::AwarenessAnimator< Type >::_awareness, OMK::Vis::AwarenessAnimator< Type >::_color, OMK::Vis::NodeMaterial::doAction(), and OMASSERTM.
00112 { 00113 OMASSERTM( _awareness, "The awareness should be set to true" ) ; 00114 node->doAction( MaterialSetAwareness( _color ) ) ; 00115 }
Ogre::String AwarenessAnimator::getMaterialName | ( | const Ogre::String & | name | ) | const [protected, virtual] |
Reimplemented from OMK::Vis::IUpdateMaterial.
Definition at line 121 of file OMKAwarenessAnimator.cpp.
References OMK::Vis::AwarenessAnimator< Type >::_awareness, and OMK::Vis::IUpdateMaterial::getUniqueMaterialName().
00122 { 00123 return getUniqueMaterialName(name + "_Awareness" + ( _awareness ? "1" : "0" )) ; 00124 }
void OMK::Vis::AwarenessAnimator< OMK::Type::StringType >::selfProcessVis | ( | const OMK::Type::StringType & | value | ) |
Definition at line 134 of file OMKAwarenessAnimator.cpp.
References OMK::Vis::AwarenessAnimator< Type >::_awareness, OMK::Vis::AwarenessAnimator< Type >::doIt(), OMK::Type::SimpleTypeT< T >::getValue(), and OMTRACEID.
00135 { 00136 00137 OMTRACEID("OMK::AwarenessAnimator"," got " << value ); 00138 //ON/OFF now 00139 std::string str( value.getValue() ) ; 00140 std::transform( str.begin(), str.end(), str.begin(), toupper ) ; 00141 bool newAwareness = !_awareness ; 00142 if( str == "ON" ) 00143 { 00144 newAwareness = true ; 00145 } 00146 else if( str == "OFF" ) 00147 { 00148 newAwareness = false ; 00149 } 00150 doIt( newAwareness ) ; 00151 }
void OMK::Vis::AwarenessAnimator< OMK::Type::BoolType >::selfProcessVis | ( | const OMK::Type::BoolType & | value | ) |
Definition at line 154 of file OMKAwarenessAnimator.cpp.
References OMK::Vis::AwarenessAnimator< Type >::doIt(), and OMK::Type::SimpleTypeT< T >::getValue().
NodeMaterialOrig* OMK::Vis::AwarenessAnimator< Type >::_node [protected] |
pointer to the node to animate
Reimplemented from OMK::Vis::OgreAnimatorCommon.
Definition at line 149 of file OMKAwarenessAnimator.h.
Referenced by OMK::Vis::AwarenessAnimator< Type >::doIt().
bool OMK::Vis::AwarenessAnimator< Type >::_awareness [protected] |
Definition at line 150 of file OMKAwarenessAnimator.h.
Referenced by OMK::Vis::AwarenessAnimator< Type >::doIt(), OMK::Vis::AwarenessAnimator< Type >::getMaterialName(), OMK::Vis::AwarenessAnimator< Type >::selfProcessVis(), and OMK::Vis::AwarenessAnimator< Type >::update().
Ogre::Vector4 OMK::Vis::AwarenessAnimator< Type >::_color [protected] |
Definition at line 151 of file OMKAwarenessAnimator.h.
Referenced by OMK::Vis::AwarenessAnimator< Type >::update().
Documentation generated on Mon Jun 9 11:46:05 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |