svn merge -r 21041:21301 https://svn.blender.org/svnroot/bf-blender/branches/blender2...
[blender.git] / source / gameengine / Ketsji / BL_Shader.cpp
index c5c517c8a65390e35114a1d93e770f9c171338ec..8bde5dd3a511452b71ed4e17c8c3a86c0ed708c1 100644 (file)
@@ -113,8 +113,8 @@ bool BL_Shader::Ok()const
        return (mShader !=0 && mOk && mUse);
 }
 
-BL_Shader::BL_Shader(PyTypeObject *T)
-:      PyObjectPlus(T),
+BL_Shader::BL_Shader()
+:      PyObjectPlus(),
        mShader(0),
        mPass(1),
        mOk(0),
@@ -728,17 +728,6 @@ void BL_Shader::SetUniform(int uniform, const int* val, int len)
        }
 }
 
-
-PyObject* BL_Shader::py_getattro(PyObject *attr)
-{
-       py_getattro_up(PyObjectPlus);
-}
-
-PyObject* BL_Shader::py_getattro_dict() {
-       py_getattro_dict_up(PyObjectPlus);
-}
-
-
 PyMethodDef BL_Shader::Methods[] = 
 {
        // creation
@@ -792,21 +781,17 @@ PyTypeObject BL_Shader::Type = {
                0,
                0,
                py_base_repr,
-               0,0,0,0,0,0,
-               py_base_getattro,
-               py_base_setattro,
                0,0,0,0,0,0,0,0,0,
-               Methods
-};
-
-
-PyParentObject BL_Shader::Parents[] = {
-       &BL_Shader::Type,
-       &PyObjectPlus::Type,
-       NULL
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &PyObjectPlus::Type,
+               0,0,0,0,0,0,
+               py_base_new
 };
 
-
 KX_PYMETHODDEF_DOC( BL_Shader, setSource," setSource(vertexProgram, fragmentProgram)" )
 {
        if(mShader !=0 && mOk  )
@@ -848,17 +833,17 @@ KX_PYMETHODDEF_DOC( BL_Shader, delSource, "delSource( )" )
 
 KX_PYMETHODDEF_DOC( BL_Shader, isValid, "isValid()" )
 {
-       return PyInt_FromLong( ( mShader !=0 &&  mOk ) );
+       return PyLong_FromSsize_t( ( mShader !=0 &&  mOk ) );
 }
 
 KX_PYMETHODDEF_DOC( BL_Shader, getVertexProg ,"getVertexProg( )" )
 {
-       return PyString_FromString(vertProg?vertProg:"");
+       return PyUnicode_FromString(vertProg?vertProg:"");
 }
 
 KX_PYMETHODDEF_DOC( BL_Shader, getFragmentProg ,"getFragmentProg( )" )
 {
-       return PyString_FromString(fragProg?fragProg:"");
+       return PyUnicode_FromString(fragProg?fragProg:"");
 }
 
 KX_PYMETHODDEF_DOC( BL_Shader, validate, "validate()")
@@ -1223,7 +1208,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformiv, "setUniformiv( uniform_name, (list2
        for(unsigned int i=0; (i<list_size && i<4); i++)
        {
                PyObject *item = PySequence_GetItem(listPtr, i);
-               array_data[i] = PyInt_AsLong(item);
+               array_data[i] = PyLong_AsSsize_t(item);
                Py_DECREF(item);
        }