From df8cf26404c7e922751643b1095e38f1ab430811 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 17 Apr 2009 20:06:06 +0000 Subject: Added m_zombie to the base python class (PyObjectPlus), when this is set all the subclasses will raise an error on access to their members. Other small changes... - KX_Camera and KX_Light didnt have get/setitem access in their PyType definition. - CList.from_id() error checking for a long was checking for -1 against an unsigned value (own fault) - CValue::SpecialRelease was incrementing an int for no reason. - renamed m_attrlist to m_attr_dict since its a PyDict type. - removed custom getattro/setattro functions for KX_Scene and KX_GameObject, use py_base_getattro, py_base_setattro for all subclasses of PyObjectPlus. - lowercase windows.h in VideoBase.cpp for cross compiling. --- source/gameengine/Expressions/Value.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'source/gameengine/Expressions/Value.h') diff --git a/source/gameengine/Expressions/Value.h b/source/gameengine/Expressions/Value.h index 4cdc80dc9bd..bcee355cda2 100644 --- a/source/gameengine/Expressions/Value.h +++ b/source/gameengine/Expressions/Value.h @@ -219,7 +219,7 @@ public: //static PyObject* PyMake(PyObject*,PyObject*); virtual PyObject *py_repr(void) { - return Py_BuildValue("s",(const char*)GetText()); + return PyString_FromString((const char*)GetText()); } @@ -228,14 +228,10 @@ public: void SpecialRelease() { - int i=0; - if (ob_refcnt == 0) + if (ob_refcnt == 0) /* make sure python always holds a reference */ { _Py_NewReference(this); - } else - { - i++; } Release(); } @@ -280,6 +276,7 @@ public: int GetRefCount() { return m_refcount; } virtual CValue* AddRef(); // Add a reference to this value virtual int Release(); // Release a reference to this value (when reference count reaches 0, the value is removed from the heap) + /// Property Management virtual void SetProperty(const STR_String& name,CValue* ioProperty); // Set property , overwrites and releases a previous property with the same name if needed @@ -355,6 +352,7 @@ private: std::map* m_pNamedPropertyArray; // Properties for user/game etc ValueFlags m_ValFlags; // Frequently used flags in a bitfield (low memoryusage) int m_refcount; // Reference Counter + bool m_zombie; // Object is invalid put its still being referenced (by python) static double m_sZeroVec[3]; static bool m_ignore_deprecation_warnings; -- cgit v1.2.3