Source_Connector.inl
Go to the documentation of this file.
1 namespace iv
2 {
3 
4 template< class T >
5 Source_Connector< T >::Source_Connector( Instance * inst, T const & default_value, AnimNode< T > * child, Attr< T > * source ) :
6  Field< T >( inst ),
7  cm( inst, this, "Source_Connector" ),
8  inst( inst ),
9  child( child ),
10  default_value( default_value )
11 {
12  this->cm.inherits( this->Field< T >::cm );
13 
14  if( source )
15  this->Assign_Attribute_R( source );
16 }
17 
18 template< class T >
20 {
21  return this->inst;
22 }
23 
24 template< class T >
26 {
27  this->child = child;
28  this->OnChanged();
29 }
30 
31 template< class T >
32 void Source_Connector< T >::OnChanged( bool real )
33 {
34  if( this->child )
35  {
36  auto mode = this->Field< T >::Mode();
37 
38  if( mode == Attribute::ValueMode::Disabled )
39  {
40  this->cm.log( SRC_INFO, iv::Defs::Log::Animation_Events, "Target ", this->default_value, " (default value)." );
41  this->child->Target( this->default_value );
42  }
43  else
44  {
45  this->cm.log( SRC_INFO, iv::Defs::Log::Animation_Events, "Target ", this->Field< T >::Get(), "." );
46  this->child->Target( this->Field< T >::Get() );
47  }
48  }
49 }
50 
51 }