2.50: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19323...
[blender.git] / source / gameengine / Ketsji / KXNetwork / KX_NetworkMessageActuator.cpp
index 4e5f27d..2483a6b 100644 (file)
@@ -47,7 +47,7 @@ KX_NetworkMessageActuator::KX_NetworkMessageActuator(
        m_networkscene(networkscene),
        m_toPropName(toPropName),
        m_subject(subject),
-       m_bodyType(bodyType),
+       m_bPropBody(bodyType),
        m_body(body)
 {
 }
@@ -69,7 +69,7 @@ bool KX_NetworkMessageActuator::Update()
        }
        //printf("messageactuator true event\n");
 
-       if (m_bodyType == 1) // ACT_MESG_PROP in DNA_actuator_types.h
+       if (m_bPropBody) // ACT_MESG_PROP in DNA_actuator_types.h
        {
                m_networkscene->SendMessage(
                        m_toPropName,
@@ -105,22 +105,22 @@ CValue* KX_NetworkMessageActuator::GetReplica()
 
 /* Integration hooks -------------------------------------------------- */
 PyTypeObject KX_NetworkMessageActuator::Type = {
-       PyObject_HEAD_INIT(&PyType_Type)
+       PyObject_HEAD_INIT(NULL)
        0,
        "KX_NetworkMessageActuator",
-       sizeof(KX_NetworkMessageActuator),
+       sizeof(PyObjectPlus_Proxy),
        0,
-       PyDestructor,
+       py_base_dealloc,
        0,
-       __getattr,
-       __setattr,
-       0, //&MyPyCompare,
-       __repr,
-       0, //&cvalue_as_number,
        0,
        0,
        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_NetworkMessageActuator::Parents[] = {
@@ -132,6 +132,7 @@ PyParentObject KX_NetworkMessageActuator::Parents[] = {
 };
 
 PyMethodDef KX_NetworkMessageActuator::Methods[] = {
+       // Deprecated ----->
        {"setToPropName", (PyCFunction)
                KX_NetworkMessageActuator::sPySetToPropName, METH_VARARGS},
        {"setSubject", (PyCFunction)
@@ -140,26 +141,36 @@ PyMethodDef KX_NetworkMessageActuator::Methods[] = {
                KX_NetworkMessageActuator::sPySetBodyType, METH_VARARGS},
        {"setBody", (PyCFunction)
                KX_NetworkMessageActuator::sPySetBody, METH_VARARGS},
+       // <-----
        {NULL,NULL} // Sentinel
 };
 
 PyAttributeDef KX_NetworkMessageActuator::Attributes[] = {
+       KX_PYATTRIBUTE_STRING_RW("propName", 0, 100, false, KX_NetworkMessageActuator, m_toPropName),
+       KX_PYATTRIBUTE_STRING_RW("subject", 0, 100, false, KX_NetworkMessageActuator, m_subject),
+       KX_PYATTRIBUTE_BOOL_RW("usePropBody", KX_NetworkMessageActuator, m_bPropBody),
+       KX_PYATTRIBUTE_STRING_RW("body", 0, 100, false, KX_NetworkMessageActuator, m_body),
        { NULL }        //Sentinel
 };
 
-PyObject* KX_NetworkMessageActuator::_getattr(const char *attr) {
-       _getattr_up(SCA_IActuator);
+PyObject* KX_NetworkMessageActuator::py_getattro(PyObject *attr) {
+       py_getattro_up(SCA_IActuator);
 }
 
+int KX_NetworkMessageActuator::py_setattro(PyObject *attr, PyObject *value) {
+       py_setattro_up(SCA_IActuator);
+}
+
+// Deprecated ----->
 // 1. SetToPropName
 PyObject* KX_NetworkMessageActuator::PySetToPropName(
-       PyObject* self,
        PyObject* args,
        PyObject* kwds)
 {
+       ShowDeprecationWarning("setToProp()", "the propName property");
     char* ToPropName;
 
-       if (PyArg_ParseTuple(args, "s", &ToPropName)) {
+       if (PyArg_ParseTuple(args, "s:setToPropName", &ToPropName)) {
             m_toPropName = ToPropName;
        }
        else {
@@ -171,13 +182,13 @@ PyObject* KX_NetworkMessageActuator::PySetToPropName(
 
 // 2. SetSubject
 PyObject* KX_NetworkMessageActuator::PySetSubject(
-       PyObject* self,
        PyObject* args,
        PyObject* kwds)
 {
+       ShowDeprecationWarning("setSubject()", "the subject property");
     char* Subject;
 
-       if (PyArg_ParseTuple(args, "s", &Subject)) {
+       if (PyArg_ParseTuple(args, "s:setSubject", &Subject)) {
             m_subject = Subject;
        }
        else {
@@ -189,14 +200,14 @@ PyObject* KX_NetworkMessageActuator::PySetSubject(
 
 // 3. SetBodyType
 PyObject* KX_NetworkMessageActuator::PySetBodyType(
-       PyObject* self,
        PyObject* args,
        PyObject* kwds)
 {
+       ShowDeprecationWarning("setBodyType()", "the usePropBody property");
     int BodyType;
 
-       if (PyArg_ParseTuple(args, "i", &BodyType)) {
-            m_bodyType = BodyType;
+       if (PyArg_ParseTuple(args, "i:setBodyType", &BodyType)) {
+               m_bPropBody = (BodyType != 0);
        }
        else {
                return NULL;
@@ -207,13 +218,13 @@ PyObject* KX_NetworkMessageActuator::PySetBodyType(
 
 // 4. SetBody
 PyObject* KX_NetworkMessageActuator::PySetBody(
-       PyObject* self,
        PyObject* args,
        PyObject* kwds)
 {
+       ShowDeprecationWarning("setBody()", "the body property");
     char* Body;
 
-       if (PyArg_ParseTuple(args, "s", &Body)) {
+       if (PyArg_ParseTuple(args, "s:setBody", &Body)) {
             m_body = Body;
        }
        else {
@@ -223,3 +234,4 @@ PyObject* KX_NetworkMessageActuator::PySetBody(
        Py_RETURN_NONE;
 }
 
+// <----- Deprecated
\ No newline at end of file