svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r20937:21899
[blender.git] / source / gameengine / Ketsji / KX_SoundActuator.cpp
index 9e005cd04bbf309bb0522b8efeb09de6fc9f2a35..393811829448e982c7650c023746332111089823 100644 (file)
@@ -50,9 +50,8 @@ KX_SoundActuator::KX_SoundActuator(SCA_IObject* gameobj,
                                                                   SND_Scene*   sndscene,
                                                                   KX_SOUNDACT_TYPE type,
                                                                   short start,
-                                                                  short end,
-                                                                  PyTypeObject* T)
-                                                                  : SCA_IActuator(gameobj,T)
+                                                                  short end)
+                                                                  : SCA_IActuator(gameobj)
 {
        m_soundObject = sndobj;
        m_soundScene = sndscene;
@@ -260,25 +259,17 @@ PyTypeObject KX_SoundActuator::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 KX_SoundActuator::Parents[] = {
-       &KX_SoundActuator::Type,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
                &SCA_IActuator::Type,
-               &SCA_ILogicBrick::Type,
-               &CValue::Type,
-               NULL
+               0,0,0,0,0,0,
+               py_base_new
 };
 
-
-
 PyMethodDef KX_SoundActuator::Methods[] = {
        // Deprecated ----->
        {"setFilename", (PyCFunction) KX_SoundActuator::sPySetFilename, METH_VARARGS,NULL},
@@ -350,25 +341,13 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, stopSound,
 }
 
 /* Atribute setting and getting -------------------------------------------- */
-PyObject* KX_SoundActuator::py_getattro(PyObject *attr)
-{
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* KX_SoundActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int KX_SoundActuator::py_setattro(PyObject *attr, PyObject* value) {
-       py_setattro_up(SCA_IActuator);
-}
 
 PyObject* KX_SoundActuator::pyattr_get_filename(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self);
        if (!actuator->m_soundObject)
        {
-               return PyString_FromString("");
+               return PyUnicode_FromString("");
        }
        STR_String objectname = actuator->m_soundObject->GetObjectName();
        char* name = objectname.Ptr();
@@ -377,7 +356,7 @@ PyObject* KX_SoundActuator::pyattr_get_filename(void *self, const struct KX_PYAT
                PyErr_SetString(PyExc_RuntimeError, "value = actuator.fileName: KX_SoundActuator, unable to get sound fileName");
                return NULL;
        } else
-               return PyString_FromString(name);
+               return PyUnicode_FromString(name);
 }
 
 PyObject* KX_SoundActuator::pyattr_get_gain(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
@@ -412,7 +391,7 @@ PyObject* KX_SoundActuator::pyattr_get_looping(void *self, const struct KX_PYATT
 {
        KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self);
        int looping = (actuator->m_soundObject) ? actuator->m_soundObject->GetLoopMode() : (int)SND_LOOP_OFF;
-       PyObject* result = PyInt_FromLong(looping);
+       PyObject* result = PyLong_FromSsize_t(looping);
        
        return result;
 }
@@ -590,7 +569,7 @@ PyObject* KX_SoundActuator::PyGetFilename()
        ShowDeprecationWarning("getFilename()", "the fileName property");
        if (!m_soundObject)
        {
-               return PyString_FromString("");
+               return PyUnicode_FromString("");
        }
        STR_String objectname = m_soundObject->GetObjectName();
        char* name = objectname.Ptr();
@@ -599,7 +578,7 @@ PyObject* KX_SoundActuator::PyGetFilename()
                PyErr_SetString(PyExc_RuntimeError, "Unable to get sound fileName");
                return NULL;
        } else
-               return PyString_FromString(name);
+               return PyUnicode_FromString(name);
 }
 
 PyObject* KX_SoundActuator::PySetGain(PyObject* args)
@@ -699,7 +678,7 @@ PyObject* KX_SoundActuator::PyGetLooping()
 {
        ShowDeprecationWarning("getLooping()", "the looping property");
        int looping = (m_soundObject) ? m_soundObject->GetLoopMode() : (int)SND_LOOP_OFF;
-       PyObject* result = PyInt_FromLong(looping);
+       PyObject* result = PyLong_FromSsize_t(looping);
        
        return result;
 }
@@ -787,7 +766,7 @@ PyObject* KX_SoundActuator::PySetType(PyObject* args)
 PyObject* KX_SoundActuator::PyGetType()
 {
        ShowDeprecationWarning("getType()", "the mode property");
-       return PyInt_FromLong(m_type);
+       return PyLong_FromSsize_t(m_type);
 }
 // <-----