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/KX_CameraActuator.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_CameraActuator.cpp210
1 files changed, 9 insertions, 201 deletions
diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp
index f8557dac2c4..99618fab8e3 100644
--- a/source/gameengine/Ketsji/KX_CameraActuator.cpp
+++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp
@@ -38,9 +38,6 @@
#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
@@ -56,10 +53,9 @@ KX_CameraActuator::KX_CameraActuator(
float hght,
float minhght,
float maxhght,
- bool xytog,
- PyTypeObject* T
+ bool xytog
):
- SCA_IActuator(gameobj, T),
+ SCA_IActuator(gameobj, KX_ACT_CAMERA),
m_ob (obj),
m_height (hght),
m_minHeight (minhght),
@@ -354,28 +350,13 @@ 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 */
/* ------------------------------------------------------------------------- */
/* Integration hooks ------------------------------------------------------- */
PyTypeObject KX_CameraActuator::Type = {
-#if (PY_VERSION_HEX >= 0x02060000)
PyVarObject_HEAD_INIT(NULL, 0)
-#else
- /* python 2.5 and below */
- PyObject_HEAD_INIT( NULL ) /* required py macro */
- 0, /* ob_size */
-#endif
"KX_CameraActuator",
sizeof(PyObjectPlus_Proxy),
0,
@@ -385,33 +366,18 @@ PyTypeObject KX_CameraActuator::Type = {
0,
0,
py_base_repr,
- 0,0,0,0,0,0,
- py_base_getattro,
- py_base_setattro,
0,0,0,0,0,0,0,0,0,
- Methods
-};
-
-PyParentObject KX_CameraActuator::Parents[] = {
- &KX_CameraActuator::Type,
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ 0,0,0,0,0,0,0,
+ Methods,
+ 0,
+ 0,
&SCA_IActuator::Type,
- &SCA_ILogicBrick::Type,
- &CValue::Type,
- NULL
+ 0,0,0,0,0,0,
+ py_base_new
};
PyMethodDef KX_CameraActuator::Methods[] = {
- // ---> deprecated (all)
- {"setObject",(PyCFunction) KX_CameraActuator::sPySetObject, METH_O, (PY_METHODCHAR)SetObject_doc},
- {"getObject",(PyCFunction) KX_CameraActuator::sPyGetObject, METH_VARARGS, (PY_METHODCHAR)GetObject_doc},
- {"setMin" ,(PyCFunction) KX_CameraActuator::sPySetMin, METH_VARARGS, (PY_METHODCHAR)SetMin_doc},
- {"getMin" ,(PyCFunction) KX_CameraActuator::sPyGetMin, METH_NOARGS, (PY_METHODCHAR)GetMin_doc},
- {"setMax" ,(PyCFunction) KX_CameraActuator::sPySetMax, METH_VARARGS, (PY_METHODCHAR)SetMax_doc},
- {"getMax" ,(PyCFunction) KX_CameraActuator::sPyGetMax, METH_NOARGS, (PY_METHODCHAR)GetMax_doc},
- {"setHeight",(PyCFunction) KX_CameraActuator::sPySetHeight, METH_VARARGS, (PY_METHODCHAR)SetHeight_doc},
- {"getHeight",(PyCFunction) KX_CameraActuator::sPyGetHeight, METH_NOARGS, (PY_METHODCHAR)GetHeight_doc},
- {"setXY" ,(PyCFunction) KX_CameraActuator::sPySetXY, METH_VARARGS, (PY_METHODCHAR)SetXY_doc},
- {"getXY" ,(PyCFunction) KX_CameraActuator::sPyGetXY, METH_NOARGS, (PY_METHODCHAR)GetXY_doc},
{NULL,NULL,NULL,NULL} //Sentinel
};
@@ -424,164 +390,6 @@ PyAttributeDef KX_CameraActuator::Attributes[] = {
{NULL}
};
-PyObject* KX_CameraActuator::py_getattro(PyObject *attr) {
- py_getattro_up(SCA_IActuator);
-}
-
-PyObject* KX_CameraActuator::py_getattro_dict() {
- py_getattro_dict_up(SCA_IActuator);
-}
-
-int KX_CameraActuator::py_setattro(PyObject *attr, PyObject* value) {
- py_setattro_up(SCA_IActuator);
-}
-
-/* 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 PyString_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 PyInt_FromLong(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);