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 #include "SG_IObject.h" 00034 #include "SG_Controller.h" 00035 00036 #include <algorithm> 00037 00038 SG_Stage gSG_Stage = SG_STAGE_UNKNOWN; 00039 00040 SG_IObject:: 00041 SG_IObject( 00042 void* clientobj, 00043 void* clientinfo, 00044 SG_Callbacks& callbacks 00045 ): 00046 SG_QList(), 00047 m_SGclientObject(clientobj), 00048 m_SGclientInfo(clientinfo) 00049 { 00050 m_callbacks = callbacks; 00051 } 00052 00053 SG_IObject:: 00054 SG_IObject( 00055 const SG_IObject &other 00056 ) : 00057 SG_QList(), 00058 m_SGclientObject(other.m_SGclientObject), 00059 m_SGclientInfo(other.m_SGclientInfo), 00060 m_callbacks(other.m_callbacks) 00061 { 00062 //nothing to do 00063 } 00064 00065 void 00066 SG_IObject:: 00067 AddSGController( 00068 SG_Controller* cont 00069 ){ 00070 m_SGcontrollers.push_back(cont); 00071 } 00072 00073 void 00074 SG_IObject:: 00075 RemoveSGController( 00076 SG_Controller* cont 00077 ) { 00078 SGControllerList::iterator contit; 00079 00080 m_SGcontrollers.erase(std::remove(m_SGcontrollers.begin(), m_SGcontrollers.end(), cont)); 00081 } 00082 00083 void 00084 SG_IObject:: 00085 RemoveAllControllers( 00086 ) { 00087 m_SGcontrollers.clear(); 00088 } 00089 00090 void SG_IObject::SetControllerTime(double time) 00091 { 00092 SGControllerList::iterator contit; 00093 for (contit = m_SGcontrollers.begin();contit!=m_SGcontrollers.end();++contit) 00094 { 00095 (*contit)->SetSimulatedTime(time); 00096 } 00097 } 00098 00100 00101 00102 SG_IObject:: 00103 ~SG_IObject() 00104 { 00105 SGControllerList::iterator contit; 00106 00107 for (contit = m_SGcontrollers.begin();contit!=m_SGcontrollers.end();++contit) 00108 { 00109 delete (*contit); 00110 } 00111 }