Blender V2.61 - r43446

KX_SceneActuator.h

Go to the documentation of this file.
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 
00032 #ifndef __KX_SCENEACTUATOR
00033 #define __KX_SCENEACTUATOR
00034 
00035 #include "SCA_IActuator.h"
00036 #include "SCA_IScene.h" /* Replace_IScene only */
00037 #include "KX_Scene.h" /* Replace_IScene only */
00038 
00039 class KX_SceneActuator : public SCA_IActuator
00040 {
00041     Py_Header
00042     
00043     int                         m_mode;
00044     // (restart) has become a toggle internally... not in the interface though
00045     bool                        m_restart;
00046     // (set Scene) Scene
00048     class   KX_Scene*           m_scene;
00049     class   KX_KetsjiEngine*    m_KetsjiEngine;
00051     STR_String                  m_nextSceneName;
00052     
00053     // (Set Camera) Object
00054     class KX_Camera*            m_camera;
00055 
00057     class KX_Scene* FindScene(const char* sceneName);
00059     class KX_Camera* FindCamera(const char* cameraName);
00060     
00061  public:
00062     enum SCA_SceneActuatorMode
00063     {
00064         KX_SCENE_NODEF = 0,
00065         KX_SCENE_RESTART,
00066         KX_SCENE_SET_SCENE,
00067         KX_SCENE_SET_CAMERA,
00068         KX_SCENE_ADD_FRONT_SCENE,
00069         KX_SCENE_ADD_BACK_SCENE,
00070         KX_SCENE_REMOVE_SCENE,
00071         KX_SCENE_SUSPEND,
00072         KX_SCENE_RESUME,
00073         KX_SCENE_MAX
00074     };
00075     
00076     KX_SceneActuator(SCA_IObject* gameobj,
00077                      int mode,
00078                      KX_Scene* scene,
00079                      KX_KetsjiEngine* ketsjiEngine,
00080                      const STR_String& nextSceneName,
00081                      KX_Camera* camera);
00082     virtual ~KX_SceneActuator();
00083 
00084     virtual CValue* GetReplica();
00085     virtual void ProcessReplica();
00086     virtual bool UnlinkObject(SCA_IObject* clientobj);
00087     virtual void Relink(CTR_Map<CTR_HashedPtr, void*> *obj_map);
00088 
00089     virtual bool Update();
00090     
00091 #ifdef WITH_PYTHON
00092 
00093     virtual void Replace_IScene(SCA_IScene *val)
00094     {
00095         m_scene= static_cast<KX_Scene *>(val);
00096     };
00097 
00098     /* --------------------------------------------------------------------- */
00099     /* Python interface ---------------------------------------------------- */
00100     /* --------------------------------------------------------------------- */
00101     
00102     static PyObject* pyattr_get_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
00103     static int pyattr_set_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
00104 
00105 #endif // WITH_PYTHON
00106 
00107 }; /* end of class KXSceneActuator */
00108 
00109 #endif
00110