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:
authorBenoit Bolsee <benoit.bolsee@online.be>2009-04-10 01:15:44 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2009-04-10 01:15:44 +0400
commitb0cca7de267f84768ee1eba0955373a24b661aad (patch)
treeb416ea7dbac52bd9ba8cc93c8d49f755b693dae4
parent09a5ffdf07677016b4e8eae8df02c47cd94ca6d8 (diff)
BGE API cleanup: StateActuator.
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_StateActuator.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_StateActuator.h7
-rw-r--r--source/gameengine/PyDoc/KX_SoundActuator.py3
4 files changed, 23 insertions, 3 deletions
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 8b8b62e9310..4ad9853f9c4 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -58,6 +58,7 @@
#include "KX_ConstraintActuator.h"
#include "KX_IpoActuator.h"
#include "KX_SoundActuator.h"
+#include "KX_StateActuator.h"
#include "BL_ActionActuator.h"
#include "RAS_IRasterizer.h"
#include "RAS_ICanvas.h"
@@ -1154,6 +1155,11 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
KX_MACRO_addTypesToDict(d, KX_SOUNDACT_LOOPBIDIRECTIONAL, KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL);
KX_MACRO_addTypesToDict(d, KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP, KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP);
+ KX_MACRO_addTypesToDict(d, KX_STATE_OP_CPY, KX_StateActuator::OP_CPY);
+ KX_MACRO_addTypesToDict(d, KX_STATE_OP_SET, KX_StateActuator::OP_SET);
+ KX_MACRO_addTypesToDict(d, KX_STATE_OP_CLR, KX_StateActuator::OP_CLR);
+ KX_MACRO_addTypesToDict(d, KX_STATE_OP_NEG, KX_StateActuator::OP_NEG);
+
// Check for errors
if (PyErr_Occurred())
diff --git a/source/gameengine/Ketsji/KX_StateActuator.cpp b/source/gameengine/Ketsji/KX_StateActuator.cpp
index 31457230f60..e9e3c091ef3 100644
--- a/source/gameengine/Ketsji/KX_StateActuator.cpp
+++ b/source/gameengine/Ketsji/KX_StateActuator.cpp
@@ -138,14 +138,18 @@ KX_StateActuator::Parents[] = {
PyMethodDef
KX_StateActuator::Methods[] = {
+ // deprecated -->
{"setOperation", (PyCFunction) KX_StateActuator::sPySetOperation,
METH_VARARGS, (PY_METHODCHAR)SetOperation_doc},
{"setMask", (PyCFunction) KX_StateActuator::sPySetMask,
METH_VARARGS, (PY_METHODCHAR)SetMask_doc},
+ // <--
{NULL,NULL} //Sentinel
};
PyAttributeDef KX_StateActuator::Attributes[] = {
+ KX_PYATTRIBUTE_INT_RW("operation",KX_StateActuator::OP_NOP+1,KX_StateActuator::OP_COUNT-1,false,KX_StateActuator,m_operation),
+ KX_PYATTRIBUTE_INT_RW("mask",0,0x3FFFFFFF,false,KX_StateActuator,m_mask),
{ NULL } //Sentinel
};
@@ -154,6 +158,10 @@ PyObject* KX_StateActuator::py_getattro(PyObject *attr)
py_getattro_up(SCA_IActuator);
};
+int KX_StateActuator::py_setattro(PyObject *attr, PyObject* value)
+{
+ py_setattro_up(SCA_IActuator);
+}
/* set operation ---------------------------------------------------------- */
@@ -168,6 +176,7 @@ PyObject*
KX_StateActuator::PySetOperation(PyObject* self,
PyObject* args,
PyObject* kwds) {
+ ShowDeprecationWarning("setOperation()", "the operation property");
int oper;
if(!PyArg_ParseTuple(args, "i", &oper)) {
@@ -193,6 +202,7 @@ PyObject*
KX_StateActuator::PySetMask(PyObject* self,
PyObject* args,
PyObject* kwds) {
+ ShowDeprecationWarning("setMask()", "the mask property");
int mask;
if(!PyArg_ParseTuple(args, "i", &mask)) {
diff --git a/source/gameengine/Ketsji/KX_StateActuator.h b/source/gameengine/Ketsji/KX_StateActuator.h
index b6f1acf4a00..426753dadfd 100644
--- a/source/gameengine/Ketsji/KX_StateActuator.h
+++ b/source/gameengine/Ketsji/KX_StateActuator.h
@@ -39,13 +39,15 @@ class KX_StateActuator : public SCA_IActuator
/** Make visible? */
enum {
+ OP_NOP = -1,
OP_CPY = 0,
OP_SET,
OP_CLR,
- OP_NEG
+ OP_NEG,
+ OP_COUNT
};
int m_operation;
- unsigned int m_mask;
+ int m_mask;
public:
@@ -74,6 +76,7 @@ class KX_StateActuator : public SCA_IActuator
/* --------------------------------------------------------------------- */
virtual PyObject* py_getattro(PyObject *attr);
+ virtual int py_setattro(PyObject *attr, PyObject* value);
//KX_PYMETHOD_DOC
KX_PYMETHOD_DOC(KX_StateActuator,SetOperation);
KX_PYMETHOD_DOC(KX_StateActuator,SetMask);
diff --git a/source/gameengine/PyDoc/KX_SoundActuator.py b/source/gameengine/PyDoc/KX_SoundActuator.py
index 383b45e6eb9..37ae3c6640d 100644
--- a/source/gameengine/PyDoc/KX_SoundActuator.py
+++ b/source/gameengine/PyDoc/KX_SoundActuator.py
@@ -7,7 +7,8 @@ class KX_SoundActuator(SCA_IActuator):
Sound Actuator.
The L{startSound()}, L{pauseSound()} and L{stopSound()} do not require
- the actuator to be activated - they act instantly.
+ the actuator to be activated - they act instantly provided that the actuator has
+ been activated once at least.
@ivar filename: Sets the filename of the sound this actuator plays.
@type filename: string