diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-04-18 00:06:06 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-04-18 00:06:06 +0400 |
commit | df8cf26404c7e922751643b1095e38f1ab430811 (patch) | |
tree | b4258cc6c90913c379f5cdd05edebd8785230647 /source/gameengine/Expressions/Value.h | |
parent | 90c6cf77f10961de756f6ff06329d3fa65ce3da4 (diff) |
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.
Diffstat (limited to 'source/gameengine/Expressions/Value.h')
-rw-r--r-- | source/gameengine/Expressions/Value.h | 10 |
1 files changed, 4 insertions, 6 deletions
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 <ioProperty>, overwrites and releases a previous property with the same name if needed @@ -355,6 +352,7 @@ private: std::map<STR_String,CValue*>* 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; |