diff options
Diffstat (limited to 'source/gameengine/Expressions/Value.h')
-rw-r--r-- | source/gameengine/Expressions/Value.h | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/source/gameengine/Expressions/Value.h b/source/gameengine/Expressions/Value.h index caf1064dc32..a687e1a493c 100644 --- a/source/gameengine/Expressions/Value.h +++ b/source/gameengine/Expressions/Value.h @@ -217,33 +217,14 @@ public: CValue(PyTypeObject *T = &Type); //static PyObject* PyMake(PyObject*,PyObject*); - virtual PyObject *_repr(void) + virtual PyObject *py_repr(void) { - return Py_BuildValue("s",(const char*)GetText()); + return PyString_FromString((const char*)GetText()); } - virtual PyObject* _getattr(const char *attr); - - void SpecialRelease() - { - int i=0; - if (ob_refcnt == 0) - { - _Py_NewReference(this); - - } else - { - i++; - } - Release(); - } - static void PyDestructor(PyObject *P) // python wrapper - { - ((CValue*)P)->SpecialRelease(); - }; - + virtual PyObject* py_getattro(PyObject *attr); virtual PyObject* ConvertValueToPython() { return NULL; } @@ -251,8 +232,8 @@ public: virtual CValue* ConvertPythonToValue(PyObject* pyobj); - virtual int _delattr(const char *attr); - virtual int _setattr(const char *attr, PyObject* value); + virtual int py_delattro(PyObject *attr); + virtual int py_setattro(PyObject *attr, PyObject* value); virtual PyObject* ConvertKeysToPython( void ); @@ -280,13 +261,16 @@ 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 - virtual CValue* GetProperty(const STR_String & inName); // Get pointer to a property with name <inName>, returns NULL if there is no property named <inName> + virtual void SetProperty(const char* name,CValue* ioProperty); + virtual CValue* GetProperty(const char* inName); // Get pointer to a property with name <inName>, returns NULL if there is no property named <inName> + virtual CValue* GetProperty(const STR_String & inName); STR_String GetPropertyText(const STR_String & inName,const STR_String& deftext=""); // Get text description of property with name <inName>, returns an empty string if there is no property named <inName> float GetPropertyNumber(const STR_String& inName,float defnumber); - virtual bool RemoveProperty(const STR_String & inName); // Remove the property named <inName>, returns true if the property was succesfully removed, false if property was not found or could not be removed + virtual bool RemoveProperty(const char *inName); // Remove the property named <inName>, returns true if the property was succesfully removed, false if property was not found or could not be removed virtual vector<STR_String> GetPropertyNames(); virtual void ClearProperties(); // Clear all properties @@ -304,7 +288,7 @@ public: virtual void SetColorOperator(VALUE_OPERATOR op); virtual const STR_String & GetText() = 0; - virtual float GetNumber() = 0; + virtual double GetNumber() = 0; double* ZeroVector() { return m_sZeroVec; }; virtual double* GetVector3(bool bGetTransformedVec = false); |