Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r--source/gameengine/Ketsji/CMakeLists.txt73
-rw-r--r--source/gameengine/Ketsji/KXNetwork/CMakeLists.txt20
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp85
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h7
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp90
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h9
-rw-r--r--source/gameengine/Ketsji/KXNetwork/SConscript9
-rw-r--r--source/gameengine/Ketsji/KX_Camera.cpp92
-rw-r--r--source/gameengine/Ketsji/KX_Camera.h3
-rw-r--r--source/gameengine/Ketsji/KX_CameraActuator.cpp169
-rw-r--r--source/gameengine/Ketsji/KX_CameraActuator.h12
-rw-r--r--source/gameengine/Ketsji/KX_ConstraintActuator.cpp338
-rw-r--r--source/gameengine/Ketsji/KX_ConstraintActuator.h22
-rw-r--r--source/gameengine/Ketsji/KX_GameActuator.cpp37
-rw-r--r--source/gameengine/Ketsji/KX_GameActuator.h5
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp208
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.h13
-rw-r--r--source/gameengine/Ketsji/KX_IpoActuator.cpp276
-rw-r--r--source/gameengine/Ketsji/KX_IpoActuator.h31
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_MeshProxy.cpp20
-rw-r--r--source/gameengine/Ketsji/KX_MouseFocusSensor.cpp91
-rw-r--r--source/gameengine/Ketsji/KX_MouseFocusSensor.h17
-rw-r--r--source/gameengine/Ketsji/KX_ObjectActuator.cpp331
-rw-r--r--source/gameengine/Ketsji/KX_ObjectActuator.h23
-rw-r--r--source/gameengine/Ketsji/KX_ParentActuator.cpp55
-rw-r--r--source/gameengine/Ketsji/KX_ParentActuator.h5
-rw-r--r--source/gameengine/Ketsji/KX_PolyProxy.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_PyMath.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_PyMath.h9
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp60
-rw-r--r--source/gameengine/Ketsji/KX_PythonInitTypes.cpp3
-rw-r--r--source/gameengine/Ketsji/KX_PythonSeq.cpp40
-rw-r--r--source/gameengine/Ketsji/KX_RadarSensor.cpp54
-rw-r--r--source/gameengine/Ketsji/KX_RadarSensor.h5
-rw-r--r--source/gameengine/Ketsji/KX_RaySensor.cpp71
-rw-r--r--source/gameengine/Ketsji/KX_RaySensor.h6
-rw-r--r--source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp209
-rw-r--r--source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h19
-rw-r--r--source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp39
-rw-r--r--source/gameengine/Ketsji/KX_SCA_DynamicActuator.h5
-rw-r--r--source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp34
-rw-r--r--source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h9
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp161
-rw-r--r--source/gameengine/Ketsji/KX_Scene.h35
-rw-r--r--source/gameengine/Ketsji/KX_SceneActuator.cpp121
-rw-r--r--source/gameengine/Ketsji/KX_SceneActuator.h16
-rw-r--r--source/gameengine/Ketsji/KX_SoundActuator.cpp117
-rw-r--r--source/gameengine/Ketsji/KX_SoundActuator.h12
-rw-r--r--source/gameengine/Ketsji/KX_StateActuator.cpp55
-rw-r--r--source/gameengine/Ketsji/KX_StateActuator.h4
-rw-r--r--source/gameengine/Ketsji/KX_TouchSensor.cpp108
-rw-r--r--source/gameengine/Ketsji/KX_TouchSensor.h18
-rw-r--r--source/gameengine/Ketsji/KX_TrackToActuator.cpp127
-rw-r--r--source/gameengine/Ketsji/KX_TrackToActuator.h13
-rw-r--r--source/gameengine/Ketsji/KX_VisibilityActuator.cpp27
-rw-r--r--source/gameengine/Ketsji/KX_VisibilityActuator.h5
-rw-r--r--source/gameengine/Ketsji/SConscript6
58 files changed, 3126 insertions, 331 deletions
diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt
index 01d369bc7a9..77bdd80721f 100644
--- a/source/gameengine/Ketsji/CMakeLists.txt
+++ b/source/gameengine/Ketsji/CMakeLists.txt
@@ -27,45 +27,48 @@
FILE(GLOB SRC *.cpp)
SET(INC
- .
- ../../../source/kernel/gen_system
- ../../../intern/string
- ../../../intern/guardedalloc
- ../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer
- ../../../source/gameengine/Converter
- ../../../source/blender/imbuf
- ../../../intern/ghost/include
- ../../../intern/moto/include
- ../../../source/gameengine/Ketsji
- ../../../source/blender/blenlib
- ../../../source/blender/blenkernel
- ../../../source/blender/python
- ../../../source/blender/python/generic
- ../../../source/blender
- ../../../source/blender/include
- ../../../source/blender/makesdna
- ../../../source/gameengine/Rasterizer
- ../../../source/gameengine/GameLogic
- ../../../source/gameengine/Expressions
- ../../../source/gameengine/Ketsji/KXNetwork
- ../../../source/gameengine/Network
- ../../../source/gameengine/SceneGraph
- ../../../source/gameengine/Physics/common
- ../../../source/gameengine/Physics/Bullet
- ../../../source/gameengine/Network/LoopBackNetwork
- ../../../intern/audaspace/intern
- ../../../source/blender/misc
- ../../../source/blender/blenloader
- ../../../source/blender/gpu
- ../../../extern/bullet2/src
- ../../../extern/glew/include
- ${PYTHON_INC}
+ .
+ ../../../source/kernel/gen_system
+ ../../../intern/string
+ ../../../intern/guardedalloc
+ ../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer
+ ../../../source/gameengine/Converter
+ ../../../source/blender/imbuf
+ ../../../intern/ghost/include
+ ../../../intern/moto/include
+ ../../../source/gameengine/Ketsji
+ ../../../source/blender/blenlib
+ ../../../source/blender/blenkernel
+ ../../../source/blender/python
+ ../../../source/blender/python/generic
+ ../../../source/blender
+ ../../../source/blender/include
+ ../../../source/blender/makesdna
+ ../../../source/gameengine/Rasterizer
+ ../../../source/gameengine/GameLogic
+ ../../../source/gameengine/Expressions
+ ../../../source/gameengine/Ketsji/KXNetwork
+ ../../../source/gameengine/Network
+ ../../../source/gameengine/SceneGraph
+ ../../../source/gameengine/Physics/common
+ ../../../source/gameengine/Physics/Bullet
+ ../../../source/gameengine/Physics/Sumo
+ ../../../source/gameengine/Physics/Sumo/Fuzzics/include
+ ../../../source/gameengine/Network/LoopBackNetwork
+ ../../../intern/audaspace/intern
+ ../../../source/blender/misc
+ ../../../source/blender/blenloader
+ ../../../source/blender/gpu
+ ../../../extern/bullet2/src
+ ../../../extern/solid
+ ../../../extern/glew/include
+ ${PYTHON_INC}
)
IF(WITH_SDL)
- SET(INC ${INC} ${SDL_INCLUDE_DIR})
+ SET(INC ${INC} ${SDL_INCLUDE_DIR})
ELSE(WITH_SDL)
- ADD_DEFINITIONS(-DDISABLE_SDL)
+ ADD_DEFINITIONS(-DDISABLE_SDL)
ENDIF(WITH_SDL)
BLENDERLIB(bf_ketsji "${SRC}" "${INC}")
diff --git a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt
index b89b0dcff9f..d9a9fc54f4b 100644
--- a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt
+++ b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt
@@ -27,16 +27,16 @@
FILE(GLOB SRC *.cpp)
SET(INC
- .
- ../../../../source/kernel/gen_system
- ../../../../intern/string
- ../../../../intern/moto/include
- ../../../../source/gameengine/Ketsji
- ../../../../source/gameengine/GameLogic
- ../../../../source/gameengine/Expressions
- ../../../../source/gameengine/SceneGraph
- ../../../../source/gameengine/Network
- ${PYTHON_INC}
+ .
+ ../../../../source/kernel/gen_system
+ ../../../../intern/string
+ ../../../../intern/moto/include
+ ../../../../source/gameengine/Ketsji
+ ../../../../source/gameengine/GameLogic
+ ../../../../source/gameengine/Expressions
+ ../../../../source/gameengine/SceneGraph
+ ../../../../source/gameengine/Network
+ ${PYTHON_INC}
)
BLENDERLIB(kx_network "${SRC}" "${INC}")
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
index 3af8f765251..410cf308217 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
@@ -123,6 +123,16 @@ PyTypeObject KX_NetworkMessageActuator::Type = {
};
PyMethodDef KX_NetworkMessageActuator::Methods[] = {
+ // Deprecated ----->
+ {"setToPropName", (PyCFunction)
+ KX_NetworkMessageActuator::sPySetToPropName, METH_VARARGS},
+ {"setSubject", (PyCFunction)
+ KX_NetworkMessageActuator::sPySetSubject, METH_VARARGS},
+ {"setBodyType", (PyCFunction)
+ KX_NetworkMessageActuator::sPySetBodyType, METH_VARARGS},
+ {"setBody", (PyCFunction)
+ KX_NetworkMessageActuator::sPySetBody, METH_VARARGS},
+ // <-----
{NULL,NULL} // Sentinel
};
@@ -133,3 +143,78 @@ PyAttributeDef KX_NetworkMessageActuator::Attributes[] = {
KX_PYATTRIBUTE_STRING_RW("body", 0, 16384, false, KX_NetworkMessageActuator, m_body),
{ NULL } //Sentinel
};
+
+// Deprecated ----->
+// 1. SetToPropName
+PyObject* KX_NetworkMessageActuator::PySetToPropName(
+ PyObject* args,
+ PyObject* kwds)
+{
+ ShowDeprecationWarning("setToProp()", "the propName property");
+ char* ToPropName;
+
+ if (PyArg_ParseTuple(args, "s:setToPropName", &ToPropName)) {
+ m_toPropName = ToPropName;
+ }
+ else {
+ return NULL;
+ }
+
+ Py_RETURN_NONE;
+}
+
+// 2. SetSubject
+PyObject* KX_NetworkMessageActuator::PySetSubject(
+ PyObject* args,
+ PyObject* kwds)
+{
+ ShowDeprecationWarning("setSubject()", "the subject property");
+ char* Subject;
+
+ if (PyArg_ParseTuple(args, "s:setSubject", &Subject)) {
+ m_subject = Subject;
+ }
+ else {
+ return NULL;
+ }
+
+ Py_RETURN_NONE;
+}
+
+// 3. SetBodyType
+PyObject* KX_NetworkMessageActuator::PySetBodyType(
+ PyObject* args,
+ PyObject* kwds)
+{
+ ShowDeprecationWarning("setBodyType()", "the usePropBody property");
+ int BodyType;
+
+ if (PyArg_ParseTuple(args, "i:setBodyType", &BodyType)) {
+ m_bPropBody = (BodyType != 0);
+ }
+ else {
+ return NULL;
+ }
+
+ Py_RETURN_NONE;
+}
+
+// 4. SetBody
+PyObject* KX_NetworkMessageActuator::PySetBody(
+ PyObject* args,
+ PyObject* kwds)
+{
+ ShowDeprecationWarning("setBody()", "the body property");
+ char* Body;
+
+ if (PyArg_ParseTuple(args, "s:setBody", &Body)) {
+ m_body = Body;
+ }
+ else {
+ return NULL;
+ }
+
+ Py_RETURN_NONE;
+}
+
+// <----- Deprecated
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h
index fa7a674c250..b4f55f2a466 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h
@@ -60,6 +60,13 @@ public:
/* Python interface ------------------------------------------- */
/* ------------------------------------------------------------ */
+ // Deprecated ----->
+ KX_PYMETHOD(KX_NetworkMessageActuator, SetToPropName);
+ KX_PYMETHOD(KX_NetworkMessageActuator, SetSubject);
+ KX_PYMETHOD(KX_NetworkMessageActuator, SetBodyType);
+ KX_PYMETHOD(KX_NetworkMessageActuator, SetBody);
+ // <-----
+
};
#endif //__KX_NETWORKMESSAGEACTUATOR_H
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
index 392e9dd9d1b..7123277d4ef 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
@@ -53,6 +53,7 @@ KX_NetworkMessageSensor::KX_NetworkMessageSensor(
const STR_String &subject
) :
SCA_ISensor(gameobj,eventmgr),
+ m_Networkeventmgr(eventmgr),
m_NetworkScene(NetworkScene),
m_subject(subject),
m_frame_message_count (0),
@@ -186,6 +187,23 @@ PyTypeObject KX_NetworkMessageSensor::Type = {
};
PyMethodDef KX_NetworkMessageSensor::Methods[] = {
+ // Deprecated ----->
+ {"setSubjectFilterText", (PyCFunction)
+ KX_NetworkMessageSensor::sPySetSubjectFilterText, METH_O,
+ (const char *)SetSubjectFilterText_doc},
+ {"getFrameMessageCount", (PyCFunction)
+ KX_NetworkMessageSensor::sPyGetFrameMessageCount, METH_NOARGS,
+ (const char *)GetFrameMessageCount_doc},
+ {"getBodies", (PyCFunction)
+ KX_NetworkMessageSensor::sPyGetBodies, METH_NOARGS,
+ (const char *)GetBodies_doc},
+ {"getSubject", (PyCFunction)
+ KX_NetworkMessageSensor::sPyGetSubject, METH_NOARGS,
+ (const char *)GetSubject_doc},
+ {"getSubjects", (PyCFunction)
+ KX_NetworkMessageSensor::sPyGetSubjects, METH_NOARGS,
+ (const char *)GetSubjects_doc},
+ // <-----
{NULL,NULL} //Sentinel
};
@@ -216,3 +234,75 @@ PyObject* KX_NetworkMessageSensor::pyattr_get_subjects(void *self_v, const KX_PY
return (new CListValue())->NewProxy(true);
}
}
+
+// Deprecated ----->
+// 1. Set the message subject that this sensor listens for
+const char KX_NetworkMessageSensor::SetSubjectFilterText_doc[] =
+"\tsetSubjectFilterText(value)\n"
+"\tChange the message subject text that this sensor is listening to.\n";
+
+PyObject* KX_NetworkMessageSensor::PySetSubjectFilterText(PyObject* value)
+{
+ ShowDeprecationWarning("setSubjectFilterText()", "subject");
+ char* Subject = _PyUnicode_AsString(value);
+ if (Subject==NULL) {
+ PyErr_SetString(PyExc_TypeError, "sensor.tsetSubjectFilterText(string): KX_NetworkMessageSensor, expected a string message");
+ return NULL;
+ }
+
+ m_subject = Subject;
+ Py_RETURN_NONE;
+}
+
+// 2. Get the number of messages received since the last frame
+const char KX_NetworkMessageSensor::GetFrameMessageCount_doc[] =
+"\tgetFrameMessageCount()\n"
+"\tGet the number of messages received since the last frame.\n";
+
+PyObject* KX_NetworkMessageSensor::PyGetFrameMessageCount()
+{
+ ShowDeprecationWarning("getFrameMessageCount()", "frameMessageCount");
+ return PyLong_FromSsize_t(long(m_frame_message_count));
+}
+
+// 3. Get the message bodies
+const char KX_NetworkMessageSensor::GetBodies_doc[] =
+"\tgetBodies()\n"
+"\tGet the list of message bodies.\n";
+
+PyObject* KX_NetworkMessageSensor::PyGetBodies()
+{
+ ShowDeprecationWarning("getBodies()", "bodies");
+ if (m_BodyList) {
+ return m_BodyList->GetProxy();
+ } else {
+ return (new CListValue())->NewProxy(true);
+ }
+}
+
+// 4. Get the message subject: field of the message sensor
+const char KX_NetworkMessageSensor::GetSubject_doc[] =
+"\tgetSubject()\n"
+"\tGet the subject: field of the message sensor.\n";
+
+PyObject* KX_NetworkMessageSensor::PyGetSubject()
+{
+ ShowDeprecationWarning("getSubject()", "subject");
+ return PyUnicode_FromString(m_subject ? m_subject : "");
+}
+
+// 5. Get the message subjects
+const char KX_NetworkMessageSensor::GetSubjects_doc[] =
+"\tgetSubjects()\n"
+"\tGet list of message subjects.\n";
+
+PyObject* KX_NetworkMessageSensor::PyGetSubjects()
+{
+ ShowDeprecationWarning("getSubjects()", "subjects");
+ if (m_SubjectList) {
+ return m_SubjectList->GetProxy();
+ } else {
+ return (new CListValue())->NewProxy(true);
+ }
+}
+// <----- Deprecated
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h
index d8a0651d2f1..ade87697303 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h
@@ -39,6 +39,7 @@ class KX_NetworkMessageSensor : public SCA_ISensor
{
// note: Py_Header MUST BE the first listed here
Py_Header;
+ KX_NetworkEventManager *m_Networkeventmgr;
NG_NetworkScene *m_NetworkScene;
// The subject we filter on.
@@ -70,6 +71,14 @@ public:
/* Python interface -------------------------------------------- */
/* ------------------------------------------------------------- */
+ // Deprecated ----->
+ KX_PYMETHOD_DOC_O(KX_NetworkMessageSensor, SetSubjectFilterText);
+ KX_PYMETHOD_DOC_NOARGS(KX_NetworkMessageSensor, GetFrameMessageCount);
+ KX_PYMETHOD_DOC_NOARGS(KX_NetworkMessageSensor, GetBodies);
+ KX_PYMETHOD_DOC_NOARGS(KX_NetworkMessageSensor, GetSubject);
+ KX_PYMETHOD_DOC_NOARGS(KX_NetworkMessageSensor, GetSubjects);
+ // <-----
+
/* attributes */
static PyObject* pyattr_get_bodies(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_subjects(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
diff --git a/source/gameengine/Ketsji/KXNetwork/SConscript b/source/gameengine/Ketsji/KXNetwork/SConscript
index 8f88511acca..e6584b55ed2 100644
--- a/source/gameengine/Ketsji/KXNetwork/SConscript
+++ b/source/gameengine/Ketsji/KXNetwork/SConscript
@@ -9,4 +9,11 @@ incs += ' #source/gameengine/Network #source/gameengine/SceneGraph'
incs += ' ' + env['BF_PYTHON_INC']
-env.BlenderLib ( 'bf_network', Split(sources), Split(incs), defines=[],libtype=['core','player'], priority=[400,125], cxx_compileflags=env['BGE_CXXFLAGS'])
+cxxflags = []
+if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
+ cxxflags.append ('/GR')
+ cxxflags.append ('/O2')
+ cxxflags.append ('/EHsc')
+
+
+env.BlenderLib ( 'kx_network', Split(sources), Split(incs), defines=[],libtype=['core', 'player'], priority=[400, 145], cxx_compileflags=cxxflags )
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp
index 0832809772d..fd289a0b55e 100644
--- a/source/gameengine/Ketsji/KX_Camera.cpp
+++ b/source/gameengine/Ketsji/KX_Camera.cpp
@@ -496,6 +496,12 @@ PyMethodDef KX_Camera::Methods[] = {
KX_PYMETHODTABLE_O(KX_Camera, getScreenPosition),
KX_PYMETHODTABLE(KX_Camera, getScreenVect),
KX_PYMETHODTABLE(KX_Camera, getScreenRay),
+
+ // DEPRECATED
+ KX_PYMETHODTABLE_O(KX_Camera, enableViewport),
+ KX_PYMETHODTABLE_NOARGS(KX_Camera, getProjectionMatrix),
+ KX_PYMETHODTABLE_O(KX_Camera, setProjectionMatrix),
+
{NULL,NULL} //Sentinel
};
@@ -674,6 +680,92 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_Camera, getWorldToCamera,
return PyObjectFrom(GetWorldToCamera()); /* new ref */
}
+KX_PYMETHODDEF_DOC_NOARGS(KX_Camera, getProjectionMatrix,
+"getProjectionMatrix() -> Matrix4x4\n"
+"\treturns this camera's projection matrix, as a list of four lists of four values.\n\n"
+"\tie: [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]])\n"
+)
+{
+ ShowDeprecationWarning("getProjectionMatrix()", "the projection_matrix property");
+ return PyObjectFrom(GetProjectionMatrix()); /* new ref */
+}
+
+KX_PYMETHODDEF_DOC_O(KX_Camera, setProjectionMatrix,
+"setProjectionMatrix(MT_Matrix4x4 m) -> None\n"
+"\tSets this camera's projection matrix\n"
+"\n"
+"\tExample:\n"
+"\timport GameLogic\n"
+"\t# Set a perspective projection matrix\n"
+"\tdef Perspective(left, right, bottom, top, near, far):\n"
+"\t\tm = MT_Matrix4x4()\n"
+"\t\tm[0][0] = m[0][2] = right - left\n"
+"\t\tm[1][1] = m[1][2] = top - bottom\n"
+"\t\tm[2][2] = m[2][3] = -far - near\n"
+"\t\tm[3][2] = -1\n"
+"\t\tm[3][3] = 0\n"
+"\t\treturn m\n"
+"\n"
+"\t# Set an orthographic projection matrix\n"
+"\tdef Orthographic(left, right, bottom, top, near, far):\n"
+"\t\tm = MT_Matrix4x4()\n"
+"\t\tm[0][0] = right - left\n"
+"\t\tm[0][3] = -right - left\n"
+"\t\tm[1][1] = top - bottom\n"
+"\t\tm[1][3] = -top - bottom\n"
+"\t\tm[2][2] = far - near\n"
+"\t\tm[2][3] = -far - near\n"
+"\t\tm[3][3] = 1\n"
+"\t\treturn m\n"
+"\n"
+"\t# Set an isometric projection matrix\n"
+"\tdef Isometric(left, right, bottom, top, near, far):\n"
+"\t\tm = MT_Matrix4x4()\n"
+"\t\tm[0][0] = m[0][2] = m[1][1] = 0.8660254037844386\n"
+"\t\tm[1][0] = 0.25\n"
+"\t\tm[1][2] = -0.25\n"
+"\t\tm[3][3] = 1\n"
+"\t\treturn m\n"
+"\n"
+"\t"
+"\tco = GameLogic.getCurrentController()\n"
+"\tcam = co.getOwner()\n"
+"\tcam.setProjectionMatrix(Perspective(-1.0, 1.0, -1.0, 1.0, 0.1, 1))\n")
+{
+ ShowDeprecationWarning("setProjectionMatrix(mat)", "the projection_matrix property");
+
+ MT_Matrix4x4 mat;
+ if (!PyMatTo(value, mat))
+ {
+ PyErr_SetString(PyExc_TypeError, "camera.setProjectionMatrix(matrix): KX_Camera, expected 4x4 list as matrix argument.");
+ return NULL;
+ }
+
+ SetProjectionMatrix(mat);
+ Py_RETURN_NONE;
+}
+
+KX_PYMETHODDEF_DOC_O(KX_Camera, enableViewport,
+"enableViewport(viewport)\n"
+"Sets this camera's viewport status\n"
+)
+{
+ ShowDeprecationWarning("enableViewport(bool)", "the useViewport property");
+
+ int viewport = PyObject_IsTrue(value);
+ if (viewport == -1) {
+ PyErr_SetString(PyExc_ValueError, "camera.enableViewport(bool): KX_Camera, expected True/False or 0/1");
+ return NULL;
+ }
+
+ if(viewport)
+ EnableViewport(true);
+ else
+ EnableViewport(false);
+
+ Py_RETURN_NONE;
+}
+
KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, setViewport,
"setViewport(left, bottom, right, top)\n"
"Sets this camera's viewport\n")
diff --git a/source/gameengine/Ketsji/KX_Camera.h b/source/gameengine/Ketsji/KX_Camera.h
index bf7a39d93c8..74c8e6d4e4f 100644
--- a/source/gameengine/Ketsji/KX_Camera.h
+++ b/source/gameengine/Ketsji/KX_Camera.h
@@ -273,7 +273,10 @@ public:
KX_PYMETHOD_DOC_NOARGS(KX_Camera, getCameraToWorld);
KX_PYMETHOD_DOC_NOARGS(KX_Camera, getWorldToCamera);
+ KX_PYMETHOD_DOC_NOARGS(KX_Camera, getProjectionMatrix);
+ KX_PYMETHOD_DOC_O(KX_Camera, setProjectionMatrix);
+ KX_PYMETHOD_DOC_O(KX_Camera, enableViewport);
KX_PYMETHOD_DOC_VARARGS(KX_Camera, setViewport);
KX_PYMETHOD_DOC_NOARGS(KX_Camera, setOnTop);
diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp
index 9c00b5991af..faf0ca50407 100644
--- a/source/gameengine/Ketsji/KX_CameraActuator.cpp
+++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp
@@ -38,6 +38,9 @@
#include "PyObjectPlus.h"
+STR_String KX_CameraActuator::X_AXIS_STRING = "x";
+STR_String KX_CameraActuator::Y_AXIS_STRING = "y";
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -350,6 +353,15 @@ CValue *KX_CameraActuator::findObject(char *obName)
return NULL;
}
+bool KX_CameraActuator::string2axischoice(const char *axisString)
+{
+ bool res = true;
+
+ res = !(axisString == Y_AXIS_STRING);
+
+ return res;
+}
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
@@ -378,6 +390,17 @@ PyTypeObject KX_CameraActuator::Type = {
};
PyMethodDef KX_CameraActuator::Methods[] = {
+ // ---> deprecated (all)
+ {"setObject",(PyCFunction) KX_CameraActuator::sPySetObject, METH_O, (const char *)SetObject_doc},
+ {"getObject",(PyCFunction) KX_CameraActuator::sPyGetObject, METH_VARARGS, (const char *)GetObject_doc},
+ {"setMin" ,(PyCFunction) KX_CameraActuator::sPySetMin, METH_VARARGS, (const char *)SetMin_doc},
+ {"getMin" ,(PyCFunction) KX_CameraActuator::sPyGetMin, METH_NOARGS, (const char *)GetMin_doc},
+ {"setMax" ,(PyCFunction) KX_CameraActuator::sPySetMax, METH_VARARGS, (const char *)SetMax_doc},
+ {"getMax" ,(PyCFunction) KX_CameraActuator::sPyGetMax, METH_NOARGS, (const char *)GetMax_doc},
+ {"setHeight",(PyCFunction) KX_CameraActuator::sPySetHeight, METH_VARARGS, (const char *)SetHeight_doc},
+ {"getHeight",(PyCFunction) KX_CameraActuator::sPyGetHeight, METH_NOARGS, (const char *)GetHeight_doc},
+ {"setXY" ,(PyCFunction) KX_CameraActuator::sPySetXY, METH_VARARGS, (const char *)SetXY_doc},
+ {"getXY" ,(PyCFunction) KX_CameraActuator::sPyGetXY, METH_NOARGS, (const char *)GetXY_doc},
{NULL,NULL,NULL,NULL} //Sentinel
};
@@ -390,6 +413,152 @@ PyAttributeDef KX_CameraActuator::Attributes[] = {
{NULL}
};
+/* get obj ---------------------------------------------------------- */
+const char KX_CameraActuator::GetObject_doc[] =
+"getObject(name_only = 1)\n"
+"name_only - optional arg, when true will return the KX_GameObject rather then its name\n"
+"\tReturns the object this sensor reacts to.\n";
+PyObject* KX_CameraActuator::PyGetObject(PyObject* args)
+{
+ int ret_name_only = 1;
+
+ ShowDeprecationWarning("getObject()", "the object property");
+
+ if (!PyArg_ParseTuple(args, "|i:getObject", &ret_name_only))
+ return NULL;
+
+ if (!m_ob)
+ Py_RETURN_NONE;
+
+ if (ret_name_only)
+ return PyUnicode_FromString(m_ob->GetName().ReadPtr());
+ else
+ return m_ob->GetProxy();
+}
+/* set obj ---------------------------------------------------------- */
+const char KX_CameraActuator::SetObject_doc[] =
+"setObject(object)\n"
+"\t- object: KX_GameObject, string or None\n"
+"\tSets the object this sensor reacts to.\n";
+PyObject* KX_CameraActuator::PySetObject(PyObject* value)
+{
+ KX_GameObject *gameobj;
+
+ ShowDeprecationWarning("setObject()", "the object property");
+
+ if (!ConvertPythonToGameObject(value, &gameobj, true, "actuator.setObject(value): KX_CameraActuator"))
+ return NULL; // ConvertPythonToGameObject sets the error
+
+ if (m_ob != NULL)
+ m_ob->UnregisterActuator(this);
+
+ m_ob = (SCA_IObject*)gameobj;
+ if (m_ob)
+ m_ob->RegisterActuator(this);
+
+ Py_RETURN_NONE;
+}
+
+/* get min ---------------------------------------------------------- */
+const char KX_CameraActuator::GetMin_doc[] =
+"getMin\n"
+"\tReturns the minimum value set in the Min: field.\n";
+PyObject* KX_CameraActuator::PyGetMin()
+{
+ ShowDeprecationWarning("getMin()", "the min property");
+ return PyFloat_FromDouble(m_minHeight);
+}
+/* set min ---------------------------------------------------------- */
+const char KX_CameraActuator::SetMin_doc[] =
+"setMin\n"
+"\tSets the minimum value.\n";
+PyObject* KX_CameraActuator::PySetMin(PyObject* args)
+{
+ ShowDeprecationWarning("setMin()", "the min property");
+ float min;
+ if(PyArg_ParseTuple(args,"f:setMin", &min))
+ {
+ m_minHeight = min;
+ Py_RETURN_NONE;
+ }
+ return NULL;
+}
+/* get min ---------------------------------------------------------- */
+const char KX_CameraActuator::GetMax_doc[] =
+"getMax\n"
+"\tReturns the maximum value set in the Max: field.\n";
+PyObject* KX_CameraActuator::PyGetMax()
+{
+ ShowDeprecationWarning("getMax()", "the max property");
+ return PyFloat_FromDouble(m_maxHeight);
+}
+/* set min ---------------------------------------------------------- */
+const char KX_CameraActuator::SetMax_doc[] =
+"setMax\n"
+"\tSets the maximum value.\n";
+PyObject* KX_CameraActuator::PySetMax(PyObject* args)
+{
+ ShowDeprecationWarning("getMax()", "the max property");
+ float max;
+ if(PyArg_ParseTuple(args,"f:setMax", &max))
+ {
+ m_maxHeight = max;
+ Py_RETURN_NONE;
+ }
+ return NULL;
+}
+/* get height ---------------------------------------------------------- */
+const char KX_CameraActuator::GetHeight_doc[] =
+"getHeight\n"
+"\tReturns the height value set in the height: field.\n";
+PyObject* KX_CameraActuator::PyGetHeight()
+{
+ ShowDeprecationWarning("getHeight()", "the height property");
+ return PyFloat_FromDouble(m_height);
+}
+/* set height ---------------------------------------------------------- */
+const char KX_CameraActuator::SetHeight_doc[] =
+"setHeight\n"
+"\tSets the height value.\n";
+PyObject* KX_CameraActuator::PySetHeight(PyObject* args)
+{
+ ShowDeprecationWarning("getHeight()", "the height property");
+ float height;
+ if(PyArg_ParseTuple(args,"f:setHeight", &height))
+ {
+ m_height = height;
+ Py_RETURN_NONE;
+ }
+ return NULL;
+}
+/* set XY ---------------------------------------------------------- */
+const char KX_CameraActuator::SetXY_doc[] =
+"setXY\n"
+"\tSets axis the camera tries to get behind.\n"
+"\t1=x, 0=y\n";
+PyObject* KX_CameraActuator::PySetXY(PyObject* args)
+{
+ ShowDeprecationWarning("setXY()", "the useXY property");
+ int value;
+ if(PyArg_ParseTuple(args,"i:setXY", &value))
+ {
+ m_x = value != 0;
+ Py_RETURN_NONE;
+ }
+ return NULL;
+}
+
+/* get XY -------------------------------------------------------------*/
+const char KX_CameraActuator::GetXY_doc[] =
+"getXY\n"
+"\tGets the axis the camera tries to get behind.\n"
+"\tTrue = X, False = Y\n";
+PyObject* KX_CameraActuator::PyGetXY()
+{
+ ShowDeprecationWarning("getXY()", "the xy property");
+ return PyLong_FromSsize_t(m_x);
+}
+
PyObject* KX_CameraActuator::pyattr_get_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_CameraActuator* self= static_cast<KX_CameraActuator*>(self_v);
diff --git a/source/gameengine/Ketsji/KX_CameraActuator.h b/source/gameengine/Ketsji/KX_CameraActuator.h
index e047e3724ea..057c6fed770 100644
--- a/source/gameengine/Ketsji/KX_CameraActuator.h
+++ b/source/gameengine/Ketsji/KX_CameraActuator.h
@@ -119,6 +119,18 @@ private :
/* --------------------------------------------------------------------- */
/* set object to look at */
+ KX_PYMETHOD_DOC_O(KX_CameraActuator,SetObject);
+ /* get current object */
+ KX_PYMETHOD_DOC_VARARGS(KX_CameraActuator,GetObject);
+ KX_PYMETHOD_DOC_VARARGS(KX_CameraActuator,SetMin);
+ KX_PYMETHOD_DOC_NOARGS(KX_CameraActuator,GetMin);
+ KX_PYMETHOD_DOC_VARARGS(KX_CameraActuator,SetMax);
+ KX_PYMETHOD_DOC_NOARGS(KX_CameraActuator,GetMax);
+ KX_PYMETHOD_DOC_VARARGS(KX_CameraActuator,SetHeight);
+ KX_PYMETHOD_DOC_NOARGS(KX_CameraActuator,GetHeight);
+ KX_PYMETHOD_DOC_VARARGS(KX_CameraActuator,SetXY);
+ KX_PYMETHOD_DOC_NOARGS(KX_CameraActuator,GetXY);
+
static PyObject* pyattr_get_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
index 7f1d2c7d53c..5f6244c3ab6 100644
--- a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
@@ -587,6 +587,30 @@ PyTypeObject KX_ConstraintActuator::Type = {
};
PyMethodDef KX_ConstraintActuator::Methods[] = {
+ // Deprecated -->
+ {"setDamp", (PyCFunction) KX_ConstraintActuator::sPySetDamp, METH_VARARGS, (const char *)SetDamp_doc},
+ {"getDamp", (PyCFunction) KX_ConstraintActuator::sPyGetDamp, METH_NOARGS, (const char *)GetDamp_doc},
+ {"setRotDamp", (PyCFunction) KX_ConstraintActuator::sPySetRotDamp, METH_VARARGS, (const char *)SetRotDamp_doc},
+ {"getRotDamp", (PyCFunction) KX_ConstraintActuator::sPyGetRotDamp, METH_NOARGS, (const char *)GetRotDamp_doc},
+ {"setDirection", (PyCFunction) KX_ConstraintActuator::sPySetDirection, METH_VARARGS, (const char *)SetDirection_doc},
+ {"getDirection", (PyCFunction) KX_ConstraintActuator::sPyGetDirection, METH_NOARGS, (const char *)GetDirection_doc},
+ {"setOption", (PyCFunction) KX_ConstraintActuator::sPySetOption, METH_VARARGS, (const char *)SetOption_doc},
+ {"getOption", (PyCFunction) KX_ConstraintActuator::sPyGetOption, METH_NOARGS, (const char *)GetOption_doc},
+ {"setTime", (PyCFunction) KX_ConstraintActuator::sPySetTime, METH_VARARGS, (const char *)SetTime_doc},
+ {"getTime", (PyCFunction) KX_ConstraintActuator::sPyGetTime, METH_NOARGS, (const char *)GetTime_doc},
+ {"setProperty", (PyCFunction) KX_ConstraintActuator::sPySetProperty, METH_VARARGS, (const char *)SetProperty_doc},
+ {"getProperty", (PyCFunction) KX_ConstraintActuator::sPyGetProperty, METH_NOARGS, (const char *)GetProperty_doc},
+ {"setMin", (PyCFunction) KX_ConstraintActuator::sPySetMin, METH_VARARGS, (const char *)SetMin_doc},
+ {"getMin", (PyCFunction) KX_ConstraintActuator::sPyGetMin, METH_NOARGS, (const char *)GetMin_doc},
+ {"setDistance", (PyCFunction) KX_ConstraintActuator::sPySetMin, METH_VARARGS, (const char *)SetDistance_doc},
+ {"getDistance", (PyCFunction) KX_ConstraintActuator::sPyGetMin, METH_NOARGS, (const char *)GetDistance_doc},
+ {"setMax", (PyCFunction) KX_ConstraintActuator::sPySetMax, METH_VARARGS, (const char *)SetMax_doc},
+ {"getMax", (PyCFunction) KX_ConstraintActuator::sPyGetMax, METH_NOARGS, (const char *)GetMax_doc},
+ {"setRayLength", (PyCFunction) KX_ConstraintActuator::sPySetMax, METH_VARARGS, (const char *)SetRayLength_doc},
+ {"getRayLength", (PyCFunction) KX_ConstraintActuator::sPyGetMax, METH_NOARGS, (const char *)GetRayLength_doc},
+ {"setLimit", (PyCFunction) KX_ConstraintActuator::sPySetLimit, METH_VARARGS, (const char *)SetLimit_doc},
+ {"getLimit", (PyCFunction) KX_ConstraintActuator::sPyGetLimit, METH_NOARGS, (const char *)GetLimit_doc},
+ // <--
{NULL,NULL} //Sentinel
};
@@ -618,4 +642,318 @@ int KX_ConstraintActuator::pyattr_check_direction(void *self, const struct KX_PY
return 0;
}
+/* 2. setDamp */
+const char KX_ConstraintActuator::SetDamp_doc[] =
+"setDamp(duration)\n"
+"\t- duration: integer\n"
+"\tSets the time constant of the orientation and distance constraint.\n"
+"\tIf the duration is negative, it is set to 0.\n";
+PyObject* KX_ConstraintActuator::PySetDamp(PyObject* args) {
+ ShowDeprecationWarning("setDamp()", "the damp property");
+ int dampArg;
+ if(!PyArg_ParseTuple(args, "i:setDamp", &dampArg)) {
+ return NULL;
+ }
+
+ m_posDampTime = dampArg;
+ if (m_posDampTime < 0) m_posDampTime = 0;
+
+ Py_RETURN_NONE;
+}
+/* 3. getDamp */
+const char KX_ConstraintActuator::GetDamp_doc[] =
+"getDamp()\n"
+"\tReturns the damping parameter.\n";
+PyObject* KX_ConstraintActuator::PyGetDamp(){
+ ShowDeprecationWarning("getDamp()", "the damp property");
+ return PyLong_FromSsize_t(m_posDampTime);
+}
+
+/* 2. setRotDamp */
+const char KX_ConstraintActuator::SetRotDamp_doc[] =
+"setRotDamp(duration)\n"
+"\t- duration: integer\n"
+"\tSets the time constant of the orientation constraint.\n"
+"\tIf the duration is negative, it is set to 0.\n";
+PyObject* KX_ConstraintActuator::PySetRotDamp(PyObject* args) {
+ ShowDeprecationWarning("setRotDamp()", "the rotDamp property");
+ int dampArg;
+ if(!PyArg_ParseTuple(args, "i:setRotDamp", &dampArg)) {
+ return NULL;
+ }
+
+ m_rotDampTime = dampArg;
+ if (m_rotDampTime < 0) m_rotDampTime = 0;
+
+ Py_RETURN_NONE;
+}
+/* 3. getRotDamp */
+const char KX_ConstraintActuator::GetRotDamp_doc[] =
+"getRotDamp()\n"
+"\tReturns the damping time for application of the constraint.\n";
+PyObject* KX_ConstraintActuator::PyGetRotDamp(){
+ ShowDeprecationWarning("getRotDamp()", "the rotDamp property");
+ return PyLong_FromSsize_t(m_rotDampTime);
+}
+
+/* 2. setDirection */
+const char KX_ConstraintActuator::SetDirection_doc[] =
+"setDirection(vector)\n"
+"\t- vector: 3-tuple\n"
+"\tSets the reference direction in world coordinate for the orientation constraint.\n";
+PyObject* KX_ConstraintActuator::PySetDirection(PyObject* args) {
+ ShowDeprecationWarning("setDirection()", "the direction property");
+ float x, y, z;
+ MT_Scalar len;
+ MT_Vector3 dir;
+
+ if(!PyArg_ParseTuple(args, "(fff):setDirection", &x, &y, &z)) {
+ return NULL;
+ }
+ dir[0] = x;
+ dir[1] = y;
+ dir[2] = z;
+ len = dir.length();
+ if (MT_fuzzyZero(len)) {
+ std::cout << "Invalid direction" << std::endl;
+ return NULL;
+ }
+ m_refDirVector = dir/len;
+ m_refDirection[0] = x/len;
+ m_refDirection[1] = y/len;
+ m_refDirection[2] = z/len;
+
+ Py_RETURN_NONE;
+}
+/* 3. getDirection */
+const char KX_ConstraintActuator::GetDirection_doc[] =
+"getDirection()\n"
+"\tReturns the reference direction of the orientation constraint as a 3-tuple.\n";
+PyObject* KX_ConstraintActuator::PyGetDirection(){
+ ShowDeprecationWarning("getDirection()", "the direction property");
+ PyObject *retVal = PyList_New(3);
+
+ PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(m_refDirection[0]));
+ PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(m_refDirection[1]));
+ PyList_SET_ITEM(retVal, 2, PyFloat_FromDouble(m_refDirection[2]));
+ return retVal;
+}
+
+/* 2. setOption */
+const char KX_ConstraintActuator::SetOption_doc[] =
+"setOption(option)\n"
+"\t- option: integer\n"
+"\tSets several options of the distance constraint.\n"
+"\tBinary combination of the following values:\n"
+"\t\t 64 : Activate alignment to surface\n"
+"\t\t128 : Detect material rather than property\n"
+"\t\t256 : No deactivation if ray does not hit target\n"
+"\t\t512 : Activate distance control\n";
+PyObject* KX_ConstraintActuator::PySetOption(PyObject* args) {
+ ShowDeprecationWarning("setOption()", "the option property");
+ int option;
+ if(!PyArg_ParseTuple(args, "i:setOption", &option)) {
+ return NULL;
+ }
+
+ m_option = option;
+
+ Py_RETURN_NONE;
+}
+/* 3. getOption */
+const char KX_ConstraintActuator::GetOption_doc[] =
+"getOption()\n"
+"\tReturns the option parameter.\n";
+PyObject* KX_ConstraintActuator::PyGetOption(){
+ ShowDeprecationWarning("getOption()", "the option property");
+ return PyLong_FromSsize_t(m_option);
+}
+
+/* 2. setTime */
+const char KX_ConstraintActuator::SetTime_doc[] =
+"setTime(duration)\n"
+"\t- duration: integer\n"
+"\tSets the activation time of the actuator.\n"
+"\tThe actuator disables itself after this many frame.\n"
+"\tIf set to 0 or negative, the actuator is not limited in time.\n";
+PyObject* KX_ConstraintActuator::PySetTime(PyObject* args) {
+ ShowDeprecationWarning("setTime()", "the time property");
+ int t;
+ if(!PyArg_ParseTuple(args, "i:setTime", &t)) {
+ return NULL;
+ }
+
+ if (t < 0)
+ t = 0;
+ m_activeTime = t;
+
+ Py_RETURN_NONE;
+}
+/* 3. getTime */
+const char KX_ConstraintActuator::GetTime_doc[] =
+"getTime()\n"
+"\tReturns the time parameter.\n";
+PyObject* KX_ConstraintActuator::PyGetTime(){
+ ShowDeprecationWarning("getTime()", "the time property");
+ return PyLong_FromSsize_t(m_activeTime);
+}
+
+/* 2. setProperty */
+const char KX_ConstraintActuator::SetProperty_doc[] =
+"setProperty(property)\n"
+"\t- property: string\n"
+"\tSets the name of the property or material for the ray detection of the distance constraint.\n"
+"\tIf empty, the ray will detect any collisioning object.\n";
+PyObject* KX_ConstraintActuator::PySetProperty(PyObject* args) {
+ ShowDeprecationWarning("setProperty()", "the 'property' property");
+ char *property;
+ if (!PyArg_ParseTuple(args, "s:setProperty", &property)) {
+ return NULL;
+ }
+ if (property == NULL) {
+ m_property = "";
+ } else {
+ m_property = property;
+ }
+
+ Py_RETURN_NONE;
+}
+/* 3. getProperty */
+const char KX_ConstraintActuator::GetProperty_doc[] =
+"getProperty()\n"
+"\tReturns the property parameter.\n";
+PyObject* KX_ConstraintActuator::PyGetProperty(){
+ ShowDeprecationWarning("getProperty()", "the 'property' property");
+ return PyUnicode_FromString(m_property.Ptr());
+}
+
+/* 4. setDistance */
+const char KX_ConstraintActuator::SetDistance_doc[] =
+"setDistance(distance)\n"
+"\t- distance: float\n"
+"\tSets the target distance in distance constraint\n";
+/* 4. setMin */
+const char KX_ConstraintActuator::SetMin_doc[] =
+"setMin(lower_bound)\n"
+"\t- lower_bound: float\n"
+"\tSets the lower value of the interval to which the value\n"
+"\tis clipped.\n";
+PyObject* KX_ConstraintActuator::PySetMin(PyObject* args) {
+ ShowDeprecationWarning("setMin() or setDistance()", "the min or distance property");
+ float minArg;
+ if(!PyArg_ParseTuple(args, "f:setMin", &minArg)) {
+ return NULL;
+ }
+
+ switch (m_locrot) {
+ default:
+ m_minimumBound = minArg;
+ break;
+ case KX_ACT_CONSTRAINT_ROTX:
+ case KX_ACT_CONSTRAINT_ROTY:
+ case KX_ACT_CONSTRAINT_ROTZ:
+ m_minimumBound = MT_radians(minArg);
+ break;
+ }
+
+ Py_RETURN_NONE;
+}
+/* 5. getDistance */
+const char KX_ConstraintActuator::GetDistance_doc[] =
+"getDistance()\n"
+"\tReturns the distance parameter \n";
+/* 5. getMin */
+const char KX_ConstraintActuator::GetMin_doc[] =
+"getMin()\n"
+"\tReturns the lower value of the interval to which the value\n"
+"\tis clipped.\n";
+PyObject* KX_ConstraintActuator::PyGetMin() {
+ ShowDeprecationWarning("getMin() or getDistance()", "the min or distance property");
+ return PyFloat_FromDouble(m_minimumBound);
+}
+
+/* 6. setRayLength */
+const char KX_ConstraintActuator::SetRayLength_doc[] =
+"setRayLength(length)\n"
+"\t- length: float\n"
+"\tSets the maximum ray length of the distance constraint\n";
+/* 6. setMax */
+const char KX_ConstraintActuator::SetMax_doc[] =
+"setMax(upper_bound)\n"
+"\t- upper_bound: float\n"
+"\tSets the upper value of the interval to which the value\n"
+"\tis clipped.\n";
+PyObject* KX_ConstraintActuator::PySetMax(PyObject* args){
+ ShowDeprecationWarning("setMax() or setRayLength()", "the max or rayLength property");
+ float maxArg;
+ if(!PyArg_ParseTuple(args, "f:setMax", &maxArg)) {
+ return NULL;
+ }
+
+ switch (m_locrot) {
+ default:
+ m_maximumBound = maxArg;
+ break;
+ case KX_ACT_CONSTRAINT_ROTX:
+ case KX_ACT_CONSTRAINT_ROTY:
+ case KX_ACT_CONSTRAINT_ROTZ:
+ m_maximumBound = MT_radians(maxArg);
+ break;
+ }
+
+ Py_RETURN_NONE;
+}
+/* 7. getRayLength */
+const char KX_ConstraintActuator::GetRayLength_doc[] =
+"getRayLength()\n"
+"\tReturns the length of the ray\n";
+/* 7. getMax */
+const char KX_ConstraintActuator::GetMax_doc[] =
+"getMax()\n"
+"\tReturns the upper value of the interval to which the value\n"
+"\tis clipped.\n";
+PyObject* KX_ConstraintActuator::PyGetMax() {
+ ShowDeprecationWarning("getMax() or getRayLength()", "the max or rayLength property");
+ return PyFloat_FromDouble(m_maximumBound);
+}
+
+
+/* This setter/getter probably for the constraint type */
+/* 8. setLimit */
+const char KX_ConstraintActuator::SetLimit_doc[] =
+"setLimit(type)\n"
+"\t- type: integer\n"
+"\t 1 : LocX\n"
+"\t 2 : LocY\n"
+"\t 3 : LocZ\n"
+"\t 7 : Distance along +X axis\n"
+"\t 8 : Distance along +Y axis\n"
+"\t 9 : Distance along +Z axis\n"
+"\t 10 : Distance along -X axis\n"
+"\t 11 : Distance along -Y axis\n"
+"\t 12 : Distance along -Z axis\n"
+"\t 13 : Align X axis\n"
+"\t 14 : Align Y axis\n"
+"\t 15 : Align Z axis\n"
+"\tSets the type of constraint.\n";
+PyObject* KX_ConstraintActuator::PySetLimit(PyObject* args) {
+ ShowDeprecationWarning("setLimit()", "the limit property");
+ int locrotArg;
+ if(!PyArg_ParseTuple(args, "i:setLimit", &locrotArg)) {
+ return NULL;
+ }
+
+ if (IsValidMode((KX_CONSTRAINTTYPE)locrotArg)) m_locrot = locrotArg;
+
+ Py_RETURN_NONE;
+}
+/* 9. getLimit */
+const char KX_ConstraintActuator::GetLimit_doc[] =
+"getLimit()\n"
+"\tReturns the type of constraint.\n";
+PyObject* KX_ConstraintActuator::PyGetLimit() {
+ ShowDeprecationWarning("setLimit()", "the limit property");
+ return PyLong_FromSsize_t(m_locrot);
+}
+
/* eof */
diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.h b/source/gameengine/Ketsji/KX_ConstraintActuator.h
index 9b6ed59e75c..677904aedc9 100644
--- a/source/gameengine/Ketsji/KX_ConstraintActuator.h
+++ b/source/gameengine/Ketsji/KX_ConstraintActuator.h
@@ -143,6 +143,28 @@ protected:
static int pyattr_check_direction(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_check_min(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
+ KX_PYMETHOD_DOC_VARARGS(KX_ConstraintActuator,SetDamp);
+ KX_PYMETHOD_DOC_NOARGS(KX_ConstraintActuator,GetDamp);
+ KX_PYMETHOD_DOC_VARARGS(KX_ConstraintActuator,SetRotDamp);
+ KX_PYMETHOD_DOC_NOARGS(KX_ConstraintActuator,GetRotDamp);
+ KX_PYMETHOD_DOC_VARARGS(KX_ConstraintActuator,SetDirection);
+ KX_PYMETHOD_DOC_NOARGS(KX_ConstraintActuator,GetDirection);
+ KX_PYMETHOD_DOC_VARARGS(KX_ConstraintActuator,SetOption);
+ KX_PYMETHOD_DOC_NOARGS(KX_ConstraintActuator,GetOption);
+ KX_PYMETHOD_DOC_VARARGS(KX_ConstraintActuator,SetTime);
+ KX_PYMETHOD_DOC_NOARGS(KX_ConstraintActuator,GetTime);
+ KX_PYMETHOD_DOC_VARARGS(KX_ConstraintActuator,SetProperty);
+ KX_PYMETHOD_DOC_NOARGS(KX_ConstraintActuator,GetProperty);
+ KX_PYMETHOD_DOC_VARARGS(KX_ConstraintActuator,SetMin);
+ KX_PYMETHOD_DOC_NOARGS(KX_ConstraintActuator,GetMin);
+ static const char SetDistance_doc[];
+ static const char GetDistance_doc[];
+ KX_PYMETHOD_DOC_VARARGS(KX_ConstraintActuator,SetMax);
+ KX_PYMETHOD_DOC_NOARGS(KX_ConstraintActuator,GetMax);
+ static const char SetRayLength_doc[];
+ static const char GetRayLength_doc[];
+ KX_PYMETHOD_DOC_VARARGS(KX_ConstraintActuator,SetLimit);
+ KX_PYMETHOD_DOC_NOARGS(KX_ConstraintActuator,GetLimit);
};
#endif //__KX_CONSTRAINTACTUATOR
diff --git a/source/gameengine/Ketsji/KX_GameActuator.cpp b/source/gameengine/Ketsji/KX_GameActuator.cpp
index 42dc4d8fd24..3f67de1e9a9 100644
--- a/source/gameengine/Ketsji/KX_GameActuator.cpp
+++ b/source/gameengine/Ketsji/KX_GameActuator.cpp
@@ -230,6 +230,10 @@ PyTypeObject KX_GameActuator::Type = {
PyMethodDef KX_GameActuator::Methods[] =
{
+ // Deprecated ----->
+ {"getFile", (PyCFunction) KX_GameActuator::sPyGetFile, METH_VARARGS, (const char *)GetFile_doc},
+ {"setFile", (PyCFunction) KX_GameActuator::sPySetFile, METH_VARARGS, (const char *)SetFile_doc},
+ // <-----
{NULL,NULL} //Sentinel
};
@@ -238,3 +242,36 @@ PyAttributeDef KX_GameActuator::Attributes[] = {
KX_PYATTRIBUTE_INT_RW("mode", KX_GAME_NODEF+1, KX_GAME_MAX-1, true, KX_GameActuator, m_mode),
{ NULL } //Sentinel
};
+
+// Deprecated ----->
+/* getFile */
+const char KX_GameActuator::GetFile_doc[] =
+"getFile()\n"
+"get the name of the file to start.\n";
+PyObject* KX_GameActuator::PyGetFile(PyObject* args, PyObject* kwds)
+{
+ ShowDeprecationWarning("getFile()", "the fileName property");
+ return PyUnicode_FromString(m_filename);
+}
+
+/* setFile */
+const char KX_GameActuator::SetFile_doc[] =
+"setFile(name)\n"
+"set the name of the file to start.\n";
+PyObject* KX_GameActuator::PySetFile(PyObject* args, PyObject* kwds)
+{
+ char* new_file;
+
+ ShowDeprecationWarning("setFile()", "the fileName property");
+
+ if (!PyArg_ParseTuple(args, "s:setFile", &new_file))
+ {
+ return NULL;
+ }
+
+ m_filename = STR_String(new_file);
+
+ Py_RETURN_NONE;
+
+}
+// <-----
diff --git a/source/gameengine/Ketsji/KX_GameActuator.h b/source/gameengine/Ketsji/KX_GameActuator.h
index 37d09a5a9fb..cabbf827b40 100644
--- a/source/gameengine/Ketsji/KX_GameActuator.h
+++ b/source/gameengine/Ketsji/KX_GameActuator.h
@@ -75,6 +75,11 @@ protected:
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
+
+ // Deprecated functions ----->
+ KX_PYMETHOD_DOC(KX_GameActuator,GetFile);
+ KX_PYMETHOD_DOC(KX_GameActuator,SetFile);
+ // <-----
}; /* end of class KX_GameActuator */
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 8193aa8c37b..146b83abd17 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -464,7 +464,7 @@ void KX_GameObject::AddMeshUser()
double* fl = GetOpenGLMatrixPtr()->getPointer();
SG_QList::iterator<RAS_MeshSlot> mit(m_meshSlots);
-// RAS_MeshSlot* ms;
+ RAS_MeshSlot* ms;
for(mit.begin(); !mit.end(); ++mit)
{
(*mit)->m_OpenGLMatrix = fl;
@@ -1383,8 +1383,8 @@ PyMethodDef KX_GameObject::Methods[] = {
{"setVisible",(PyCFunction) KX_GameObject::sPySetVisible, METH_VARARGS},
{"setOcclusion",(PyCFunction) KX_GameObject::sPySetOcclusion, METH_VARARGS},
{"removeParent", (PyCFunction)KX_GameObject::sPyRemoveParent,METH_NOARGS},
-
-
+ {"getChildren", (PyCFunction)KX_GameObject::sPyGetChildren,METH_NOARGS},
+ {"getChildrenRecursive", (PyCFunction)KX_GameObject::sPyGetChildrenRecursive,METH_NOARGS},
{"getPhysicsId", (PyCFunction)KX_GameObject::sPyGetPhysicsId,METH_NOARGS},
{"getPropertyNames", (PyCFunction)KX_GameObject::sPyGetPropertyNames,METH_NOARGS},
{"replaceMesh",(PyCFunction) KX_GameObject::sPyReplaceMesh, METH_VARARGS},
@@ -1398,8 +1398,21 @@ PyMethodDef KX_GameObject::Methods[] = {
KX_PYMETHODTABLE(KX_GameObject, sendMessage),
// dict style access for props
+ {"has_key",(PyCFunction) KX_GameObject::sPyhas_key, METH_O},
{"get",(PyCFunction) KX_GameObject::sPyget, METH_VARARGS},
+ // deprecated
+ {"getPosition", (PyCFunction) KX_GameObject::sPyGetPosition, METH_NOARGS},
+ {"setPosition", (PyCFunction) KX_GameObject::sPySetPosition, METH_O},
+ {"setWorldPosition", (PyCFunction) KX_GameObject::sPySetWorldPosition, METH_O},
+ {"getOrientation", (PyCFunction) KX_GameObject::sPyGetOrientation, METH_NOARGS},
+ {"setOrientation", (PyCFunction) KX_GameObject::sPySetOrientation, METH_O},
+ {"getState",(PyCFunction) KX_GameObject::sPyGetState, METH_NOARGS},
+ {"setState",(PyCFunction) KX_GameObject::sPySetState, METH_O},
+ {"getParent", (PyCFunction)KX_GameObject::sPyGetParent,METH_NOARGS},
+ {"getVisible",(PyCFunction) KX_GameObject::sPyGetVisible, METH_NOARGS},
+ {"getMass", (PyCFunction) KX_GameObject::sPyGetMass, METH_NOARGS},
+ {"getMesh", (PyCFunction)KX_GameObject::sPyGetMesh,METH_VARARGS},
{NULL,NULL} //Sentinel
};
@@ -1502,6 +1515,13 @@ PyObject* KX_GameObject::PyReinstancePhysicsMesh(PyObject* args)
Py_RETURN_FALSE;
}
+
+PyObject* KX_GameObject::PyGetPosition()
+{
+ ShowDeprecationWarning("getPosition()", "the position property");
+ return PyObjectFrom(NodeGetWorldPosition());
+}
+
static PyObject *Map_GetItem(PyObject *self_v, PyObject *item)
{
KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(self_v);
@@ -1797,10 +1817,10 @@ int KX_GameObject::pyattr_set_visible(void *self_v, const KX_PYATTRIBUTE_DEF *at
PyObject* KX_GameObject::pyattr_get_worldPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
+ KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
#ifdef USE_MATHUTILS
- return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_POS_GLOBAL);
+ return newVectorObject_cb((PyObject *)self_v, 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_POS_GLOBAL);
#else
- KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
return PyObjectFrom(self->NodeGetWorldPosition());
#endif
}
@@ -1819,10 +1839,10 @@ int KX_GameObject::pyattr_set_worldPosition(void *self_v, const KX_PYATTRIBUTE_D
PyObject* KX_GameObject::pyattr_get_localPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
+ KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
#ifdef USE_MATHUTILS
- return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_POS_LOCAL);
+ return newVectorObject_cb((PyObject *)self_v, 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_POS_LOCAL);
#else
- KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
return PyObjectFrom(self->NodeGetLocalPosition());
#endif
}
@@ -1841,10 +1861,10 @@ int KX_GameObject::pyattr_set_localPosition(void *self_v, const KX_PYATTRIBUTE_D
PyObject* KX_GameObject::pyattr_get_localInertia(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
+ KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
#ifdef USE_MATHUTILS
- return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_INERTIA_LOCAL);
+ return newVectorObject_cb((PyObject *)self_v, 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_INERTIA_LOCAL);
#else
- KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
if (self->GetPhysicsController())
return PyObjectFrom(self->GetPhysicsController()->GetLocalInertia());
return Py_BuildValue("fff", 0.0f, 0.0f, 0.0f);
@@ -1854,7 +1874,7 @@ PyObject* KX_GameObject::pyattr_get_localInertia(void *self_v, const KX_PYATTRIB
PyObject* KX_GameObject::pyattr_get_worldOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
#ifdef USE_MATHUTILS
- return newMatrixObject_cb(BGE_PROXY_FROM_REF(self_v), 3, 3, mathutils_kxgameob_matrix_cb_index, MATHUTILS_MAT_CB_ORI_GLOBAL);
+ return newMatrixObject_cb((PyObject *)self_v, 3, 3, mathutils_kxgameob_matrix_cb_index, MATHUTILS_MAT_CB_ORI_GLOBAL);
#else
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
return PyObjectFrom(self->NodeGetWorldOrientation());
@@ -1879,7 +1899,7 @@ int KX_GameObject::pyattr_set_worldOrientation(void *self_v, const KX_PYATTRIBUT
PyObject* KX_GameObject::pyattr_get_localOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
#ifdef USE_MATHUTILS
- return newMatrixObject_cb(BGE_PROXY_FROM_REF(self_v), 3, 3, mathutils_kxgameob_matrix_cb_index, MATHUTILS_MAT_CB_ORI_LOCAL);
+ return newMatrixObject_cb((PyObject *)self_v, 3, 3, mathutils_kxgameob_matrix_cb_index, MATHUTILS_MAT_CB_ORI_LOCAL);
#else
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
return PyObjectFrom(self->NodeGetLocalOrientation());
@@ -1902,20 +1922,20 @@ int KX_GameObject::pyattr_set_localOrientation(void *self_v, const KX_PYATTRIBUT
PyObject* KX_GameObject::pyattr_get_worldScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
+ KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
#ifdef USE_MATHUTILS
- return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_SCALE_GLOBAL);
+ return newVectorObject_cb((PyObject *)self_v, 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_SCALE_GLOBAL);
#else
- KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
return PyObjectFrom(self->NodeGetWorldScaling());
#endif
}
PyObject* KX_GameObject::pyattr_get_localScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
+ KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
#ifdef USE_MATHUTILS
- return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_SCALE_LOCAL);
+ return newVectorObject_cb((PyObject *)self_v, 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_SCALE_LOCAL);
#else
- KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
return PyObjectFrom(self->NodeGetLocalScaling());
#endif
}
@@ -2181,6 +2201,41 @@ PyObject* KX_GameObject::PySetOcclusion(PyObject* args)
Py_RETURN_NONE;
}
+PyObject* KX_GameObject::PyGetVisible()
+{
+ ShowDeprecationWarning("getVisible()", "the visible property");
+ return PyLong_FromSsize_t(m_bVisible);
+}
+
+PyObject* KX_GameObject::PyGetState()
+{
+ ShowDeprecationWarning("getState()", "the state property");
+ int state = 0;
+ state |= GetState();
+ return PyLong_FromSsize_t(state);
+}
+
+PyObject* KX_GameObject::PySetState(PyObject* value)
+{
+ ShowDeprecationWarning("setState()", "the state property");
+ int state_i = PyLong_AsSsize_t(value);
+ unsigned int state = 0;
+
+ if (state_i == -1 && PyErr_Occurred()) {
+ PyErr_SetString(PyExc_TypeError, "expected an int bit field");
+ return NULL;
+ }
+
+ state |= state_i;
+ if ((state & ((1<<30)-1)) == 0) {
+ PyErr_SetString(PyExc_AttributeError, "The state bitfield was not between 0 and 30 (1<<0 and 1<<29)");
+ return NULL;
+ }
+ SetState(state);
+
+ Py_RETURN_NONE;
+}
+
PyObject* KX_GameObject::PyGetVelocity(PyObject* args)
{
// only can get the velocity if we have a physics object connected to us...
@@ -2199,6 +2254,14 @@ PyObject* KX_GameObject::PyGetVelocity(PyObject* args)
}
}
+
+
+PyObject* KX_GameObject::PyGetMass()
+{
+ ShowDeprecationWarning("getMass()", "the mass property");
+ return PyFloat_FromDouble((GetPhysicsController() != NULL) ? GetPhysicsController()->GetMass() : 0.0f);
+}
+
PyObject* KX_GameObject::PyGetReactionForce()
{
// only can get the velocity if we have a physics object connected to us...
@@ -2235,6 +2298,18 @@ PyObject* KX_GameObject::PyDisableRigidBody()
}
+
+PyObject* KX_GameObject::PyGetParent()
+{
+ ShowDeprecationWarning("getParent()", "the parent property");
+ KX_GameObject* parent = this->GetParent();
+ if (parent) {
+ parent->Release(); /* self->GetParent() AddRef's */
+ return parent->GetProxy();
+ }
+ Py_RETURN_NONE;
+}
+
PyObject* KX_GameObject::PySetParent(PyObject* args)
{
KX_Scene *scene = KX_GetActiveScene();
@@ -2260,6 +2335,41 @@ PyObject* KX_GameObject::PyRemoveParent()
Py_RETURN_NONE;
}
+PyObject* KX_GameObject::PyGetChildren()
+{
+ ShowDeprecationWarning("getChildren()", "the children property");
+
+ return GetChildren()->NewProxy(true);
+}
+
+PyObject* KX_GameObject::PyGetChildrenRecursive()
+{
+ ShowDeprecationWarning("getChildrenRecursive()", "the childrenRecursive property");
+
+ return GetChildrenRecursive()->NewProxy(true);
+}
+
+PyObject* KX_GameObject::PyGetMesh(PyObject* args)
+{
+ ShowDeprecationWarning("getMesh()", "the meshes property (now a list of meshes)");
+
+ int mesh = 0;
+
+ if (!PyArg_ParseTuple(args, "|i:getMesh", &mesh))
+ return NULL; // python sets a simple error
+
+ if (((unsigned int)mesh < m_meshes.size()) && mesh >= 0)
+ {
+ KX_MeshProxy* meshproxy = new KX_MeshProxy(m_meshes[mesh]);
+ return meshproxy->NewProxy(true); // XXX Todo Python own.
+ }
+
+ Py_RETURN_NONE;
+}
+
+
+
+
PyObject* KX_GameObject::PySetCollisionMargin(PyObject* value)
{
@@ -2323,6 +2433,29 @@ PyObject* KX_GameObject::PyRestoreDynamics()
}
+
+PyObject* KX_GameObject::PyGetOrientation() //keywords
+{
+ ShowDeprecationWarning("getOrientation()", "the orientation property");
+ return PyObjectFrom(NodeGetWorldOrientation());
+}
+
+
+
+PyObject* KX_GameObject::PySetOrientation(PyObject* value)
+{
+ ShowDeprecationWarning("setOrientation()", "the orientation property");
+ MT_Matrix3x3 rot;
+
+ /* if value is not a sequence PyOrientationTo makes an error */
+ if (!PyOrientationTo(value, rot, "gameOb.setOrientation(sequence): KX_GameObject, "))
+ return NULL;
+
+ NodeSetLocalOrientation(rot);
+ NodeUpdateGS(0.f);
+ Py_RETURN_NONE;
+}
+
PyObject* KX_GameObject::PyAlignAxisToVect(PyObject* args)
{
PyObject* pyvect;
@@ -2355,6 +2488,33 @@ PyObject* KX_GameObject::PyGetAxisVect(PyObject* value)
return NULL;
}
+PyObject* KX_GameObject::PySetPosition(PyObject* value)
+{
+ ShowDeprecationWarning("setPosition()", "the localPosition property");
+ MT_Point3 pos;
+ if (PyVecTo(value, pos))
+ {
+ NodeSetLocalPosition(pos);
+ NodeUpdateGS(0.f);
+ Py_RETURN_NONE;
+ }
+
+ return NULL;
+}
+
+PyObject* KX_GameObject::PySetWorldPosition(PyObject* value)
+{
+ ShowDeprecationWarning("setWorldPosition()", "the worldPosition property");
+ MT_Point3 pos;
+ if (PyVecTo(value, pos))
+ {
+ NodeSetWorldPosition(pos);
+ NodeUpdateGS(0.f);
+ Py_RETURN_NONE;
+ }
+
+ return NULL;
+}
PyObject* KX_GameObject::PyGetPhysicsId()
{
@@ -2520,10 +2680,12 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo,
}
}
MT_Point3 fromPoint = NodeGetWorldPosition();
-
if (dist != 0.0f)
- toPoint = fromPoint + dist * (toPoint-fromPoint).safe_normalized();
-
+ {
+ MT_Vector3 toDir = toPoint-fromPoint;
+ toDir.normalize();
+ toPoint = fromPoint + (dist) * toDir;
+ }
PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
KX_IPhysicsController *spc = GetPhysicsController();
KX_GameObject *parent = GetParent();
@@ -2716,7 +2878,7 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_GameObject, sendMessage,
char* to = (char *)"";
const STR_String& from = GetName();
- if (!PyArg_ParseTuple(args, "s|ss:sendMessage", &subject, &body, &to))
+ if (!PyArg_ParseTuple(args, "s|sss:sendMessage", &subject, &body, &to))
return NULL;
scene->GetNetworkScene()->SendMessage(to, from, subject, body);
@@ -2757,6 +2919,14 @@ PyObject* KX_GameObject::Pyget(PyObject *args)
return def;
}
+/* Matches python dict.has_key() */
+PyObject* KX_GameObject::Pyhas_key(PyObject* value)
+{
+ // the ONLY error case is invalid data, this is checked by the macro'd static function
+ // that calls this one. but make sure Seq_Contains doesnt add extra errors later on.
+ return PyBool_FromLong(Seq_Contains((PyObject *)this, value));
+}
+
/* ---------------------------------------------------------------------
* Some stuff taken from the header
* --------------------------------------------------------------------- */
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index 845cead1cdb..ba7451fdeef 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -795,7 +795,9 @@ public:
{
return PyUnicode_FromString(GetName().ReadPtr());
}
-
+
+ KX_PYMETHOD_NOARGS(KX_GameObject,GetPosition);
+ KX_PYMETHOD_O(KX_GameObject,SetPosition);
KX_PYMETHOD_O(KX_GameObject,SetWorldPosition);
KX_PYMETHOD_VARARGS(KX_GameObject, ApplyForce);
KX_PYMETHOD_VARARGS(KX_GameObject, ApplyTorque);
@@ -806,10 +808,10 @@ public:
KX_PYMETHOD_VARARGS(KX_GameObject,GetAngularVelocity);
KX_PYMETHOD_VARARGS(KX_GameObject,SetAngularVelocity);
KX_PYMETHOD_VARARGS(KX_GameObject,GetVelocity);
-
+ KX_PYMETHOD_NOARGS(KX_GameObject,GetMass);
KX_PYMETHOD_NOARGS(KX_GameObject,GetReactionForce);
-
-
+ KX_PYMETHOD_NOARGS(KX_GameObject,GetOrientation);
+ KX_PYMETHOD_O(KX_GameObject,SetOrientation);
KX_PYMETHOD_NOARGS(KX_GameObject,GetVisible);
KX_PYMETHOD_VARARGS(KX_GameObject,SetVisible);
KX_PYMETHOD_VARARGS(KX_GameObject,SetOcclusion);
@@ -826,7 +828,7 @@ public:
KX_PYMETHOD_NOARGS(KX_GameObject,GetParent);
KX_PYMETHOD_VARARGS(KX_GameObject,SetParent);
KX_PYMETHOD_NOARGS(KX_GameObject,RemoveParent);
- KX_PYMETHOD_NOARGS(KX_GameObject,GetChildren);
+ KX_PYMETHOD_NOARGS(KX_GameObject,GetChildren);
KX_PYMETHOD_NOARGS(KX_GameObject,GetChildrenRecursive);
KX_PYMETHOD_VARARGS(KX_GameObject,GetMesh);
KX_PYMETHOD_NOARGS(KX_GameObject,GetPhysicsId);
@@ -842,6 +844,7 @@ public:
/* Dict access */
KX_PYMETHOD_VARARGS(KX_GameObject,get);
+ KX_PYMETHOD_O(KX_GameObject,has_key);
/* attributes */
static PyObject* pyattr_get_name(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp
index b71907be961..e4eaff4f401 100644
--- a/source/gameengine/Ketsji/KX_IpoActuator.cpp
+++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp
@@ -49,13 +49,13 @@
/* Type strings */
/* ------------------------------------------------------------------------- */
-const char *KX_IpoActuator::S_KX_ACT_IPO_PLAY_STRING = "Play";
-const char *KX_IpoActuator::S_KX_ACT_IPO_PINGPONG_STRING = "PingPong";
-const char *KX_IpoActuator::S_KX_ACT_IPO_FLIPPER_STRING = "Flipper";
-const char *KX_IpoActuator::S_KX_ACT_IPO_LOOPSTOP_STRING = "LoopStop";
-const char *KX_IpoActuator::S_KX_ACT_IPO_LOOPEND_STRING = "LoopEnd";
-const char *KX_IpoActuator::S_KX_ACT_IPO_KEY2KEY_STRING = "Key2key";
-const char *KX_IpoActuator::S_KX_ACT_IPO_FROM_PROP_STRING = "FromProp";
+STR_String KX_IpoActuator::S_KX_ACT_IPO_PLAY_STRING = "Play";
+STR_String KX_IpoActuator::S_KX_ACT_IPO_PINGPONG_STRING = "PingPong";
+STR_String KX_IpoActuator::S_KX_ACT_IPO_FLIPPER_STRING = "Flipper";
+STR_String KX_IpoActuator::S_KX_ACT_IPO_LOOPSTOP_STRING = "LoopStop";
+STR_String KX_IpoActuator::S_KX_ACT_IPO_LOOPEND_STRING = "LoopEnd";
+STR_String KX_IpoActuator::S_KX_ACT_IPO_KEY2KEY_STRING = "Key2key";
+STR_String KX_IpoActuator::S_KX_ACT_IPO_FROM_PROP_STRING = "FromProp";
/* ------------------------------------------------------------------------- */
/* Native functions */
@@ -385,19 +385,19 @@ bool KX_IpoActuator::Update(double curtime, bool frame)
int KX_IpoActuator::string2mode(char* modename) {
IpoActType res = KX_ACT_IPO_NODEF;
- if (strcmp(modename, S_KX_ACT_IPO_PLAY_STRING)==0) {
+ if (modename == S_KX_ACT_IPO_PLAY_STRING) {
res = KX_ACT_IPO_PLAY;
- } else if (strcmp(modename, S_KX_ACT_IPO_PINGPONG_STRING)==0) {
+ } else if (modename == S_KX_ACT_IPO_PINGPONG_STRING) {
res = KX_ACT_IPO_PINGPONG;
- } else if (strcmp(modename, S_KX_ACT_IPO_FLIPPER_STRING)==0) {
+ } else if (modename == S_KX_ACT_IPO_FLIPPER_STRING) {
res = KX_ACT_IPO_FLIPPER;
- } else if (strcmp(modename, S_KX_ACT_IPO_LOOPSTOP_STRING)==0) {
+ } else if (modename == S_KX_ACT_IPO_LOOPSTOP_STRING) {
res = KX_ACT_IPO_LOOPSTOP;
- } else if (strcmp(modename, S_KX_ACT_IPO_LOOPEND_STRING)==0) {
+ } else if (modename == S_KX_ACT_IPO_LOOPEND_STRING) {
res = KX_ACT_IPO_LOOPEND;
- } else if (strcmp(modename, S_KX_ACT_IPO_KEY2KEY_STRING)==0) {
+ } else if (modename == S_KX_ACT_IPO_KEY2KEY_STRING) {
res = KX_ACT_IPO_KEY2KEY;
- } else if (strcmp(modename, S_KX_ACT_IPO_FROM_PROP_STRING)==0) {
+ } else if (modename == S_KX_ACT_IPO_FROM_PROP_STRING) {
res = KX_ACT_IPO_FROM_PROP;
}
@@ -434,6 +434,21 @@ PyTypeObject KX_IpoActuator::Type = {
};
PyMethodDef KX_IpoActuator::Methods[] = {
+ // deprecated
+ {"set", (PyCFunction) KX_IpoActuator::sPySet, METH_VARARGS, (const char *)Set_doc},
+ {"setProperty", (PyCFunction) KX_IpoActuator::sPySetProperty, METH_VARARGS, (const char *)SetProperty_doc},
+ {"setStart", (PyCFunction) KX_IpoActuator::sPySetStart, METH_VARARGS, (const char *)SetStart_doc},
+ {"getStart", (PyCFunction) KX_IpoActuator::sPyGetStart, METH_NOARGS, (const char *)GetStart_doc},
+ {"setEnd", (PyCFunction) KX_IpoActuator::sPySetEnd, METH_VARARGS, (const char *)SetEnd_doc},
+ {"getEnd", (PyCFunction) KX_IpoActuator::sPyGetEnd, METH_NOARGS, (const char *)GetEnd_doc},
+ {"setIpoAsForce", (PyCFunction) KX_IpoActuator::sPySetIpoAsForce, METH_VARARGS, (const char *)SetIpoAsForce_doc},
+ {"getIpoAsForce", (PyCFunction) KX_IpoActuator::sPyGetIpoAsForce, METH_NOARGS, (const char *)GetIpoAsForce_doc},
+ {"setIpoAdd", (PyCFunction) KX_IpoActuator::sPySetIpoAdd, METH_VARARGS, (const char *)SetIpoAdd_doc},
+ {"getIpoAdd", (PyCFunction) KX_IpoActuator::sPyGetIpoAdd, METH_NOARGS, (const char *)GetIpoAdd_doc},
+ {"setForceIpoActsLocal", (PyCFunction) KX_IpoActuator::sPySetForceIpoActsLocal, METH_VARARGS, (const char *)SetForceIpoActsLocal_doc},
+ {"getForceIpoActsLocal", (PyCFunction) KX_IpoActuator::sPyGetForceIpoActsLocal, METH_NOARGS, (const char *)GetForceIpoActsLocal_doc},
+ {"setType", (PyCFunction) KX_IpoActuator::sPySetType, METH_VARARGS, (const char *)SetType_doc},
+ {"getType", (PyCFunction) KX_IpoActuator::sPyGetType, METH_NOARGS, (const char *)GetType_doc},
{NULL,NULL} //Sentinel
};
@@ -451,4 +466,237 @@ PyAttributeDef KX_IpoActuator::Attributes[] = {
{ NULL } //Sentinel
};
+
+/* set --------------------------------------------------------------------- */
+const char KX_IpoActuator::Set_doc[] =
+"set(type, startframe, endframe, mode?)\n"
+"\t - type: Play, PingPong, Flipper, LoopStop, LoopEnd or FromProp (string)\n"
+"\t - startframe: first frame to use (int)\n"
+"\t - endframe : last frame to use (int)\n"
+"\t - mode? : special mode (0=normal, 1=interpret location as force, 2=additive)"
+"\tSet the properties of the actuator.\n";
+PyObject* KX_IpoActuator::PySet(PyObject* args) {
+
+ ShowDeprecationWarning("set()", "a range properties");
+
+ /* sets modes PLAY, PINGPONG, FLIPPER, LOOPSTOP, LOOPEND */
+ /* arg 1 = mode string, arg 2 = startframe, arg3 = stopframe, */
+ /* arg4 = force toggle */
+ char* mode;
+ int forceToggle;
+ int modenum;
+ int startFrame, stopFrame;
+ if(!PyArg_ParseTuple(args, "siii:set", &mode, &startFrame,
+ &stopFrame, &forceToggle)) {
+ return NULL;
+ }
+ modenum = string2mode(mode);
+
+ switch (modenum) {
+ case KX_ACT_IPO_PLAY:
+ case KX_ACT_IPO_PINGPONG:
+ case KX_ACT_IPO_FLIPPER:
+ case KX_ACT_IPO_LOOPSTOP:
+ case KX_ACT_IPO_LOOPEND:
+ m_type = modenum;
+ m_startframe = startFrame;
+ m_endframe = stopFrame;
+ m_ipo_as_force = forceToggle == 1;
+ m_ipo_add = forceToggle == 2;
+ break;
+ default:
+ ; /* error */
+ }
+
+ Py_RETURN_NONE;
+}
+
+/* set property ----------------------------------------------------------- */
+const char KX_IpoActuator::SetProperty_doc[] =
+"setProperty(propname)\n"
+"\t - propname: name of the property (string)\n"
+"\tSet the property to be used in FromProp mode.\n";
+PyObject* KX_IpoActuator::PySetProperty(PyObject* args) {
+
+ ShowDeprecationWarning("setProperty()", "the propName property");
+
+ /* mode is implicit here, but not supported yet... */
+ /* args: property */
+ char *propertyName;
+ if(!PyArg_ParseTuple(args, "s:setProperty", &propertyName)) {
+ return NULL;
+ }
+
+ m_propname = propertyName;
+
+ Py_RETURN_NONE;
+}
+
+/* 4. setStart: */
+const char KX_IpoActuator::SetStart_doc[] =
+"setStart(frame)\n"
+"\t - frame: first frame to use (int)\n"
+"\tSet the frame from which the ipo starts playing.\n";
+PyObject* KX_IpoActuator::PySetStart(PyObject* args) {
+
+ ShowDeprecationWarning("setStart()", "the frameStart property");
+
+ float startArg;
+ if(!PyArg_ParseTuple(args, "f:setStart", &startArg)) {
+ return NULL;
+ }
+
+ m_startframe = startArg;
+
+ Py_RETURN_NONE;
+}
+/* 5. getStart: */
+const char KX_IpoActuator::GetStart_doc[] =
+"getStart()\n"
+"\tReturns the frame from which the ipo starts playing.\n";
+PyObject* KX_IpoActuator::PyGetStart() {
+ ShowDeprecationWarning("getStart()", "the frameStart property");
+ return PyFloat_FromDouble(m_startframe);
+}
+
+/* 6. setEnd: */
+const char KX_IpoActuator::SetEnd_doc[] =
+"setEnd(frame)\n"
+"\t - frame: last frame to use (int)\n"
+"\tSet the frame at which the ipo stops playing.\n";
+PyObject* KX_IpoActuator::PySetEnd(PyObject* args) {
+ ShowDeprecationWarning("setEnd()", "the frameEnd property");
+ float endArg;
+ if(!PyArg_ParseTuple(args, "f:setEnd", &endArg)) {
+ return NULL;
+ }
+
+ m_endframe = endArg;
+
+ Py_RETURN_NONE;
+}
+/* 7. getEnd: */
+const char KX_IpoActuator::GetEnd_doc[] =
+"getEnd()\n"
+"\tReturns the frame at which the ipo stops playing.\n";
+PyObject* KX_IpoActuator::PyGetEnd() {
+ ShowDeprecationWarning("getEnd()", "the frameEnd property");
+ return PyFloat_FromDouble(m_endframe);
+}
+
+/* 6. setIpoAsForce: */
+const char KX_IpoActuator::SetIpoAsForce_doc[] =
+"setIpoAsForce(force?)\n"
+"\t - force? : interpret this ipo as a force? (KX_TRUE, KX_FALSE)\n"
+"\tSet whether to interpret the ipo as a force rather than a displacement.\n";
+PyObject* KX_IpoActuator::PySetIpoAsForce(PyObject* args) {
+ ShowDeprecationWarning("setIpoAsForce()", "the useIpoAsForce property");
+ int boolArg;
+
+ if (!PyArg_ParseTuple(args, "i:setIpoAsForce", &boolArg)) {
+ return NULL;
+ }
+
+ m_ipo_as_force = PyArgToBool(boolArg);
+ if (m_ipo_as_force)
+ m_ipo_add = false;
+
+ Py_RETURN_NONE;
+}
+/* 7. getIpoAsForce: */
+const char KX_IpoActuator::GetIpoAsForce_doc[] =
+"getIpoAsForce()\n"
+"\tReturns whether to interpret the ipo as a force rather than a displacement.\n";
+PyObject* KX_IpoActuator::PyGetIpoAsForce() {
+ ShowDeprecationWarning("getIpoAsForce()", "the useIpoAsForce property");
+ return BoolToPyArg(m_ipo_as_force);
+}
+
+/* 6. setIpoAsForce: */
+const char KX_IpoActuator::SetIpoAdd_doc[] =
+"setIpoAdd(add?)\n"
+"\t - add? : add flag (KX_TRUE, KX_FALSE)\n"
+"\tSet whether to interpret the ipo as additive rather than absolute.\n";
+PyObject* KX_IpoActuator::PySetIpoAdd(PyObject* args) {
+ ShowDeprecationWarning("setIpoAdd()", "the useIpoAdd property");
+ int boolArg;
+
+ if (!PyArg_ParseTuple(args, "i:setIpoAdd", &boolArg)) {
+ return NULL;
+ }
+
+ m_ipo_add = PyArgToBool(boolArg);
+ if (m_ipo_add)
+ m_ipo_as_force = false;
+
+ Py_RETURN_NONE;
+}
+/* 7. getIpoAsForce: */
+const char KX_IpoActuator::GetIpoAdd_doc[] =
+"getIpoAsAdd()\n"
+"\tReturns whether to interpret the ipo as additive rather than absolute.\n";
+PyObject* KX_IpoActuator::PyGetIpoAdd() {
+ ShowDeprecationWarning("getIpoAdd()", "the useIpoAdd property");
+ return BoolToPyArg(m_ipo_add);
+}
+
+/* 8. setType: */
+const char KX_IpoActuator::SetType_doc[] =
+"setType(mode)\n"
+"\t - mode: Play, PingPong, Flipper, LoopStop, LoopEnd or FromProp (string)\n"
+"\tSet the operation mode of the actuator.\n";
+PyObject* KX_IpoActuator::PySetType(PyObject* args) {
+ ShowDeprecationWarning("setType()", "the mode property");
+ int typeArg;
+
+ if (!PyArg_ParseTuple(args, "i:setType", &typeArg)) {
+ return NULL;
+ }
+
+ if ( (typeArg > KX_ACT_IPO_NODEF)
+ && (typeArg < KX_ACT_IPO_MAX) ) {
+ m_type = typeArg;
+ }
+
+ Py_RETURN_NONE;
+}
+/* 9. getType: */
+const char KX_IpoActuator::GetType_doc[] =
+"getType()\n"
+"\tReturns the operation mode of the actuator.\n";
+PyObject* KX_IpoActuator::PyGetType() {
+ ShowDeprecationWarning("getType()", "the mode property");
+ return PyLong_FromSsize_t(m_type);
+}
+
+/* 10. setForceIpoActsLocal: */
+const char KX_IpoActuator::SetForceIpoActsLocal_doc[] =
+"setForceIpoActsLocal(local?)\n"
+"\t - local? : Apply the ipo-as-force in the object's local\n"
+"\t coordinates? (KX_TRUE, KX_FALSE)\n"
+"\tSet whether to apply the force in the object's local\n"
+"\tcoordinates rather than the world global coordinates.\n";
+PyObject* KX_IpoActuator::PySetForceIpoActsLocal(PyObject* args) {
+ ShowDeprecationWarning("setForceIpoActsLocal()", "the useIpoLocal property");
+ int boolArg;
+
+ if (!PyArg_ParseTuple(args, "i:setForceIpoActsLocal", &boolArg)) {
+ return NULL;
+ }
+
+ m_ipo_local = PyArgToBool(boolArg);
+
+ Py_RETURN_NONE;
+}
+/* 11. getForceIpoActsLocal: */
+const char KX_IpoActuator::GetForceIpoActsLocal_doc[] =
+"getForceIpoActsLocal()\n"
+"\tReturn whether to apply the force in the object's local\n"
+"\tcoordinates rather than the world global coordinates.\n";
+PyObject* KX_IpoActuator::PyGetForceIpoActsLocal() {
+ ShowDeprecationWarning("getForceIpoActsLocal()", "the useIpoLocal property");
+ return BoolToPyArg(m_ipo_local);
+}
+
+
/* eof */
diff --git a/source/gameengine/Ketsji/KX_IpoActuator.h b/source/gameengine/Ketsji/KX_IpoActuator.h
index 72fe812f98e..01051ca82dc 100644
--- a/source/gameengine/Ketsji/KX_IpoActuator.h
+++ b/source/gameengine/Ketsji/KX_IpoActuator.h
@@ -100,13 +100,13 @@ public:
KX_ACT_IPO_MAX
};
- static const char *S_KX_ACT_IPO_PLAY_STRING;
- static const char *S_KX_ACT_IPO_PINGPONG_STRING;
- static const char *S_KX_ACT_IPO_FLIPPER_STRING;
- static const char *S_KX_ACT_IPO_LOOPSTOP_STRING;
- static const char *S_KX_ACT_IPO_LOOPEND_STRING;
- static const char *S_KX_ACT_IPO_KEY2KEY_STRING;
- static const char *S_KX_ACT_IPO_FROM_PROP_STRING;
+ static STR_String S_KX_ACT_IPO_PLAY_STRING;
+ static STR_String S_KX_ACT_IPO_PINGPONG_STRING;
+ static STR_String S_KX_ACT_IPO_FLIPPER_STRING;
+ static STR_String S_KX_ACT_IPO_LOOPSTOP_STRING;
+ static STR_String S_KX_ACT_IPO_LOOPEND_STRING;
+ static STR_String S_KX_ACT_IPO_KEY2KEY_STRING;
+ static STR_String S_KX_ACT_IPO_FROM_PROP_STRING;
int string2mode(char* modename);
@@ -138,6 +138,23 @@ public:
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
+ //KX_PYMETHOD_DOC
+ KX_PYMETHOD_DOC_VARARGS(KX_IpoActuator,Set);
+ KX_PYMETHOD_DOC_VARARGS(KX_IpoActuator,SetProperty);
+/* KX_PYMETHOD_DOC(KX_IpoActuator,SetKey2Key); */
+ KX_PYMETHOD_DOC_VARARGS(KX_IpoActuator,SetStart);
+ KX_PYMETHOD_DOC_NOARGS(KX_IpoActuator,GetStart);
+ KX_PYMETHOD_DOC_VARARGS(KX_IpoActuator,SetEnd);
+ KX_PYMETHOD_DOC_NOARGS(KX_IpoActuator,GetEnd);
+ KX_PYMETHOD_DOC_VARARGS(KX_IpoActuator,SetIpoAsForce);
+ KX_PYMETHOD_DOC_NOARGS(KX_IpoActuator,GetIpoAsForce);
+ KX_PYMETHOD_DOC_VARARGS(KX_IpoActuator,SetIpoAdd);
+ KX_PYMETHOD_DOC_NOARGS(KX_IpoActuator,GetIpoAdd);
+ KX_PYMETHOD_DOC_VARARGS(KX_IpoActuator,SetType);
+ KX_PYMETHOD_DOC_NOARGS(KX_IpoActuator,GetType);
+ KX_PYMETHOD_DOC_VARARGS(KX_IpoActuator,SetForceIpoActsLocal);
+ KX_PYMETHOD_DOC_NOARGS(KX_IpoActuator,GetForceIpoActsLocal);
+
};
#endif //__KX_IPOACTUATOR
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index 4117e493322..13643e3a1ac 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -382,12 +382,12 @@ void KX_KetsjiEngine::StartEngine(bool clearIpo)
m_firstframe = true;
m_bInitialized = true;
// there is always one scene enabled at startup
- Scene* scene = m_scenes[0]->GetBlenderScene();
- if (scene)
+ World* world = m_scenes[0]->GetBlenderScene()->world;
+ if (world)
{
- m_ticrate = scene->gm.ticrate ? scene->gm.ticrate : DEFAULT_LOGIC_TIC_RATE;
- m_maxLogicFrame = scene->gm.maxlogicstep ? scene->gm.maxlogicstep : 5;
- m_maxPhysicsFrame = scene->gm.maxphystep ? scene->gm.maxlogicstep : 5;
+ m_ticrate = world->ticrate ? world->ticrate : DEFAULT_LOGIC_TIC_RATE;
+ m_maxLogicFrame = world->maxlogicstep ? world->maxlogicstep : 5;
+ m_maxPhysicsFrame = world->maxphystep ? world->maxlogicstep : 5;
}
else
{
diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp
index 744fdb75796..e15847fe6c6 100644
--- a/source/gameengine/Ketsji/KX_MeshProxy.cpp
+++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp
@@ -68,12 +68,18 @@ PyTypeObject KX_MeshProxy::Type = {
};
PyMethodDef KX_MeshProxy::Methods[] = {
+// Deprecated ----->
+{"getNumMaterials", (PyCFunction)KX_MeshProxy::sPyGetNumMaterials,METH_VARARGS},
+{"getNumPolygons", (PyCFunction)KX_MeshProxy::sPyGetNumPolygons,METH_NOARGS},
+// <-----
+
{"getMaterialName", (PyCFunction)KX_MeshProxy::sPyGetMaterialName,METH_VARARGS},
{"getTextureName", (PyCFunction)KX_MeshProxy::sPyGetTextureName,METH_VARARGS},
{"getVertexArrayLength", (PyCFunction)KX_MeshProxy::sPyGetVertexArrayLength,METH_VARARGS},
{"getVertex", (PyCFunction)KX_MeshProxy::sPyGetVertex,METH_VARARGS},
{"getPolygon", (PyCFunction)KX_MeshProxy::sPyGetPolygon,METH_VARARGS},
//{"getIndexArrayLength", (PyCFunction)KX_MeshProxy::sPyGetIndexArrayLength,METH_VARARGS},
+
{NULL,NULL} //Sentinel
};
@@ -113,6 +119,20 @@ CValue* KX_MeshProxy::GetReplica() { return NULL;}
// stuff for python integration
+
+PyObject* KX_MeshProxy::PyGetNumMaterials(PyObject* args, PyObject* kwds)
+{
+ int num = m_meshobj->NumMaterials();
+ ShowDeprecationWarning("getNumMaterials()", "the numMaterials property");
+ return PyLong_FromSsize_t(num);
+}
+
+PyObject* KX_MeshProxy::PyGetNumPolygons()
+{
+ int num = m_meshobj->NumPolygons();
+ ShowDeprecationWarning("getNumPolygons()", "the numPolygons property");
+ return PyLong_FromSsize_t(num);
+}
PyObject* KX_MeshProxy::PyGetMaterialName(PyObject* args, PyObject* kwds)
{
diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
index 8abc4f6b897..58053e1038d 100644
--- a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
+++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
@@ -61,13 +61,11 @@ KX_MouseFocusSensor::KX_MouseFocusSensor(SCA_MouseManager* eventmgr,
int starty,
short int mousemode,
int focusmode,
- bool bTouchPulse,
KX_Scene* kxscene,
KX_KetsjiEngine *kxengine,
SCA_IObject* gameobj)
: SCA_MouseSensor(eventmgr, startx, starty, mousemode, gameobj),
m_focusmode(focusmode),
- m_bTouchPulse(bTouchPulse),
m_kxscene(kxscene),
m_kxengine(kxengine)
{
@@ -79,7 +77,6 @@ void KX_MouseFocusSensor::Init()
m_mouse_over_in_previous_frame = (m_invert)?true:false;
m_positive_event = false;
m_hitObject = 0;
- m_hitObject_Last = NULL;
m_reset = true;
m_hitPosition.setValue(0,0,0);
@@ -110,10 +107,7 @@ bool KX_MouseFocusSensor::Evaluate()
m_positive_event = true;
if (!m_mouse_over_in_previous_frame) {
result = true;
- }
- else if(m_bTouchPulse && (m_hitObject != m_hitObject_Last)) {
- result = true;
- }
+ }
}
if (reset) {
// force an event
@@ -129,8 +123,7 @@ bool KX_MouseFocusSensor::Evaluate()
}
m_mouse_over_in_previous_frame = obHasFocus;
- m_hitObject_Last = (void *)m_hitObject;
-
+
return result;
}
@@ -368,6 +361,13 @@ PyTypeObject KX_MouseFocusSensor::Type = {
};
PyMethodDef KX_MouseFocusSensor::Methods[] = {
+ {"getRayTarget", (PyCFunction) KX_MouseFocusSensor::sPyGetRayTarget, METH_NOARGS, (const char *)GetRayTarget_doc},
+ {"getRaySource", (PyCFunction) KX_MouseFocusSensor::sPyGetRaySource, METH_NOARGS, (const char *)GetRaySource_doc},
+ {"getHitObject",(PyCFunction) KX_MouseFocusSensor::sPyGetHitObject,METH_NOARGS, (const char *)GetHitObject_doc},
+ {"getHitPosition",(PyCFunction) KX_MouseFocusSensor::sPyGetHitPosition,METH_NOARGS, (const char *)GetHitPosition_doc},
+ {"getHitNormal",(PyCFunction) KX_MouseFocusSensor::sPyGetHitNormal,METH_NOARGS, (const char *)GetHitNormal_doc},
+ {"getRayDirection",(PyCFunction) KX_MouseFocusSensor::sPyGetRayDirection,METH_NOARGS, (const char *)GetRayDirection_doc},
+
{NULL,NULL} //Sentinel
};
@@ -378,10 +378,81 @@ PyAttributeDef KX_MouseFocusSensor::Attributes[] = {
KX_PYATTRIBUTE_RO_FUNCTION("hitObject", KX_MouseFocusSensor, pyattr_get_hit_object),
KX_PYATTRIBUTE_RO_FUNCTION("hitPosition", KX_MouseFocusSensor, pyattr_get_hit_position),
KX_PYATTRIBUTE_RO_FUNCTION("hitNormal", KX_MouseFocusSensor, pyattr_get_hit_normal),
- KX_PYATTRIBUTE_BOOL_RW("usePulseFocus", KX_MouseFocusSensor,m_bTouchPulse),
{ NULL } //Sentinel
};
+const char KX_MouseFocusSensor::GetHitObject_doc[] =
+"getHitObject()\n"
+"\tReturns the object that was hit by this ray.\n";
+PyObject* KX_MouseFocusSensor::PyGetHitObject()
+{
+ ShowDeprecationWarning("GetHitObject()", "the hitObject property");
+
+ if (m_hitObject)
+ return m_hitObject->GetProxy();
+
+ Py_RETURN_NONE;
+}
+
+
+const char KX_MouseFocusSensor::GetHitPosition_doc[] =
+"getHitPosition()\n"
+"\tReturns the position (in worldcoordinates) where the object was hit by this ray.\n";
+PyObject* KX_MouseFocusSensor::PyGetHitPosition()
+{
+ ShowDeprecationWarning("getHitPosition()", "the hitPosition property");
+
+ return PyObjectFrom(m_hitPosition);
+}
+
+const char KX_MouseFocusSensor::GetRayDirection_doc[] =
+"getRayDirection()\n"
+"\tReturns the direction from the ray (in worldcoordinates) .\n";
+PyObject* KX_MouseFocusSensor::PyGetRayDirection()
+{
+ ShowDeprecationWarning("getRayDirection()", "the rayDirection property");
+
+ MT_Vector3 dir = m_prevTargetPoint - m_prevSourcePoint;
+ if(MT_fuzzyZero(dir)) dir.setValue(0,0,0);
+ else dir.normalize();
+ return PyObjectFrom(dir);
+}
+
+const char KX_MouseFocusSensor::GetHitNormal_doc[] =
+"getHitNormal()\n"
+"\tReturns the normal (in worldcoordinates) at the point of collision where the object was hit by this ray.\n";
+PyObject* KX_MouseFocusSensor::PyGetHitNormal()
+{
+ ShowDeprecationWarning("getHitNormal()", "the hitNormal property");
+
+ return PyObjectFrom(m_hitNormal);
+}
+
+
+/* getRayTarget */
+const char KX_MouseFocusSensor::GetRayTarget_doc[] =
+"getRayTarget()\n"
+"\tReturns the target of the ray that seeks the focus object,\n"
+"\tin worldcoordinates.";
+PyObject* KX_MouseFocusSensor::PyGetRayTarget()
+{
+ ShowDeprecationWarning("getRayTarget()", "the rayTarget property");
+
+ return PyObjectFrom(m_prevTargetPoint);
+}
+
+/* getRayTarget */
+const char KX_MouseFocusSensor::GetRaySource_doc[] =
+"getRaySource()\n"
+"\tReturns the source of the ray that seeks the focus object,\n"
+"\tin worldcoordinates.";
+PyObject* KX_MouseFocusSensor::PyGetRaySource()
+{
+ ShowDeprecationWarning("getRaySource()", "the raySource property");
+
+ return PyObjectFrom(m_prevSourcePoint);
+}
+
/* Attributes */
PyObject* KX_MouseFocusSensor::pyattr_get_ray_source(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.h b/source/gameengine/Ketsji/KX_MouseFocusSensor.h
index 7b53557467f..dfada7a59cc 100644
--- a/source/gameengine/Ketsji/KX_MouseFocusSensor.h
+++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.h
@@ -49,12 +49,11 @@ class KX_MouseFocusSensor : public SCA_MouseSensor
public:
- KX_MouseFocusSensor(class SCA_MouseManager* eventmgr,
+ KX_MouseFocusSensor(class SCA_MouseManager* keybdmgr,
int startx,
int starty,
short int mousemode,
int focusmode,
- bool bTouchPulse,
KX_Scene* kxscene,
KX_KetsjiEngine* kxengine,
SCA_IObject* gameobj);
@@ -90,6 +89,14 @@ class KX_MouseFocusSensor : public SCA_MouseSensor
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
+ KX_PYMETHOD_DOC_NOARGS(KX_MouseFocusSensor,GetRayTarget);
+ KX_PYMETHOD_DOC_NOARGS(KX_MouseFocusSensor,GetRaySource);
+
+ KX_PYMETHOD_DOC_NOARGS(KX_MouseFocusSensor,GetHitObject);
+ KX_PYMETHOD_DOC_NOARGS(KX_MouseFocusSensor,GetHitPosition);
+ KX_PYMETHOD_DOC_NOARGS(KX_MouseFocusSensor,GetHitNormal);
+ KX_PYMETHOD_DOC_NOARGS(KX_MouseFocusSensor,GetRayDirection);
+
/* attributes */
static PyObject* pyattr_get_ray_source(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_ray_target(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
@@ -100,7 +107,6 @@ class KX_MouseFocusSensor : public SCA_MouseSensor
/* --------------------------------------------------------------------- */
SCA_IObject* m_hitObject;
- void* m_hitObject_Last; /* only use for comparison, never access */
private:
/**
@@ -114,11 +120,6 @@ class KX_MouseFocusSensor : public SCA_MouseSensor
bool m_mouse_over_in_previous_frame;
/**
- * Flags whether changes in hit object should trigger a pulse
- */
- bool m_bTouchPulse;
-
- /**
* Flags whether the previous test evaluated positive.
*/
bool m_positive_event;
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
index 2601ced9c38..2ee30ee0bfa 100644
--- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
@@ -347,6 +347,32 @@ PyTypeObject KX_ObjectActuator::Type = {
};
PyMethodDef KX_ObjectActuator::Methods[] = {
+ // Deprecated ----->
+ {"getForce", (PyCFunction) KX_ObjectActuator::sPyGetForce, METH_NOARGS},
+ {"setForce", (PyCFunction) KX_ObjectActuator::sPySetForce, METH_VARARGS},
+ {"getTorque", (PyCFunction) KX_ObjectActuator::sPyGetTorque, METH_NOARGS},
+ {"setTorque", (PyCFunction) KX_ObjectActuator::sPySetTorque, METH_VARARGS},
+ {"getDLoc", (PyCFunction) KX_ObjectActuator::sPyGetDLoc, METH_NOARGS},
+ {"setDLoc", (PyCFunction) KX_ObjectActuator::sPySetDLoc, METH_VARARGS},
+ {"getDRot", (PyCFunction) KX_ObjectActuator::sPyGetDRot, METH_NOARGS},
+ {"setDRot", (PyCFunction) KX_ObjectActuator::sPySetDRot, METH_VARARGS},
+ {"getLinearVelocity", (PyCFunction) KX_ObjectActuator::sPyGetLinearVelocity, METH_NOARGS},
+ {"setLinearVelocity", (PyCFunction) KX_ObjectActuator::sPySetLinearVelocity, METH_VARARGS},
+ {"getAngularVelocity", (PyCFunction) KX_ObjectActuator::sPyGetAngularVelocity, METH_NOARGS},
+ {"setAngularVelocity", (PyCFunction) KX_ObjectActuator::sPySetAngularVelocity, METH_VARARGS},
+ {"setDamping", (PyCFunction) KX_ObjectActuator::sPySetDamping, METH_VARARGS},
+ {"getDamping", (PyCFunction) KX_ObjectActuator::sPyGetDamping, METH_NOARGS},
+ {"setForceLimitX", (PyCFunction) KX_ObjectActuator::sPySetForceLimitX, METH_VARARGS},
+ {"getForceLimitX", (PyCFunction) KX_ObjectActuator::sPyGetForceLimitX, METH_NOARGS},
+ {"setForceLimitY", (PyCFunction) KX_ObjectActuator::sPySetForceLimitY, METH_VARARGS},
+ {"getForceLimitY", (PyCFunction) KX_ObjectActuator::sPyGetForceLimitY, METH_NOARGS},
+ {"setForceLimitZ", (PyCFunction) KX_ObjectActuator::sPySetForceLimitZ, METH_VARARGS},
+ {"getForceLimitZ", (PyCFunction) KX_ObjectActuator::sPyGetForceLimitZ, METH_NOARGS},
+ {"setPID", (PyCFunction) KX_ObjectActuator::sPyGetPID, METH_NOARGS},
+ {"getPID", (PyCFunction) KX_ObjectActuator::sPySetPID, METH_VARARGS},
+
+ // <----- Deprecated
+
{NULL,NULL} //Sentinel
};
@@ -467,7 +493,7 @@ Mathutils_Callback mathutils_obactu_vector_cb = {
PyObject* KX_ObjectActuator::pyattr_get_linV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
- return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxobactu_vector_cb_index, MATHUTILS_VEC_CB_LINV);
+ return newVectorObject_cb((PyObject *)self_v, 3, mathutils_kxobactu_vector_cb_index, MATHUTILS_VEC_CB_LINV);
}
int KX_ObjectActuator::pyattr_set_linV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
@@ -481,7 +507,7 @@ int KX_ObjectActuator::pyattr_set_linV(void *self_v, const KX_PYATTRIBUTE_DEF *a
PyObject* KX_ObjectActuator::pyattr_get_angV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
- return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxobactu_vector_cb_index, MATHUTILS_VEC_CB_ANGV);
+ return newVectorObject_cb((PyObject *)self_v, 3, mathutils_kxobactu_vector_cb_index, MATHUTILS_VEC_CB_ANGV);
}
int KX_ObjectActuator::pyattr_set_angV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
@@ -641,4 +667,305 @@ int KX_ObjectActuator::pyattr_set_reference(void *self, const struct KX_PYATTRIB
return PY_SET_ATTR_SUCCESS;
}
+
+/* 1. set ------------------------------------------------------------------ */
+/* Removed! */
+
+/* 2. getForce */
+PyObject* KX_ObjectActuator::PyGetForce()
+{
+ ShowDeprecationWarning("getForce()", "the force and the useLocalForce properties");
+ PyObject *retVal = PyList_New(4);
+
+ PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(m_force[0]));
+ PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(m_force[1]));
+ PyList_SET_ITEM(retVal, 2, PyFloat_FromDouble(m_force[2]));
+ PyList_SET_ITEM(retVal, 3, BoolToPyArg(m_bitLocalFlag.Force));
+
+ return retVal;
+}
+/* 3. setForce */
+PyObject* KX_ObjectActuator::PySetForce(PyObject* args)
+{
+ ShowDeprecationWarning("setForce()", "the force and the useLocalForce properties");
+ float vecArg[3];
+ int bToggle = 0;
+ if (!PyArg_ParseTuple(args, "fffi:setForce", &vecArg[0], &vecArg[1],
+ &vecArg[2], &bToggle)) {
+ return NULL;
+ }
+ m_force.setValue(vecArg);
+ m_bitLocalFlag.Force = PyArgToBool(bToggle);
+ UpdateFuzzyFlags();
+ Py_RETURN_NONE;
+}
+
+/* 4. getTorque */
+PyObject* KX_ObjectActuator::PyGetTorque()
+{
+ ShowDeprecationWarning("getTorque()", "the torque and the useLocalTorque properties");
+ PyObject *retVal = PyList_New(4);
+
+ PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(m_torque[0]));
+ PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(m_torque[1]));
+ PyList_SET_ITEM(retVal, 2, PyFloat_FromDouble(m_torque[2]));
+ PyList_SET_ITEM(retVal, 3, BoolToPyArg(m_bitLocalFlag.Torque));
+
+ return retVal;
+}
+/* 5. setTorque */
+PyObject* KX_ObjectActuator::PySetTorque(PyObject* args)
+{
+ ShowDeprecationWarning("setTorque()", "the torque and the useLocalTorque properties");
+ float vecArg[3];
+ int bToggle = 0;
+ if (!PyArg_ParseTuple(args, "fffi:setTorque", &vecArg[0], &vecArg[1],
+ &vecArg[2], &bToggle)) {
+ return NULL;
+ }
+ m_torque.setValue(vecArg);
+ m_bitLocalFlag.Torque = PyArgToBool(bToggle);
+ UpdateFuzzyFlags();
+ Py_RETURN_NONE;
+}
+
+/* 6. getDLoc */
+PyObject* KX_ObjectActuator::PyGetDLoc()
+{
+ ShowDeprecationWarning("getDLoc()", "the dLoc and the useLocalDLoc properties");
+ PyObject *retVal = PyList_New(4);
+
+ PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(m_dloc[0]));
+ PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(m_dloc[1]));
+ PyList_SET_ITEM(retVal, 2, PyFloat_FromDouble(m_dloc[2]));
+ PyList_SET_ITEM(retVal, 3, BoolToPyArg(m_bitLocalFlag.DLoc));
+
+ return retVal;
+}
+/* 7. setDLoc */
+PyObject* KX_ObjectActuator::PySetDLoc(PyObject* args)
+{
+ ShowDeprecationWarning("setDLoc()", "the dLoc and the useLocalDLoc properties");
+ float vecArg[3];
+ int bToggle = 0;
+ if(!PyArg_ParseTuple(args, "fffi:setDLoc", &vecArg[0], &vecArg[1],
+ &vecArg[2], &bToggle)) {
+ return NULL;
+ }
+ m_dloc.setValue(vecArg);
+ m_bitLocalFlag.DLoc = PyArgToBool(bToggle);
+ UpdateFuzzyFlags();
+ Py_RETURN_NONE;
+}
+
+/* 8. getDRot */
+PyObject* KX_ObjectActuator::PyGetDRot()
+{
+ ShowDeprecationWarning("getDRot()", "the dRot and the useLocalDRot properties");
+ PyObject *retVal = PyList_New(4);
+
+ PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(m_drot[0]));
+ PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(m_drot[1]));
+ PyList_SET_ITEM(retVal, 2, PyFloat_FromDouble(m_drot[2]));
+ PyList_SET_ITEM(retVal, 3, BoolToPyArg(m_bitLocalFlag.DRot));
+
+ return retVal;
+}
+/* 9. setDRot */
+PyObject* KX_ObjectActuator::PySetDRot(PyObject* args)
+{
+ ShowDeprecationWarning("setDRot()", "the dRot and the useLocalDRot properties");
+ float vecArg[3];
+ int bToggle = 0;
+ if (!PyArg_ParseTuple(args, "fffi:setDRot", &vecArg[0], &vecArg[1],
+ &vecArg[2], &bToggle)) {
+ return NULL;
+ }
+ m_drot.setValue(vecArg);
+ m_bitLocalFlag.DRot = PyArgToBool(bToggle);
+ UpdateFuzzyFlags();
+ Py_RETURN_NONE;
+}
+
+/* 10. getLinearVelocity */
+PyObject* KX_ObjectActuator::PyGetLinearVelocity() {
+ ShowDeprecationWarning("getLinearVelocity()", "the linV and the useLocalLinV properties");
+ PyObject *retVal = PyList_New(4);
+
+ PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(m_linear_velocity[0]));
+ PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(m_linear_velocity[1]));
+ PyList_SET_ITEM(retVal, 2, PyFloat_FromDouble(m_linear_velocity[2]));
+ PyList_SET_ITEM(retVal, 3, BoolToPyArg(m_bitLocalFlag.LinearVelocity));
+
+ return retVal;
+}
+
+/* 11. setLinearVelocity */
+PyObject* KX_ObjectActuator::PySetLinearVelocity(PyObject* args) {
+ ShowDeprecationWarning("setLinearVelocity()", "the linV and the useLocalLinV properties");
+ float vecArg[3];
+ int bToggle = 0;
+ if (!PyArg_ParseTuple(args, "fffi:setLinearVelocity", &vecArg[0], &vecArg[1],
+ &vecArg[2], &bToggle)) {
+ return NULL;
+ }
+ m_linear_velocity.setValue(vecArg);
+ m_bitLocalFlag.LinearVelocity = PyArgToBool(bToggle);
+ UpdateFuzzyFlags();
+ Py_RETURN_NONE;
+}
+
+
+/* 12. getAngularVelocity */
+PyObject* KX_ObjectActuator::PyGetAngularVelocity() {
+ ShowDeprecationWarning("getAngularVelocity()", "the angV and the useLocalAngV properties");
+ PyObject *retVal = PyList_New(4);
+
+ PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(m_angular_velocity[0]));
+ PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(m_angular_velocity[1]));
+ PyList_SET_ITEM(retVal, 2, PyFloat_FromDouble(m_angular_velocity[2]));
+ PyList_SET_ITEM(retVal, 3, BoolToPyArg(m_bitLocalFlag.AngularVelocity));
+
+ return retVal;
+}
+/* 13. setAngularVelocity */
+PyObject* KX_ObjectActuator::PySetAngularVelocity(PyObject* args) {
+ ShowDeprecationWarning("setAngularVelocity()", "the angV and the useLocalAngV properties");
+ float vecArg[3];
+ int bToggle = 0;
+ if (!PyArg_ParseTuple(args, "fffi:setAngularVelocity", &vecArg[0], &vecArg[1],
+ &vecArg[2], &bToggle)) {
+ return NULL;
+ }
+ m_angular_velocity.setValue(vecArg);
+ m_bitLocalFlag.AngularVelocity = PyArgToBool(bToggle);
+ UpdateFuzzyFlags();
+ Py_RETURN_NONE;
+}
+
+/* 13. setDamping */
+PyObject* KX_ObjectActuator::PySetDamping(PyObject* args) {
+ ShowDeprecationWarning("setDamping()", "the damping property");
+ int damping = 0;
+ if (!PyArg_ParseTuple(args, "i:setDamping", &damping) || damping < 0 || damping > 1000) {
+ return NULL;
+ }
+ m_damping = damping;
+ Py_RETURN_NONE;
+}
+
+/* 13. getVelocityDamping */
+PyObject* KX_ObjectActuator::PyGetDamping() {
+ ShowDeprecationWarning("getDamping()", "the damping property");
+ return Py_BuildValue("i",m_damping);
+}
+/* 6. getForceLimitX */
+PyObject* KX_ObjectActuator::PyGetForceLimitX()
+{
+ ShowDeprecationWarning("getForceLimitX()", "the forceLimitX property");
+ PyObject *retVal = PyList_New(3);
+
+ PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(m_drot[0]));
+ PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(m_dloc[0]));
+ PyList_SET_ITEM(retVal, 2, BoolToPyArg(m_bitLocalFlag.Torque));
+
+ return retVal;
+}
+/* 7. setForceLimitX */
+PyObject* KX_ObjectActuator::PySetForceLimitX(PyObject* args)
+{
+ ShowDeprecationWarning("setForceLimitX()", "the forceLimitX property");
+ float vecArg[2];
+ int bToggle = 0;
+ if(!PyArg_ParseTuple(args, "ffi:setForceLimitX", &vecArg[0], &vecArg[1], &bToggle)) {
+ return NULL;
+ }
+ m_drot[0] = vecArg[0];
+ m_dloc[0] = vecArg[1];
+ m_bitLocalFlag.Torque = PyArgToBool(bToggle);
+ Py_RETURN_NONE;
+}
+
+/* 6. getForceLimitY */
+PyObject* KX_ObjectActuator::PyGetForceLimitY()
+{
+ ShowDeprecationWarning("getForceLimitY()", "the forceLimitY property");
+ PyObject *retVal = PyList_New(3);
+
+ PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(m_drot[1]));
+ PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(m_dloc[1]));
+ PyList_SET_ITEM(retVal, 2, BoolToPyArg(m_bitLocalFlag.DLoc));
+
+ return retVal;
+}
+/* 7. setForceLimitY */
+PyObject* KX_ObjectActuator::PySetForceLimitY(PyObject* args)
+{
+ ShowDeprecationWarning("setForceLimitY()", "the forceLimitY property");
+ float vecArg[2];
+ int bToggle = 0;
+ if(!PyArg_ParseTuple(args, "ffi:setForceLimitY", &vecArg[0], &vecArg[1], &bToggle)) {
+ return NULL;
+ }
+ m_drot[1] = vecArg[0];
+ m_dloc[1] = vecArg[1];
+ m_bitLocalFlag.DLoc = PyArgToBool(bToggle);
+ Py_RETURN_NONE;
+}
+
+/* 6. getForceLimitZ */
+PyObject* KX_ObjectActuator::PyGetForceLimitZ()
+{
+ ShowDeprecationWarning("getForceLimitZ()", "the forceLimitZ property");
+ PyObject *retVal = PyList_New(3);
+
+ PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(m_drot[2]));
+ PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(m_dloc[2]));
+ PyList_SET_ITEM(retVal, 2, BoolToPyArg(m_bitLocalFlag.DRot));
+
+ return retVal;
+}
+/* 7. setForceLimitZ */
+PyObject* KX_ObjectActuator::PySetForceLimitZ(PyObject* args)
+{
+ ShowDeprecationWarning("setForceLimitZ()", "the forceLimitZ property");
+ float vecArg[2];
+ int bToggle = 0;
+ if(!PyArg_ParseTuple(args, "ffi:setForceLimitZ", &vecArg[0], &vecArg[1], &bToggle)) {
+ return NULL;
+ }
+ m_drot[2] = vecArg[0];
+ m_dloc[2] = vecArg[1];
+ m_bitLocalFlag.DRot = PyArgToBool(bToggle);
+ Py_RETURN_NONE;
+}
+
+/* 4. getPID */
+PyObject* KX_ObjectActuator::PyGetPID()
+{
+ ShowDeprecationWarning("getPID()", "the pid property");
+ PyObject *retVal = PyList_New(3);
+
+ PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(m_pid[0]));
+ PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(m_pid[1]));
+ PyList_SET_ITEM(retVal, 2, PyFloat_FromDouble(m_pid[2]));
+
+ return retVal;
+}
+/* 5. setPID */
+PyObject* KX_ObjectActuator::PySetPID(PyObject* args)
+{
+ ShowDeprecationWarning("setPID()", "the pid property");
+ float vecArg[3];
+ if (!PyArg_ParseTuple(args, "fff:setPID", &vecArg[0], &vecArg[1], &vecArg[2])) {
+ return NULL;
+ }
+ m_pid.setValue(vecArg);
+ Py_RETURN_NONE;
+}
+
+
+
+
+
/* eof */
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.h b/source/gameengine/Ketsji/KX_ObjectActuator.h
index 7a8c7de16b1..20aec9e0e86 100644
--- a/source/gameengine/Ketsji/KX_ObjectActuator.h
+++ b/source/gameengine/Ketsji/KX_ObjectActuator.h
@@ -163,6 +163,29 @@ public:
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
+ KX_PYMETHOD_NOARGS(KX_ObjectActuator,GetForce);
+ KX_PYMETHOD_VARARGS(KX_ObjectActuator,SetForce);
+ KX_PYMETHOD_NOARGS(KX_ObjectActuator,GetTorque);
+ KX_PYMETHOD_VARARGS(KX_ObjectActuator,SetTorque);
+ KX_PYMETHOD_NOARGS(KX_ObjectActuator,GetDLoc);
+ KX_PYMETHOD_VARARGS(KX_ObjectActuator,SetDLoc);
+ KX_PYMETHOD_NOARGS(KX_ObjectActuator,GetDRot);
+ KX_PYMETHOD_VARARGS(KX_ObjectActuator,SetDRot);
+ KX_PYMETHOD_NOARGS(KX_ObjectActuator,GetLinearVelocity);
+ KX_PYMETHOD_VARARGS(KX_ObjectActuator,SetLinearVelocity);
+ KX_PYMETHOD_NOARGS(KX_ObjectActuator,GetAngularVelocity);
+ KX_PYMETHOD_VARARGS(KX_ObjectActuator,SetAngularVelocity);
+ KX_PYMETHOD_VARARGS(KX_ObjectActuator,SetDamping);
+ KX_PYMETHOD_NOARGS(KX_ObjectActuator,GetDamping);
+ KX_PYMETHOD_NOARGS(KX_ObjectActuator,GetForceLimitX);
+ KX_PYMETHOD_VARARGS(KX_ObjectActuator,SetForceLimitX);
+ KX_PYMETHOD_NOARGS(KX_ObjectActuator,GetForceLimitY);
+ KX_PYMETHOD_VARARGS(KX_ObjectActuator,SetForceLimitY);
+ KX_PYMETHOD_NOARGS(KX_ObjectActuator,GetForceLimitZ);
+ KX_PYMETHOD_VARARGS(KX_ObjectActuator,SetForceLimitZ);
+ KX_PYMETHOD_NOARGS(KX_ObjectActuator,GetPID);
+ KX_PYMETHOD_VARARGS(KX_ObjectActuator,SetPID);
+
/* Attributes */
static PyObject* pyattr_get_forceLimitX(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_forceLimitX(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
diff --git a/source/gameengine/Ketsji/KX_ParentActuator.cpp b/source/gameengine/Ketsji/KX_ParentActuator.cpp
index 20e982f03e0..621aeea87be 100644
--- a/source/gameengine/Ketsji/KX_ParentActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ParentActuator.cpp
@@ -162,6 +162,10 @@ PyTypeObject KX_ParentActuator::Type = {
};
PyMethodDef KX_ParentActuator::Methods[] = {
+ // Deprecated ----->
+ {"setObject", (PyCFunction) KX_ParentActuator::sPySetObject, METH_O, (const char *)SetObject_doc},
+ {"getObject", (PyCFunction) KX_ParentActuator::sPyGetObject, METH_VARARGS, (const char *)GetObject_doc},
+ // <-----
{NULL,NULL} //Sentinel
};
@@ -201,4 +205,55 @@ int KX_ParentActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUTE
return PY_SET_ATTR_SUCCESS;
}
+
+/* Deprecated -----> */
+/* 1. setObject */
+const char KX_ParentActuator::SetObject_doc[] =
+"setObject(object)\n"
+"\t- object: KX_GameObject, string or None\n"
+"\tSet the object to set as parent.\n";
+PyObject* KX_ParentActuator::PySetObject(PyObject* value) {
+ KX_GameObject *gameobj;
+
+ ShowDeprecationWarning("setObject()", "the object property");
+
+ if (!ConvertPythonToGameObject(value, &gameobj, true, "actuator.setObject(value): KX_ParentActuator"))
+ return NULL; // ConvertPythonToGameObject sets the error
+
+ if (m_ob != NULL)
+ m_ob->UnregisterActuator(this);
+
+ m_ob = (SCA_IObject*)gameobj;
+ if (m_ob)
+ m_ob->RegisterActuator(this);
+
+ Py_RETURN_NONE;
+}
+
+/* 2. getObject */
+
+/* get obj ---------------------------------------------------------- */
+const char KX_ParentActuator::GetObject_doc[] =
+"getObject(name_only = 1)\n"
+"name_only - optional arg, when true will return the KX_GameObject rather then its name\n"
+"\tReturns the object that is set to.\n";
+PyObject* KX_ParentActuator::PyGetObject(PyObject* args)
+{
+ int ret_name_only = 1;
+
+ ShowDeprecationWarning("getObject()", "the object property");
+
+ if (!PyArg_ParseTuple(args, "|i:getObject", &ret_name_only))
+ return NULL;
+
+ if (!m_ob)
+ Py_RETURN_NONE;
+
+ if (ret_name_only)
+ return PyUnicode_FromString(m_ob->GetName().ReadPtr());
+ else
+ return m_ob->GetProxy();
+}
+/* <----- */
+
/* eof */
diff --git a/source/gameengine/Ketsji/KX_ParentActuator.h b/source/gameengine/Ketsji/KX_ParentActuator.h
index f750affc8a1..aeb39eabf89 100644
--- a/source/gameengine/Ketsji/KX_ParentActuator.h
+++ b/source/gameengine/Ketsji/KX_ParentActuator.h
@@ -84,6 +84,11 @@ class KX_ParentActuator : public SCA_IActuator
/* These are used to get and set m_ob */
static PyObject* pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+
+ // Deprecated ----->
+ KX_PYMETHOD_DOC_O(KX_ParentActuator,SetObject);
+ KX_PYMETHOD_DOC_VARARGS(KX_ParentActuator,GetObject);
+ // <-----
}; /* end of class KX_ParentActuator : public SCA_PropertyActuator */
diff --git a/source/gameengine/Ketsji/KX_PolyProxy.cpp b/source/gameengine/Ketsji/KX_PolyProxy.cpp
index af8e0510a11..eae1894428c 100644
--- a/source/gameengine/Ketsji/KX_PolyProxy.cpp
+++ b/source/gameengine/Ketsji/KX_PolyProxy.cpp
@@ -132,19 +132,19 @@ PyObject* KX_PolyProxy::py_getattro(PyObject *attr)
}
if (!strcmp(attr_str, "v1"))
{
- return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, 0));
+ return PyLong_FromSsize_t(m_polygon->GetVertexOffset(0));
}
if (!strcmp(attr_str, "v2"))
{
- return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, 1));
+ return PyLong_FromSsize_t(m_polygon->GetVertexOffset(1));
}
if (!strcmp(attr_str, "v3"))
{
- return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, 2));
+ return PyLong_FromSsize_t(m_polygon->GetVertexOffset(2));
}
if (!strcmp(attr_str, "v4"))
{
- return PyLong_FromSsize_t(((m_polygon->VertexCount()>3)?m_polygon->GetVertexOffsetAbs(m_mesh, 3):0));
+ return PyLong_FromSsize_t(((m_polygon->VertexCount()>3)?m_polygon->GetVertexOffset(3):0));
}
if (!strcmp(attr_str, "visible"))
{
@@ -244,7 +244,7 @@ KX_PYMETHODDEF_DOC(KX_PolyProxy, getVertexIndex,
}
if (index < m_polygon->VertexCount())
{
- return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, index));
+ return PyLong_FromSsize_t(m_polygon->GetVertexOffset(index));
}
return PyLong_FromSsize_t(0);
}
diff --git a/source/gameengine/Ketsji/KX_PyMath.cpp b/source/gameengine/Ketsji/KX_PyMath.cpp
index a41dab194dd..6d33c38190c 100644
--- a/source/gameengine/Ketsji/KX_PyMath.cpp
+++ b/source/gameengine/Ketsji/KX_PyMath.cpp
@@ -146,7 +146,7 @@ PyObject* PyObjectFrom(const MT_Quaternion &qrot)
{
/* NOTE, were re-ordering here for Mathutils compat */
float fvec[4]= {qrot[3], qrot[0], qrot[1], qrot[2]};
- return newQuaternionObject(fvec, Py_NEW, NULL);
+ return newQuaternionObject(fvec, Py_WRAP, NULL);
}
#endif
@@ -154,7 +154,7 @@ PyObject* PyObjectFrom(const MT_Tuple4 &vec)
{
#ifdef USE_MATHUTILS
float fvec[4]= {vec[0], vec[1], vec[2], vec[3]};
- return newVectorObject(fvec, 4, Py_NEW, NULL);
+ return newVectorObject(fvec, 4, Py_WRAP, NULL);
#else
PyObject *list = PyList_New(4);
PyList_SET_ITEM(list, 0, PyFloat_FromDouble(vec[0]));
@@ -169,7 +169,7 @@ PyObject* PyObjectFrom(const MT_Tuple3 &vec)
{
#ifdef USE_MATHUTILS
float fvec[3]= {vec[0], vec[1], vec[2]};
- return newVectorObject(fvec, 3, Py_NEW, NULL);
+ return newVectorObject(fvec, 3, Py_WRAP, NULL);
#else
PyObject *list = PyList_New(3);
PyList_SET_ITEM(list, 0, PyFloat_FromDouble(vec[0]));
@@ -183,7 +183,7 @@ PyObject* PyObjectFrom(const MT_Tuple2 &vec)
{
#ifdef USE_MATHUTILS
float fvec[2]= {vec[0], vec[1]};
- return newVectorObject(fvec, 2, Py_NEW, NULL);
+ return newVectorObject(fvec, 2, Py_WRAP, NULL);
#else
PyObject *list = PyList_New(2);
PyList_SET_ITEM(list, 0, PyFloat_FromDouble(vec[0]));
diff --git a/source/gameengine/Ketsji/KX_PyMath.h b/source/gameengine/Ketsji/KX_PyMath.h
index 17102905607..9ee11c9e745 100644
--- a/source/gameengine/Ketsji/KX_PyMath.h
+++ b/source/gameengine/Ketsji/KX_PyMath.h
@@ -109,33 +109,30 @@ bool PyVecTo(PyObject* pyval, T& vec)
if(VectorObject_Check(pyval)) {
VectorObject *pyvec= (VectorObject *)pyval;
- BaseMath_ReadCallback(pyvec);
if (pyvec->size != Size(vec)) {
PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", pyvec->size, Size(vec));
return false;
}
- vec.setValue((float *) pyvec->vec);
+ vec.getValue((float *) pyvec->vec);
return true;
}
else if(QuaternionObject_Check(pyval)) {
QuaternionObject *pyquat= (QuaternionObject *)pyval;
- BaseMath_ReadCallback(pyquat);
if (4 != Size(vec)) {
PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", 4, Size(vec));
return false;
}
/* xyzw -> wxyz reordering is done by PyQuatTo */
- vec.setValue((float *) pyquat->quat);
+ vec.getValue((float *) pyquat->quat);
return true;
}
else if(EulerObject_Check(pyval)) {
EulerObject *pyeul= (EulerObject *)pyval;
- BaseMath_ReadCallback(pyeul);
if (3 != Size(vec)) {
PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", 3, Size(vec));
return false;
}
- vec.setValue((float *) pyeul->eul);
+ vec.getValue((float *) pyeul->eul);
return true;
} else
#endif
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 298d485aaaf..de3dcd0ebf8 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -32,6 +32,11 @@
// directory header for py function getBlendFileList
#include <stdlib.h>
+#ifndef WIN32
+ #include <dirent.h>
+#else
+ #include "BLI_winstuff.h"
+#endif
#ifdef WIN32
#pragma warning (disable : 4786)
@@ -75,6 +80,8 @@ extern "C" {
#include "InputParser.h"
#include "KX_Scene.h"
+#include "NG_NetworkScene.h" //Needed for sendMessage()
+
#include "BL_Shader.h"
#include "KX_PyMath.h"
@@ -104,13 +111,6 @@ extern "C" {
#include "BLI_blenlib.h"
#include "GPU_material.h"
-#ifndef WIN32
- #include <dirent.h>
-#else
- #include "BLI_winstuff.h"
-#endif
-#include "NG_NetworkScene.h" //Needed for sendMessage()
-
static void setSandbox(TPythonSecurityLevel level);
// 'local' copy of canvas ptr, for window height/width python scripts
@@ -142,7 +142,7 @@ void KX_RasterizerDrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,cons
// List of methods defined in the module
static PyObject* ErrorObject;
-static const char *gPyGetRandomFloat_doc="getRandomFloat returns a random floating point value in the range [0..1]";
+STR_String gPyGetRandomFloat_doc="getRandomFloat returns a random floating point value in the range [0..1)";
static PyObject* gPyGetRandomFloat(PyObject*)
{
@@ -346,7 +346,7 @@ static PyObject* gPyGetBlendFileList(PyObject*, PyObject* args)
return list;
}
-static const char *gPyGetCurrentScene_doc =
+static STR_String gPyGetCurrentScene_doc =
"getCurrentScene()\n"
"Gets a reference to the current scene.\n";
static PyObject* gPyGetCurrentScene(PyObject* self)
@@ -354,7 +354,7 @@ static PyObject* gPyGetCurrentScene(PyObject* self)
return gp_KetsjiScene->GetProxy();
}
-static const char *gPyGetSceneList_doc =
+static STR_String gPyGetSceneList_doc =
"getSceneList()\n"
"Return a list of converted scenes.\n";
static PyObject* gPyGetSceneList(PyObject* self)
@@ -448,18 +448,46 @@ static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *)
}
+static PyObject *gEvalExpression(PyObject*, PyObject* value)
+{
+ char* txt= _PyUnicode_AsString(value);
+
+ if (txt==NULL) {
+ PyErr_SetString(PyExc_TypeError, "Expression.calc(text): expects a single string argument");
+ return NULL;
+ }
+
+ CParser parser;
+ CExpression* expr = parser.ProcessText(txt);
+ CValue* val = expr->Calculate();
+ expr->Release();
+
+ if (val) {
+ PyObject* pyobj = val->ConvertValueToPython();
+ if (pyobj)
+ return pyobj;
+ else
+ return val->GetProxy();
+ }
+
+ Py_RETURN_NONE;
+}
+
+
static struct PyMethodDef game_methods[] = {
{"expandPath", (PyCFunction)gPyExpandPath, METH_VARARGS, (const char *)gPyExpandPath_doc},
{"sendMessage", (PyCFunction)gPySendMessage, METH_VARARGS, (const char *)gPySendMessage_doc},
{"getCurrentController",
(PyCFunction) SCA_PythonController::sPyGetCurrentController,
- METH_NOARGS, SCA_PythonController::sPyGetCurrentController__doc__},
+ METH_NOARGS, (const char *)SCA_PythonController::sPyGetCurrentController__doc__},
{"getCurrentScene", (PyCFunction) gPyGetCurrentScene,
- METH_NOARGS, gPyGetCurrentScene_doc},
+ METH_NOARGS, (const char *)gPyGetCurrentScene_doc.Ptr()},
{"getSceneList", (PyCFunction) gPyGetSceneList,
- METH_NOARGS, (const char *)gPyGetSceneList_doc},
+ METH_NOARGS, (const char *)gPyGetSceneList_doc.Ptr()},
+ {"addActiveActuator",(PyCFunction) SCA_PythonController::sPyAddActiveActuator,
+ METH_VARARGS, (const char *)SCA_PythonController::sPyAddActiveActuator__doc__},
{"getRandomFloat",(PyCFunction) gPyGetRandomFloat,
- METH_NOARGS, (const char *)gPyGetRandomFloat_doc},
+ METH_NOARGS, (const char *)gPyGetRandomFloat_doc.Ptr()},
{"setGravity",(PyCFunction) gPySetGravity, METH_O, (const char *)"set Gravitation"},
{"getSpectrum",(PyCFunction) gPyGetSpectrum, METH_NOARGS, (const char *)"get audio spectrum"},
{"stopDSP",(PyCFunction) gPyStopDSP, METH_VARARGS, (const char *)"stop using the audio dsp (for performance reasons)"},
@@ -474,6 +502,7 @@ static struct PyMethodDef game_methods[] = {
{"getAverageFrameRate", (PyCFunction) gPyGetAverageFrameRate, METH_NOARGS, (const char *)"Gets the estimated average frame rate"},
{"getBlendFileList", (PyCFunction)gPyGetBlendFileList, METH_VARARGS, (const char *)"Gets a list of blend files in the same directory as the current blend file"},
{"PrintGLInfo", (PyCFunction)pyPrintExt, METH_NOARGS, (const char *)"Prints GL Extension Info"},
+ {"EvalExpression", (PyCFunction)gEvalExpression, METH_O, (const char *)"Evaluate a string as a game logic expression"},
{NULL, (PyCFunction) NULL, 0, NULL }
};
@@ -2016,3 +2045,6 @@ void resetGamePythonPath()
{
gp_GamePythonPathOrig[0] = '\0';
}
+
+
+
diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
index 61e563791c3..5260c0bb01a 100644
--- a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
@@ -123,6 +123,9 @@ static void PyType_Ready_ADD(PyObject *dict, PyTypeObject *tp, PyAttributeDef *a
memset(attr_getset, 0, sizeof(PyGetSetDef));
}
} else {
+
+ PyObject *item;
+
PyType_Ready(tp);
PyDict_SetItemString(dict, tp->tp_name, reinterpret_cast<PyObject *>(tp));
}
diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp
index 75a7c9b8aeb..4fc5252de60 100644
--- a/source/gameengine/Ketsji/KX_PythonSeq.cpp
+++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp
@@ -340,42 +340,11 @@ static PyObject *KX_PythonSeq_nextIter(KX_PythonSeq *self)
}
-static int KX_PythonSeq_compare( KX_PythonSeq * a, KX_PythonSeq * b )
+static int KX_PythonSeq_compare( KX_PythonSeq * a, KX_PythonSeq * b ) /* TODO - python3.x wants richcmp */
{
return ( a->type == b->type && a->base == b->base) ? 0 : -1;
}
-static PyObject *KX_PythonSeq_richcmp(PyObject *a, PyObject *b, int op)
-{
- PyObject *res;
- int ok= -1; /* zero is true */
-
- if(BPy_KX_PythonSeq_Check(a) && BPy_KX_PythonSeq_Check(b))
- ok= KX_PythonSeq_compare((KX_PythonSeq *)a, (KX_PythonSeq *)b);
-
- switch (op) {
- case Py_NE:
- ok = !ok; /* pass through */
- case Py_EQ:
- res = ok ? Py_False : Py_True;
- break;
-
- case Py_LT:
- case Py_LE:
- case Py_GT:
- case Py_GE:
- res = Py_NotImplemented;
- break;
- default:
- PyErr_BadArgument();
- return NULL;
- }
-
- Py_INCREF(res);
- return res;
-}
-
-
/*
* repr function
* convert to a list and get its string value
@@ -405,7 +374,8 @@ PyTypeObject KX_PythonSeq_Type = {
NULL, /* printfunc tp_print; */
NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
+ /* TODO, richcmp */
+ NULL, /* ( cmpfunc ) KX_PythonSeq_compare, /* cmpfunc tp_compare; */
( reprfunc ) KX_PythonSeq_repr, /* reprfunc tp_repr; */
/* Method suites for standard classes */
@@ -431,14 +401,14 @@ PyTypeObject KX_PythonSeq_Type = {
NULL, /* char *tp_doc; Documentation string */
/*** Assigned meaning in release 2.0 ***/
/* call function for all accessible objects */
- NULL, /* traverseproc tp_traverse; */
+ NULL, /* traverseproc tp_traverse; */
/* delete references to contained objects */
NULL, /* inquiry tp_clear; */
/*** Assigned meaning in release 2.1 ***/
/*** rich comparisons ***/
- (richcmpfunc)KX_PythonSeq_richcmp, /* richcmpfunc tp_richcompare; */
+ NULL, /* richcmpfunc tp_richcompare; */
/*** weak reference enabler ***/
0, /* long tp_weaklistoffset; */
diff --git a/source/gameengine/Ketsji/KX_RadarSensor.cpp b/source/gameengine/Ketsji/KX_RadarSensor.cpp
index eb127be8044..d020a2544d2 100644
--- a/source/gameengine/Ketsji/KX_RadarSensor.cpp
+++ b/source/gameengine/Ketsji/KX_RadarSensor.cpp
@@ -176,7 +176,51 @@ void KX_RadarSensor::SynchronizeTransform()
/* Python Functions */
/* ------------------------------------------------------------------------- */
-/* none */
+//Deprecated ----->
+/* getConeOrigin */
+const char KX_RadarSensor::GetConeOrigin_doc[] =
+"getConeOrigin()\n"
+"\tReturns the origin of the cone with which to test. The origin\n"
+"\tis in the middle of the cone.";
+PyObject* KX_RadarSensor::PyGetConeOrigin() {
+ ShowDeprecationWarning("getConeOrigin()", "the coneOrigin property");
+
+ PyObject *retVal = PyList_New(3);
+
+ PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(m_cone_origin[0]));
+ PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(m_cone_origin[1]));
+ PyList_SET_ITEM(retVal, 2, PyFloat_FromDouble(m_cone_origin[2]));
+
+ return retVal;
+}
+
+/* getConeOrigin */
+const char KX_RadarSensor::GetConeTarget_doc[] =
+"getConeTarget()\n"
+"\tReturns the center of the bottom face of the cone with which to test.\n";
+PyObject* KX_RadarSensor::PyGetConeTarget() {
+ ShowDeprecationWarning("getConeTarget()", "the coneTarget property");
+
+ PyObject *retVal = PyList_New(3);
+
+ PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(m_cone_target[0]));
+ PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(m_cone_target[1]));
+ PyList_SET_ITEM(retVal, 2, PyFloat_FromDouble(m_cone_target[2]));
+
+ return retVal;
+}
+
+/* getConeHeight */
+const char KX_RadarSensor::GetConeHeight_doc[] =
+"getConeHeight()\n"
+"\tReturns the height of the cone with which to test.\n";
+PyObject* KX_RadarSensor::PyGetConeHeight() {
+
+ ShowDeprecationWarning("getConeHeight()", "the distance property");
+
+ return PyFloat_FromDouble(m_coneheight);
+}
+//<----- Deprecated
/* ------------------------------------------------------------------------- */
/* Python Integration Hooks */
@@ -204,6 +248,14 @@ PyTypeObject KX_RadarSensor::Type = {
};
PyMethodDef KX_RadarSensor::Methods[] = {
+ //Deprecated ----->
+ {"getConeOrigin", (PyCFunction) KX_RadarSensor::sPyGetConeOrigin,
+ METH_VARARGS, (const char *)GetConeOrigin_doc},
+ {"getConeTarget", (PyCFunction) KX_RadarSensor::sPyGetConeTarget,
+ METH_VARARGS, (const char *)GetConeTarget_doc},
+ {"getConeHeight", (PyCFunction) KX_RadarSensor::sPyGetConeHeight,
+ METH_VARARGS, (const char *)GetConeHeight_doc},
+ //<-----
{NULL} //Sentinel
};
diff --git a/source/gameengine/Ketsji/KX_RadarSensor.h b/source/gameengine/Ketsji/KX_RadarSensor.h
index 487e9f1aaa7..9f38d75abc4 100644
--- a/source/gameengine/Ketsji/KX_RadarSensor.h
+++ b/source/gameengine/Ketsji/KX_RadarSensor.h
@@ -90,6 +90,11 @@ public:
/* python */
virtual sensortype GetSensorType() { return ST_RADAR; }
+ //Deprecated ----->
+ KX_PYMETHOD_DOC_NOARGS(KX_RadarSensor,GetConeOrigin);
+ KX_PYMETHOD_DOC_NOARGS(KX_RadarSensor,GetConeTarget);
+ KX_PYMETHOD_DOC_NOARGS(KX_RadarSensor,GetConeHeight);
+ //<-----
};
#endif //__KX_RADAR_SENSOR_H
diff --git a/source/gameengine/Ketsji/KX_RaySensor.cpp b/source/gameengine/Ketsji/KX_RaySensor.cpp
index 1f36945ccaa..8616145d709 100644
--- a/source/gameengine/Ketsji/KX_RaySensor.cpp
+++ b/source/gameengine/Ketsji/KX_RaySensor.cpp
@@ -342,6 +342,12 @@ PyTypeObject KX_RaySensor::Type = {
};
PyMethodDef KX_RaySensor::Methods[] = {
+ // Deprecated ----->
+ {"getHitObject",(PyCFunction) KX_RaySensor::sPyGetHitObject,METH_NOARGS, (const char *)GetHitObject_doc},
+ {"getHitPosition",(PyCFunction) KX_RaySensor::sPyGetHitPosition,METH_NOARGS, (const char *)GetHitPosition_doc},
+ {"getHitNormal",(PyCFunction) KX_RaySensor::sPyGetHitNormal,METH_NOARGS, (const char *)GetHitNormal_doc},
+ {"getRayDirection",(PyCFunction) KX_RaySensor::sPyGetRayDirection,METH_NOARGS, (const char *)GetRayDirection_doc},
+ // <-----
{NULL,NULL} //Sentinel
};
@@ -366,3 +372,68 @@ PyObject* KX_RaySensor::pyattr_get_hitobject(void *self_v, const KX_PYATTRIBUTE_
Py_RETURN_NONE;
}
+
+// Deprecated ----->
+const char KX_RaySensor::GetHitObject_doc[] =
+"getHitObject()\n"
+"\tReturns the name of the object that was hit by this ray.\n";
+PyObject* KX_RaySensor::PyGetHitObject()
+{
+ ShowDeprecationWarning("getHitObject()", "the hitObject property");
+ if (m_hitObject)
+ {
+ return m_hitObject->GetProxy();
+ }
+ Py_RETURN_NONE;
+}
+
+
+const char KX_RaySensor::GetHitPosition_doc[] =
+"getHitPosition()\n"
+"\tReturns the position (in worldcoordinates) where the object was hit by this ray.\n";
+PyObject* KX_RaySensor::PyGetHitPosition()
+{
+ ShowDeprecationWarning("getHitPosition()", "the hitPosition property");
+
+ PyObject *retVal = PyList_New(3);
+
+ PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(m_hitPosition[0]));
+ PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(m_hitPosition[1]));
+ PyList_SET_ITEM(retVal, 2, PyFloat_FromDouble(m_hitPosition[2]));
+
+ return retVal;
+}
+
+const char KX_RaySensor::GetRayDirection_doc[] =
+"getRayDirection()\n"
+"\tReturns the direction from the ray (in worldcoordinates) .\n";
+PyObject* KX_RaySensor::PyGetRayDirection()
+{
+ ShowDeprecationWarning("getRayDirection()", "the rayDirection property");
+
+ PyObject *retVal = PyList_New(3);
+
+ PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(m_rayDirection[0]));
+ PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(m_rayDirection[1]));
+ PyList_SET_ITEM(retVal, 2, PyFloat_FromDouble(m_rayDirection[2]));
+
+ return retVal;
+}
+
+const char KX_RaySensor::GetHitNormal_doc[] =
+"getHitNormal()\n"
+"\tReturns the normal (in worldcoordinates) of the object at the location where the object was hit by this ray.\n";
+PyObject* KX_RaySensor::PyGetHitNormal()
+{
+ ShowDeprecationWarning("getHitNormal()", "the hitNormal property");
+
+ PyObject *retVal = PyList_New(3);
+
+ PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(m_hitNormal[0]));
+ PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(m_hitNormal[1]));
+ PyList_SET_ITEM(retVal, 2, PyFloat_FromDouble(m_hitNormal[2]));
+
+ return retVal;
+}
+
+// <----- Deprecated
diff --git a/source/gameengine/Ketsji/KX_RaySensor.h b/source/gameengine/Ketsji/KX_RaySensor.h
index d3e92a14214..530c8ce54e5 100644
--- a/source/gameengine/Ketsji/KX_RaySensor.h
+++ b/source/gameengine/Ketsji/KX_RaySensor.h
@@ -84,6 +84,12 @@ public:
KX_RAY_AXIS_NEG_Z
};
+ // Deprecated ----->
+ KX_PYMETHOD_DOC_NOARGS(KX_RaySensor,GetHitObject);
+ KX_PYMETHOD_DOC_NOARGS(KX_RaySensor,GetHitPosition);
+ KX_PYMETHOD_DOC_NOARGS(KX_RaySensor,GetHitNormal);
+ KX_PYMETHOD_DOC_NOARGS(KX_RaySensor,GetRayDirection);
+ // <-----
/* Attributes */
static PyObject* pyattr_get_hitobject(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
index 099403fc28d..fffb0ac1220 100644
--- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
@@ -192,7 +192,18 @@ PyTypeObject KX_SCA_AddObjectActuator::Type = {
};
PyMethodDef KX_SCA_AddObjectActuator::Methods[] = {
+ // ---> deprecated
+ {"setTime", (PyCFunction) KX_SCA_AddObjectActuator::sPySetTime, METH_O, (const char *)SetTime_doc},
+ {"getTime", (PyCFunction) KX_SCA_AddObjectActuator::sPyGetTime, METH_NOARGS, (const char *)GetTime_doc},
+ {"getLinearVelocity", (PyCFunction) KX_SCA_AddObjectActuator::sPyGetLinearVelocity, METH_NOARGS, (const char *)GetLinearVelocity_doc},
+ {"setLinearVelocity", (PyCFunction) KX_SCA_AddObjectActuator::sPySetLinearVelocity, METH_VARARGS, (const char *)SetLinearVelocity_doc},
+ {"getAngularVelocity", (PyCFunction) KX_SCA_AddObjectActuator::sPyGetAngularVelocity, METH_NOARGS, (const char *)GetAngularVelocity_doc},
+ {"setAngularVelocity", (PyCFunction) KX_SCA_AddObjectActuator::sPySetAngularVelocity, METH_VARARGS, (const char *)SetAngularVelocity_doc},
+ {"getLastCreatedObject", (PyCFunction) KX_SCA_AddObjectActuator::sPyGetLastCreatedObject, METH_NOARGS,"getLastCreatedObject() : get the object handle to the last created object\n"},
{"instantAddObject", (PyCFunction) KX_SCA_AddObjectActuator::sPyInstantAddObject, METH_NOARGS,"instantAddObject() : immediately add object without delay\n"},
+ {"setObject", (PyCFunction) KX_SCA_AddObjectActuator::sPySetObject, METH_O, (const char *)SetObject_doc},
+ {"getObject", (PyCFunction) KX_SCA_AddObjectActuator::sPyGetObject, METH_VARARGS, (const char *)GetObject_doc},
+
{NULL,NULL} //Sentinel
};
@@ -242,6 +253,181 @@ PyObject* KX_SCA_AddObjectActuator::pyattr_get_objectLastCreated(void *self, con
return actuator->m_lastCreatedObject->GetProxy();
}
+/* 1. setObject */
+const char KX_SCA_AddObjectActuator::SetObject_doc[] =
+"setObject(object)\n"
+"\t- object: KX_GameObject, string or None\n"
+"\tSets the object that will be added. There has to be an object\n"
+"\tof this name. If not, this function does nothing.\n";
+PyObject* KX_SCA_AddObjectActuator::PySetObject(PyObject* value)
+{
+ KX_GameObject *gameobj;
+
+ ShowDeprecationWarning("setObject()", "the object property");
+
+ if (!ConvertPythonToGameObject(value, &gameobj, true, "actuator.setObject(value): KX_SCA_AddObjectActuator"))
+ return NULL; // ConvertPythonToGameObject sets the error
+
+ if (m_OriginalObject != NULL)
+ m_OriginalObject->UnregisterActuator(this);
+
+ m_OriginalObject = (SCA_IObject*)gameobj;
+ if (m_OriginalObject)
+ m_OriginalObject->RegisterActuator(this);
+
+ Py_RETURN_NONE;
+}
+
+
+
+/* 2. setTime */
+const char KX_SCA_AddObjectActuator::SetTime_doc[] =
+"setTime(duration)\n"
+"\t- duration: integer\n"
+"\tSets the lifetime of the object that will be added, in frames. \n"
+"\tIf the duration is negative, it is set to 0.\n";
+
+
+PyObject* KX_SCA_AddObjectActuator::PySetTime(PyObject* value)
+{
+ ShowDeprecationWarning("setTime()", "the time property");
+ int deltatime = PyLong_AsSsize_t(value);
+ if (deltatime==-1 && PyErr_Occurred()) {
+ PyErr_SetString(PyExc_TypeError, "expected an int");
+ return NULL;
+ }
+
+ m_timeProp = deltatime;
+ if (m_timeProp < 0) m_timeProp = 0;
+
+ Py_RETURN_NONE;
+}
+
+
+
+/* 3. getTime */
+const char KX_SCA_AddObjectActuator::GetTime_doc[] =
+"getTime()\n"
+"\tReturns the lifetime of the object that will be added.\n";
+
+
+PyObject* KX_SCA_AddObjectActuator::PyGetTime()
+{
+ ShowDeprecationWarning("getTime()", "the time property");
+ return PyLong_FromSsize_t(m_timeProp);
+}
+
+
+/* 4. getObject */
+const char KX_SCA_AddObjectActuator::GetObject_doc[] =
+"getObject(name_only = 1)\n"
+"name_only - optional arg, when true will return the KX_GameObject rather then its name\n"
+"\tReturns the name of the object that will be added.\n";
+PyObject* KX_SCA_AddObjectActuator::PyGetObject(PyObject* args)
+{
+ int ret_name_only = 1;
+
+ ShowDeprecationWarning("getObject()", "the object property");
+
+ if (!PyArg_ParseTuple(args, "|i:getObject", &ret_name_only))
+ return NULL;
+
+ if (!m_OriginalObject)
+ Py_RETURN_NONE;
+
+ if (ret_name_only)
+ return PyUnicode_FromString(m_OriginalObject->GetName().ReadPtr());
+ else
+ return m_OriginalObject->GetProxy();
+}
+
+
+
+/* 5. getLinearVelocity */
+const char KX_SCA_AddObjectActuator::GetLinearVelocity_doc[] =
+"GetLinearVelocity()\n"
+"\tReturns the linear velocity that will be assigned to \n"
+"\tthe created object.\n";
+
+PyObject* KX_SCA_AddObjectActuator::PyGetLinearVelocity()
+{
+ ShowDeprecationWarning("getLinearVelocity()", "the linearVelocity property");
+ PyObject *retVal = PyList_New(3);
+
+ PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(m_linear_velocity[0]));
+ PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(m_linear_velocity[1]));
+ PyList_SET_ITEM(retVal, 2, PyFloat_FromDouble(m_linear_velocity[2]));
+
+ return retVal;
+}
+
+
+
+/* 6. setLinearVelocity */
+const char KX_SCA_AddObjectActuator::SetLinearVelocity_doc[] =
+"setLinearVelocity(vx, vy, vz)\n"
+"\t- vx: float\n"
+"\t- vy: float\n"
+"\t- vz: float\n"
+"\t- local: bool\n"
+"\tAssign this velocity to the created object. \n";
+
+PyObject* KX_SCA_AddObjectActuator::PySetLinearVelocity(PyObject* args)
+{
+ ShowDeprecationWarning("setLinearVelocity()", "the linearVelocity property");
+
+ float vecArg[3];
+ if (!PyArg_ParseTuple(args, "fff:setLinearVelocity", &vecArg[0], &vecArg[1], &vecArg[2]))
+ return NULL;
+
+ m_linear_velocity[0] = vecArg[0];
+ m_linear_velocity[1] = vecArg[1];
+ m_linear_velocity[2] = vecArg[2];
+ Py_RETURN_NONE;
+}
+
+/* 7. getAngularVelocity */
+const char KX_SCA_AddObjectActuator::GetAngularVelocity_doc[] =
+"GetAngularVelocity()\n"
+"\tReturns the angular velocity that will be assigned to \n"
+"\tthe created object.\n";
+
+PyObject* KX_SCA_AddObjectActuator::PyGetAngularVelocity()
+{
+ ShowDeprecationWarning("getAngularVelocity()", "the angularVelocity property");
+ PyObject *retVal = PyList_New(3);
+
+ PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(m_angular_velocity[0]));
+ PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(m_angular_velocity[1]));
+ PyList_SET_ITEM(retVal, 2, PyFloat_FromDouble(m_angular_velocity[2]));
+
+ return retVal;
+}
+
+
+
+/* 8. setAngularVelocity */
+const char KX_SCA_AddObjectActuator::SetAngularVelocity_doc[] =
+"setAngularVelocity(vx, vy, vz)\n"
+"\t- vx: float\n"
+"\t- vy: float\n"
+"\t- vz: float\n"
+"\t- local: bool\n"
+"\tAssign this angular velocity to the created object. \n";
+
+PyObject* KX_SCA_AddObjectActuator::PySetAngularVelocity(PyObject* args)
+{
+ ShowDeprecationWarning("setAngularVelocity()", "the angularVelocity property");
+
+ float vecArg[3];
+ if (!PyArg_ParseTuple(args, "fff:setAngularVelocity", &vecArg[0], &vecArg[1], &vecArg[2]))
+ return NULL;
+
+ m_angular_velocity[0] = vecArg[0];
+ m_angular_velocity[1] = vecArg[1];
+ m_angular_velocity[2] = vecArg[2];
+ Py_RETURN_NONE;
+}
void KX_SCA_AddObjectActuator::InstantAddObject()
{
@@ -284,3 +470,26 @@ PyObject* KX_SCA_AddObjectActuator::PyInstantAddObject()
Py_RETURN_NONE;
}
+
+
+
+/* 7. GetLastCreatedObject */
+const char KX_SCA_AddObjectActuator::GetLastCreatedObject_doc[] =
+"getLastCreatedObject()\n"
+"\tReturn the last created object. \n";
+
+
+PyObject* KX_SCA_AddObjectActuator::PyGetLastCreatedObject()
+{
+ ShowDeprecationWarning("getLastCreatedObject()", "the objectLastCreated property");
+ SCA_IObject* result = this->GetLastCreatedObject();
+
+ // if result->GetSGNode() is NULL
+ // it means the object has ended, The BGE python api crashes in many places if the object is returned.
+ if (result && (static_cast<KX_GameObject *>(result))->GetSGNode())
+ {
+ return result->GetProxy();
+ }
+ // don't return NULL to python anymore, it gives trouble in the scripts
+ Py_RETURN_NONE;
+}
diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
index 7137ba5209e..3151e7a89ca 100644
--- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
+++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
@@ -115,6 +115,25 @@ public:
void InstantAddObject();
+ /* 1. setObject */
+ KX_PYMETHOD_DOC_O(KX_SCA_AddObjectActuator,SetObject);
+ /* 2. setTime */
+ KX_PYMETHOD_DOC_O(KX_SCA_AddObjectActuator,SetTime);
+ /* 3. getTime */
+ KX_PYMETHOD_DOC_NOARGS(KX_SCA_AddObjectActuator,GetTime);
+ /* 4. getObject */
+ KX_PYMETHOD_DOC_VARARGS(KX_SCA_AddObjectActuator,GetObject);
+ /* 5. getLinearVelocity */
+ KX_PYMETHOD_DOC_NOARGS(KX_SCA_AddObjectActuator,GetLinearVelocity);
+ /* 6. setLinearVelocity */
+ KX_PYMETHOD_DOC_VARARGS(KX_SCA_AddObjectActuator,SetLinearVelocity);
+ /* 7. getAngularVelocity */
+ KX_PYMETHOD_DOC_NOARGS(KX_SCA_AddObjectActuator,GetAngularVelocity);
+ /* 8. setAngularVelocity */
+ KX_PYMETHOD_DOC_VARARGS(KX_SCA_AddObjectActuator,SetAngularVelocity);
+ /* 9. getLastCreatedObject */
+ KX_PYMETHOD_DOC_NOARGS(KX_SCA_AddObjectActuator,GetLastCreatedObject);
+ /* 10. instantAddObject*/
KX_PYMETHOD_DOC_NOARGS(KX_SCA_AddObjectActuator,InstantAddObject);
static PyObject* pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
index 646cfb7219f..196c1915f72 100644
--- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
@@ -70,6 +70,9 @@ PyTypeObject KX_SCA_DynamicActuator::Type = {
};
PyMethodDef KX_SCA_DynamicActuator::Methods[] = {
+ // ---> deprecated
+ KX_PYMETHODTABLE(KX_SCA_DynamicActuator, setOperation),
+ KX_PYMETHODTABLE(KX_SCA_DynamicActuator, getOperation),
{NULL,NULL} //Sentinel
};
@@ -79,6 +82,42 @@ PyAttributeDef KX_SCA_DynamicActuator::Attributes[] = {
{ NULL } //Sentinel
};
+
+/* 1. setOperation */
+KX_PYMETHODDEF_DOC(KX_SCA_DynamicActuator, setOperation,
+"setOperation(operation?)\n"
+"\t - operation? : type of dynamic operation\n"
+"\t 0 = restore dynamics\n"
+"\t 1 = disable dynamics\n"
+"\t 2 = enable rigid body\n"
+"\t 3 = disable rigid body\n"
+"Change the dynamic status of the parent object.\n")
+{
+ ShowDeprecationWarning("setOperation()", "the mode property");
+ int dyn_operation;
+
+ if (!PyArg_ParseTuple(args, "i:setOperation", &dyn_operation))
+ {
+ return NULL;
+ }
+ if (dyn_operation <0 || dyn_operation>3) {
+ PyErr_SetString(PyExc_IndexError, "Dynamic Actuator's setOperation() range must be between 0 and 3");
+ return NULL;
+ }
+ m_dyn_operation= dyn_operation;
+ Py_RETURN_NONE;
+}
+
+KX_PYMETHODDEF_DOC(KX_SCA_DynamicActuator, getOperation,
+"getOperation() -> integer\n"
+"Returns the operation type of this actuator.\n"
+)
+{
+ ShowDeprecationWarning("getOperation()", "the mode property");
+ return PyLong_FromSsize_t((long)m_dyn_operation);
+}
+
+
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h
index 58b28654eca..8b598c9ecfa 100644
--- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h
+++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h
@@ -71,6 +71,11 @@ class KX_SCA_DynamicActuator : public SCA_IActuator
KX_DYN_DISABLE_RIGID_BODY,
KX_DYN_SET_MASS,
};
+
+ /* 1. setOperation */
+ KX_PYMETHOD_DOC(KX_SCA_DynamicActuator,setOperation);
+ KX_PYMETHOD_DOC(KX_SCA_DynamicActuator,getOperation);
+
};
#endif
diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
index e85b8a32798..0819ad99633 100644
--- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
@@ -74,6 +74,9 @@ PyTypeObject KX_SCA_ReplaceMeshActuator::Type = {
PyMethodDef KX_SCA_ReplaceMeshActuator::Methods[] = {
KX_PYMETHODTABLE(KX_SCA_ReplaceMeshActuator, instantReplaceMesh),
+ // Deprecated ----->
+ {"setMesh", (PyCFunction) KX_SCA_ReplaceMeshActuator::sPySetMesh, METH_O, (const char *)SetMesh_doc},
+ KX_PYMETHODTABLE(KX_SCA_ReplaceMeshActuator, getMesh),
{NULL,NULL} //Sentinel
};
@@ -105,6 +108,37 @@ int KX_SCA_ReplaceMeshActuator::pyattr_set_mesh(void *self, const struct KX_PYAT
return PY_SET_ATTR_SUCCESS;
}
+/* 1. setMesh */
+const char KX_SCA_ReplaceMeshActuator::SetMesh_doc[] =
+ "setMesh(name)\n"
+ "\t- name: string or None\n"
+ "\tSet the mesh that will be substituted for the current one.\n";
+
+PyObject* KX_SCA_ReplaceMeshActuator::PySetMesh(PyObject* value)
+{
+ ShowDeprecationWarning("setMesh()", "the mesh property");
+ RAS_MeshObject* new_mesh;
+
+ if (!ConvertPythonToMesh(value, &new_mesh, true, "actuator.mesh = value: KX_SCA_ReplaceMeshActuator"))
+ return NULL;
+
+ m_mesh = new_mesh;
+ Py_RETURN_NONE;
+}
+
+KX_PYMETHODDEF_DOC(KX_SCA_ReplaceMeshActuator, getMesh,
+"getMesh() -> string\n"
+"Returns the name of the mesh to be substituted.\n"
+)
+{
+ ShowDeprecationWarning("getMesh()", "the mesh property");
+ if (!m_mesh)
+ Py_RETURN_NONE;
+
+ return PyUnicode_FromString(const_cast<char *>(m_mesh->GetName().ReadPtr()));
+}
+
+
KX_PYMETHODDEF_DOC(KX_SCA_ReplaceMeshActuator, instantReplaceMesh,
"instantReplaceMesh() : immediately replace mesh without delay\n")
{
diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
index e5482c29aa7..ae2c0d2d6ce 100644
--- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
+++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
@@ -50,8 +50,8 @@ class KX_SCA_ReplaceMeshActuator : public SCA_IActuator
// mesh reference (mesh to replace)
RAS_MeshObject* m_mesh;
SCA_IScene* m_scene;
- bool m_use_gfx;
bool m_use_phys;
+ bool m_use_gfx;
public:
KX_SCA_ReplaceMeshActuator(
@@ -74,13 +74,12 @@ class KX_SCA_ReplaceMeshActuator : public SCA_IActuator
void InstantReplaceMesh();
- /* --------------------------------------------------------------------- */
- /* Python interface ---------------------------------------------------- */
- /* --------------------------------------------------------------------- */
-
static PyObject* pyattr_get_mesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_mesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+ /* 1. setMesh */
+ KX_PYMETHOD_DOC_O(KX_SCA_ReplaceMeshActuator,SetMesh);
+ KX_PYMETHOD_DOC(KX_SCA_ReplaceMeshActuator,getMesh);
KX_PYMETHOD_DOC(KX_SCA_ReplaceMeshActuator,instantReplaceMesh);
};
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index 3483496c3a6..5c19911fe58 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1615,10 +1615,7 @@ PyTypeObject KX_Scene::Type = {
0,
0,
py_base_repr,
- 0,
- &Sequence,
- &Mapping,
- 0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
0,0,0,0,0,0,0,
Methods,
@@ -1630,117 +1627,13 @@ PyTypeObject KX_Scene::Type = {
};
PyMethodDef KX_Scene::Methods[] = {
+ KX_PYMETHODTABLE_NOARGS(KX_Scene, getLightList),
+ KX_PYMETHODTABLE_NOARGS(KX_Scene, getObjectList),
+ KX_PYMETHODTABLE_NOARGS(KX_Scene, getName),
KX_PYMETHODTABLE(KX_Scene, addObject),
- /* dict style access */
- KX_PYMETHODTABLE(KX_Scene, get),
-
{NULL,NULL} //Sentinel
};
-static PyObject *Map_GetItem(PyObject *self_v, PyObject *item)
-{
- KX_Scene* self= static_cast<KX_Scene*>BGE_PROXY_REF(self_v);
- const char *attr_str= _PyUnicode_AsString(item);
- PyObject* pyconvert;
-
- if (self==NULL) {
- PyErr_SetString(PyExc_SystemError, "val = scene[key]: KX_Scene, "BGE_PROXY_ERROR_MSG);
- return NULL;
- }
-
- if (self->m_attr_dict && (pyconvert=PyDict_GetItem(self->m_attr_dict, item))) {
-
- if (attr_str)
- PyErr_Clear();
- Py_INCREF(pyconvert);
- return pyconvert;
- }
- else {
- if(attr_str) PyErr_Format(PyExc_KeyError, "value = scene[key]: KX_Scene, key \"%s\" does not exist", attr_str);
- else PyErr_SetString(PyExc_KeyError, "value = scene[key]: KX_Scene, key does not exist");
- return NULL;
- }
-
-}
-
-static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val)
-{
- KX_Scene* self= static_cast<KX_Scene*>BGE_PROXY_REF(self_v);
- const char *attr_str= _PyUnicode_AsString(key);
- if(attr_str==NULL)
- PyErr_Clear();
-
- if (self==NULL) {
- PyErr_SetString(PyExc_SystemError, "scene[key] = value: KX_Scene, "BGE_PROXY_ERROR_MSG);
- return -1;
- }
-
- if (val==NULL) { /* del ob["key"] */
- int del= 0;
-
- if(self->m_attr_dict)
- del |= (PyDict_DelItem(self->m_attr_dict, key)==0) ? 1:0;
-
- if (del==0) {
- if(attr_str) PyErr_Format(PyExc_KeyError, "scene[key] = value: KX_Scene, key \"%s\" could not be set", attr_str);
- else PyErr_SetString(PyExc_KeyError, "del scene[key]: KX_Scene, key could not be deleted");
- return -1;
- }
- else if (self->m_attr_dict) {
- PyErr_Clear(); /* PyDict_DelItem sets an error when it fails */
- }
- }
- else { /* ob["key"] = value */
- int set = 0;
-
- if (self->m_attr_dict==NULL) /* lazy init */
- self->m_attr_dict= PyDict_New();
-
-
- if(PyDict_SetItem(self->m_attr_dict, key, val)==0)
- set= 1;
- else
- PyErr_SetString(PyExc_KeyError, "scene[key] = value: KX_Scene, key not be added to internal dictionary");
-
- if(set==0)
- return -1; /* pythons error value */
-
- }
-
- return 0; /* success */
-}
-
-static int Seq_Contains(PyObject *self_v, PyObject *value)
-{
- KX_Scene* self= static_cast<KX_Scene*>BGE_PROXY_REF(self_v);
-
- if (self==NULL) {
- PyErr_SetString(PyExc_SystemError, "val in scene: KX_Scene, "BGE_PROXY_ERROR_MSG);
- return -1;
- }
-
- if (self->m_attr_dict && PyDict_GetItem(self->m_attr_dict, value))
- return 1;
-
- return 0;
-}
-
-PyMappingMethods KX_Scene::Mapping = {
- (lenfunc)NULL , /*inquiry mp_length */
- (binaryfunc)Map_GetItem, /*binaryfunc mp_subscript */
- (objobjargproc)Map_SetItem, /*objobjargproc mp_ass_subscript */
-};
-
-PySequenceMethods KX_Scene::Sequence = {
- NULL, /* Cant set the len otherwise it can evaluate as false */
- NULL, /* sq_concat */
- NULL, /* sq_repeat */
- NULL, /* sq_item */
- NULL, /* sq_slice */
- NULL, /* sq_ass_item */
- NULL, /* sq_ass_slice */
- (objobjproc)Seq_Contains, /* sq_contains */
-};
PyObject* KX_Scene::pyattr_get_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
@@ -1821,6 +1714,33 @@ PyAttributeDef KX_Scene::Attributes[] = {
{ NULL } //Sentinel
};
+KX_PYMETHODDEF_DOC_NOARGS(KX_Scene, getLightList,
+"getLightList() -> list [KX_Light]\n"
+"Returns a list of all lights in the scene.\n"
+)
+{
+ ShowDeprecationWarning("getLightList()", "the lights property");
+ return m_lightlist->GetProxy();
+}
+
+KX_PYMETHODDEF_DOC_NOARGS(KX_Scene, getObjectList,
+"getObjectList() -> list [KX_GameObject]\n"
+"Returns a list of all game objects in the scene.\n"
+)
+{
+ ShowDeprecationWarning("getObjectList()", "the objects property");
+ return m_objectlist->GetProxy();
+}
+
+KX_PYMETHODDEF_DOC_NOARGS(KX_Scene, getName,
+"getName() -> string\n"
+"Returns the name of the scene.\n"
+)
+{
+ ShowDeprecationWarning("getName()", "the name property");
+ return PyUnicode_FromString(GetName());
+}
+
KX_PYMETHODDEF_DOC(KX_Scene, addObject,
"addObject(object, other, time=0)\n"
"Returns the added object.\n")
@@ -1845,22 +1765,3 @@ KX_PYMETHODDEF_DOC(KX_Scene, addObject,
replica->Release();
return replica->GetProxy();
}
-
-/* Matches python dict.get(key, [default]) */
-KX_PYMETHODDEF_DOC(KX_Scene, get, "")
-{
- PyObject *key;
- PyObject* def = Py_None;
- PyObject* ret;
-
- if (!PyArg_ParseTuple(args, "O|O:get", &key, &def))
- return NULL;
-
- if (m_attr_dict && (ret=PyDict_GetItem(m_attr_dict, key))) {
- Py_INCREF(ret);
- return ret;
- }
-
- Py_INCREF(def);
- return def;
-}
diff --git a/source/gameengine/Ketsji/KX_Scene.h b/source/gameengine/Ketsji/KX_Scene.h
index 3e0dc303d72..f48e9520f53 100644
--- a/source/gameengine/Ketsji/KX_Scene.h
+++ b/source/gameengine/Ketsji/KX_Scene.h
@@ -90,7 +90,6 @@ struct KX_ClientObjectInfo;
class KX_Scene : public PyObjectPlus, public SCA_IScene
{
Py_Header;
- PyObject* m_attr_dict;
struct CullingInfo {
int m_layer;
@@ -263,10 +262,15 @@ protected:
double m_suspendedtime;
double m_suspendeddelta;
+
+ /**
+ * This stores anything from python
+ */
+ PyObject* m_attr_dict;
struct Scene* m_blenderScene;
-public:
+public:
KX_Scene(class SCA_IInputDevice* keyboarddevice,
class SCA_IInputDevice* mousedevice,
class NG_NetworkDeviceInterface* ndi,
@@ -517,12 +521,23 @@ public:
*/
void SetNodeTree(SG_Tree* root);
- /* --------------------------------------------------------------------- */
- /* Python interface ---------------------------------------------------- */
- /* --------------------------------------------------------------------- */
-
+ KX_PYMETHOD_DOC_NOARGS(KX_Scene, getLightList);
+ KX_PYMETHOD_DOC_NOARGS(KX_Scene, getObjectList);
+ KX_PYMETHOD_DOC_NOARGS(KX_Scene, getName);
KX_PYMETHOD_DOC(KX_Scene, addObject);
- KX_PYMETHOD_DOC(KX_Scene, get);
+/*
+ KX_PYMETHOD_DOC(KX_Scene, getActiveCamera);
+ KX_PYMETHOD_DOC(KX_Scene, getActiveCamera);
+ KX_PYMETHOD_DOC(KX_Scene, findCamera);
+
+ KX_PYMETHOD_DOC(KX_Scene, getGravity);
+
+ KX_PYMETHOD_DOC(KX_Scene, setActivityCulling);
+ KX_PYMETHOD_DOC(KX_Scene, setActivityCullingRadius);
+
+ KX_PYMETHOD_DOC(KX_Scene, setSceneViewport);
+ KX_PYMETHOD_DOC(KX_Scene, setSceneViewport);
+ */
/* attributes */
static PyObject* pyattr_get_name(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
@@ -534,11 +549,7 @@ public:
static int pyattr_set_active_camera(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
virtual PyObject* py_repr(void) { return PyUnicode_FromString(GetName().ReadPtr()); }
-
- /* getitem/setitem */
- static PyMappingMethods Mapping;
- static PySequenceMethods Sequence;
-
+
/**
* Sets the time the scene was suspended
*/
diff --git a/source/gameengine/Ketsji/KX_SceneActuator.cpp b/source/gameengine/Ketsji/KX_SceneActuator.cpp
index ea1be7bca6c..a0b7664d63a 100644
--- a/source/gameengine/Ketsji/KX_SceneActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SceneActuator.cpp
@@ -245,6 +245,14 @@ PyTypeObject KX_SceneActuator::Type = {
PyMethodDef KX_SceneActuator::Methods[] =
{
+ //Deprecated functions ------>
+ {"setUseRestart", (PyCFunction) KX_SceneActuator::sPySetUseRestart, METH_VARARGS, (const char *)SetUseRestart_doc},
+ {"setScene", (PyCFunction) KX_SceneActuator::sPySetScene, METH_VARARGS, (const char *)SetScene_doc},
+ {"setCamera", (PyCFunction) KX_SceneActuator::sPySetCamera, METH_O, (const char *)SetCamera_doc},
+ {"getUseRestart", (PyCFunction) KX_SceneActuator::sPyGetUseRestart, METH_NOARGS, (const char *)GetUseRestart_doc},
+ {"getScene", (PyCFunction) KX_SceneActuator::sPyGetScene, METH_NOARGS, (const char *)GetScene_doc},
+ {"getCamera", (PyCFunction) KX_SceneActuator::sPyGetCamera, METH_NOARGS, (const char *)GetCamera_doc},
+ //<----- Deprecated
{NULL,NULL} //Sentinel
};
@@ -287,4 +295,117 @@ int KX_SceneActuator::pyattr_set_camera(void *self, const struct KX_PYATTRIBUTE_
return PY_SET_ATTR_SUCCESS;
}
+
+/* 2. setUseRestart--------------------------------------------------------- */
+const char KX_SceneActuator::SetUseRestart_doc[] =
+"setUseRestart(flag)\n"
+"\t- flag: 0 or 1.\n"
+"\tSet flag to 1 to restart the scene.\n" ;
+PyObject* KX_SceneActuator::PySetUseRestart(PyObject* args)
+{
+ ShowDeprecationWarning("setUseRestart()", "the useRestart property");
+ int boolArg;
+
+ if (!PyArg_ParseTuple(args, "i:setUseRestart", &boolArg))
+ {
+ return NULL;
+ }
+
+ m_restart = boolArg != 0;
+
+ Py_RETURN_NONE;
+}
+
+
+
+/* 3. getUseRestart: */
+const char KX_SceneActuator::GetUseRestart_doc[] =
+"getUseRestart()\n"
+"\tReturn whether the scene will be restarted.\n" ;
+PyObject* KX_SceneActuator::PyGetUseRestart()
+{
+ ShowDeprecationWarning("getUseRestart()", "the useRestart property");
+ return PyLong_FromSsize_t(!(m_restart == 0));
+}
+
+
+
+/* 4. set scene------------------------------------------------------------- */
+const char KX_SceneActuator::SetScene_doc[] =
+"setScene(scene)\n"
+"\t- scene: string\n"
+"\tSet the name of scene the actuator will switch to.\n" ;
+PyObject* KX_SceneActuator::PySetScene(PyObject* args)
+{
+ ShowDeprecationWarning("setScene()", "the scene property");
+ /* one argument: a scene, ignore the rest */
+ char *scene_name;
+
+ if(!PyArg_ParseTuple(args, "s:setScene", &scene_name))
+ {
+ return NULL;
+ }
+
+ /* Scene switch is done by name. */
+ m_nextSceneName = scene_name;
+
+ Py_RETURN_NONE;
+}
+
+
+
+/* 5. getScene: */
+const char KX_SceneActuator::GetScene_doc[] =
+"getScene()\n"
+"\tReturn the name of the scene the actuator wants to switch to.\n" ;
+PyObject* KX_SceneActuator::PyGetScene()
+{
+ ShowDeprecationWarning("getScene()", "the scene property");
+ return PyUnicode_FromString(m_nextSceneName);
+}
+
+
+
+/* 6. set camera------------------------------------------------------------ */
+const char KX_SceneActuator::SetCamera_doc[] =
+"setCamera(camera)\n"
+"\t- camera: string\n"
+"\tSet the camera to switch to.\n" ;
+PyObject* KX_SceneActuator::PySetCamera(PyObject* value)
+{
+ ShowDeprecationWarning("setCamera()", "the camera property");
+ KX_Camera *camOb;
+
+ if (!ConvertPythonToCamera(value, &camOb, true, "actu.setCamera(value): KX_SceneActuator"))
+ return NULL;
+
+ if (m_camera)
+ m_camera->UnregisterActuator(this);
+
+ if(camOb==NULL) {
+ m_camera= NULL;
+ }
+ else {
+ m_camera = camOb;
+ m_camera->RegisterActuator(this);
+ }
+ Py_RETURN_NONE;
+}
+
+
+
+/* 7. getCamera: */
+const char KX_SceneActuator::GetCamera_doc[] =
+"getCamera()\n"
+"\tReturn the name of the camera to switch to.\n" ;
+PyObject* KX_SceneActuator::PyGetCamera()
+{
+ ShowDeprecationWarning("getCamera()", "the camera property");
+ if (m_camera) {
+ return PyUnicode_FromString(m_camera->GetName());
+ }
+ else {
+ Py_RETURN_NONE;
+ }
+}
/* eof */
diff --git a/source/gameengine/Ketsji/KX_SceneActuator.h b/source/gameengine/Ketsji/KX_SceneActuator.h
index e979a8ce559..86de3395d1e 100644
--- a/source/gameengine/Ketsji/KX_SceneActuator.h
+++ b/source/gameengine/Ketsji/KX_SceneActuator.h
@@ -90,6 +90,22 @@ class KX_SceneActuator : public SCA_IActuator
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
+
+ /* 1. set */
+ /* Removed */
+
+ /* 2. setUseRestart: */
+ KX_PYMETHOD_DOC_VARARGS(KX_SceneActuator,SetUseRestart);
+ /* 3. getUseRestart: */
+ KX_PYMETHOD_DOC_NOARGS(KX_SceneActuator,GetUseRestart);
+ /* 4. setScene: */
+ KX_PYMETHOD_DOC_VARARGS(KX_SceneActuator,SetScene);
+ /* 5. getScene: */
+ KX_PYMETHOD_DOC_NOARGS(KX_SceneActuator,GetScene);
+ /* 6. setCamera: */
+ KX_PYMETHOD_DOC_O(KX_SceneActuator,SetCamera);
+ /* 7. getCamera: */
+ KX_PYMETHOD_DOC_NOARGS(KX_SceneActuator,GetCamera);
static PyObject* pyattr_get_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp
index e2b4022a312..024c51cabc1 100644
--- a/source/gameengine/Ketsji/KX_SoundActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp
@@ -296,6 +296,17 @@ PyTypeObject KX_SoundActuator::Type = {
};
PyMethodDef KX_SoundActuator::Methods[] = {
+ // Deprecated ----->
+ {"setGain",(PyCFunction) KX_SoundActuator::sPySetGain,METH_VARARGS,NULL},
+ {"getGain",(PyCFunction) KX_SoundActuator::sPyGetGain,METH_NOARGS,NULL},
+ {"setPitch",(PyCFunction) KX_SoundActuator::sPySetPitch,METH_VARARGS,NULL},
+ {"getPitch",(PyCFunction) KX_SoundActuator::sPyGetPitch,METH_NOARGS,NULL},
+ {"setRollOffFactor",(PyCFunction) KX_SoundActuator::sPySetRollOffFactor,METH_VARARGS,NULL},
+ {"getRollOffFactor",(PyCFunction) KX_SoundActuator::sPyGetRollOffFactor,METH_NOARGS,NULL},
+ {"setType",(PyCFunction) KX_SoundActuator::sPySetType,METH_VARARGS,NULL},
+ {"getType",(PyCFunction) KX_SoundActuator::sPyGetType,METH_NOARGS,NULL},
+ // <-----
+
KX_PYMETHODTABLE_NOARGS(KX_SoundActuator, startSound),
KX_PYMETHODTABLE_NOARGS(KX_SoundActuator, pauseSound),
KX_PYMETHODTABLE_NOARGS(KX_SoundActuator, stopSound),
@@ -416,3 +427,109 @@ int KX_SoundActuator::pyattr_set_rollOffFactor(void *self, const struct KX_PYATT
return PY_SET_ATTR_SUCCESS;
}
+
+PyObject* KX_SoundActuator::PySetGain(PyObject* args)
+{
+ ShowDeprecationWarning("setGain()", "the volume property");
+ float gain = 1.0;
+ if (!PyArg_ParseTuple(args, "f:setGain", &gain))
+ return NULL;
+
+ m_volume = gain;
+ if(m_handle)
+ AUD_setSoundVolume(m_handle, gain);
+
+ Py_RETURN_NONE;
+}
+
+
+
+PyObject* KX_SoundActuator::PyGetGain()
+{
+ ShowDeprecationWarning("getGain()", "the volume property");
+ float gain = m_volume;
+ PyObject* result = PyFloat_FromDouble(gain);
+
+ return result;
+}
+
+
+
+PyObject* KX_SoundActuator::PySetPitch(PyObject* args)
+{
+ ShowDeprecationWarning("setPitch()", "the pitch property");
+ float pitch = 1.0;
+ if (!PyArg_ParseTuple(args, "f:setPitch", &pitch))
+ return NULL;
+
+ m_pitch = pitch;
+ if(m_handle)
+ AUD_setSoundPitch(m_handle, pitch);
+
+ Py_RETURN_NONE;
+}
+
+
+
+PyObject* KX_SoundActuator::PyGetPitch()
+{
+ ShowDeprecationWarning("getPitch()", "the pitch property");
+ float pitch = m_pitch;
+ PyObject* result = PyFloat_FromDouble(pitch);
+
+ return result;
+}
+
+
+
+PyObject* KX_SoundActuator::PySetRollOffFactor(PyObject* args)
+{
+ ShowDeprecationWarning("setRollOffFactor()", "the rollOffFactor property");
+ float rollofffactor = 1.0;
+ if (!PyArg_ParseTuple(args, "f:setRollOffFactor", &rollofffactor))
+ return NULL;
+
+ m_3d.rolloff_factor = rollofffactor;
+ if(m_handle)
+ AUD_set3DSourceSetting(m_handle, AUD_3DSS_ROLLOFF_FACTOR, rollofffactor);
+
+ Py_RETURN_NONE;
+}
+
+
+
+PyObject* KX_SoundActuator::PyGetRollOffFactor()
+{
+ ShowDeprecationWarning("getRollOffFactor()", "the rollOffFactor property");
+ float rollofffactor = m_3d.rolloff_factor;
+ PyObject* result = PyFloat_FromDouble(rollofffactor);
+
+ return result;
+}
+
+
+
+PyObject* KX_SoundActuator::PySetType(PyObject* args)
+{
+ int typeArg;
+ ShowDeprecationWarning("setType()", "the mode property");
+
+ if (!PyArg_ParseTuple(args, "i:setType", &typeArg)) {
+ return NULL;
+ }
+
+ if ( (typeArg > KX_SOUNDACT_NODEF)
+ && (typeArg < KX_SOUNDACT_MAX) ) {
+ m_type = (KX_SOUNDACT_TYPE) typeArg;
+ }
+
+ Py_RETURN_NONE;
+}
+
+PyObject* KX_SoundActuator::PyGetType()
+{
+ ShowDeprecationWarning("getType()", "the mode property");
+ return PyLong_FromSsize_t(m_type);
+}
+// <-----
+
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.h b/source/gameengine/Ketsji/KX_SoundActuator.h
index 43198f1a253..bc0293ed2b4 100644
--- a/source/gameengine/Ketsji/KX_SoundActuator.h
+++ b/source/gameengine/Ketsji/KX_SoundActuator.h
@@ -110,6 +110,18 @@ public:
static PyObject* pyattr_get_pitch(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_rollOffFactor(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_type(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
+
+ // Deprecated ----->
+ KX_PYMETHOD_VARARGS(KX_SoundActuator,SetGain);
+ KX_PYMETHOD_NOARGS(KX_SoundActuator,GetGain);
+ KX_PYMETHOD_VARARGS(KX_SoundActuator,SetPitch);
+ KX_PYMETHOD_NOARGS(KX_SoundActuator,GetPitch);
+ KX_PYMETHOD_VARARGS(KX_SoundActuator,SetRollOffFactor);
+ KX_PYMETHOD_NOARGS(KX_SoundActuator,GetRollOffFactor);
+ KX_PYMETHOD_VARARGS(KX_SoundActuator,SetType);
+ KX_PYMETHOD_NOARGS(KX_SoundActuator,GetType);
+ // <-----
+
};
#endif //__KX_SOUNDACTUATOR
diff --git a/source/gameengine/Ketsji/KX_StateActuator.cpp b/source/gameengine/Ketsji/KX_StateActuator.cpp
index 4159e9c373d..09d95612cbb 100644
--- a/source/gameengine/Ketsji/KX_StateActuator.cpp
+++ b/source/gameengine/Ketsji/KX_StateActuator.cpp
@@ -159,6 +159,12 @@ PyTypeObject KX_StateActuator::Type = {
};
PyMethodDef KX_StateActuator::Methods[] = {
+ // deprecated -->
+ {"setOperation", (PyCFunction) KX_StateActuator::sPySetOperation,
+ METH_VARARGS, (const char *)SetOperation_doc},
+ {"setMask", (PyCFunction) KX_StateActuator::sPySetMask,
+ METH_VARARGS, (const char *)SetMask_doc},
+ // <--
{NULL,NULL} //Sentinel
};
@@ -167,3 +173,52 @@ PyAttributeDef KX_StateActuator::Attributes[] = {
KX_PYATTRIBUTE_INT_RW("mask",0,0x3FFFFFFF,false,KX_StateActuator,m_mask),
{ NULL } //Sentinel
};
+
+
+/* set operation ---------------------------------------------------------- */
+const char
+KX_StateActuator::SetOperation_doc[] =
+"setOperation(op)\n"
+"\t - op : bit operation (0=Copy, 1=Set, 2=Clear, 3=Negate)"
+"\tSet the type of bit operation to be applied on object state mask.\n"
+"\tUse setMask() to specify the bits that will be modified.\n";
+PyObject*
+
+KX_StateActuator::PySetOperation(PyObject* args) {
+ ShowDeprecationWarning("setOperation()", "the operation property");
+ int oper;
+
+ if(!PyArg_ParseTuple(args, "i:setOperation", &oper)) {
+ return NULL;
+ }
+
+ m_operation = oper;
+
+ Py_RETURN_NONE;
+}
+
+/* set mask ---------------------------------------------------------- */
+const char
+KX_StateActuator::SetMask_doc[] =
+"setMask(mask)\n"
+"\t - mask : bits that will be modified"
+"\tSet the value that defines the bits that will be modified by the operation.\n"
+"\tThe bits that are 1 in the value will be updated in the object state,\n"
+"\tthe bits that are 0 are will be left unmodified expect for the Copy operation\n"
+"\twhich copies the value to the object state.\n";
+PyObject*
+
+KX_StateActuator::PySetMask(PyObject* args) {
+ ShowDeprecationWarning("setMask()", "the mask property");
+ int mask;
+
+ if(!PyArg_ParseTuple(args, "i:setMask", &mask)) {
+ return NULL;
+ }
+
+ m_mask = mask;
+
+ Py_RETURN_NONE;
+}
+
+
diff --git a/source/gameengine/Ketsji/KX_StateActuator.h b/source/gameengine/Ketsji/KX_StateActuator.h
index 4cf84f74287..ce86c4b44fe 100644
--- a/source/gameengine/Ketsji/KX_StateActuator.h
+++ b/source/gameengine/Ketsji/KX_StateActuator.h
@@ -88,7 +88,9 @@ class KX_StateActuator : public SCA_IActuator
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
-
+ //KX_PYMETHOD_DOC
+ KX_PYMETHOD_DOC_VARARGS(KX_StateActuator,SetOperation);
+ KX_PYMETHOD_DOC_VARARGS(KX_StateActuator,SetMask);
};
#endif
diff --git a/source/gameengine/Ketsji/KX_TouchSensor.cpp b/source/gameengine/Ketsji/KX_TouchSensor.cpp
index cde67787e2f..bf8469f1ec9 100644
--- a/source/gameengine/Ketsji/KX_TouchSensor.cpp
+++ b/source/gameengine/Ketsji/KX_TouchSensor.cpp
@@ -101,7 +101,8 @@ KX_TouchSensor::KX_TouchSensor(SCA_EventManager* eventmgr,KX_GameObject* gameobj
:SCA_ISensor(gameobj,eventmgr),
m_touchedpropname(touchedpropname),
m_bFindMaterial(bFindMaterial),
-m_bTouchPulse(bTouchPulse)
+m_bTouchPulse(bTouchPulse),
+m_eventmgr(eventmgr)
/*m_sumoObj(sumoObj),*/
{
// KX_TouchEventManager* touchmgr = (KX_TouchEventManager*) eventmgr;
@@ -315,6 +316,16 @@ PyTypeObject KX_TouchSensor::Type = {
};
PyMethodDef KX_TouchSensor::Methods[] = {
+ //Deprecated ----->
+ {"setProperty",
+ (PyCFunction) KX_TouchSensor::sPySetProperty, METH_O, (const char *)SetProperty_doc},
+ {"getProperty",
+ (PyCFunction) KX_TouchSensor::sPyGetProperty, METH_NOARGS, (const char *)GetProperty_doc},
+ {"getHitObject",
+ (PyCFunction) KX_TouchSensor::sPyGetHitObject, METH_NOARGS, (const char *)GetHitObject_doc},
+ {"getHitObjectList",
+ (PyCFunction) KX_TouchSensor::sPyGetHitObjectList, METH_NOARGS, (const char *)GetHitObjectList_doc},
+ //<-----
{NULL,NULL} //Sentinel
};
@@ -329,6 +340,101 @@ PyAttributeDef KX_TouchSensor::Attributes[] = {
/* Python API */
+/* 1. setProperty */
+const char KX_TouchSensor::SetProperty_doc[] =
+"setProperty(name)\n"
+"\t- name: string\n"
+"\tSet the property or material to collide with. Use\n"
+"\tsetTouchMaterial() to switch between properties and\n"
+"\tmaterials.";
+PyObject* KX_TouchSensor::PySetProperty(PyObject* value)
+{
+ ShowDeprecationWarning("setProperty()", "the propName property");
+ char *nameArg= _PyUnicode_AsString(value);
+ if (nameArg==NULL) {
+ PyErr_SetString(PyExc_ValueError, "expected a ");
+ return NULL;
+ }
+
+ m_touchedpropname = nameArg;
+ Py_RETURN_NONE;
+}
+/* 2. getProperty */
+const char KX_TouchSensor::GetProperty_doc[] =
+"getProperty(name)\n"
+"\tReturns the property or material to collide with. Use\n"
+"\tgetTouchMaterial() to find out whether this sensor\n"
+"\tlooks for properties or materials.";
+PyObject* KX_TouchSensor::PyGetProperty() {
+ ShowDeprecationWarning("getProperty()", "the propName property");
+
+ return PyUnicode_FromString(m_touchedpropname);
+}
+
+const char KX_TouchSensor::GetHitObject_doc[] =
+"getHitObject()\n"
+;
+PyObject* KX_TouchSensor::PyGetHitObject()
+{
+ ShowDeprecationWarning("getHitObject()", "the hitObject property");
+ /* to do: do Py_IncRef if the object is already known in Python */
+ /* otherwise, this leaks memory */
+ if (m_hitObject)
+ {
+ return m_hitObject->GetProxy();
+ }
+ Py_RETURN_NONE;
+}
+
+const char KX_TouchSensor::GetHitObjectList_doc[] =
+"getHitObjectList()\n"
+"\tReturn a list of the objects this object collided with,\n"
+"\tbut only those matching the property/material condition.\n";
+PyObject* KX_TouchSensor::PyGetHitObjectList()
+{
+ ShowDeprecationWarning("getHitObjectList()", "the hitObjectList property");
+ /* to do: do Py_IncRef if the object is already known in Python */
+ /* otherwise, this leaks memory */ /* Edit, this seems ok and not to leak memory - Campbell */
+ return m_colliders->GetProxy();
+}
+
+/*getTouchMaterial and setTouchMaterial were never added to the api,
+they can probably be removed with out anyone noticing*/
+
+/* 5. getTouchMaterial */
+const char KX_TouchSensor::GetTouchMaterial_doc[] =
+"getTouchMaterial()\n"
+"\tReturns KX_TRUE if this sensor looks for a specific material,\n"
+"\tKX_FALSE if it looks for a specific property.\n" ;
+PyObject* KX_TouchSensor::PyGetTouchMaterial()
+{
+ ShowDeprecationWarning("getTouchMaterial()", "the useMaterial property");
+ return PyLong_FromSsize_t(m_bFindMaterial);
+}
+
+/* 6. setTouchMaterial */
+#if 0
+const char KX_TouchSensor::SetTouchMaterial_doc[] =
+"setTouchMaterial(flag)\n"
+"\t- flag: KX_TRUE or KX_FALSE.\n"
+"\tSet flag to KX_TRUE to switch on positive pulse mode,\n"
+"\tKX_FALSE to switch off positive pulse mode.\n" ;
+PyObject* KX_TouchSensor::PySetTouchMaterial(PyObject *value)
+{
+ ShowDeprecationWarning("setTouchMaterial()", "the useMaterial property");
+ int pulseArg = PyLong_AsSsize_t(value);
+
+ if(pulseArg ==-1 && PyErr_Occurred()) {
+ PyErr_SetString(PyExc_ValueError, "expected a bool");
+ return NULL;
+ }
+
+ m_bFindMaterial = pulseArg != 0;
+
+ Py_RETURN_NONE;
+}
+#endif
+
PyObject* KX_TouchSensor::pyattr_get_object_hit(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_TouchSensor* self= static_cast<KX_TouchSensor*>(self_v);
diff --git a/source/gameengine/Ketsji/KX_TouchSensor.h b/source/gameengine/Ketsji/KX_TouchSensor.h
index ad1830e05c9..6cbf5b15e3b 100644
--- a/source/gameengine/Ketsji/KX_TouchSensor.h
+++ b/source/gameengine/Ketsji/KX_TouchSensor.h
@@ -58,6 +58,7 @@ protected:
STR_String m_touchedpropname;
bool m_bFindMaterial;
bool m_bTouchPulse; /* changes in the colliding objects trigger pulses */
+ class SCA_EventManager* m_eventmgr;
class PHY_IPhysicsController* m_physCtrl;
@@ -119,6 +120,23 @@ public:
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
+
+ //Deprecated ----->
+ /* 1. setProperty */
+ KX_PYMETHOD_DOC_O(KX_TouchSensor,SetProperty);
+ /* 2. getProperty */
+ KX_PYMETHOD_DOC_NOARGS(KX_TouchSensor,GetProperty);
+ /* 3. getHitObject */
+ KX_PYMETHOD_DOC_NOARGS(KX_TouchSensor,GetHitObject);
+ /* 4. getHitObject */
+ KX_PYMETHOD_DOC_NOARGS(KX_TouchSensor,GetHitObjectList);
+ /* 5. getTouchMaterial */
+ KX_PYMETHOD_DOC_NOARGS(KX_TouchSensor,GetTouchMaterial);
+#if 0
+ /* 6. setTouchMaterial */
+ KX_PYMETHOD_DOC_O(KX_TouchSensor,SetTouchMaterial);
+#endif
+ //<-----
static PyObject* pyattr_get_object_hit(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_object_hit_list(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.cpp b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
index e6c2f86bbce..b5b7e9de444 100644
--- a/source/gameengine/Ketsji/KX_TrackToActuator.cpp
+++ b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
@@ -453,6 +453,14 @@ PyTypeObject KX_TrackToActuator::Type = {
};
PyMethodDef KX_TrackToActuator::Methods[] = {
+ // ---> deprecated
+ {"setTime", (PyCFunction) KX_TrackToActuator::sPySetTime, METH_VARARGS, (const char *)SetTime_doc},
+ {"getTime", (PyCFunction) KX_TrackToActuator::sPyGetTime, METH_NOARGS, (const char *)GetTime_doc},
+ {"setUse3D", (PyCFunction) KX_TrackToActuator::sPySetUse3D, METH_VARARGS, (const char *)SetUse3D_doc},
+ {"getUse3D", (PyCFunction) KX_TrackToActuator::sPyGetUse3D, METH_NOARGS, (const char *)GetUse3D_doc},
+ {"setObject", (PyCFunction) KX_TrackToActuator::sPySetObject, METH_O, (const char *)SetObject_doc},
+ {"getObject", (PyCFunction) KX_TrackToActuator::sPyGetObject, METH_VARARGS, (const char *)GetObject_doc},
+
{NULL,NULL} //Sentinel
};
@@ -492,4 +500,123 @@ int KX_TrackToActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUT
return PY_SET_ATTR_SUCCESS;
}
+
+/* 1. setObject */
+const char KX_TrackToActuator::SetObject_doc[] =
+"setObject(object)\n"
+"\t- object: KX_GameObject, string or None\n"
+"\tSet the object to track with the parent of this actuator.\n";
+PyObject* KX_TrackToActuator::PySetObject(PyObject* value)
+{
+ KX_GameObject *gameobj;
+
+ ShowDeprecationWarning("setObject()", "the object property");
+
+ if (!ConvertPythonToGameObject(value, &gameobj, true, "actuator.setObject(value): KX_TrackToActuator"))
+ return NULL; // ConvertPythonToGameObject sets the error
+
+ if (m_object != NULL)
+ m_object->UnregisterActuator(this);
+
+ m_object = (SCA_IObject*)gameobj;
+ if (m_object)
+ m_object->RegisterActuator(this);
+
+ Py_RETURN_NONE;
+}
+
+
+
+/* 2. getObject */
+const char KX_TrackToActuator::GetObject_doc[] =
+"getObject(name_only = 1)\n"
+"name_only - optional arg, when true will return the KX_GameObject rather then its name\n"
+"\tReturns the object to track with the parent of this actuator\n";
+PyObject* KX_TrackToActuator::PyGetObject(PyObject* args)
+{
+ int ret_name_only = 1;
+
+ ShowDeprecationWarning("getObject()", "the object property");
+
+ if (!PyArg_ParseTuple(args, "|i:getObject", &ret_name_only))
+ return NULL;
+
+ if (!m_object)
+ Py_RETURN_NONE;
+
+ if (ret_name_only)
+ return PyUnicode_FromString(m_object->GetName());
+ else
+ return m_object->GetProxy();
+}
+
+
+
+/* 3. setTime */
+const char KX_TrackToActuator::SetTime_doc[] =
+"setTime(time)\n"
+"\t- time: integer\n"
+"\tSet the time in frames with which to delay the tracking motion.\n";
+PyObject* KX_TrackToActuator::PySetTime(PyObject* args)
+{
+ ShowDeprecationWarning("setTime()", "the timer property");
+ int timeArg;
+
+ if (!PyArg_ParseTuple(args, "i:setTime", &timeArg))
+ {
+ return NULL;
+ }
+
+ m_time= timeArg;
+
+ Py_RETURN_NONE;
+}
+
+
+
+/* 4.getTime */
+const char KX_TrackToActuator::GetTime_doc[] =
+"getTime()\n"
+"\t- time: integer\n"
+"\tReturn the time in frames with which the tracking motion is delayed.\n";
+PyObject* KX_TrackToActuator::PyGetTime()
+{
+ ShowDeprecationWarning("getTime()", "the timer property");
+ return PyLong_FromSsize_t(m_time);
+}
+
+
+
+/* 5. getUse3D */
+const char KX_TrackToActuator::GetUse3D_doc[] =
+"getUse3D()\n"
+"\tReturns 1 if the motion is allowed to extend in the z-direction.\n";
+PyObject* KX_TrackToActuator::PyGetUse3D()
+{
+ ShowDeprecationWarning("setTime()", "the use3D property");
+ return PyLong_FromSsize_t(!(m_allow3D == 0));
+}
+
+
+
+/* 6. setUse3D */
+const char KX_TrackToActuator::SetUse3D_doc[] =
+"setUse3D(value)\n"
+"\t- value: 0 or 1\n"
+"\tSet to 1 to allow the tracking motion to extend in the z-direction,\n"
+"\tset to 0 to lock the tracking motion to the x-y plane.\n";
+PyObject* KX_TrackToActuator::PySetUse3D(PyObject* args)
+{
+ ShowDeprecationWarning("setTime()", "the use3D property");
+ int boolArg;
+
+ if (!PyArg_ParseTuple(args, "i:setUse3D", &boolArg)) {
+ return NULL;
+ }
+
+ m_allow3D = !(boolArg == 0);
+
+ Py_RETURN_NONE;
+}
+
/* eof */
diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.h b/source/gameengine/Ketsji/KX_TrackToActuator.h
index bbfc1d17576..801e695bb9b 100644
--- a/source/gameengine/Ketsji/KX_TrackToActuator.h
+++ b/source/gameengine/Ketsji/KX_TrackToActuator.h
@@ -74,6 +74,19 @@ class KX_TrackToActuator : public SCA_IActuator
/* These are used to get and set m_ob */
static PyObject* pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+
+ /* 1. setObject */
+ KX_PYMETHOD_DOC_O(KX_TrackToActuator,SetObject);
+ /* 2. getObject */
+ KX_PYMETHOD_DOC_VARARGS(KX_TrackToActuator,GetObject);
+ /* 3. setTime */
+ KX_PYMETHOD_DOC_VARARGS(KX_TrackToActuator,SetTime);
+ /* 4. getTime */
+ KX_PYMETHOD_DOC_NOARGS(KX_TrackToActuator,GetTime);
+ /* 5. getUse3D */
+ KX_PYMETHOD_DOC_NOARGS(KX_TrackToActuator,GetUse3D);
+ /* 6. setUse3D */
+ KX_PYMETHOD_DOC_VARARGS(KX_TrackToActuator,SetUse3D);
}; /* end of class KX_TrackToActuator : public KX_EditObjectActuator */
diff --git a/source/gameengine/Ketsji/KX_VisibilityActuator.cpp b/source/gameengine/Ketsji/KX_VisibilityActuator.cpp
index 184e127209f..97c893c6caa 100644
--- a/source/gameengine/Ketsji/KX_VisibilityActuator.cpp
+++ b/source/gameengine/Ketsji/KX_VisibilityActuator.cpp
@@ -113,6 +113,10 @@ PyTypeObject KX_VisibilityActuator::Type = {
};
PyMethodDef KX_VisibilityActuator::Methods[] = {
+ // Deprecated ----->
+ {"set", (PyCFunction) KX_VisibilityActuator::sPySetVisible, METH_VARARGS,
+ (const char *) SetVisible_doc},
+ // <-----
{NULL,NULL} //Sentinel
};
@@ -122,3 +126,26 @@ PyAttributeDef KX_VisibilityActuator::Attributes[] = {
KX_PYATTRIBUTE_BOOL_RW("useRecursion", KX_VisibilityActuator, m_recursive),
{ NULL } //Sentinel
};
+
+/* set visibility ---------------------------------------------------------- */
+const char
+KX_VisibilityActuator::SetVisible_doc[] =
+"setVisible(visible?)\n"
+"\t - visible? : Make the object visible? (KX_TRUE, KX_FALSE)"
+"\tSet the properties of the actuator.\n";
+PyObject*
+
+KX_VisibilityActuator::PySetVisible(PyObject* args) {
+ int vis;
+ ShowDeprecationWarning("SetVisible()", "the visible property");
+
+ if(!PyArg_ParseTuple(args, "i:setVisible", &vis)) {
+ return NULL;
+ }
+
+ m_visible = PyArgToBool(vis);
+
+ Py_RETURN_NONE;
+}
+
+
diff --git a/source/gameengine/Ketsji/KX_VisibilityActuator.h b/source/gameengine/Ketsji/KX_VisibilityActuator.h
index e75551644a4..3ad50c6cea2 100644
--- a/source/gameengine/Ketsji/KX_VisibilityActuator.h
+++ b/source/gameengine/Ketsji/KX_VisibilityActuator.h
@@ -67,6 +67,11 @@ class KX_VisibilityActuator : public SCA_IActuator
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
+ // Deprecated ----->
+ KX_PYMETHOD_DOC_VARARGS(KX_VisibilityActuator,SetVisible);
+ // <-----
+
+
};
#endif
diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript
index 5f38020780b..d3b67cfdb11 100644
--- a/source/gameengine/Ketsji/SConscript
+++ b/source/gameengine/Ketsji/SConscript
@@ -29,8 +29,12 @@ if env['WITH_BF_SDL']:
else:
defs.append('DISABLE_SDL')
+cxxflags = []
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
+ cxxflags.append ('/GR')
+ cxxflags.append ('/O2')
+ cxxflags.append ('/EHsc')
if env['BF_DEBUG']:
defs.append('_DEBUG') # for Python
-env.BlenderLib ( 'bf_ketsji', sources, Split(incs), defs, libtype=['core','player'], priority=[320,45], cxx_compileflags=env['BGE_CXXFLAGS'])
+env.BlenderLib ( 'bf_ketsji', sources, Split(incs), defs, libtype=['core','player'], priority=[320, 60], cxx_compileflags = cxxflags )