BGE PyAPI
authorCampbell Barton <ideasman42@gmail.com>
Tue, 28 Apr 2009 13:11:56 +0000 (13:11 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 28 Apr 2009 13:11:56 +0000 (13:11 +0000)
- renamed generic attribute "isValid" to "invalid" since BL_Shader already uses isValid.
- Moved deprecation warnings from CValue
- removed unused KX_Scene::SetProjectionMatrix and KX_Scene::GetViewMatrix
- Added KX_Scene attributes "lights", "cameras", "objects_inactive", to allow access to objects in unseen layers (before the AddObject actuator adds them)
- KX_Camera deprecated cam.enableViewport(bool) for cam.isViewport which can be read as well.

source/gameengine/Expressions/PyObjectPlus.cpp
source/gameengine/Expressions/PyObjectPlus.h
source/gameengine/Expressions/Value.cpp
source/gameengine/Expressions/Value.h
source/gameengine/Ketsji/KX_Camera.cpp
source/gameengine/Ketsji/KX_Camera.h
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_Scene.cpp
source/gameengine/Ketsji/KX_Scene.h

index 54f076741cc42a3934dcdc03776ba7d2e8c23123..8bd34cdc73bbe12292b2da878c0760a75913e208 100644 (file)
@@ -113,13 +113,13 @@ PyMethodDef PyObjectPlus::Methods[] = {
 };
 
 PyAttributeDef PyObjectPlus::Attributes[] = {
-       KX_PYATTRIBUTE_RO_FUNCTION("isValid",           PyObjectPlus, pyattr_get_is_valid),
+       KX_PYATTRIBUTE_RO_FUNCTION("invalid",           PyObjectPlus, pyattr_get_invalid),
        {NULL} //Sentinel
 };
 
-PyObject* PyObjectPlus::pyattr_get_is_valid(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+PyObject* PyObjectPlus::pyattr_get_invalid(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {      
-       Py_RETURN_TRUE;
+       Py_RETURN_FALSE;
 }
 
 /*------------------------------
@@ -137,8 +137,8 @@ PyObject *PyObjectPlus::py_base_getattro(PyObject * self, PyObject *attr)
 {
        PyObjectPlus *self_plus= BGE_PROXY_REF(self);
        if(self_plus==NULL) {
-               if(!strcmp("isValid", PyString_AsString(attr))) {
-                       Py_RETURN_FALSE;
+               if(!strcmp("invalid", PyString_AsString(attr))) {
+                       Py_RETURN_TRUE;
                }
                PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG);
                return NULL;
@@ -896,5 +896,56 @@ PyObject *PyObjectPlus::NewProxy_Ext(PyObjectPlus *self, PyTypeObject *tp, bool
        return self->m_proxy;
 }
 
+///////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////
+/* deprecation warning management */
+bool PyObjectPlus::m_ignore_deprecation_warnings(false);
+void PyObjectPlus::SetDeprecationWarnings(bool ignoreDeprecationWarnings)
+{
+       m_ignore_deprecation_warnings = ignoreDeprecationWarnings;
+}
+
+void PyObjectPlus::ShowDeprecationWarning(const char* old_way,const char* new_way)
+{
+       if (!m_ignore_deprecation_warnings) {
+               printf("Method %s is deprecated, please use %s instead.\n", old_way, new_way);
+               
+               // import sys; print '\t%s:%d' % (sys._getframe(0).f_code.co_filename, sys._getframe(0).f_lineno)
+               
+               PyObject *getframe, *frame;
+               PyObject *f_lineno, *f_code, *co_filename;
+               
+               getframe = PySys_GetObject((char *)"_getframe"); // borrowed
+               if (getframe) {
+                       frame = PyObject_CallObject(getframe, NULL);
+                       if (frame) {
+                               f_lineno= PyObject_GetAttrString(frame, "f_lineno");
+                               f_code= PyObject_GetAttrString(frame, "f_code");
+                               if (f_lineno && f_code) {
+                                       co_filename= PyObject_GetAttrString(f_code, "co_filename");
+                                       if (co_filename) {
+                                               
+                                               printf("\t%s:%d\n", PyString_AsString(co_filename), (int)PyInt_AsLong(f_lineno));
+                                               
+                                               Py_DECREF(f_lineno);
+                                               Py_DECREF(f_code);
+                                               Py_DECREF(co_filename);
+                                               Py_DECREF(frame);
+                                               return;
+                                       }
+                               }
+                               
+                               Py_XDECREF(f_lineno);
+                               Py_XDECREF(f_code);
+                               Py_DECREF(frame);
+                       }
+                       
+               }
+               PyErr_Clear();
+               printf("\tERROR - Could not access sys._getframe(0).f_lineno or sys._getframe().f_code.co_filename\n");
+       }
+}
+
+
 #endif //NO_EXP_PYTHON_EMBEDDING
 
index 257851ef4b3a6857abdee0576fe255db69e65724..f90a1436d00f8e65a4dad415d7fd082d9b337dd8 100644 (file)
@@ -446,7 +446,7 @@ public:
        KX_PYMETHOD_O(PyObjectPlus,isA);
        
        /* Kindof dumb, always returns True, the false case is checked for, before this function gets accessed */
-       static PyObject*        pyattr_get_is_valid(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject*        pyattr_get_invalid(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
        
        static PyObject *GetProxy_Ext(PyObjectPlus *self, PyTypeObject *tp);
        static PyObject *NewProxy_Ext(PyObjectPlus *self, PyTypeObject *tp, bool py_owns);
@@ -458,6 +458,14 @@ public:
         */
        virtual void ProcessReplica();
        
+       
+       static bool                     m_ignore_deprecation_warnings;
+       
+       /** enable/disable display of deprecation warnings */
+       static void                     SetDeprecationWarnings(bool ignoreDeprecationWarnings);
+       /** Shows a deprecation warning */
+       static void                     ShowDeprecationWarning(const char* method,const char* prop);
+       
 };
 
 PyObject *py_getattr_dict(PyObject *pydict, PyObject *tp_dict);
index 6e8f2ba10618b5fa7aa5be819993589db4e0f985..088b5cb98a4e915254c435330c1b08629142459b 100644 (file)
@@ -32,7 +32,6 @@
 //////////////////////////////////////////////////////////////////////
 
 double CValue::m_sZeroVec[3] = {0.0,0.0,0.0};
-bool CValue::m_ignore_deprecation_warnings(false);
 
 #ifndef NO_EXP_PYTHON_EMBEDDING
 
@@ -781,52 +780,3 @@ void CValue::SetValue(CValue* newval)
        // no one should get here
        assertd(newval->GetNumber() == 10121969);       
 }
-///////////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-/* deprecation warning management */
-void CValue::SetDeprecationWarnings(bool ignoreDeprecationWarnings)
-{
-       m_ignore_deprecation_warnings = ignoreDeprecationWarnings;
-}
-
-void CValue::ShowDeprecationWarning(const char* old_way,const char* new_way)
-{
-       if (!m_ignore_deprecation_warnings) {
-               printf("Method %s is deprecated, please use %s instead.\n", old_way, new_way);
-               
-               // import sys; print '\t%s:%d' % (sys._getframe(0).f_code.co_filename, sys._getframe(0).f_lineno)
-               
-               PyObject *getframe, *frame;
-               PyObject *f_lineno, *f_code, *co_filename;
-               
-               getframe = PySys_GetObject((char *)"_getframe"); // borrowed
-               if (getframe) {
-                       frame = PyObject_CallObject(getframe, NULL);
-                       if (frame) {
-                               f_lineno= PyObject_GetAttrString(frame, "f_lineno");
-                               f_code= PyObject_GetAttrString(frame, "f_code");
-                               if (f_lineno && f_code) {
-                                       co_filename= PyObject_GetAttrString(f_code, "co_filename");
-                                       if (co_filename) {
-                                               
-                                               printf("\t%s:%d\n", PyString_AsString(co_filename), (int)PyInt_AsLong(f_lineno));
-                                               
-                                               Py_DECREF(f_lineno);
-                                               Py_DECREF(f_code);
-                                               Py_DECREF(co_filename);
-                                               Py_DECREF(frame);
-                                               return;
-                                       }
-                               }
-                               
-                               Py_XDECREF(f_lineno);
-                               Py_XDECREF(f_code);
-                               Py_DECREF(frame);
-                       }
-                       
-               }
-               PyErr_Clear();
-               printf("\tERROR - Could not access sys._getframe(0).f_lineno or sys._getframe().f_code.co_filename\n");
-       }
-}
-
index 97ce9cddcea728fc3244b6e6296b3285fe5a2579..fca603a831ecfe0d36bafc03d98ee707c0da3b2c 100644 (file)
@@ -303,10 +303,6 @@ public:
        
        
        STR_String                              op2str(VALUE_OPERATOR op);
-       /** enable/disable display of deprecation warnings */
-       static void                     SetDeprecationWarnings(bool ignoreDeprecationWarnings);
-       /** Shows a deprecation warning */
-       static void                     ShowDeprecationWarning(const char* method,const char* prop);
                
        // setting / getting flags
        inline void                     SetSelected(bool bSelected)                                                             { m_ValFlags.Selected = bSelected; }
@@ -338,7 +334,6 @@ private:
        ValueFlags                      m_ValFlags;                                                                                             // Frequently used flags in a bitfield (low memoryusage)
        int                                     m_refcount;                                                                                             // Reference Counter    
        static  double m_sZeroVec[3];   
-       static bool                     m_ignore_deprecation_warnings;
 
 };
 
index 8565346b30e6fb38b7a9c069afdbf0c73f8cadb3..bc2c2fc33b0cfb78c1ff7136274b58169c2f7b07 100644 (file)
@@ -478,10 +478,12 @@ PyMethodDef KX_Camera::Methods[] = {
        KX_PYMETHODTABLE_NOARGS(KX_Camera, getWorldToCamera),
        KX_PYMETHODTABLE_NOARGS(KX_Camera, getProjectionMatrix),
        KX_PYMETHODTABLE_O(KX_Camera, setProjectionMatrix),
-       KX_PYMETHODTABLE_O(KX_Camera, enableViewport),
        KX_PYMETHODTABLE(KX_Camera, setViewport),
        KX_PYMETHODTABLE_NOARGS(KX_Camera, setOnTop),
        
+       // DEPRECATED
+       KX_PYMETHODTABLE_O(KX_Camera, enableViewport),
+       
        {NULL,NULL} //Sentinel
 };
 
@@ -494,6 +496,8 @@ PyAttributeDef KX_Camera::Attributes[] = {
        KX_PYATTRIBUTE_RW_FUNCTION("near",      KX_Camera,      pyattr_get_near, pyattr_set_near),
        KX_PYATTRIBUTE_RW_FUNCTION("far",       KX_Camera,      pyattr_get_far,  pyattr_set_far),
        
+       KX_PYATTRIBUTE_RW_FUNCTION("isViewport",        KX_Camera,      pyattr_get_is_viewport,  pyattr_set_is_viewport),
+       
        KX_PYATTRIBUTE_RO_FUNCTION("projection_matrix", KX_Camera,      pyattr_get_projection_matrix),
        KX_PYATTRIBUTE_RO_FUNCTION("modelview_matrix",  KX_Camera,      pyattr_get_modelview_matrix),
        KX_PYATTRIBUTE_RO_FUNCTION("camera_to_world",   KX_Camera,      pyattr_get_camera_to_world),
@@ -745,8 +749,9 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, enableViewport,
 "Sets this camera's viewport status\n"
 )
 {
-       int viewport = PyObject_IsTrue(value);
+       ShowDeprecationWarning("enableViewport(bool)", "the isViewport property");
        
+       int viewport = PyObject_IsTrue(value);
        if (viewport == -1) {
                PyErr_SetString(PyExc_ValueError, "camera.enableViewport(bool): KX_Camera, expected True/False or 0/1");
                return NULL;
@@ -776,10 +781,7 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_Camera, setOnTop,
 "setOnTop()\n"
 "Sets this camera's viewport on top\n")
 {
-       class KX_Scene* scene;
-       
-       scene = KX_GetActiveScene();
-       MT_assert(scene);
+       class KX_Scene* scene = KX_GetActiveScene();
        scene->SetCameraOnTop(this);
        Py_RETURN_NONE;
 }
@@ -863,6 +865,26 @@ int KX_Camera::pyattr_set_far(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, P
        return 0;
 }
 
+
+PyObject* KX_Camera::pyattr_get_is_viewport(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_Camera* self= static_cast<KX_Camera*>(self_v);
+       return PyBool_FromLong(self->GetViewport());
+}
+
+int KX_Camera::pyattr_set_is_viewport(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       KX_Camera* self= static_cast<KX_Camera*>(self_v);
+       int param = PyObject_IsTrue( value );
+       if (param == -1) {
+               PyErr_SetString(PyExc_AttributeError, "camera.isViewport = bool: KX_Camera, expected True or False");
+               return 1;
+       }
+       self->EnableViewport((bool)param);
+       return 0;
+}
+
+
 PyObject* KX_Camera::pyattr_get_projection_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_Camera* self= static_cast<KX_Camera*>(self_v);
index 83316972ca01c5a342e58b2fb95fc09234efc701..e99a0594701a734263d9916322b2b0cf045c4c36 100644 (file)
@@ -284,6 +284,9 @@ public:
        static PyObject*        pyattr_get_far(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
        static int                      pyattr_set_far(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
        
+       static PyObject*        pyattr_get_is_viewport(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static int                      pyattr_set_is_viewport(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+       
        static PyObject*        pyattr_get_projection_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
        static int                      pyattr_set_projection_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
        
index 53c2d6c79378d098d8f8b48e6a28e2614dfd7bcf..ed162238e8a69e98a5e1f0ea87e9874d5bd9dc58 100644 (file)
@@ -1067,7 +1067,6 @@ CListValue* KX_GameObject::GetChildrenRecursive()
 /* ------- python stuff ---------------------------------------------------*/
 
 PyMethodDef KX_GameObject::Methods[] = {
-       {"setWorldPosition", (PyCFunction) KX_GameObject::sPySetWorldPosition, METH_O},
        {"applyForce", (PyCFunction)    KX_GameObject::sPyApplyForce, METH_VARARGS},
        {"applyTorque", (PyCFunction)   KX_GameObject::sPyApplyTorque, METH_VARARGS},
        {"applyRotation", (PyCFunction) KX_GameObject::sPyApplyRotation, METH_VARARGS},
@@ -1106,6 +1105,7 @@ PyMethodDef KX_GameObject::Methods[] = {
        // deprecated
        {"getPosition", (PyCFunction) KX_GameObject::sPyGetPosition, METH_NOARGS},
        {"setPosition", (PyCFunction) KX_GameObject::sPySetPosition, METH_O},
+       {"setWorldPosition", (PyCFunction) KX_GameObject::sPySetWorldPosition, METH_O},
        {"getOrientation", (PyCFunction) KX_GameObject::sPyGetOrientation, METH_NOARGS},
        {"setOrientation", (PyCFunction) KX_GameObject::sPySetOrientation, METH_O},
        {"getState",(PyCFunction) KX_GameObject::sPyGetState, METH_NOARGS},
@@ -1177,8 +1177,8 @@ PyObject* KX_GameObject::PyReplaceMesh(PyObject* value)
 
 PyObject* KX_GameObject::PyEndObject()
 {
-
        KX_Scene *scene = KX_GetActiveScene();
+       
        scene->DelayedRemoveObject(this);
        
        Py_RETURN_NONE;
@@ -1321,7 +1321,6 @@ PyMappingMethods KX_GameObject::Mapping = {
        (objobjargproc)KX_GameObject::Map_SetItem,      /*objobjargproc mp_ass_subscript */
 };
 
-
 PyTypeObject KX_GameObject::Type = {
        PyObject_HEAD_INIT(NULL)
                0,
@@ -2069,17 +2068,20 @@ PyObject* KX_GameObject::PyGetParent()
 
 PyObject* KX_GameObject::PySetParent(PyObject* value)
 {
+       KX_Scene *scene = KX_GetActiveScene();
        KX_GameObject *obj;
+       
        if (!ConvertPythonToGameObject(value, &obj, false, "gameOb.setParent(value): KX_GameObject"))
                return NULL;
        
-       this->SetParent(KX_GetActiveScene(), obj);
+       this->SetParent(scene, obj);
        Py_RETURN_NONE;
 }
 
 PyObject* KX_GameObject::PyRemoveParent()
 {
        KX_Scene *scene = KX_GetActiveScene();
+       
        this->RemoveParent(scene);
        Py_RETURN_NONE;
 }
@@ -2249,6 +2251,7 @@ PyObject* KX_GameObject::PySetPosition(PyObject* value)
 
 PyObject* KX_GameObject::PySetWorldPosition(PyObject* value)
 {
+       ShowDeprecationWarning("setWorldPosition()", "the worldPosition property");
        MT_Point3 pos;
        if (PyVecTo(value, pos))
        {
@@ -2585,6 +2588,7 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_GameObject, sendMessage,
 "body = Message body (string)"
 "to = Name of object to send the message to")
 {
+       KX_Scene *scene = KX_GetActiveScene();
        char* subject;
        char* body = (char *)"";
        char* to = (char *)"";
@@ -2592,9 +2596,8 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_GameObject, sendMessage,
 
        if (!PyArg_ParseTuple(args, "s|sss:sendMessage", &subject, &body, &to))
                return NULL;
-
-       KX_GetActiveScene()->GetNetworkScene()->SendMessage(to, from, subject, body);
-
+       
+       scene->GetNetworkScene()->SendMessage(to, from, subject, body);
        Py_RETURN_NONE;
 }
 
index 9e67e39b2a55fce7678d5459900c79790df05780..1c1cc881d1701cd663bff9bd485d340901896a78 100644 (file)
@@ -255,13 +255,6 @@ KX_Scene::~KX_Scene()
        Py_DECREF(m_attr_dict);
 }
 
-void KX_Scene::SetProjectionMatrix(MT_CmMatrix4x4& pmat)
-{
-       m_projectionmat = pmat;
-}
-
-
-
 RAS_BucketManager* KX_Scene::GetBucketManager()
 {
        return m_bucketmanager;
@@ -1153,24 +1146,6 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj)
        gameobj->AddMeshUser();
 }
 
-
-
-MT_CmMatrix4x4& KX_Scene::GetViewMatrix()
-{
-       MT_Scalar cammat[16];
-       m_active_camera->GetWorldToCamera().getValue(cammat);
-       m_viewmat = cammat;
-       return m_viewmat;
-}
-
-
-
-MT_CmMatrix4x4& KX_Scene::GetProjectionMatrix()
-{
-       return m_projectionmat;
-}
-
-
 KX_Camera* KX_Scene::FindCamera(KX_Camera* cam)
 {
        list<KX_Camera*>::iterator it = m_cameras.begin();
@@ -1645,9 +1620,9 @@ PyParentObject KX_Scene::Parents[] = {
 };
 
 PyMethodDef KX_Scene::Methods[] = {
-       KX_PYMETHODTABLE(KX_Scene, getLightList),
-       KX_PYMETHODTABLE(KX_Scene, getObjectList),
-       KX_PYMETHODTABLE(KX_Scene, getName),
+       KX_PYMETHODTABLE_NOARGS(KX_Scene, getLightList),
+       KX_PYMETHODTABLE_NOARGS(KX_Scene, getObjectList),
+       KX_PYMETHODTABLE_NOARGS(KX_Scene, getName),
        KX_PYMETHODTABLE(KX_Scene, addObject),
        
        {NULL,NULL} //Sentinel
@@ -1665,6 +1640,39 @@ PyObject* KX_Scene::pyattr_get_objects(void *self_v, const KX_PYATTRIBUTE_DEF *a
        return self->GetObjectList()->GetProxy();
 }
 
+PyObject* KX_Scene::pyattr_get_objects_inactive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_Scene* self= static_cast<KX_Scene*>(self_v);
+       return self->GetInactiveList()->GetProxy();
+}
+
+PyObject* KX_Scene::pyattr_get_lights(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_Scene* self= static_cast<KX_Scene*>(self_v);
+       return self->GetLightList()->GetProxy();
+}
+
+PyObject* KX_Scene::pyattr_get_cameras(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       /* With refcounts in this case...
+        * the new CListValue is owned by python, so its possible python holds onto it longer then the BGE
+        * however this is the same with "scene.objects + []", when you make a copy by adding lists.
+        */
+       
+       KX_Scene* self= static_cast<KX_Scene*>(self_v);
+       CListValue* clist = new CListValue();
+       
+       /* return self->GetCameras()->GetProxy(); */
+       
+       list<KX_Camera*>::iterator it = self->GetCameras()->begin();
+       while (it != self->GetCameras()->end()) {
+               clist->Add((*it)->AddRef());
+               it++;
+       }
+       
+       return clist->NewProxy(true);
+}
+
 PyObject* KX_Scene::pyattr_get_active_camera(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_Scene* self= static_cast<KX_Scene*>(self_v);
@@ -1672,13 +1680,16 @@ PyObject* KX_Scene::pyattr_get_active_camera(void *self_v, const KX_PYATTRIBUTE_
 }
 
 PyAttributeDef KX_Scene::Attributes[] = {
-       KX_PYATTRIBUTE_RO_FUNCTION("name",                      KX_Scene, pyattr_get_name),
-       KX_PYATTRIBUTE_RO_FUNCTION("objects",           KX_Scene, pyattr_get_objects),
-       KX_PYATTRIBUTE_RO_FUNCTION("active_camera",     KX_Scene, pyattr_get_active_camera),
-       KX_PYATTRIBUTE_BOOL_RO("suspended",                     KX_Scene, m_suspend),
-       KX_PYATTRIBUTE_BOOL_RO("activity_culling",      KX_Scene, m_activity_culling),
+       KX_PYATTRIBUTE_RO_FUNCTION("name",                              KX_Scene, pyattr_get_name),
+       KX_PYATTRIBUTE_RO_FUNCTION("objects",                   KX_Scene, pyattr_get_objects),
+       KX_PYATTRIBUTE_RO_FUNCTION("objects_inactive",  KX_Scene, pyattr_get_objects_inactive), KX_PYATTRIBUTE_RO_FUNCTION("lights",                    KX_Scene, pyattr_get_lights),
+       KX_PYATTRIBUTE_RO_FUNCTION("cameras",                   KX_Scene, pyattr_get_cameras),
+       KX_PYATTRIBUTE_RO_FUNCTION("lights",                    KX_Scene, pyattr_get_lights),
+       KX_PYATTRIBUTE_RO_FUNCTION("active_camera",             KX_Scene, pyattr_get_active_camera),
+       KX_PYATTRIBUTE_BOOL_RO("suspended",                             KX_Scene, m_suspend),
+       KX_PYATTRIBUTE_BOOL_RO("activity_culling",              KX_Scene, m_activity_culling),
        KX_PYATTRIBUTE_FLOAT_RW("activity_culling_radius", 0.5f, FLT_MAX, KX_Scene, m_activity_box_radius),
-       KX_PYATTRIBUTE_BOOL_RO("dbvt_culling",          KX_Scene, m_dbvt_culling),
+       KX_PYATTRIBUTE_BOOL_RO("dbvt_culling",                  KX_Scene, m_dbvt_culling),
        { NULL }        //Sentinel
 };
 
@@ -1754,6 +1765,7 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_Scene, getLightList,
 "Returns a list of all lights in the scene.\n"
 )
 {
+       ShowDeprecationWarning("getLightList()", "the lights property");
        return m_lightlist->GetProxy();
 }
 
@@ -1762,7 +1774,7 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_Scene, getObjectList,
 "Returns a list of all game objects in the scene.\n"
 )
 {
-       // ShowDeprecationWarning("getObjectList()", "the objects property"); // XXX Grr, why doesnt this work?
+       ShowDeprecationWarning("getObjectList()", "the objects property");
        return m_objectlist->GetProxy();
 }
 
@@ -1771,6 +1783,7 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_Scene, getName,
 "Returns the name of the scene.\n"
 )
 {
+       ShowDeprecationWarning("getName()", "the name property");
        return PyString_FromString(GetName());
 }
 
index dbba7723cc5c5978539fe066b18794df6f5dc590..52a3cd5733ea79d91259d83b605faa3df2b80eae 100644 (file)
@@ -32,8 +32,6 @@
 
 #include "KX_PhysicsEngineEnums.h"
 
-#include "MT_CmMatrix4x4.h"
-
 #include <vector>
 #include <set>
 #include <list>
@@ -191,15 +189,6 @@ protected:
         */
        KX_Camera* m_active_camera;
 
-       /** 
-        * The projection and view matrices of this scene 
-        * The projection matrix is computed externally by KX_Engine    
-        * The view mat is stored as a side effect of GetViewMatrix()
-        * and is totally unnessary.
-        */
-       MT_CmMatrix4x4                          m_projectionmat;
-       MT_CmMatrix4x4                          m_viewmat;
-
        /** Desired canvas width set at design time. */
        unsigned int m_canvasDesignWidth;
        /** Desired canvas height set at design time. */
@@ -422,25 +411,6 @@ public:
                class KX_Camera*
        );
 
-       /** Return the viewmatrix as used by the last frame. */
-               MT_CmMatrix4x4&                 
-       GetViewMatrix(
-       );
-
-       /** 
-        * Return the projectionmatrix as used by the last frame. This is
-        * set by hand :) 
-        */
-               MT_CmMatrix4x4&                 
-       GetProjectionMatrix(
-       );
-
-       /** Sets the projection matrix. */
-               void                                    
-       SetProjectionMatrix(
-               MT_CmMatrix4x4& pmat
-       );
-
        /**
         * Activates new desired canvas width set at design time.
         * @param width The new desired width.
@@ -592,6 +562,9 @@ public:
        /* attributes */
        static PyObject*        pyattr_get_name(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
        static PyObject*        pyattr_get_objects(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject*        pyattr_get_objects_inactive(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject*        pyattr_get_lights(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject*        pyattr_get_cameras(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
        static PyObject*        pyattr_get_active_camera(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
 
        virtual PyObject* py_getattro(PyObject *attr); /* name, active_camera, gravity, suspended, viewport, framing, activity_culling, activity_culling_radius */