Revision: 41498
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41498
Author:   campbellbarton
Date:     2011-11-03 13:10:37 +0000 (Thu, 03 Nov 2011)
Log Message:
-----------
use Py_TYPE macro (no functional changes)

Modified Paths:
--------------
    trunk/blender/intern/audaspace/Python/AUD_PyAPI.cpp
    trunk/blender/source/gameengine/Ketsji/KX_PythonSeq.h
    trunk/blender/source/gameengine/VideoTexture/BlendType.h
    trunk/blender/source/gameengine/VideoTexture/FilterBase.cpp
    trunk/blender/source/gameengine/VideoTexture/ImageBase.cpp
    trunk/blender/source/gameengine/VideoTexture/Texture.cpp
    trunk/blender/source/gameengine/VideoTexture/blendVideoTex.cpp

Modified: trunk/blender/intern/audaspace/Python/AUD_PyAPI.cpp
===================================================================
--- trunk/blender/intern/audaspace/Python/AUD_PyAPI.cpp 2011-11-03 12:47:39 UTC 
(rev 41497)
+++ trunk/blender/intern/audaspace/Python/AUD_PyAPI.cpp 2011-11-03 13:10:37 UTC 
(rev 41498)
@@ -226,7 +226,7 @@
        if(!PyArg_ParseTuple(args, "f|f:lowpass", &frequency, &Q))
                return NULL;
 
-       PyTypeObject* type = ((PyObject*)self)->ob_type;
+       PyTypeObject* type = Py_TYPE(self);
        Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
        if(parent != NULL)
@@ -267,7 +267,7 @@
        if(!PyArg_ParseTuple(args, "f:delay", &delay))
                return NULL;
 
-       PyTypeObject* type = ((PyObject*)self)->ob_type;
+       PyTypeObject* type = Py_TYPE(self);
        Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
        if(parent != NULL)
@@ -303,7 +303,7 @@
 static PyObject *
 Factory_join(Factory* self, PyObject* object)
 {
-       PyTypeObject* type = ((PyObject*)self)->ob_type;
+       PyTypeObject* type = Py_TYPE(self);
 
        if(!PyObject_TypeCheck(object, type))
        {
@@ -354,7 +354,7 @@
        if(!PyArg_ParseTuple(args, "f|f:highpass", &frequency, &Q))
                return NULL;
 
-       PyTypeObject* type = ((PyObject*)self)->ob_type;
+       PyTypeObject* type = Py_TYPE(self);
        Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
        if(parent != NULL)
@@ -395,7 +395,7 @@
        if(!PyArg_ParseTuple(args, "ff:limit", &start, &end))
                return NULL;
 
-       PyTypeObject* type = ((PyObject*)self)->ob_type;
+       PyTypeObject* type = Py_TYPE(self);
        Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
        if(parent != NULL)
@@ -439,7 +439,7 @@
        if(!PyArg_ParseTuple(args, "f:pitch", &factor))
                return NULL;
 
-       PyTypeObject* type = ((PyObject*)self)->ob_type;
+       PyTypeObject* type = Py_TYPE(self);
        Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
        if(parent != NULL)
@@ -481,7 +481,7 @@
        if(!PyArg_ParseTuple(args, "f:volume", &volume))
                return NULL;
 
-       PyTypeObject* type = ((PyObject*)self)->ob_type;
+       PyTypeObject* type = Py_TYPE(self);
        Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
        if(parent != NULL)
@@ -524,7 +524,7 @@
        if(!PyArg_ParseTuple(args, "ff:fadein", &start, &length))
                return NULL;
 
-       PyTypeObject* type = ((PyObject*)self)->ob_type;
+       PyTypeObject* type = Py_TYPE(self);
        Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
        if(parent != NULL)
@@ -568,7 +568,7 @@
        if(!PyArg_ParseTuple(args, "ff:fadeout", &start, &length))
                return NULL;
 
-       PyTypeObject* type = ((PyObject*)self)->ob_type;
+       PyTypeObject* type = Py_TYPE(self);
        Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
        if(parent != NULL)
@@ -610,7 +610,7 @@
        if(!PyArg_ParseTuple(args, "i:loop", &loop))
                return NULL;
 
-       PyTypeObject* type = ((PyObject*)self)->ob_type;
+       PyTypeObject* type = Py_TYPE(self);
        Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
        if(parent != NULL)
@@ -646,7 +646,7 @@
 static PyObject *
 Factory_mix(Factory* self, PyObject* object)
 {
-       PyTypeObject* type = ((PyObject*)self)->ob_type;
+       PyTypeObject* type = Py_TYPE(self);
 
        if(!PyObject_TypeCheck(object, type))
        {
@@ -686,7 +686,7 @@
 static PyObject *
 Factory_pingpong(Factory* self)
 {
-       PyTypeObject* type = ((PyObject*)self)->ob_type;
+       PyTypeObject* type = Py_TYPE(self);
        Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
        if(parent != NULL)
@@ -725,7 +725,7 @@
 static PyObject *
 Factory_reverse(Factory* self)
 {
-       PyTypeObject* type = ((PyObject*)self)->ob_type;
+       PyTypeObject* type = Py_TYPE(self);
        Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
        if(parent != NULL)
@@ -763,7 +763,7 @@
 static PyObject *
 Factory_buffer(Factory* self)
 {
-       PyTypeObject* type = ((PyObject*)self)->ob_type;
+       PyTypeObject* type = Py_TYPE(self);
        Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
        if(parent != NULL)
@@ -802,7 +802,7 @@
        if(!PyArg_ParseTuple(args, "|f:square", &threshold))
                return NULL;
 
-       PyTypeObject* type = ((PyObject*)self)->ob_type;
+       PyTypeObject* type = Py_TYPE(self);
        Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
        if(parent != NULL)
@@ -905,7 +905,7 @@
        else
                a.push_back(1);
 
-       PyTypeObject* type = ((PyObject*)self)->ob_type;
+       PyTypeObject* type = Py_TYPE(self);
        Factory *parent = (Factory*)type->tp_alloc(type, 0);
 
        if(parent != NULL)

Modified: trunk/blender/source/gameengine/Ketsji/KX_PythonSeq.h
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_PythonSeq.h       2011-11-03 
12:47:39 UTC (rev 41497)
+++ trunk/blender/source/gameengine/Ketsji/KX_PythonSeq.h       2011-11-03 
13:10:37 UTC (rev 41498)
@@ -51,8 +51,8 @@
 /* The Main PyType Object defined in Main.c */
 extern PyTypeObject KX_PythonSeq_Type;
 
-#define BPy_KX_PythonSeq_Check(v) \
-    ((v)->ob_type == &KX_PythonSeq_Type)
+#define BPy_KX_PythonSeq_Check(obj)  \
+    (Py_TYPE(obj) == &KX_PythonSeq_Type)
 
 typedef struct {
        PyObject_VAR_HEAD

Modified: trunk/blender/source/gameengine/VideoTexture/BlendType.h
===================================================================
--- trunk/blender/source/gameengine/VideoTexture/BlendType.h    2011-11-03 
12:47:39 UTC (rev 41497)
+++ trunk/blender/source/gameengine/VideoTexture/BlendType.h    2011-11-03 
13:10:37 UTC (rev 41498)
@@ -43,15 +43,15 @@
                if (m_objType == NULL)
                {
                        // compare names of type
-                       if (strcmp(obj->ob_type->tp_name, m_name) == 0)
+                       if (strcmp(Py_TYPE(obj)->tp_name, m_name) == 0)
                                // if name of type match, save pointer to type
-                               m_objType = obj->ob_type;
+                               m_objType = Py_TYPE(obj);
                        else
                                // if names of type don't match, return NULL
                                return NULL;
                }
                // if pointer to type is set and don't match to type of 
provided object, return NULL
-               else if (obj->ob_type != m_objType) 
+               else if (Py_TYPE(obj) != m_objType)
                        return NULL;
                // return pointer to object, this class can only be used for KX 
object =>
                // the Py object is actually a proxy

Modified: trunk/blender/source/gameengine/VideoTexture/FilterBase.cpp
===================================================================
--- trunk/blender/source/gameengine/VideoTexture/FilterBase.cpp 2011-11-03 
12:47:39 UTC (rev 41497)
+++ trunk/blender/source/gameengine/VideoTexture/FilterBase.cpp 2011-11-03 
13:10:37 UTC (rev 41498)
@@ -141,7 +141,7 @@
        if (self->m_filter != NULL)
        {
                // check new value
-               if (value == NULL || !pyFilterTypes.in(value->ob_type))
+               if (value == NULL || !pyFilterTypes.in(Py_TYPE(value)))
                {
                        // report value error
                        PyErr_SetString(PyExc_TypeError, "Invalid type of 
value");

Modified: trunk/blender/source/gameengine/VideoTexture/ImageBase.cpp
===================================================================
--- trunk/blender/source/gameengine/VideoTexture/ImageBase.cpp  2011-11-03 
12:47:39 UTC (rev 41497)
+++ trunk/blender/source/gameengine/VideoTexture/ImageBase.cpp  2011-11-03 
13:10:37 UTC (rev 41498)
@@ -567,7 +567,7 @@
        if (self->m_image != NULL)
        {
                // check type of object
-               if (pyImageTypes.in(obj->ob_type))
+               if (pyImageTypes.in(Py_TYPE(obj)))
                {
                        // convert to image struct
                        PyImage * img = reinterpret_cast<PyImage*>(obj);
@@ -619,7 +619,7 @@
        if (self->m_image != NULL)
        {
                // check new value
-               if (value == NULL || !pyFilterTypes.in(value->ob_type))
+               if (value == NULL || !pyFilterTypes.in(Py_TYPE(value)))
                {
                        // report value error
                        PyErr_SetString(PyExc_TypeError, "Invalid type of 
value");

Modified: trunk/blender/source/gameengine/VideoTexture/Texture.cpp
===================================================================
--- trunk/blender/source/gameengine/VideoTexture/Texture.cpp    2011-11-03 
12:47:39 UTC (rev 41497)
+++ trunk/blender/source/gameengine/VideoTexture/Texture.cpp    2011-11-03 
13:10:37 UTC (rev 41498)
@@ -171,7 +171,7 @@
        // release scaled image buffer
        delete [] self->m_scaledImg;
        // release object
-       ((PyObject *)self)->ob_type->tp_free((PyObject*)self);
+       Py_TYPE((PyObject *)self)->tp_free((PyObject*)self);
 }
 
 
@@ -410,7 +410,7 @@
 int Texture_setSource (Texture * self, PyObject * value, void * closure)
 {
        // check new value
-       if (value == NULL || !pyImageTypes.in(value->ob_type))
+       if (value == NULL || !pyImageTypes.in(Py_TYPE(value)))
        {
                // report value error
                PyErr_SetString(PyExc_TypeError, "Invalid type of value");

Modified: trunk/blender/source/gameengine/VideoTexture/blendVideoTex.cpp
===================================================================
--- trunk/blender/source/gameengine/VideoTexture/blendVideoTex.cpp      
2011-11-03 12:47:39 UTC (rev 41497)
+++ trunk/blender/source/gameengine/VideoTexture/blendVideoTex.cpp      
2011-11-03 13:10:37 UTC (rev 41498)
@@ -91,7 +91,7 @@
        // parameter is Image object
        PyObject * pyImg;
        char *mode = NULL;
-       if (!PyArg_ParseTuple(args, "O|s:imageToArray", &pyImg, &mode) || 
!pyImageTypes.in(pyImg->ob_type))
+       if (!PyArg_ParseTuple(args, "O|s:imageToArray", &pyImg, &mode) || 
!pyImageTypes.in(Py_TYPE(pyImg)))
        {
                // if object is incorect, report error
                PyErr_SetString(PyExc_TypeError, 
"VideoTexture.imageToArray(image): The value must be a image source object");

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to