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