~ubuntu-branches/ubuntu/vivid/mygui/vivid

« back to all changes in this revision

Viewing changes to UnitTests/UnitTest_GraphView/GraphNodeLoopController.h

  • Committer: Package Import Robot
  • Author(s): Scott Howard, Bret Curtis, Scott Howard
  • Date: 2014-09-18 17:57:48 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140918175748-dd8va78mvpw1jbes
Tags: 3.2.1-1
[ Bret Curtis ]
* Updated license for majority of files from LGPL to Expat (MIT)

[ Scott Howard ]
* New upstream release
* Updated patch to add build option for system GLEW libraries
* All patches accepted upstream except shared_libraries.patch
* Bumped SONAME due to dropped symbols, updated *.symbols and package
  names
* Updated license of debian/* to Expat with permission of all authors
* Don't install Doxygen autogenerated md5 and map files (thanks
  lintian)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*!
2
 
        @file
3
 
        @author         Albert Semenov
4
 
        @date           08/2009
5
 
*/
6
 
#ifndef __GRAPH_NODE_LOOP_CONTROLLER_H__
7
 
#define __GRAPH_NODE_LOOP_CONTROLLER_H__
8
 
 
9
 
#include <MyGUI.h>
10
 
#include "BaseAnimationNode.h"
11
 
#include "IAnimationGraph.h"
12
 
 
13
 
namespace demo
14
 
{
15
 
 
16
 
        class GraphNodeLoopController :
17
 
                public BaseAnimationNode
18
 
        {
19
 
        public:
20
 
                GraphNodeLoopController(const std::string& _name) :
21
 
                        BaseAnimationNode("GraphNodeLoopController.layout", "LoopController", _name),
22
 
                        mStartIn(nullptr),
23
 
                        mStopIn(nullptr),
24
 
                        mWeightIn(nullptr),
25
 
                        mStartOut(nullptr),
26
 
                        mStopOut(nullptr),
27
 
                        mWeightOut(nullptr),
28
 
                        mPositionOut(nullptr),
29
 
                        mLength(1)
30
 
                {
31
 
                }
32
 
 
33
 
                virtual void addConnection(const std::string& _eventout, BaseAnimationNode* _node, const std::string& _eventin)
34
 
                {
35
 
                        BaseAnimationNode::addConnection(_eventout, _node, _eventin);
36
 
                        if (_eventout == "Position")
37
 
                        {
38
 
                                mStateName = _node->getAnimationNode()->getName();
39
 
                                updateStateLenght();
40
 
                        }
41
 
                }
42
 
 
43
 
                virtual void removeConnection(const std::string& _eventout, BaseAnimationNode* _node, const std::string& _eventin)
44
 
                {
45
 
                        BaseAnimationNode::removeConnection(_eventout, _node, _eventin);
46
 
                        if (_eventout == "Position")
47
 
                        {
48
 
                                mStateName.clear();
49
 
                                updateStateLenght();
50
 
                        }
51
 
                }
52
 
 
53
 
                virtual void invalidateNode(BaseAnimationNode* _sender)
54
 
                {
55
 
                        BaseAnimationNode::invalidateNode(_sender);
56
 
                        if (_sender->getAnimationNode()->getName() == mStateName)
57
 
                        {
58
 
                                updateStateLenght();
59
 
                        }
60
 
                }
61
 
 
62
 
        private:
63
 
                void updateStateLenght()
64
 
                {
65
 
                        mLength = 1;
66
 
                        animation::IAnimationNode* node = getAnimationNode()->getGraph()->getNodeByName(mStateName);
67
 
                        if (node)
68
 
                        {
69
 
                                mLength = node->getLength();
70
 
                                //if (mLength > 0.0001) mLength -= 0.0001;
71
 
                        }
72
 
                        else
73
 
                        {
74
 
                                mStateName.clear();
75
 
                        }
76
 
 
77
 
                        getAnimationNode()->setProperty("Length", MyGUI::utility::toString(mLength));
78
 
                }
79
 
 
80
 
                virtual void initialise()
81
 
                {
82
 
                        mMainWidget->castType<MyGUI::Window>()->setCaption(getName());
83
 
 
84
 
                        assignBase(mStartIn, "StartIn");
85
 
                        assignBase(mStopIn, "StopIn");
86
 
                        assignBase(mWeightIn, "WeightIn");
87
 
                        assignBase(mStartOut, "StartOut");
88
 
                        assignBase(mStopOut, "StopOut");
89
 
                        assignBase(mWeightOut, "WeightOut");
90
 
                        assignBase(mPositionOut, "PositionOut");
91
 
 
92
 
                }
93
 
 
94
 
                virtual void shutdown()
95
 
                {
96
 
                }
97
 
 
98
 
        private:
99
 
                wraps::BaseGraphConnection* mStartIn;
100
 
                wraps::BaseGraphConnection* mStopIn;
101
 
                wraps::BaseGraphConnection* mWeightIn;
102
 
                wraps::BaseGraphConnection* mStartOut;
103
 
                wraps::BaseGraphConnection* mStopOut;
104
 
                wraps::BaseGraphConnection* mWeightOut;
105
 
                wraps::BaseGraphConnection* mPositionOut;
106
 
 
107
 
                float mLength;
108
 
                std::string mStateName;
109
 
        };
110
 
 
111
 
} // namespace demo
112
 
 
113
 
#endif // __GRAPH_NODE_LOOP_CONTROLLER_H__
 
1
/*!
 
2
        @file
 
3
        @author         Albert Semenov
 
4
        @date           08/2009
 
5
*/
 
6
#ifndef __GRAPH_NODE_LOOP_CONTROLLER_H__
 
7
#define __GRAPH_NODE_LOOP_CONTROLLER_H__
 
8
 
 
9
#include <MyGUI.h>
 
10
#include "BaseAnimationNode.h"
 
11
#include "IAnimationGraph.h"
 
12
 
 
13
namespace demo
 
14
{
 
15
 
 
16
        class GraphNodeLoopController :
 
17
                public BaseAnimationNode
 
18
        {
 
19
        public:
 
20
                GraphNodeLoopController(const std::string& _name) :
 
21
                        BaseAnimationNode("GraphNodeLoopController.layout", "LoopController", _name),
 
22
                        mStartIn(nullptr),
 
23
                        mStopIn(nullptr),
 
24
                        mWeightIn(nullptr),
 
25
                        mStartOut(nullptr),
 
26
                        mStopOut(nullptr),
 
27
                        mWeightOut(nullptr),
 
28
                        mPositionOut(nullptr),
 
29
                        mLength(1)
 
30
                {
 
31
                }
 
32
 
 
33
                virtual void addConnection(const std::string& _eventout, BaseAnimationNode* _node, const std::string& _eventin)
 
34
                {
 
35
                        BaseAnimationNode::addConnection(_eventout, _node, _eventin);
 
36
                        if (_eventout == "Position")
 
37
                        {
 
38
                                mStateName = _node->getAnimationNode()->getName();
 
39
                                updateStateLenght();
 
40
                        }
 
41
                }
 
42
 
 
43
                virtual void removeConnection(const std::string& _eventout, BaseAnimationNode* _node, const std::string& _eventin)
 
44
                {
 
45
                        BaseAnimationNode::removeConnection(_eventout, _node, _eventin);
 
46
                        if (_eventout == "Position")
 
47
                        {
 
48
                                mStateName.clear();
 
49
                                updateStateLenght();
 
50
                        }
 
51
                }
 
52
 
 
53
                virtual void invalidateNode(BaseAnimationNode* _sender)
 
54
                {
 
55
                        BaseAnimationNode::invalidateNode(_sender);
 
56
                        if (_sender->getAnimationNode()->getName() == mStateName)
 
57
                        {
 
58
                                updateStateLenght();
 
59
                        }
 
60
                }
 
61
 
 
62
        private:
 
63
                void updateStateLenght()
 
64
                {
 
65
                        mLength = 1;
 
66
                        animation::IAnimationNode* node = getAnimationNode()->getGraph()->getNodeByName(mStateName);
 
67
                        if (node)
 
68
                        {
 
69
                                mLength = node->getLength();
 
70
                                //if (mLength > 0.0001) mLength -= 0.0001;
 
71
                        }
 
72
                        else
 
73
                        {
 
74
                                mStateName.clear();
 
75
                        }
 
76
 
 
77
                        getAnimationNode()->setProperty("Length", MyGUI::utility::toString(mLength));
 
78
                }
 
79
 
 
80
                virtual void initialise()
 
81
                {
 
82
                        mMainWidget->castType<MyGUI::Window>()->setCaption(getName());
 
83
 
 
84
                        assignBase(mStartIn, "StartIn");
 
85
                        assignBase(mStopIn, "StopIn");
 
86
                        assignBase(mWeightIn, "WeightIn");
 
87
                        assignBase(mStartOut, "StartOut");
 
88
                        assignBase(mStopOut, "StopOut");
 
89
                        assignBase(mWeightOut, "WeightOut");
 
90
                        assignBase(mPositionOut, "PositionOut");
 
91
 
 
92
                }
 
93
 
 
94
                virtual void shutdown()
 
95
                {
 
96
                }
 
97
 
 
98
        private:
 
99
                wraps::BaseGraphConnection* mStartIn;
 
100
                wraps::BaseGraphConnection* mStopIn;
 
101
                wraps::BaseGraphConnection* mWeightIn;
 
102
                wraps::BaseGraphConnection* mStartOut;
 
103
                wraps::BaseGraphConnection* mStopOut;
 
104
                wraps::BaseGraphConnection* mWeightOut;
 
105
                wraps::BaseGraphConnection* mPositionOut;
 
106
 
 
107
                float mLength;
 
108
                std::string mStateName;
 
109
        };
 
110
 
 
111
} // namespace demo
 
112
 
 
113
#endif // __GRAPH_NODE_LOOP_CONTROLLER_H__