Merge of itasc branch. Project files, scons and cmake should be working. Makefile...
[blender.git] / source / gameengine / GameLogic / SCA_IObject.h
index c4f3460..64ea0a7 100644 (file)
@@ -36,6 +36,7 @@
 #include "Value.h"
 #include <vector>
 
+class SCA_IObject;
 class SCA_ISensor;
 class SCA_IController;
 class SCA_IActuator;
@@ -45,6 +46,7 @@ template<class T> T PyVecTo(PyObject*);
 typedef std::vector<SCA_ISensor *>       SCA_SensorList;
 typedef std::vector<SCA_IController *>   SCA_ControllerList;
 typedef std::vector<SCA_IActuator *>     SCA_ActuatorList;
+typedef std::vector<SCA_IObject *>              SCA_ObjectList;
 
 class SCA_IObject :    public CValue
 {
@@ -52,12 +54,14 @@ class SCA_IObject : public CValue
        Py_Header;
        
 protected:
+       friend class KX_StateActuator;
        friend class SCA_IActuator;
        friend class SCA_IController;
        SCA_SensorList         m_sensors;
        SCA_ControllerList     m_controllers;
        SCA_ActuatorList       m_actuators;
        SCA_ActuatorList       m_registeredActuators;   // actuators that use a pointer to this object
+       SCA_ObjectList             m_registeredObjects;         // objects that hold reference to this object
 
        // SG_Dlist: element of objects with active actuators
        //           Head: SCA_LogicManager::m_activeActuators
@@ -97,9 +101,14 @@ protected:
         */
        unsigned int                    m_state;
 
+       /**
+        * pointer inside state actuator list for sorting
+        */
+       SG_QList*                               m_firstState;
+
 public:
        
-       SCA_IObject(PyTypeObject* T=&Type);
+       SCA_IObject();
        virtual ~SCA_IObject();
 
        SCA_ControllerList& GetControllers()
@@ -137,13 +146,22 @@ public:
        void RegisterActuator(SCA_IActuator* act);
        void UnregisterActuator(SCA_IActuator* act);
        
+       void RegisterObject(SCA_IObject* objs);
+       void UnregisterObject(SCA_IObject* objs);
+       /**
+        * UnlinkObject(...)
+        * this object is informed that one of the object to which it holds a reference is deleted
+        * returns true if there was indeed a reference.
+        */
+       virtual bool UnlinkObject(SCA_IObject* clientobj) { return false; }
+
        SCA_ISensor* FindSensor(const STR_String& sensorname);
        SCA_IActuator* FindActuator(const STR_String& actuatorname);
        SCA_IController* FindController(const STR_String& controllername);
 
        void SetCurrentTime(float currentTime) {}
 
-       void ReParentLogic();
+       virtual void ReParentLogic();
        
        /**
         * Set whether or not to ignore activity culling requests
@@ -193,15 +211,12 @@ public:
        unsigned int GetState(void)     { return m_state; }
 
 //     const class MT_Point3&  ConvertPythonPylist(PyObject* pylist);
-       
-       // here come the python forwarded methods
-       virtual PyObject* py_getattro(PyObject *attr);
-       virtual PyObject* py_getattro_dict();
 
        virtual int GetGameObjectType() {return -1;}
        
        typedef enum ObjectTypes {
                OBJ_ARMATURE=0,
+               OBJ_CAMERA=1,
        }ObjectTypes;
 
 };