Blender V2.61 - r43446
|
00001 /* 00002 * Always trigger 00003 * 00004 * 00005 * ***** BEGIN GPL LICENSE BLOCK ***** 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software Foundation, 00019 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00020 * 00021 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00022 * All rights reserved. 00023 * 00024 * The Original Code is: all of this file. 00025 * 00026 * Contributor(s): none yet. 00027 * 00028 * ***** END GPL LICENSE BLOCK ***** 00029 */ 00030 00036 #if defined(WIN32) && !defined(FREE_WINDOWS) 00037 // This warning tells us about truncation of __long__ stl-generated names. 00038 // It can occasionally cause DevStudio to have internal compiler warnings. 00039 #pragma warning( disable : 4786 ) 00040 #endif 00041 00042 #include "SCA_AlwaysSensor.h" 00043 #include "SCA_LogicManager.h" 00044 #include "SCA_EventManager.h" 00045 00046 /* ------------------------------------------------------------------------- */ 00047 /* Native functions */ 00048 /* ------------------------------------------------------------------------- */ 00049 00050 SCA_AlwaysSensor::SCA_AlwaysSensor(class SCA_EventManager* eventmgr, 00051 SCA_IObject* gameobj) 00052 : SCA_ISensor(gameobj,eventmgr) 00053 { 00054 //SetDrawColor(255,0,0); 00055 Init(); 00056 } 00057 00058 void SCA_AlwaysSensor::Init() 00059 { 00060 m_alwaysresult = true; 00061 } 00062 00063 SCA_AlwaysSensor::~SCA_AlwaysSensor() 00064 { 00065 /* intentionally empty */ 00066 } 00067 00068 00069 00070 CValue* SCA_AlwaysSensor::GetReplica() 00071 { 00072 CValue* replica = new SCA_AlwaysSensor(*this);//m_float,GetName()); 00073 // this will copy properties and so on... 00074 replica->ProcessReplica(); 00075 00076 return replica; 00077 } 00078 00079 00080 00081 bool SCA_AlwaysSensor::IsPositiveTrigger() 00082 { 00083 return (m_invert ? false : true); 00084 } 00085 00086 00087 00088 bool SCA_AlwaysSensor::Evaluate() 00089 { 00090 /* Nice! :) */ 00091 //return true; 00092 /* even nicer ;) */ 00093 //return false; 00094 00095 /* nicest ! */ 00096 bool result = m_alwaysresult; 00097 m_alwaysresult = false; 00098 return result; 00099 } 00100 00101 #ifdef WITH_PYTHON 00102 00103 /* ------------------------------------------------------------------------- */ 00104 /* Python functions */ 00105 /* ------------------------------------------------------------------------- */ 00106 00107 /* Integration hooks ------------------------------------------------------- */ 00108 PyTypeObject SCA_AlwaysSensor::Type = { 00109 PyVarObject_HEAD_INIT(NULL, 0) 00110 "SCA_AlwaysSensor", 00111 sizeof(PyObjectPlus_Proxy), 00112 0, 00113 py_base_dealloc, 00114 0, 00115 0, 00116 0, 00117 0, 00118 py_base_repr, 00119 0,0,0,0,0,0,0,0,0, 00120 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, 00121 0,0,0,0,0,0,0, 00122 Methods, 00123 0, 00124 0, 00125 &SCA_ISensor::Type, 00126 0,0,0,0,0,0, 00127 py_base_new 00128 }; 00129 00130 PyMethodDef SCA_AlwaysSensor::Methods[] = { 00131 {NULL,NULL} //Sentinel 00132 }; 00133 00134 PyAttributeDef SCA_AlwaysSensor::Attributes[] = { 00135 { NULL } //Sentinel 00136 }; 00137 00138 #endif 00139 00140 /* eof */