svn merge ^/trunk/blender -r41226:41227 .
[blender.git] / source / gameengine / VideoTexture / ImageMix.cpp
index 8532249f7d86e93aed4d5896a40969d8c81841f7..573daef88da9505db60b0d19cbc0ed1a5a1f963b 100644 (file)
@@ -1,4 +1,6 @@
-/* $Id$
+/** \file gameengine/VideoTexture/ImageMix.cpp
+ *  \ingroup bgevideotex
+ */
 -----------------------------------------------------------------------------
 This source file is part of VideoTexture library
 
@@ -63,7 +65,7 @@ ExceptionID ImageSizesNotMatch;
 ExpDesc ImageSizesNotMatchDesc (ImageSizesNotMatch, "Image sizes of sources are different");
 
 // calculate image from sources and set its availability
-void ImageMix::calcImage (unsigned int texId)
+void ImageMix::calcImage (unsigned int texId, double ts)
 {
        // check source sizes
        if (!checkSourceSizes()) THRWEXCP(ImageSizesNotMatch, S_OK);
@@ -109,7 +111,9 @@ PyObject * getWeight (PyImage * self, PyObject * args)
        short weight = 0;
        // get arguments
        char * id;
-       if (self->m_image != NULL && PyArg_ParseTuple(args, "s", &id))
+       if (!PyArg_ParseTuple(args, "s:getWeight", &id))
+               return NULL;
+       if (self->m_image != NULL)
                // get weight
                weight = getImageMix(self)->getWeight(id);
        // return weight
@@ -123,12 +127,14 @@ PyObject * setWeight (PyImage * self, PyObject * args)
        // get arguments
        char * id;
        short weight = 0;
-       if (self->m_image != NULL && PyArg_ParseTuple(args, "sh", &id, &weight))
+       if (!PyArg_ParseTuple(args, "sh:setWeight", &id, &weight))
+               return NULL;
+       if (self->m_image != NULL)
                // set weight
                if (!getImageMix(self)->setWeight(id, weight))
                {
                        // if not set, report error
-                       PyErr_SetString(PyExc_RuntimeError, "Invalid id of source");;
+                       PyErr_SetString(PyExc_RuntimeError, "Invalid id of source");
                        return NULL;
                }
        // return none
@@ -150,11 +156,12 @@ static PyMethodDef imageMixMethods[] =
 // attributes structure
 static PyGetSetDef imageMixGetSets[] =
 { // attributes from ImageBase class
-       {"image", (getter)Image_getImage, NULL, "image data", NULL},
-       {"size", (getter)Image_getSize, NULL, "image size", NULL},
-       {"scale", (getter)Image_getScale, (setter)Image_setScale, "fast scale of image (near neighbour)", NULL},
-       {"flip", (getter)Image_getFlip, (setter)Image_setFlip, "flip image vertically", NULL},
-       {"filter", (getter)Image_getFilter, (setter)Image_setFilter, "pixel filter", NULL},
+       {(char*)"valid", (getter)Image_valid, NULL, (char*)"bool to tell if an image is available", NULL},
+       {(char*)"image", (getter)Image_getImage, NULL, (char*)"image data", NULL},
+       {(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
+       {(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbour)", NULL},
+       {(char*)"flip", (getter)Image_getFlip, (setter)Image_setFlip, (char*)"flip image vertically", NULL},
+       {(char*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL},
        {NULL}
 };
 
@@ -162,8 +169,7 @@ static PyGetSetDef imageMixGetSets[] =
 // define python type
 PyTypeObject ImageMixType =
 { 
-       PyObject_HEAD_INIT(NULL)
-       0,                         /*ob_size*/
+       PyVarObject_HEAD_INIT(NULL, 0)
        "VideoTexture.ImageMix",   /*tp_name*/
        sizeof(PyImage),          /*tp_basicsize*/
        0,                         /*tp_itemsize*/
@@ -181,7 +187,7 @@ PyTypeObject ImageMixType =
        0,                         /*tp_str*/
        0,                         /*tp_getattro*/
        0,                         /*tp_setattro*/
-       0,                         /*tp_as_buffer*/
+       &imageBufferProcs,         /*tp_as_buffer*/
        Py_TPFLAGS_DEFAULT,        /*tp_flags*/
        "Image mixer",       /* tp_doc */
        0,                             /* tp_traverse */