|
Blender
V2.59
|
00001 /* 00002 * $Id: KX_IpoActuator.h 35063 2011-02-22 10:33:14Z jesterking $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00021 * All rights reserved. 00022 * 00023 * The Original Code is: all of this file. 00024 * 00025 * Contributor(s): none yet. 00026 * 00027 * ***** END GPL LICENSE BLOCK ***** 00028 */ 00029 00035 #ifndef __KX_IPOACTUATOR 00036 #define __KX_IPOACTUATOR 00037 00038 #include "SCA_IActuator.h" 00039 00040 class KX_IpoActuator : public SCA_IActuator 00041 { 00042 Py_Header; 00043 private: 00046 void SetStartTime(float curtime); 00049 void SetLocalTime(float curtime); 00052 bool ClampLocalTime(); 00053 00054 protected: 00055 bool m_bNegativeEvent; 00056 00058 float m_startframe; 00059 00061 float m_endframe; 00062 00064 bool m_recurse; 00065 00067 float m_localtime; 00068 00070 float m_starttime; 00071 00073 float m_direction; 00074 00076 STR_String m_propname; 00077 00079 STR_String m_framepropname; 00080 00082 bool m_ipo_as_force; 00083 00085 bool m_ipo_add; 00086 00088 bool m_ipo_local; 00089 00090 bool m_bIpoPlaying; 00091 00093 void ResetStartTime(); 00094 00095 public: 00096 enum IpoActType 00097 { 00098 KX_ACT_IPO_NODEF = 0, 00099 KX_ACT_IPO_PLAY, 00100 KX_ACT_IPO_PINGPONG, 00101 KX_ACT_IPO_FLIPPER, 00102 KX_ACT_IPO_LOOPSTOP, 00103 KX_ACT_IPO_LOOPEND, 00104 KX_ACT_IPO_KEY2KEY, 00105 KX_ACT_IPO_FROM_PROP, 00106 KX_ACT_IPO_MAX 00107 }; 00108 00109 #ifdef WITH_PYTHON 00110 static PyObject* pyattr_get_frame_start(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); 00111 static int pyattr_set_frame_start(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); 00112 static PyObject* pyattr_get_frame_end(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); 00113 static int pyattr_set_frame_end(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); 00114 #endif 00115 static const char *S_KX_ACT_IPO_PLAY_STRING; 00116 static const char *S_KX_ACT_IPO_PINGPONG_STRING; 00117 static const char *S_KX_ACT_IPO_FLIPPER_STRING; 00118 static const char *S_KX_ACT_IPO_LOOPSTOP_STRING; 00119 static const char *S_KX_ACT_IPO_LOOPEND_STRING; 00120 static const char *S_KX_ACT_IPO_KEY2KEY_STRING; 00121 static const char *S_KX_ACT_IPO_FROM_PROP_STRING; 00122 00123 int string2mode(char* modename); 00124 00125 int m_type; 00126 00127 KX_IpoActuator(SCA_IObject* gameobj, 00128 const STR_String& propname, 00129 const STR_String& framePropname, 00130 float starttime, 00131 float endtime, 00132 bool recurse, 00133 int acttype, 00134 bool ipo_as_force, 00135 bool ipo_add, 00136 bool ipo_local); 00137 virtual ~KX_IpoActuator() {}; 00138 00139 virtual CValue* GetReplica() { 00140 KX_IpoActuator* replica = new KX_IpoActuator(*this);//m_float,GetName()); 00141 replica->ProcessReplica(); 00142 return replica; 00143 }; 00144 00145 void SetStart(float starttime); 00146 void SetEnd(float endtime); 00147 virtual bool Update(double curtime, bool frame); 00148 00149 /* --------------------------------------------------------------------- */ 00150 /* Python interface ---------------------------------------------------- */ 00151 /* --------------------------------------------------------------------- */ 00152 00153 }; 00154 00155 #endif //__KX_IPOACTUATOR 00156