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 // 00034 00035 // Remove the actuator's parent when triggered 00036 // 00037 // Previously existed as: 00038 // \source\gameengine\GameLogic\SCA_EndObjectActuator.cpp 00039 // Please look here for revision history. 00040 00041 #include "SCA_IActuator.h" 00042 #include "KX_SCA_EndObjectActuator.h" 00043 #include "SCA_IScene.h" 00044 00045 KX_SCA_EndObjectActuator::KX_SCA_EndObjectActuator(SCA_IObject *gameobj, 00046 SCA_IScene* scene): 00047 SCA_IActuator(gameobj, KX_ACT_END_OBJECT), 00048 m_scene(scene) 00049 { 00050 // intentionally empty 00051 } /* End of constructor */ 00052 00053 00054 00055 KX_SCA_EndObjectActuator::~KX_SCA_EndObjectActuator() 00056 { 00057 // there's nothing to be done here, really.... 00058 } /* end of destructor */ 00059 00060 00061 00062 bool KX_SCA_EndObjectActuator::Update() 00063 { 00064 // bool result = false; /*unused*/ 00065 bool bNegativeEvent = IsNegativeEvent(); 00066 RemoveAllEvents(); 00067 00068 if (bNegativeEvent) 00069 return false; // do nothing on negative events 00070 m_scene->DelayedRemoveObject(GetParent()); 00071 00072 return false; 00073 } 00074 00075 00076 00077 CValue* KX_SCA_EndObjectActuator::GetReplica() 00078 { 00079 KX_SCA_EndObjectActuator* replica = 00080 new KX_SCA_EndObjectActuator(*this); 00081 if (replica == NULL) return NULL; 00082 00083 replica->ProcessReplica(); 00084 return replica; 00085 }; 00086 00087 #ifdef WITH_PYTHON 00088 00089 /* ------------------------------------------------------------------------- */ 00090 /* Python functions : integration hooks */ 00091 /* ------------------------------------------------------------------------- */ 00092 00093 PyTypeObject KX_SCA_EndObjectActuator::Type = { 00094 PyVarObject_HEAD_INIT(NULL, 0) 00095 "KX_SCA_EndObjectActuator", 00096 sizeof(PyObjectPlus_Proxy), 00097 0, 00098 py_base_dealloc, 00099 0, 00100 0, 00101 0, 00102 0, 00103 py_base_repr, 00104 0,0,0,0,0,0,0,0,0, 00105 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, 00106 0,0,0,0,0,0,0, 00107 Methods, 00108 0, 00109 0, 00110 &SCA_IActuator::Type, 00111 0,0,0,0,0,0, 00112 py_base_new 00113 }; 00114 00115 PyMethodDef KX_SCA_EndObjectActuator::Methods[] = { 00116 {NULL,NULL} //Sentinel 00117 }; 00118 00119 PyAttributeDef KX_SCA_EndObjectActuator::Attributes[] = { 00120 { NULL } //Sentinel 00121 }; 00122 00123 #endif // WITH_PYTHON 00124 00125 /* eof */