Blender  V2.59
KX_SceneActuator.h
Go to the documentation of this file.
00001 // $Id: KX_SceneActuator.h 36523 2011-05-06 20:18:42Z blendix $
00002 //
00003 // ***** BEGIN GPL LICENSE BLOCK *****
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software Foundation,
00017 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018 //
00019 // The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00020 // All rights reserved.
00021 //
00022 // The Original Code is: all of this file.
00023 //
00024 // Contributor(s): none yet.
00025 //
00026 // ***** END GPL LICENSE BLOCK *****
00027 //
00028 
00033 #ifndef __KX_SCENEACTUATOR
00034 #define __KX_SCENEACTUATOR
00035 
00036 #include "SCA_IActuator.h"
00037 #include "SCA_IScene.h" /* Replace_IScene only */
00038 #include "KX_Scene.h" /* Replace_IScene only */
00039 
00040 class KX_SceneActuator : public SCA_IActuator
00041 {
00042         Py_Header;
00043         
00044         int                                                     m_mode;
00045         // (restart) has become a toggle internally... not in the interface though
00046         bool                                            m_restart;
00047         // (set Scene) Scene
00049         class   KX_Scene*                       m_scene;
00050         class   KX_KetsjiEngine*        m_KetsjiEngine;
00052         STR_String                                      m_nextSceneName;
00053         
00054         // (Set Camera) Object
00055         class KX_Camera*                        m_camera;
00056 
00058         class KX_Scene* FindScene(char* sceneName);
00060         class KX_Camera* FindCamera(char* cameraName);
00061         
00062  public:
00063         enum SCA_SceneActuatorMode
00064         {
00065                 KX_SCENE_NODEF = 0,
00066                 KX_SCENE_RESTART,
00067                 KX_SCENE_SET_SCENE,
00068                 KX_SCENE_SET_CAMERA,
00069                 KX_SCENE_ADD_FRONT_SCENE,
00070                 KX_SCENE_ADD_BACK_SCENE,
00071                 KX_SCENE_REMOVE_SCENE,
00072                 KX_SCENE_SUSPEND,
00073                 KX_SCENE_RESUME,
00074                 KX_SCENE_MAX
00075         };
00076         
00077         KX_SceneActuator(SCA_IObject* gameobj,
00078                                          int mode,
00079                                          KX_Scene* scene,
00080                                          KX_KetsjiEngine* ketsjiEngine,
00081                                          const STR_String& nextSceneName,
00082                                          KX_Camera* camera);
00083         virtual ~KX_SceneActuator();
00084 
00085         virtual CValue* GetReplica();
00086         virtual void ProcessReplica();
00087         virtual bool UnlinkObject(SCA_IObject* clientobj);
00088         virtual void Relink(CTR_Map<CTR_HashedPtr, void*> *obj_map);
00089 
00090         virtual bool Update();
00091         
00092 #ifdef WITH_PYTHON
00093 
00094         virtual void Replace_IScene(SCA_IScene *val)
00095         {
00096                 m_scene= static_cast<KX_Scene *>(val);
00097         };
00098 
00099         /* --------------------------------------------------------------------- */
00100         /* Python interface ---------------------------------------------------- */
00101         /* --------------------------------------------------------------------- */
00102         
00103         static PyObject* pyattr_get_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
00104         static int pyattr_set_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
00105 
00106 #endif // WITH_PYTHON
00107 
00108 }; /* end of class KXSceneActuator */
00109 
00110 #endif
00111