svn merge -r 21041:21301 https://svn.blender.org/svnroot/bf-blender/branches/blender2...
[blender.git] / source / gameengine / Ketsji / KX_Light.cpp
index ae9e097a96e9fbbb576269bac8eb0ca2ac7f6204..fb385f8a9a2cb039bca314c13f725f45d086e685 100644 (file)
 KX_LightObject::KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks,
                                                           class RAS_IRenderTools* rendertools,
                                                           const RAS_LightObject&       lightobj,
-                                                          bool glsl,
-                                                          PyTypeObject* T
-                                                          )
- :
-       KX_GameObject(sgReplicationInfo,callbacks,T),
-               m_rendertools(rendertools)
+                                                          bool glsl)
+       : KX_GameObject(sgReplicationInfo,callbacks),
+         m_rendertools(rendertools)
 {
        m_lightobj = lightobj;
        m_lightobj.m_scene = sgReplicationInfo;
@@ -271,11 +268,6 @@ void KX_LightObject::UnbindShadowBuffer(RAS_IRasterizer *ras)
 /* Python Integration Hooks                                                                     */
 /* ------------------------------------------------------------------------- */
 
-PyObject* KX_LightObject::py_getattro_dict() {
-       py_getattro_dict_up(KX_GameObject);
-}
-
-
 PyTypeObject KX_LightObject::Type = {
 #if (PY_VERSION_HEX >= 0x02060000)
        PyVarObject_HEAD_INIT(NULL, 0)
@@ -297,20 +289,17 @@ PyTypeObject KX_LightObject::Type = {
                &KX_GameObject::Sequence,
                &KX_GameObject::Mapping,
                0,0,0,
-               py_base_getattro,
-               py_base_setattro,
+               NULL,
+               NULL,
                0,
-               Py_TPFLAGS_DEFAULT,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
                0,0,0,0,0,0,0,
-               Methods
-};
-
-PyParentObject KX_LightObject::Parents[] = {
-       &KX_LightObject::Type,
-       &KX_GameObject::Type,
-               &SCA_IObject::Type,
-               &CValue::Type,
-               NULL
+               Methods,
+               0,
+               0,
+               &KX_GameObject::Type,
+               0,0,0,0,0,0,
+               py_base_new
 };
 
 PyMethodDef KX_LightObject::Methods[] = {
@@ -362,11 +351,11 @@ PyObject* KX_LightObject::pyattr_get_typeconst(void *self_v, const KX_PYATTRIBUT
        const char* type = attrdef->m_name;
 
        if(strcmp(type, "SPOT")) {
-               retvalue = PyInt_FromLong(RAS_LightObject::LIGHT_SPOT);
+               retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_SPOT);
        } else if (strcmp(type, "SUN")) {
-               retvalue = PyInt_FromLong(RAS_LightObject::LIGHT_SUN);
+               retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_SUN);
        } else if (strcmp(type, "NORMAL")) {
-               retvalue = PyInt_FromLong(RAS_LightObject::LIGHT_NORMAL);
+               retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_NORMAL);
        }
 
        return retvalue;
@@ -375,13 +364,13 @@ PyObject* KX_LightObject::pyattr_get_typeconst(void *self_v, const KX_PYATTRIBUT
 PyObject* KX_LightObject::pyattr_get_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_LightObject* self = static_cast<KX_LightObject*>(self_v);
-       return PyInt_FromLong(self->m_lightobj.m_type);
+       return PyLong_FromSsize_t(self->m_lightobj.m_type);
 }
 
 int KX_LightObject::pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value)
 {
        KX_LightObject* self = static_cast<KX_LightObject*>(self_v);
-       int val = PyInt_AsLong(value);
+       int val = PyLong_AsSsize_t(value);
        if((val==-1 && PyErr_Occurred()) || val<0 || val>2) {
                PyErr_SetString(PyExc_ValueError, "light.type= val: KX_LightObject, expected an int between 0 and 2");
                return PY_SET_ATTR_FAIL;
@@ -401,14 +390,3 @@ int KX_LightObject::pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attr
 
        return PY_SET_ATTR_SUCCESS;
 }
-
-
-PyObject* KX_LightObject::py_getattro(PyObject *attr)
-{
-       py_getattro_up(KX_GameObject);
-}
-
-int KX_LightObject::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(KX_GameObject);
-}