Transform_ConnectorI.inl
Go to the documentation of this file.
1 namespace iv
2 {
3 
4 template< class TParent, class TChild >
6  AnimConnector( inst ),
7  cm( inst, this, "Transform_ConnectorI" ),
8  parent( nullptr ),
9  child( nullptr ),
10  _treeChanged( false )
11 {
12  this->cm.inherits( this->AnimConnector::cm );
13 }
14 
15 template< class TParent, class TChild >
17 {
18  if( this->parent )
19  this->parent->anim_removeChild( this );
20 
21  if( this->child )
22  this->child->anim_unsetParent( this );
23 }
24 
25 
26 template< class TParent, class TChild >
28 {
29  return this->_treeChanged;
30 }
31 
32 template< class TParent, class TChild >
34 {
35  this->_treeChanged = false;
36 }
37 
38 template< class TParent, class TChild >
39 void Transform_ConnectorI< TParent, TChild >::anim_eachChild( std::function< void( AnimNodeI * ) > const & f )
40 {
41  if( this->child )
42  f( this->child );
43 }
44 
45 template< class TParent, class TChild >
47 {
48  if( this->child == node )
49  {
50  this->child->anim_unsetParent( this );
51  this->child = nullptr;
52  this->Activate();
53  this->_treeChanged = true;
54  }
55 }
56 
57 template< class TParent, class TChild >
58 void Transform_ConnectorI< TParent, TChild >::anim_eachParent( std::function< void( AnimNodeI * ) > const & f )
59 {
60  if( this->parent )
61  f( this->parent );
62 }
63 
64 template< class TParent, class TChild >
66 {
67  if( this->parent == node )
68  {
69  this->parent->anim_removeChild( this );
70  this->parent = nullptr;
71  this->Activate();
72  this->_treeChanged = true;
73  }
74 }
75 
76 
77 template< class TParent, class TChild >
79 {
80  if( node )
81  {
82  this->parent = node;
83  this->parent->anim_addChild( this );
84  this->Activate();
85  this->_treeChanged = true;
86  }
87  else
88  {
89  this->parent->anim_removeChild( this );
90  this->parent = nullptr;
91  this->Activate();
92  this->_treeChanged = true;
93  }
94 }
95 
96 template< class TParent, class TChild >
98 {
99  if( node )
100  {
101  this->child = node;
102  this->child->anim_setParent( this );
103  this->Activate();
104  this->_treeChanged = true;
105  }
106  else
107  {
108  this->child->anim_unsetParent( this );
109  this->child = nullptr;
110  this->Activate();
111  this->_treeChanged = true;
112  }
113 }
114 
115 }