6 * ***** BEGIN GPL LICENSE BLOCK *****
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23 * All rights reserved.
25 * The Original Code is: all of this file.
27 * Contributor(s): none yet.
29 * ***** END GPL LICENSE BLOCK *****
32 #ifndef __KX_IPOACTUATOR
33 #define __KX_IPOACTUATOR
35 #include "SCA_IActuator.h"
37 class KX_IpoActuator : public SCA_IActuator
41 /** Computes the IPO start time from the current time
42 and the current frame. */
43 void SetStartTime(float curtime);
44 /** Computes the current frame from the current time
45 and the IPO start time. */
46 void SetLocalTime(float curtime);
47 /** Ensures the current frame is between the start and
49 bool ClampLocalTime();
52 bool m_bNegativeEvent;
54 /** Begin frame of the ipo. */
57 /** End frame of the ipo. */
60 /** Include children in the transforms? */
63 /** Current active frame of the ipo. */
66 /** The time this ipo started at. */
69 /** play backwards or forwards? (positive means forward). */
72 /** Name of the property (only used in from_prop mode). */
73 STR_String m_propname;
75 /** Interpret the ipo as a force? */
78 /** Add Ipo curve to current loc/rot/scale */
81 /** The Ipo curve is applied in local coordinates */
100 static STR_String S_KX_ACT_IPO_PLAY_STRING;
101 static STR_String S_KX_ACT_IPO_PINGPONG_STRING;
102 static STR_String S_KX_ACT_IPO_FLIPPER_STRING;
103 static STR_String S_KX_ACT_IPO_LOOPSTOP_STRING;
104 static STR_String S_KX_ACT_IPO_LOOPEND_STRING;
105 static STR_String S_KX_ACT_IPO_KEY2KEY_STRING;
106 static STR_String S_KX_ACT_IPO_FROM_PROP_STRING;
108 IpoActType string2mode(char* modename);
112 KX_IpoActuator(SCA_IObject* gameobj,
113 const STR_String& propname,
121 PyTypeObject* T=&Type);
122 virtual ~KX_IpoActuator() {};
124 virtual CValue* GetReplica() {
125 KX_IpoActuator* replica = new KX_IpoActuator(*this);//m_float,GetName());
126 replica->ProcessReplica();
127 // this will copy properties and so on...
128 CValue::AddDataToReplica(replica);
132 void SetStart(float starttime);
133 void SetEnd(float endtime);
134 virtual bool Update(double curtime, bool frame);
136 /* --------------------------------------------------------------------- */
137 /* Python interface ---------------------------------------------------- */
138 /* --------------------------------------------------------------------- */
140 virtual PyObject* _getattr(const STR_String& attr);
142 KX_PYMETHOD_DOC(KX_IpoActuator,Set);
143 KX_PYMETHOD_DOC(KX_IpoActuator,SetProperty);
144 /* KX_PYMETHOD_DOC(KX_IpoActuator,SetKey2Key); */
145 KX_PYMETHOD_DOC(KX_IpoActuator,SetStart);
146 KX_PYMETHOD_DOC_NOARGS(KX_IpoActuator,GetStart);
147 KX_PYMETHOD_DOC(KX_IpoActuator,SetEnd);
148 KX_PYMETHOD_DOC_NOARGS(KX_IpoActuator,GetEnd);
149 KX_PYMETHOD_DOC(KX_IpoActuator,SetIpoAsForce);
150 KX_PYMETHOD_DOC_NOARGS(KX_IpoActuator,GetIpoAsForce);
151 KX_PYMETHOD_DOC(KX_IpoActuator,SetIpoAdd);
152 KX_PYMETHOD_DOC_NOARGS(KX_IpoActuator,GetIpoAdd);
153 KX_PYMETHOD_DOC(KX_IpoActuator,SetType);
154 KX_PYMETHOD_DOC_NOARGS(KX_IpoActuator,GetType);
155 KX_PYMETHOD_DOC(KX_IpoActuator,SetForceIpoActsLocal);
156 KX_PYMETHOD_DOC_NOARGS(KX_IpoActuator,GetForceIpoActsLocal);
160 #endif //__KX_IPOACTUATOR