#include <OMKMaterialAnimator.h>
Inheritance diagram for OMK::Vis::MaterialAnimator< 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 |
virtual void | undo (NodeMaterial *node) |
Protected Attributes | |
std::string | _materialName |
NodeMaterialOrig * | _node |
pointer to the node to animate | |
bool | _modified |
Private Member Functions | |
DECLARE_TEMPLATE_ANIMATOR_FACTORY (MaterialAnimator, Type) | |
virtual void | selfProcessVis (const Type &value) |
Called by the partner to process the visualisation. | |
void | doIt (bool activate) |
Animator { myMaterialAnimator { Class MaterialAnimator // or MaterialBoolAnimator NodeName Robot changeInitMaterial "initialMaterial" // Optional material "aMaterial" } }
The first type, MaterialBoolAnimator class, is a boolean:
visuOgre { Class OgreVis ... Extensions { ... materialWithString { Class KeyStringEmitterExtension Key E VisuName visuOgre EventName "materialWithString" Values ["TOGGLE"] Signal on } materialWithBool { Class KeyBoolEmitterExtension Key A VisuName visuOgre EventName "materialWithBool" Values [ON OFF] Signal on } ... } UserParams { OgreHome "${OGRE_HOME}" ... VisualObject { ... scene { Class OgreObjectScene ... Animator { materialWithString { Class MaterialAnimator NodeName FirstNODE material "first_material" ListenedEvent "materialWithString" } materialWithBool { Class MaterialBoolAnimator NodeName SecondNODE material "second_material" ListenedEvent "materialWithBool" } } } ... } } }
Definition at line 134 of file OMKMaterialAnimator.h.
OMK::Vis::MaterialAnimator< Type >::DECLARE_TEMPLATE_ANIMATOR_FACTORY | ( | MaterialAnimator< Type > | , | |
Type | ||||
) | [private] |
virtual void OMK::Vis::MaterialAnimator< 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 MaterialAnimator::doIt | ( | bool | activate | ) | [private] |
Definition at line 87 of file OMKMaterialAnimator.cpp.
References OMK::Vis::MaterialAnimator< Type >::_modified, OMK::Vis::MaterialAnimator< Type >::_node, OMK::Vis::NodeMaterialOrig::createCopyAndUpdateWith(), OMTRACEID, and OMK::Vis::NodeMaterialOrig::undoFor().
Referenced by OMK::Vis::MaterialAnimator< Type >::selfProcessVis().
00088 { 00089 OMTRACEID("OMK::MaterialAnimator"," modi " << _modified << " new " << activate ); 00090 if( activate != _modified ) 00091 { 00092 _modified = activate ; 00093 if( _modified ) 00094 { 00095 OMTRACEID("OMK::MaterialAnimator"," copy" ); 00096 _node->createCopyAndUpdateWith( this ) ; 00097 } 00098 else 00099 { 00100 OMTRACEID("OMK::MaterialAnimator"," UNDO " ); 00101 _node->undoFor( this, true ) ; 00102 } 00103 } 00104 }
void MaterialAnimator::update | ( | NodeMaterial * | node | ) | [protected, virtual] |
Implements OMK::Vis::IUpdateMaterial.
Definition at line 110 of file OMKMaterialAnimator.cpp.
References OMK::Vis::MaterialAnimator< Type >::_materialName, and OMK::Vis::NodeMaterial::doAction().
00111 { 00112 node->doAction( MaterialSetMaterialName( _materialName ) ) ; 00113 }
Ogre::String MaterialAnimator::getMaterialName | ( | const Ogre::String & | name | ) | const [protected, virtual] |
Reimplemented from OMK::Vis::IUpdateMaterial.
Definition at line 119 of file OMKMaterialAnimator.cpp.
References OMK::Vis::MaterialAnimator< Type >::_materialName.
00120 { 00121 return _materialName ; 00122 }
void MaterialAnimator::undo | ( | NodeMaterial * | node | ) | [protected, virtual] |
Reimplemented from OMK::Vis::IUpdateMaterial.
Definition at line 128 of file OMKMaterialAnimator.cpp.
void OMK::Vis::MaterialAnimator< OMK::Type::StringType >::selfProcessVis | ( | const OMK::Type::StringType & | value | ) |
Definition at line 143 of file OMKMaterialAnimator.cpp.
References OMK::Vis::MaterialAnimator< Type >::_modified, OMK::Vis::MaterialAnimator< Type >::doIt(), OMK::Type::SimpleTypeT< T >::getValue(), and OMTRACEID.
00144 { 00145 OMTRACEID("OMK::MaterialAnimator"," got " << value ); 00146 std::string str( value.getValue() ) ; 00147 std::transform( str.begin(), str.end(), str.begin(), toupper ) ; 00148 bool newModified = !_modified ; 00149 if( str == "ON" ) 00150 { 00151 newModified = true ; 00152 } 00153 else if( str == "OFF" ) 00154 { 00155 newModified = false ; 00156 } 00157 doIt( newModified ) ; 00158 }
void OMK::Vis::MaterialAnimator< OMK::Type::BoolType >::selfProcessVis | ( | const OMK::Type::BoolType & | value | ) |
Definition at line 161 of file OMKMaterialAnimator.cpp.
References OMK::Vis::MaterialAnimator< Type >::doIt(), OMK::Type::SimpleTypeT< T >::getValue(), and OMTRACEID.
00162 { 00163 OMTRACEID("OMK::MaterialAnimator"," got " << value ); 00164 doIt( value.getValue() ) ; 00165 }
std::string OMK::Vis::MaterialAnimator< Type >::_materialName [protected] |
Definition at line 147 of file OMKMaterialAnimator.h.
Referenced by OMK::Vis::MaterialAnimator< Type >::getMaterialName(), and OMK::Vis::MaterialAnimator< Type >::update().
NodeMaterialOrig* OMK::Vis::MaterialAnimator< Type >::_node [protected] |
pointer to the node to animate
Reimplemented from OMK::Vis::OgreAnimatorCommon.
Definition at line 148 of file OMKMaterialAnimator.h.
Referenced by OMK::Vis::MaterialAnimator< Type >::doIt().
bool OMK::Vis::MaterialAnimator< Type >::_modified [protected] |
Definition at line 149 of file OMKMaterialAnimator.h.
Referenced by OMK::Vis::MaterialAnimator< Type >::doIt(), and OMK::Vis::MaterialAnimator< Type >::selfProcessVis().
Documentation generated on Mon Jun 9 11:46:05 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |