diff options
Diffstat (limited to 'source/gameengine/GameLogic')
25 files changed, 0 insertions, 1407 deletions
diff --git a/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp b/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp index 11ea089270a..428362a0a24 100644 --- a/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp +++ b/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp @@ -143,10 +143,6 @@ PyTypeObject SCA_ActuatorSensor::Type = { }; PyMethodDef SCA_ActuatorSensor::Methods[] = { - //Deprecated functions ------> - {"getActuator", (PyCFunction) SCA_ActuatorSensor::sPyGetActuator, METH_NOARGS, (const char *)GetActuator_doc}, - {"setActuator", (PyCFunction) SCA_ActuatorSensor::sPySetActuator, METH_VARARGS, (const char *)SetActuator_doc}, - //<----- Deprecated {NULL,NULL} //Sentinel }; @@ -167,41 +163,4 @@ int SCA_ActuatorSensor::CheckActuator(void *self, const PyAttributeDef*) return 1; } -/* 3. getActuator */ -const char SCA_ActuatorSensor::GetActuator_doc[] = -"getActuator()\n" -"\tReturn the Actuator with which the sensor operates.\n"; -PyObject* SCA_ActuatorSensor::PyGetActuator() -{ - ShowDeprecationWarning("getActuator()", "the actuator property"); - return PyUnicode_FromString(m_checkactname); -} - -/* 4. setActuator */ -const char SCA_ActuatorSensor::SetActuator_doc[] = -"setActuator(name)\n" -"\t- name: string\n" -"\tSets the Actuator with which to operate. If there is no Actuator\n" -"\tof this name, the call is ignored.\n"; -PyObject* SCA_ActuatorSensor::PySetActuator(PyObject* args) -{ - ShowDeprecationWarning("setActuator()", "the actuator property"); - /* We should query whether the name exists. Or should we create a prop */ - /* on the fly? */ - char *actNameArg = NULL; - - if (!PyArg_ParseTuple(args, "s:setActuator", &actNameArg)) { - return NULL; - } - - SCA_IActuator* act = GetParent()->FindActuator(STR_String(actNameArg)); - if (act) { - m_checkactname = actNameArg; - m_actuator = act; - } else { - ; /* error: bad actuator name */ - } - Py_RETURN_NONE; -} - /* eof */ diff --git a/source/gameengine/GameLogic/SCA_ActuatorSensor.h b/source/gameengine/GameLogic/SCA_ActuatorSensor.h index cf8e735cad4..1a095148500 100644 --- a/source/gameengine/GameLogic/SCA_ActuatorSensor.h +++ b/source/gameengine/GameLogic/SCA_ActuatorSensor.h @@ -59,11 +59,6 @@ public: /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ - - /* 3. setProperty */ - KX_PYMETHOD_DOC_VARARGS(SCA_ActuatorSensor,SetActuator); - /* 4. getProperty */ - KX_PYMETHOD_DOC_NOARGS(SCA_ActuatorSensor,GetActuator); static int CheckActuator(void *self, const PyAttributeDef*); }; diff --git a/source/gameengine/GameLogic/SCA_DelaySensor.cpp b/source/gameengine/GameLogic/SCA_DelaySensor.cpp index 0d563db910e..0f67ddd56a5 100644 --- a/source/gameengine/GameLogic/SCA_DelaySensor.cpp +++ b/source/gameengine/GameLogic/SCA_DelaySensor.cpp @@ -152,16 +152,6 @@ PyTypeObject SCA_DelaySensor::Type = { }; PyMethodDef SCA_DelaySensor::Methods[] = { - //Deprecated functions ------> - /* setProperty */ - {"setDelay", (PyCFunction) SCA_DelaySensor::sPySetDelay, METH_VARARGS, (const char *)SetDelay_doc}, - {"setDuration", (PyCFunction) SCA_DelaySensor::sPySetDuration, METH_VARARGS, (const char *)SetDuration_doc}, - {"setRepeat", (PyCFunction) SCA_DelaySensor::sPySetRepeat, METH_VARARGS, (const char *)SetRepeat_doc}, - /* getProperty */ - {"getDelay", (PyCFunction) SCA_DelaySensor::sPyGetDelay, METH_NOARGS, (const char *)GetDelay_doc}, - {"getDuration", (PyCFunction) SCA_DelaySensor::sPyGetDuration, METH_NOARGS, (const char *)GetDuration_doc}, - {"getRepeat", (PyCFunction) SCA_DelaySensor::sPyGetRepeat, METH_NOARGS, (const char *)GetRepeat_doc}, - //<----- Deprecated {NULL,NULL} //Sentinel }; @@ -172,91 +162,4 @@ PyAttributeDef SCA_DelaySensor::Attributes[] = { { NULL } //Sentinel }; -const char SCA_DelaySensor::SetDelay_doc[] = -"setDelay(delay)\n" -"\t- delay: length of the initial OFF period as number of frame\n" -"\t 0 for immediate trigger\n" -"\tSet the initial delay before the positive trigger\n"; -PyObject* SCA_DelaySensor::PySetDelay(PyObject* args) -{ - ShowDeprecationWarning("setDelay()", "the delay property"); - int delay; - - if(!PyArg_ParseTuple(args, "i:setDelay", &delay)) { - return NULL; - } - if (delay < 0) { - PyErr_SetString(PyExc_ValueError, "Delay cannot be negative"); - return NULL; - } - m_delay = delay; - Py_RETURN_NONE; -} - -const char SCA_DelaySensor::SetDuration_doc[] = -"setDuration(duration)\n" -"\t- duration: length of the ON period in number of frame after the initial off period\n" -"\t 0 for no ON period\n" -"\tSet the duration of the ON pulse after initial delay.\n" -"\tIf > 0, a negative trigger is fired at the end of the ON pulse.\n"; -PyObject* SCA_DelaySensor::PySetDuration(PyObject* args) -{ - ShowDeprecationWarning("setDuration()", "the duration property"); - int duration; - - if(!PyArg_ParseTuple(args, "i:setDuration", &duration)) { - return NULL; - } - if (duration < 0) { - PyErr_SetString(PyExc_ValueError, "Duration cannot be negative"); - return NULL; - } - m_duration = duration; - Py_RETURN_NONE; -} - -const char SCA_DelaySensor::SetRepeat_doc[] = -"setRepeat(repeat)\n" -"\t- repeat: 1 if the initial OFF-ON cycle should be repeated indefinately\n" -"\t 0 if the initial OFF-ON cycle should run only once\n" -"\tSet the sensor repeat mode\n"; -PyObject* SCA_DelaySensor::PySetRepeat(PyObject* args) -{ - ShowDeprecationWarning("setRepeat()", "the repeat property"); - int repeat; - - if(!PyArg_ParseTuple(args, "i:setRepeat", &repeat)) { - return NULL; - } - m_repeat = (repeat != 0); - Py_RETURN_NONE; -} - -const char SCA_DelaySensor::GetDelay_doc[] = -"getDelay()\n" -"\tReturn the delay parameter value\n"; -PyObject* SCA_DelaySensor::PyGetDelay() -{ - ShowDeprecationWarning("getDelay()", "the delay property"); - return PyLong_FromSsize_t(m_delay); -} - -const char SCA_DelaySensor::GetDuration_doc[] = -"getDuration()\n" -"\tReturn the duration parameter value\n"; -PyObject* SCA_DelaySensor::PyGetDuration() -{ - ShowDeprecationWarning("getDuration()", "the duration property"); - return PyLong_FromSsize_t(m_duration); -} - -const char SCA_DelaySensor::GetRepeat_doc[] = -"getRepeat()\n" -"\tReturn the repeat parameter value\n"; -PyObject* SCA_DelaySensor::PyGetRepeat() -{ - ShowDeprecationWarning("getRepeat()", "the repeat property"); - return BoolToPyArg(m_repeat); -} - /* eof */ diff --git a/source/gameengine/GameLogic/SCA_DelaySensor.h b/source/gameengine/GameLogic/SCA_DelaySensor.h index 8270e8959b7..187a9179b5d 100644 --- a/source/gameengine/GameLogic/SCA_DelaySensor.h +++ b/source/gameengine/GameLogic/SCA_DelaySensor.h @@ -59,14 +59,6 @@ public: /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ - /* setProperty */ - KX_PYMETHOD_DOC_VARARGS(SCA_DelaySensor,SetDelay); - KX_PYMETHOD_DOC_VARARGS(SCA_DelaySensor,SetDuration); - KX_PYMETHOD_DOC_VARARGS(SCA_DelaySensor,SetRepeat); - /* getProperty */ - KX_PYMETHOD_DOC_NOARGS(SCA_DelaySensor,GetDelay); - KX_PYMETHOD_DOC_NOARGS(SCA_DelaySensor,GetDuration); - KX_PYMETHOD_DOC_NOARGS(SCA_DelaySensor,GetRepeat); }; diff --git a/source/gameengine/GameLogic/SCA_IController.cpp b/source/gameengine/GameLogic/SCA_IController.cpp index 24c39563c28..7cfd2adc1d0 100644 --- a/source/gameengine/GameLogic/SCA_IController.cpp +++ b/source/gameengine/GameLogic/SCA_IController.cpp @@ -221,13 +221,6 @@ PyTypeObject SCA_IController::Type = { }; PyMethodDef SCA_IController::Methods[] = { - //Deprecated functions ------> - {"getSensor", (PyCFunction) SCA_IController::sPyGetSensor, METH_O}, - {"getActuator", (PyCFunction) SCA_IController::sPyGetActuator, METH_O}, - {"getSensors", (PyCFunction) SCA_IController::sPyGetSensors, METH_NOARGS}, - {"getActuators", (PyCFunction) SCA_IController::sPyGetActuators, METH_NOARGS}, - {"getState", (PyCFunction) SCA_IController::sPyGetState, METH_NOARGS}, - //<----- Deprecated {NULL,NULL} //Sentinel }; @@ -239,85 +232,6 @@ PyAttributeDef SCA_IController::Attributes[] = { { NULL } //Sentinel }; -PyObject* SCA_IController::PyGetActuators() -{ - ShowDeprecationWarning("getActuators()", "the actuators property"); - - PyObject* resultlist = PyList_New(m_linkedactuators.size()); - for (unsigned int index=0;index<m_linkedactuators.size();index++) - { - PyList_SET_ITEM(resultlist,index, m_linkedactuators[index]->GetProxy()); - } - - return resultlist; -} - -PyObject* SCA_IController::PyGetSensor(PyObject* value) -{ - ShowDeprecationWarning("getSensor(string)", "the sensors[string] property"); - - char *scriptArg = _PyUnicode_AsString(value); - if (scriptArg==NULL) { - PyErr_SetString(PyExc_TypeError, "controller.getSensor(string): Python Controller, expected a string (sensor name)"); - return NULL; - } - - for (unsigned int index=0;index<m_linkedsensors.size();index++) - { - SCA_ISensor* sensor = m_linkedsensors[index]; - STR_String& realname = sensor->GetName(); - if (realname == scriptArg) - { - return sensor->GetProxy(); - } - } - - PyErr_Format(PyExc_AttributeError, "controller.getSensor(string): Python Controller, unable to find requested sensor \"%s\"", scriptArg); - return NULL; -} - -PyObject* SCA_IController::PyGetActuator(PyObject* value) -{ - ShowDeprecationWarning("getActuator(string)", "the actuators[string] property"); - - char *scriptArg = _PyUnicode_AsString(value); - if (scriptArg==NULL) { - PyErr_SetString(PyExc_TypeError, "controller.getActuator(string): Python Controller, expected a string (actuator name)"); - return NULL; - } - - for (unsigned int index=0;index<m_linkedactuators.size();index++) - { - SCA_IActuator* actua = m_linkedactuators[index]; - if (actua->GetName() == scriptArg) - { - return actua->GetProxy(); - } - } - - PyErr_Format(PyExc_AttributeError, "controller.getActuator(string): Python Controller, unable to find requested actuator \"%s\"", scriptArg); - return NULL; -} - -PyObject* SCA_IController::PyGetSensors() -{ - ShowDeprecationWarning("getSensors()", "the sensors property"); - - PyObject* resultlist = PyList_New(m_linkedsensors.size()); - for (unsigned int index=0;index<m_linkedsensors.size();index++) - { - PyList_SET_ITEM(resultlist,index, m_linkedsensors[index]->GetProxy()); - } - - return resultlist; -} - -PyObject* SCA_IController::PyGetState() -{ - ShowDeprecationWarning("getState()", "the state property"); - return PyLong_FromSsize_t(m_statemask); -} - PyObject* SCA_IController::pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { SCA_IController* self= static_cast<SCA_IController*>(self_v); diff --git a/source/gameengine/GameLogic/SCA_IController.h b/source/gameengine/GameLogic/SCA_IController.h index 523878bee26..202921c6986 100644 --- a/source/gameengine/GameLogic/SCA_IController.h +++ b/source/gameengine/GameLogic/SCA_IController.h @@ -97,12 +97,6 @@ public: } } } - - KX_PYMETHOD_NOARGS(SCA_IController,GetSensors); - KX_PYMETHOD_NOARGS(SCA_IController,GetActuators); - KX_PYMETHOD_O(SCA_IController,GetSensor); - KX_PYMETHOD_O(SCA_IController,GetActuator); - KX_PYMETHOD_NOARGS(SCA_IController,GetState); static PyObject* pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp b/source/gameengine/GameLogic/SCA_ILogicBrick.cpp index 2c64e02913d..f679d0ee487 100644 --- a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp +++ b/source/gameengine/GameLogic/SCA_ILogicBrick.cpp @@ -199,11 +199,6 @@ PyTypeObject SCA_ILogicBrick::Type = { }; PyMethodDef SCA_ILogicBrick::Methods[] = { - // --> Deprecated - {"getOwner", (PyCFunction) SCA_ILogicBrick::sPyGetOwner, METH_NOARGS}, - {"getExecutePriority", (PyCFunction) SCA_ILogicBrick::sPyGetExecutePriority, METH_NOARGS}, - {"setExecutePriority", (PyCFunction) SCA_ILogicBrick::sPySetExecutePriority, METH_VARARGS}, - // <-- Deprecated {NULL,NULL} //Sentinel }; @@ -232,46 +227,6 @@ int SCA_ILogicBrick::CheckProperty(void *self, const PyAttributeDef *attrdef) return 0; } -PyObject* SCA_ILogicBrick::PyGetOwner() -{ - ShowDeprecationWarning("getOwner()", "the owner property"); - - CValue* parent = GetParent(); - if (parent) - { - return parent->GetProxy(); - } - - printf("ERROR: Python scriptblock without owner\n"); - Py_RETURN_NONE; //Int_FromLong(IsPositiveTrigger()); -} - - - -PyObject* SCA_ILogicBrick::PySetExecutePriority(PyObject* args) -{ - ShowDeprecationWarning("setExecutePriority()", "the executePriority property"); - - int priority=0; - - if (!PyArg_ParseTuple(args, "i:setExecutePriority", &priority)) { - return NULL; - } - - m_Execute_Priority = priority; - - Py_RETURN_NONE; -} - - - -PyObject* SCA_ILogicBrick::PyGetExecutePriority() -{ - ShowDeprecationWarning("getExecutePriority()", "the executePriority property"); - return PyLong_FromSsize_t(m_Execute_Priority); -} - - /*Attribute functions */ PyObject* SCA_ILogicBrick::pyattr_get_owner(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.h b/source/gameengine/GameLogic/SCA_ILogicBrick.h index 50679856802..ac533335f0b 100644 --- a/source/gameengine/GameLogic/SCA_ILogicBrick.h +++ b/source/gameengine/GameLogic/SCA_ILogicBrick.h @@ -126,10 +126,6 @@ public: // python methods - - KX_PYMETHOD_NOARGS(SCA_ILogicBrick,GetOwner); - KX_PYMETHOD_VARARGS(SCA_ILogicBrick,SetExecutePriority); - KX_PYMETHOD_NOARGS(SCA_ILogicBrick,GetExecutePriority); static PyObject* pyattr_get_owner(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp index b018124dcca..497a5d1095a 100644 --- a/source/gameengine/GameLogic/SCA_ISensor.cpp +++ b/source/gameengine/GameLogic/SCA_ISensor.cpp @@ -292,171 +292,6 @@ void SCA_ISensor::Activate(class SCA_LogicManager* logicmgr) /* Python Functions */ /* ----------------------------------------------- */ -//Deprecated Functions ------> -const char SCA_ISensor::IsPositive_doc[] = -"isPositive()\n" -"\tReturns whether the sensor is in an active state.\n"; -PyObject* SCA_ISensor::PyIsPositive() -{ - ShowDeprecationWarning("isPositive()", "the read-only positive property"); - int retval = GetState(); - return PyLong_FromSsize_t(retval); -} - -const char SCA_ISensor::IsTriggered_doc[] = -"isTriggered()\n" -"\tReturns whether the sensor has triggered the current controller.\n"; -PyObject* SCA_ISensor::PyIsTriggered() -{ - ShowDeprecationWarning("isTriggered()", "the read-only triggered property"); - // check with the current controller - int retval = 0; - if (SCA_PythonController::m_sCurrentController) - retval = SCA_PythonController::m_sCurrentController->IsTriggered(this); - return PyLong_FromSsize_t(retval); -} - -/** - * getUsePulseMode: getter for the pulse mode (KX_TRUE = on) - */ -const char SCA_ISensor::GetUsePosPulseMode_doc[] = -"getUsePosPulseMode()\n" -"\tReturns whether positive pulse mode is active.\n"; -PyObject* SCA_ISensor::PyGetUsePosPulseMode() -{ - ShowDeprecationWarning("getUsePosPulseMode()", "the usePosPulseMode property"); - return BoolToPyArg(m_pos_pulsemode); -} - -/** - * setUsePulseMode: setter for the pulse mode (KX_TRUE = on) - */ -const char SCA_ISensor::SetUsePosPulseMode_doc[] = -"setUsePosPulseMode(pulse?)\n" -"\t - pulse? : Pulse when a positive event occurs?\n" -"\t (KX_TRUE, KX_FALSE)\n" -"\tSet whether to do pulsing when positive pulses occur.\n"; -PyObject* SCA_ISensor::PySetUsePosPulseMode(PyObject* args) -{ - ShowDeprecationWarning("setUsePosPulseMode()", "the usePosPulseMode property"); - int pyarg = 0; - if(!PyArg_ParseTuple(args, "i:setUsePosPulseMode", &pyarg)) { return NULL; } - m_pos_pulsemode = PyArgToBool(pyarg); - Py_RETURN_NONE; -} - -/** - * getFrequency: getter for the pulse mode interval - */ -const char SCA_ISensor::GetFrequency_doc[] = -"getFrequency()\n" -"\tReturns the frequency of the updates in pulse mode.\n" ; -PyObject* SCA_ISensor::PyGetFrequency() -{ - ShowDeprecationWarning("getFrequency()", "the frequency property"); - return PyLong_FromSsize_t(m_pulse_frequency); -} - -/** - * setFrequency: setter for the pulse mode (KX_TRUE = on) - */ -const char SCA_ISensor::SetFrequency_doc[] = -"setFrequency(pulse_frequency)\n" -"\t- pulse_frequency: The frequency of the updates in pulse mode (integer)" -"\tSet the frequency of the updates in pulse mode.\n" -"\tIf the frequency is negative, it is set to 0.\n" ; -PyObject* SCA_ISensor::PySetFrequency(PyObject* args) -{ - ShowDeprecationWarning("setFrequency()", "the frequency property"); - int pulse_frequencyArg = 0; - - if(!PyArg_ParseTuple(args, "i:setFrequency", &pulse_frequencyArg)) { - return NULL; - } - - /* We can do three things here: clip, ignore and raise an exception. */ - /* Exceptions don't work yet, ignoring is not desirable now... */ - if (pulse_frequencyArg < 0) { - pulse_frequencyArg = 0; - }; - m_pulse_frequency = pulse_frequencyArg; - - Py_RETURN_NONE; -} - - -const char SCA_ISensor::GetInvert_doc[] = -"getInvert()\n" -"\tReturns whether or not pulses from this sensor are inverted.\n" ; -PyObject* SCA_ISensor::PyGetInvert() -{ - ShowDeprecationWarning("getInvert()", "the invert property"); - return BoolToPyArg(m_invert); -} - -const char SCA_ISensor::SetInvert_doc[] = -"setInvert(invert?)\n" -"\t- invert?: Invert the event-values? (KX_TRUE, KX_FALSE)\n" -"\tSet whether to invert pulses.\n"; -PyObject* SCA_ISensor::PySetInvert(PyObject* args) -{ - ShowDeprecationWarning("setInvert()", "the invert property"); - int pyarg = 0; - if(!PyArg_ParseTuple(args, "i:setInvert", &pyarg)) { return NULL; } - m_invert = PyArgToBool(pyarg); - Py_RETURN_NONE; -} - -const char SCA_ISensor::GetLevel_doc[] = -"getLevel()\n" -"\tReturns whether this sensor is a level detector or a edge detector.\n" -"\tIt makes a difference only in case of logic state transition (state actuator).\n" -"\tA level detector will immediately generate a pulse, negative or positive\n" -"\tdepending on the sensor condition, as soon as the state is activated.\n" -"\tA edge detector will wait for a state change before generating a pulse.\n"; -PyObject* SCA_ISensor::PyGetLevel() -{ - ShowDeprecationWarning("getLevel()", "the level property"); - return BoolToPyArg(m_level); -} - -const char SCA_ISensor::SetLevel_doc[] = -"setLevel(level?)\n" -"\t- level?: Detect level instead of edge? (KX_TRUE, KX_FALSE)\n" -"\tSet whether to detect level or edge transition when entering a state.\n"; -PyObject* SCA_ISensor::PySetLevel(PyObject* args) -{ - ShowDeprecationWarning("setLevel()", "the level property"); - int pyarg = 0; - if(!PyArg_ParseTuple(args, "i:setLevel", &pyarg)) { return NULL; } - m_level = PyArgToBool(pyarg); - Py_RETURN_NONE; -} - -const char SCA_ISensor::GetUseNegPulseMode_doc[] = -"getUseNegPulseMode()\n" -"\tReturns whether negative pulse mode is active.\n"; -PyObject* SCA_ISensor::PyGetUseNegPulseMode() -{ - ShowDeprecationWarning("getUseNegPulseMode()", "the useNegPulseMode property"); - return BoolToPyArg(m_neg_pulsemode); -} - -const char SCA_ISensor::SetUseNegPulseMode_doc[] = -"setUseNegPulseMode(pulse?)\n" -"\t - pulse? : Pulse when a negative event occurs?\n" -"\t (KX_TRUE, KX_FALSE)\n" -"\tSet whether to do pulsing when negative pulses occur.\n"; -PyObject* SCA_ISensor::PySetUseNegPulseMode(PyObject* args) -{ - ShowDeprecationWarning("setUseNegPulseMode()", "the useNegPulseMode property"); - int pyarg = 0; - if(!PyArg_ParseTuple(args, "i:setUseNegPulseMode", &pyarg)) { return NULL; } - m_neg_pulsemode = PyArgToBool(pyarg); - Py_RETURN_NONE; -} -//<------Deprecated - KX_PYMETHODDEF_DOC_NOARGS(SCA_ISensor, reset, "reset()\n" "\tReset sensor internal state, effect depends on the type of sensor and settings.\n" @@ -494,32 +329,6 @@ PyTypeObject SCA_ISensor::Type = { }; PyMethodDef SCA_ISensor::Methods[] = { - //Deprecated functions -----> - {"isPositive", (PyCFunction) SCA_ISensor::sPyIsPositive, - METH_NOARGS, (const char *)IsPositive_doc}, - {"isTriggered", (PyCFunction) SCA_ISensor::sPyIsTriggered, - METH_VARARGS, (const char *)IsTriggered_doc}, - {"getUsePosPulseMode", (PyCFunction) SCA_ISensor::sPyGetUsePosPulseMode, - METH_NOARGS, (const char *)GetUsePosPulseMode_doc}, - {"setUsePosPulseMode", (PyCFunction) SCA_ISensor::sPySetUsePosPulseMode, - METH_VARARGS, (const char *)SetUsePosPulseMode_doc}, - {"getFrequency", (PyCFunction) SCA_ISensor::sPyGetFrequency, - METH_NOARGS, (const char *)GetFrequency_doc}, - {"setFrequency", (PyCFunction) SCA_ISensor::sPySetFrequency, - METH_VARARGS, (const char *)SetFrequency_doc}, - {"getUseNegPulseMode", (PyCFunction) SCA_ISensor::sPyGetUseNegPulseMode, - METH_NOARGS, (const char *)GetUseNegPulseMode_doc}, - {"setUseNegPulseMode", (PyCFunction) SCA_ISensor::sPySetUseNegPulseMode, - METH_VARARGS, (const char *)SetUseNegPulseMode_doc}, - {"getInvert", (PyCFunction) SCA_ISensor::sPyGetInvert, - METH_NOARGS, (const char *)GetInvert_doc}, - {"setInvert", (PyCFunction) SCA_ISensor::sPySetInvert, - METH_VARARGS, (const char *)SetInvert_doc}, - {"getLevel", (PyCFunction) SCA_ISensor::sPyGetLevel, - METH_NOARGS, (const char *)GetLevel_doc}, - {"setLevel", (PyCFunction) SCA_ISensor::sPySetLevel, - METH_VARARGS, (const char *)SetLevel_doc}, - //<----- Deprecated KX_PYMETHODTABLE_NOARGS(SCA_ISensor, reset), {NULL,NULL} //Sentinel }; diff --git a/source/gameengine/GameLogic/SCA_ISensor.h b/source/gameengine/GameLogic/SCA_ISensor.h index 81864ab6a34..742b05bd88b 100644 --- a/source/gameengine/GameLogic/SCA_ISensor.h +++ b/source/gameengine/GameLogic/SCA_ISensor.h @@ -172,21 +172,6 @@ public: { return !m_links; } /* Python functions: */ - - //Deprecated functions -----> - KX_PYMETHOD_DOC_NOARGS(SCA_ISensor,IsPositive); - KX_PYMETHOD_DOC_NOARGS(SCA_ISensor,IsTriggered); - KX_PYMETHOD_DOC_NOARGS(SCA_ISensor,GetUsePosPulseMode); - KX_PYMETHOD_DOC_VARARGS(SCA_ISensor,SetUsePosPulseMode); - KX_PYMETHOD_DOC_NOARGS(SCA_ISensor,GetFrequency); - KX_PYMETHOD_DOC_VARARGS(SCA_ISensor,SetFrequency); - KX_PYMETHOD_DOC_NOARGS(SCA_ISensor,GetUseNegPulseMode); - KX_PYMETHOD_DOC_VARARGS(SCA_ISensor,SetUseNegPulseMode); - KX_PYMETHOD_DOC_NOARGS(SCA_ISensor,GetInvert); - KX_PYMETHOD_DOC_VARARGS(SCA_ISensor,SetInvert); - KX_PYMETHOD_DOC_NOARGS(SCA_ISensor,GetLevel); - KX_PYMETHOD_DOC_VARARGS(SCA_ISensor,SetLevel); - //<------ KX_PYMETHOD_DOC_NOARGS(SCA_ISensor,reset); static PyObject* pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp index 76d35e6d615..4936b380352 100644 --- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp @@ -273,24 +273,6 @@ PyTypeObject SCA_JoystickSensor::Type = { }; PyMethodDef SCA_JoystickSensor::Methods[] = { - //Deprecated functions ------> - {"getIndex", (PyCFunction) SCA_JoystickSensor::sPyGetIndex, METH_NOARGS, (const char *)GetIndex_doc}, - {"setIndex", (PyCFunction) SCA_JoystickSensor::sPySetIndex, METH_O, (const char *)SetIndex_doc}, - {"getAxis", (PyCFunction) SCA_JoystickSensor::sPyGetAxis, METH_NOARGS, (const char *)GetAxis_doc}, - {"setAxis", (PyCFunction) SCA_JoystickSensor::sPySetAxis, METH_VARARGS, (const char *)SetAxis_doc}, - {"getAxisValue", (PyCFunction) SCA_JoystickSensor::sPyGetAxisValue, METH_NOARGS, (const char *)GetAxisValue_doc}, - {"getThreshold", (PyCFunction) SCA_JoystickSensor::sPyGetThreshold, METH_NOARGS, (const char *)GetThreshold_doc}, - {"setThreshold", (PyCFunction) SCA_JoystickSensor::sPySetThreshold, METH_VARARGS, (const char *)SetThreshold_doc}, - {"getButton", (PyCFunction) SCA_JoystickSensor::sPyGetButton, METH_NOARGS, (const char *)GetButton_doc}, - {"setButton", (PyCFunction) SCA_JoystickSensor::sPySetButton, METH_O, (const char *)SetButton_doc}, - {"getHat", (PyCFunction) SCA_JoystickSensor::sPyGetHat, METH_NOARGS, (const char *)GetHat_doc}, - {"setHat", (PyCFunction) SCA_JoystickSensor::sPySetHat, METH_VARARGS, (const char *)SetHat_doc}, - {"getNumAxes", (PyCFunction) SCA_JoystickSensor::sPyNumberOfAxes, METH_NOARGS, (const char *)NumberOfAxes_doc}, - {"getNumButtons",(PyCFunction) SCA_JoystickSensor::sPyNumberOfButtons,METH_NOARGS, (const char *)NumberOfButtons_doc}, - {"getNumHats", (PyCFunction) SCA_JoystickSensor::sPyNumberOfHats, METH_NOARGS, (const char *)NumberOfHats_doc}, - {"isConnected", (PyCFunction) SCA_JoystickSensor::sPyConnected, METH_NOARGS, (const char *)Connected_doc}, - {"getButtonValue",(PyCFunction) SCA_JoystickSensor::sPyGetButtonValue, METH_NOARGS,(const char *)GetButtonValue_doc}, - //<----- Deprecated {"getButtonActiveList",(PyCFunction) SCA_JoystickSensor::sPyGetButtonActiveList, METH_NOARGS,(const char *)GetButtonActiveList_doc}, {"getButtonStatus",(PyCFunction) SCA_JoystickSensor::sPyGetButtonStatus, METH_VARARGS,(const char *)GetButtonStatus_doc}, {NULL,NULL} //Sentinel @@ -314,138 +296,6 @@ PyAttributeDef SCA_JoystickSensor::Attributes[] = { { NULL } //Sentinel }; - -/* get index ---------------------------------------------------------- */ -const char SCA_JoystickSensor::GetIndex_doc[] = -"getIndex\n" -"\tReturns the joystick index to use.\n"; -PyObject* SCA_JoystickSensor::PyGetIndex( ) { - ShowDeprecationWarning("getIndex()", "the index property"); - return PyLong_FromSsize_t(m_joyindex); -} - - -/* set index ---------------------------------------------------------- */ -const char SCA_JoystickSensor::SetIndex_doc[] = -"setIndex\n" -"\tSets the joystick index to use.\n"; -PyObject* SCA_JoystickSensor::PySetIndex( PyObject* value ) { - ShowDeprecationWarning("setIndex()", "the index property"); - int index = PyLong_AsSsize_t( value ); /* -1 on error, will raise an error in this case */ - if (index < 0 || index >= JOYINDEX_MAX) { - PyErr_SetString(PyExc_ValueError, "joystick index out of range or not an int"); - return NULL; - } - - m_joyindex = index; - Py_RETURN_NONE; -} - -/* get axis ---------------------------------------------------------- */ -const char SCA_JoystickSensor::GetAxis_doc[] = -"getAxis\n" -"\tReturns the current axis this sensor reacts to.\n"; -PyObject* SCA_JoystickSensor::PyGetAxis( ) { - ShowDeprecationWarning("getAxis()", "the axis property"); - return Py_BuildValue("[ii]",m_axis, m_axisf); -} - - -/* set axis ---------------------------------------------------------- */ -const char SCA_JoystickSensor::SetAxis_doc[] = -"setAxis\n" -"\tSets the current axis this sensor reacts to.\n"; -PyObject* SCA_JoystickSensor::PySetAxis( PyObject* args ) { - ShowDeprecationWarning("setAxis()", "the axis property"); - - int axis,axisflag; - if(!PyArg_ParseTuple(args, "ii:setAxis", &axis, &axisflag)){ - return NULL; - } - m_axis = axis; - m_axisf = axisflag; - - CheckAxis((void *)this, NULL); /* clamp values */ - Py_RETURN_NONE; -} - - -/* get axis value ----------------------------------------------------- */ -const char SCA_JoystickSensor::GetAxisValue_doc[] = -"getAxisValue\n" -"\tReturns a list of the values for the current state of each axis.\n"; -PyObject* SCA_JoystickSensor::PyGetAxisValue( ) { - ShowDeprecationWarning("getAxisValue()", "the axisPosition property"); - SCA_Joystick *joy = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex); - - int axis_index= joy->GetNumberOfAxes(); - PyObject *list= PyList_New(axis_index); - - while(axis_index--) { - PyList_SET_ITEM(list, axis_index, PyLong_FromSsize_t(joy->GetAxisPosition(axis_index))); - } - - return list; -} - - -/* get threshold ----------------------------------------------------- */ -const char SCA_JoystickSensor::GetThreshold_doc[] = -"getThreshold\n" -"\tReturns the threshold of the axis.\n"; -PyObject* SCA_JoystickSensor::PyGetThreshold( ) { - ShowDeprecationWarning("getThreshold()", "the threshold property"); - return PyLong_FromSsize_t(m_precision); -} - - -/* set threshold ----------------------------------------------------- */ -const char SCA_JoystickSensor::SetThreshold_doc[] = -"setThreshold\n" -"\tSets the threshold of the axis.\n"; -PyObject* SCA_JoystickSensor::PySetThreshold( PyObject* args ) { - ShowDeprecationWarning("setThreshold()", "the threshold property"); - int thresh; - if(!PyArg_ParseTuple(args, "i:setThreshold", &thresh)){ - return NULL; - } - m_precision = thresh; - Py_RETURN_NONE; -} - -/* get button -------------------------------------------------------- */ -const char SCA_JoystickSensor::GetButton_doc[] = -"getButton\n" -"\tReturns the current button this sensor is checking.\n"; -PyObject* SCA_JoystickSensor::PyGetButton( ) { - ShowDeprecationWarning("getButton()", "the button property"); - return PyLong_FromSsize_t(m_button); -} - -/* set button -------------------------------------------------------- */ -const char SCA_JoystickSensor::SetButton_doc[] = -"setButton\n" -"\tSets the button the sensor reacts to.\n"; -PyObject* SCA_JoystickSensor::PySetButton( PyObject* value ) { - ShowDeprecationWarning("setButton()", "the button property"); - int button = PyLong_AsSsize_t(value); - if(button==-1 && PyErr_Occurred()) { - PyErr_SetString(PyExc_ValueError, "expected an int"); - return NULL; - } - m_button = button; - Py_RETURN_NONE; -} - -/* get button value -------------------------------------------------- */ -const char SCA_JoystickSensor::GetButtonValue_doc[] = -"getButtonValue\n" -"\tReturns a list containing the indicies of the current pressed state of each button.\n"; -PyObject* SCA_JoystickSensor::PyGetButtonValue( ) { - ShowDeprecationWarning("getButtonValue()", "getButtonActiveList"); - return PyGetButtonActiveList( ); -} - /* get button active list -------------------------------------------------- */ const char SCA_JoystickSensor::GetButtonActiveList_doc[] = "getButtonActiveList\n" @@ -485,75 +335,6 @@ PyObject* SCA_JoystickSensor::PyGetButtonStatus( PyObject* args ) { return PyBool_FromLong(0); } -/* get hat ----------------------------------------------------------- */ -const char SCA_JoystickSensor::GetHat_doc[] = -"getHat\n" -"\tReturns the current direction of the hat.\n"; -PyObject* SCA_JoystickSensor::PyGetHat( ) { - ShowDeprecationWarning("getHat()", "the hat property"); - return Py_BuildValue("[ii]",m_hat, m_hatf); -} - - -/* set hat ----------------------------------------------------------- */ -const char SCA_JoystickSensor::SetHat_doc[] = -"setHat\n" -"\tSets the hat the sensor reacts to.\n"; -PyObject* SCA_JoystickSensor::PySetHat( PyObject* args ) { - ShowDeprecationWarning("setHat()", "the hat property"); - int hat,hatflag; - if(!PyArg_ParseTuple(args, "ii:setHat", &hat, &hatflag)){ - return NULL; - } - m_hat = hat; - m_hatf = hatflag; - - CheckHat((void *)this, NULL); /* clamp values */ - Py_RETURN_NONE; -} - - -/* get # of ----------------------------------------------------- */ -const char SCA_JoystickSensor::NumberOfAxes_doc[] = -"getNumAxes\n" -"\tReturns the number of axes .\n"; -PyObject* SCA_JoystickSensor::PyNumberOfAxes( ) { - ShowDeprecationWarning("getNumAxes()", "the numAxis property"); - SCA_Joystick *joy = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex); - // when the joystick is null their is 0 exis still. dumb but scripters should use isConnected() - return PyLong_FromSsize_t( joy ? joy->GetNumberOfAxes() : 0 ); -} - - -const char SCA_JoystickSensor::NumberOfButtons_doc[] = -"getNumButtons\n" -"\tReturns the number of buttons .\n"; -PyObject* SCA_JoystickSensor::PyNumberOfButtons( ) { - ShowDeprecationWarning("getNumButtons()", "the numButtons property"); - SCA_Joystick *joy = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex); - return PyLong_FromSsize_t( joy ? joy->GetNumberOfButtons() : 0 ); -} - - -const char SCA_JoystickSensor::NumberOfHats_doc[] = -"getNumHats\n" -"\tReturns the number of hats .\n"; -PyObject* SCA_JoystickSensor::PyNumberOfHats( ) { - ShowDeprecationWarning("getNumHats()", "the numHats property"); - SCA_Joystick *joy = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex); - return PyLong_FromSsize_t( joy ? joy->GetNumberOfHats() : 0 ); -} - -const char SCA_JoystickSensor::Connected_doc[] = -"getConnected\n" -"\tReturns True if a joystick is connected at this joysticks index.\n"; -PyObject* SCA_JoystickSensor::PyConnected( ) { - ShowDeprecationWarning("getConnected()", "the connected property"); - SCA_Joystick *joy = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex); - return PyBool_FromLong( joy ? joy->Connected() : 0 ); -} - - PyObject* SCA_JoystickSensor::pyattr_get_axis_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { SCA_JoystickSensor* self= static_cast<SCA_JoystickSensor*>(self_v); diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.h b/source/gameengine/GameLogic/SCA_JoystickSensor.h index 1189b1ec18c..b793c591ac1 100644 --- a/source/gameengine/GameLogic/SCA_JoystickSensor.h +++ b/source/gameengine/GameLogic/SCA_JoystickSensor.h @@ -122,28 +122,8 @@ public: /* --------------------------------------------------------------------- */ /* Joystick Index */ - KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetIndex); - KX_PYMETHOD_DOC_O(SCA_JoystickSensor,SetIndex); - /* Axes*/ - KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetAxis); - KX_PYMETHOD_DOC_VARARGS(SCA_JoystickSensor,SetAxis); - KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetAxisValue); - KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetThreshold); - KX_PYMETHOD_DOC_VARARGS(SCA_JoystickSensor,SetThreshold); - /* Buttons */ - KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetButton); - KX_PYMETHOD_DOC_O(SCA_JoystickSensor,SetButton); - KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetButtonValue); KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetButtonActiveList); KX_PYMETHOD_DOC_VARARGS(SCA_JoystickSensor,GetButtonStatus); - /* Hats */ - KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetHat); - KX_PYMETHOD_DOC_VARARGS(SCA_JoystickSensor,SetHat); - /* number of */ - KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,NumberOfAxes); - KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,NumberOfButtons); - KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,NumberOfHats); - KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,Connected); static PyObject* pyattr_get_axis_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_axis_single(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp index 13b32b5446c..d2e3871fec2 100644 --- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp +++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp @@ -408,184 +408,6 @@ void SCA_KeyboardSensor::LogKeystrokes(void) /* Python Functions */ /* ------------------------------------------------------------------------- */ -//Deprecated -----> -/** 1. GetKey : check which key this sensor looks at */ -const char SCA_KeyboardSensor::GetKey_doc[] = -"getKey()\n" -"\tReturn the code of the key this sensor is listening to.\n" ; -PyObject* SCA_KeyboardSensor::PyGetKey() -{ - ShowDeprecationWarning("getKey()", "the key property"); - return PyLong_FromSsize_t(m_hotkey); -} - -/** 2. SetKey: change the key to look at */ -const char SCA_KeyboardSensor::SetKey_doc[] = -"setKey(keycode)\n" -"\t- keycode: any code from GameKeys\n" -"\tSet the key this sensor should listen to.\n" ; -PyObject* SCA_KeyboardSensor::PySetKey(PyObject* args) -{ - ShowDeprecationWarning("setKey()", "the key property"); - int keyCode; - - if(!PyArg_ParseTuple(args, "i:setKey", &keyCode)) { - return NULL; - } - - /* Since we have symbolic constants for this in Python, we don't guard */ - /* anything. It's up to the user to provide a sensible number. */ - m_hotkey = keyCode; - - Py_RETURN_NONE; -} - -/** 3. GetHold1 : set the first bucky bit */ -const char SCA_KeyboardSensor::GetHold1_doc[] = -"getHold1()\n" -"\tReturn the code of the first key modifier to the key this \n" -"\tsensor is listening to.\n" ; -PyObject* SCA_KeyboardSensor::PyGetHold1() -{ - ShowDeprecationWarning("getHold1()", "the hold1 property"); - return PyLong_FromSsize_t(m_qual); -} - -/** 4. SetHold1: change the first bucky bit */ -const char SCA_KeyboardSensor::SetHold1_doc[] = -"setHold1(keycode)\n" -"\t- keycode: any code from GameKeys\n" -"\tSet the first modifier to the key this sensor should listen to.\n" ; -PyObject* SCA_KeyboardSensor::PySetHold1(PyObject* args) -{ - ShowDeprecationWarning("setHold1()", "the hold1 property"); - int keyCode; - - if(!PyArg_ParseTuple(args, "i:setHold1", &keyCode)) { - return NULL; - } - - /* Since we have symbolic constants for this in Python, we don't guard */ - /* anything. It's up to the user to provide a sensible number. */ - m_qual = keyCode; - - Py_RETURN_NONE; -} - -/** 5. GetHold2 : get the second bucky bit */ -const char SCA_KeyboardSensor::GetHold2_doc[] = -"getHold2()\n" -"\tReturn the code of the second key modifier to the key this \n" -"\tsensor is listening to.\n" ; -PyObject* SCA_KeyboardSensor::PyGetHold2() -{ - ShowDeprecationWarning("getHold2()", "the hold2 property"); - return PyLong_FromSsize_t(m_qual2); -} - -/** 6. SetHold2: change the second bucky bit */ -const char SCA_KeyboardSensor::SetHold2_doc[] = -"setHold2(keycode)\n" -"\t- keycode: any code from GameKeys\n" -"\tSet the first modifier to the key this sensor should listen to.\n" ; -PyObject* SCA_KeyboardSensor::PySetHold2(PyObject* args) -{ - ShowDeprecationWarning("setHold2()", "the hold2 property"); - int keyCode; - - if(!PyArg_ParseTuple(args, "i:setHold2", &keyCode)) { - return NULL; - } - - /* Since we have symbolic constants for this in Python, we don't guard */ - /* anything. It's up to the user to provide a sensible number. */ - m_qual2 = keyCode; - - Py_RETURN_NONE; -} - - -const char SCA_KeyboardSensor::GetPressedKeys_doc[] = -"getPressedKeys()\n" -"\tGet a list of pressed keys that have either been pressed, or just released this frame.\n" ; - -PyObject* SCA_KeyboardSensor::PyGetPressedKeys() -{ - ShowDeprecationWarning("getPressedKeys()", "events"); - - SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice(); - - int num = inputdev->GetNumJustEvents(); - PyObject* resultlist = PyList_New(num); - - if (num > 0) - { - - int index = 0; - - for (int i=SCA_IInputDevice::KX_BEGINKEY ; i<= SCA_IInputDevice::KX_ENDKEY;i++) - { - const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) i); - if ((inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED) - || (inevent.m_status == SCA_InputEvent::KX_JUSTRELEASED)) - { - PyObject* keypair = PyList_New(2); - PyList_SET_ITEM(keypair,0,PyLong_FromSsize_t(i)); - PyList_SET_ITEM(keypair,1,PyLong_FromSsize_t(inevent.m_status)); - PyList_SET_ITEM(resultlist,index,keypair); - index++; - - if (index >= num) /* should not happen */ - break; - } - } - } - - return resultlist; -} - - - -const char SCA_KeyboardSensor::GetCurrentlyPressedKeys_doc[] = -"getCurrentlyPressedKeys()\n" -"\tGet a list of keys that are currently pressed.\n" ; - -PyObject* SCA_KeyboardSensor::PyGetCurrentlyPressedKeys() -{ - ShowDeprecationWarning("getCurrentlyPressedKeys()", "events"); - - SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice(); - - int num = inputdev->GetNumActiveEvents(); - PyObject* resultlist = PyList_New(num); - - if (num > 0) - { - int index = 0; - - for (int i=SCA_IInputDevice::KX_BEGINKEY ; i<= SCA_IInputDevice::KX_ENDKEY;i++) - { - const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) i); - if ( (inevent.m_status == SCA_InputEvent::KX_ACTIVE) - || (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED)) - { - PyObject* keypair = PyList_New(2); - PyList_SET_ITEM(keypair,0,PyLong_FromSsize_t(i)); - PyList_SET_ITEM(keypair,1,PyLong_FromSsize_t(inevent.m_status)); - PyList_SET_ITEM(resultlist,index,keypair); - index++; - - if (index >= num) /* should never happen */ - break; - } - } - } - - return resultlist; -} - -//<---- Deprecated - KX_PYMETHODDEF_DOC_O(SCA_KeyboardSensor, getKeyStatus, "getKeyStatus(keycode)\n" "\tGet the given key's status (KX_NO_INPUTSTATUS, KX_JUSTACTIVATED, KX_ACTIVE or KX_JUSTRELEASED).\n") @@ -635,16 +457,6 @@ PyTypeObject SCA_KeyboardSensor::Type = { }; PyMethodDef SCA_KeyboardSensor::Methods[] = { - //Deprecated functions ------> - {"getKey", (PyCFunction) SCA_KeyboardSensor::sPyGetKey, METH_NOARGS, (const char *)GetKey_doc}, - {"setKey", (PyCFunction) SCA_KeyboardSensor::sPySetKey, METH_VARARGS, (const char *)SetKey_doc}, - {"getHold1", (PyCFunction) SCA_KeyboardSensor::sPyGetHold1, METH_NOARGS, (const char *)GetHold1_doc}, - {"setHold1", (PyCFunction) SCA_KeyboardSensor::sPySetHold1, METH_VARARGS, (const char *)SetHold1_doc}, - {"getHold2", (PyCFunction) SCA_KeyboardSensor::sPyGetHold2, METH_NOARGS, (const char *)GetHold2_doc}, - {"setHold2", (PyCFunction) SCA_KeyboardSensor::sPySetHold2, METH_VARARGS, (const char *)SetHold2_doc}, - {"getPressedKeys", (PyCFunction) SCA_KeyboardSensor::sPyGetPressedKeys, METH_NOARGS, (const char *)GetPressedKeys_doc}, - {"getCurrentlyPressedKeys", (PyCFunction) SCA_KeyboardSensor::sPyGetCurrentlyPressedKeys, METH_NOARGS, (const char *)GetCurrentlyPressedKeys_doc}, - //<----- Deprecated KX_PYMETHODTABLE_O(SCA_KeyboardSensor, getKeyStatus), {NULL,NULL} //Sentinel }; diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.h b/source/gameengine/GameLogic/SCA_KeyboardSensor.h index bce56b800e6..d7e0f301a9d 100644 --- a/source/gameengine/GameLogic/SCA_KeyboardSensor.h +++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.h @@ -107,25 +107,6 @@ public: /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ - //Deprecated functions -----> - /** 1. GetKey : check which key this sensor looks at */ - KX_PYMETHOD_DOC_NOARGS(SCA_KeyboardSensor,GetKey); - /** 2. SetKey: change the key to look at */ - KX_PYMETHOD_DOC_VARARGS(SCA_KeyboardSensor,SetKey); - /** 3. GetHold1 : set the first bucky bit */ - KX_PYMETHOD_DOC_NOARGS(SCA_KeyboardSensor,GetHold1); - /** 4. SetHold1: change the first bucky bit */ - KX_PYMETHOD_DOC_VARARGS(SCA_KeyboardSensor,SetHold1); - /** 5. GetHold2 : set the second bucky bit */ - KX_PYMETHOD_DOC_NOARGS(SCA_KeyboardSensor,GetHold2); - /** 6. SetHold2: change the second bucky bit */ - KX_PYMETHOD_DOC_VARARGS(SCA_KeyboardSensor,SetHold2); - /** 9. GetPressedKeys: */ - KX_PYMETHOD_DOC_NOARGS(SCA_KeyboardSensor,GetPressedKeys); - /** 9. GetCurrrentlyPressedKeys: */ - KX_PYMETHOD_DOC_NOARGS(SCA_KeyboardSensor,GetCurrentlyPressedKeys); - // <------ - // KeyEvents: KX_PYMETHOD_DOC_NOARGS(SCA_KeyboardSensor,getEventList); // KeyStatus: diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.cpp b/source/gameengine/GameLogic/SCA_MouseSensor.cpp index e19b5a3956b..9d32682eaa9 100644 --- a/source/gameengine/GameLogic/SCA_MouseSensor.cpp +++ b/source/gameengine/GameLogic/SCA_MouseSensor.cpp @@ -243,30 +243,6 @@ bool SCA_MouseSensor::isValid(SCA_MouseSensor::KX_MOUSESENSORMODE m) /* Python functions */ /* ------------------------------------------------------------------------- */ -//Deprecated functions ------> -/* get x position ---------------------------------------------------------- */ -const char SCA_MouseSensor::GetXPosition_doc[] = -"getXPosition\n" -"\tReturns the x-coordinate of the mouse sensor, in frame coordinates.\n" -"\tThe lower-left corner is the origin. The coordinate is given in\n" -"\tpixels\n"; -PyObject* SCA_MouseSensor::PyGetXPosition() { - ShowDeprecationWarning("getXPosition()", "the position property"); - return PyLong_FromSsize_t(m_x); -} - -/* get y position ---------------------------------------------------------- */ -const char SCA_MouseSensor::GetYPosition_doc[] = -"getYPosition\n" -"\tReturns the y-coordinate of the mouse sensor, in frame coordinates.\n" -"\tThe lower-left corner is the origin. The coordinate is given in\n" -"\tpixels\n"; -PyObject* SCA_MouseSensor::PyGetYPosition() { - ShowDeprecationWarning("getYPosition()", "the position property"); - return PyLong_FromSsize_t(m_y); -} -//<----- Deprecated - KX_PYMETHODDEF_DOC_O(SCA_MouseSensor, getButtonStatus, "getButtonStatus(button)\n" "\tGet the given button's status (KX_INPUT_NONE, KX_INPUT_NONE, KX_INPUT_JUST_ACTIVATED, KX_INPUT_ACTIVE, KX_INPUT_JUST_RELEASED).\n") @@ -316,10 +292,6 @@ PyTypeObject SCA_MouseSensor::Type = { }; PyMethodDef SCA_MouseSensor::Methods[] = { - //Deprecated functions ------> - {"getXPosition", (PyCFunction) SCA_MouseSensor::sPyGetXPosition, METH_VARARGS, (const char *)GetXPosition_doc}, - {"getYPosition", (PyCFunction) SCA_MouseSensor::sPyGetYPosition, METH_VARARGS, (const char *)GetYPosition_doc}, - //<----- Deprecated KX_PYMETHODTABLE_O(SCA_MouseSensor, getButtonStatus), {NULL,NULL} //Sentinel }; diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.h b/source/gameengine/GameLogic/SCA_MouseSensor.h index ad74a77a219..a679e605428 100644 --- a/source/gameengine/GameLogic/SCA_MouseSensor.h +++ b/source/gameengine/GameLogic/SCA_MouseSensor.h @@ -106,13 +106,6 @@ class SCA_MouseSensor : public SCA_ISensor /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ - - //Deprecated functions -----> - /* read x-coordinate */ - KX_PYMETHOD_DOC_NOARGS(SCA_MouseSensor,GetXPosition); - /* read y-coordinate */ - KX_PYMETHOD_DOC_NOARGS(SCA_MouseSensor,GetYPosition); - //<----- deprecated // get button status KX_PYMETHOD_DOC_O(SCA_MouseSensor,getButtonStatus); diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp index 5afb537c28a..9446487cdb7 100644 --- a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp +++ b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp @@ -250,12 +250,6 @@ PyTypeObject SCA_PropertyActuator::Type = { }; PyMethodDef SCA_PropertyActuator::Methods[] = { - //Deprecated functions ------> - {"setProperty", (PyCFunction) SCA_PropertyActuator::sPySetProperty, METH_VARARGS, (const char *)SetProperty_doc}, - {"getProperty", (PyCFunction) SCA_PropertyActuator::sPyGetProperty, METH_VARARGS, (const char *)GetProperty_doc}, - {"setValue", (PyCFunction) SCA_PropertyActuator::sPySetValue, METH_VARARGS, (const char *)SetValue_doc}, - {"getValue", (PyCFunction) SCA_PropertyActuator::sPyGetValue, METH_VARARGS, (const char *)GetValue_doc}, - //<----- Deprecated {NULL,NULL} //Sentinel }; @@ -266,71 +260,4 @@ PyAttributeDef SCA_PropertyActuator::Attributes[] = { { NULL } //Sentinel }; -/* 1. setProperty */ -const char SCA_PropertyActuator::SetProperty_doc[] = -"setProperty(name)\n" -"\t- name: string\n" -"\tSet the property on which to operate. If there is no property\n" -"\tof this name, the call is ignored.\n"; -PyObject* SCA_PropertyActuator::PySetProperty(PyObject* args, PyObject* kwds) -{ - ShowDeprecationWarning("setProperty()", "the 'propName' property"); - /* Check whether the name exists first ! */ - char *nameArg; - if (!PyArg_ParseTuple(args, "s:setProperty", &nameArg)) { - return NULL; - } - - CValue* prop = GetParent()->FindIdentifier(nameArg); - - if (!prop->IsError()) { - m_propname = nameArg; - } else { - ; /* not found ... */ - } - prop->Release(); - - Py_RETURN_NONE; -} - -/* 2. getProperty */ -const char SCA_PropertyActuator::GetProperty_doc[] = -"getProperty(name)\n" -"\tReturn the property on which the actuator operates.\n"; -PyObject* SCA_PropertyActuator::PyGetProperty(PyObject* args, PyObject* kwds) -{ - ShowDeprecationWarning("getProperty()", "the 'propName' property"); - return PyUnicode_FromString(m_propname); -} - -/* 3. setValue */ -const char SCA_PropertyActuator::SetValue_doc[] = -"setValue(value)\n" -"\t- value: string\n" -"\tSet the value with which the actuator operates. If the value\n" -"\tis not compatible with the type of the property, the subsequent\n" -"\t action is ignored.\n"; -PyObject* SCA_PropertyActuator::PySetValue(PyObject* args, PyObject* kwds) -{ - ShowDeprecationWarning("setValue()", "the value property"); - char *valArg; - if(!PyArg_ParseTuple(args, "s:setValue", &valArg)) { - return NULL; - } - - if (valArg) m_exprtxt = valArg; - - Py_RETURN_NONE; -} - -/* 4. getValue */ -const char SCA_PropertyActuator::GetValue_doc[] = -"getValue()\n" -"\tReturns the value with which the actuator operates.\n"; -PyObject* SCA_PropertyActuator::PyGetValue(PyObject* args, PyObject* kwds) -{ - ShowDeprecationWarning("getValue()", "the value property"); - return PyUnicode_FromString(m_exprtxt); -} - /* eof */ diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.h b/source/gameengine/GameLogic/SCA_PropertyActuator.h index 8fb2e7a7bc5..833547a5cd3 100644 --- a/source/gameengine/GameLogic/SCA_PropertyActuator.h +++ b/source/gameengine/GameLogic/SCA_PropertyActuator.h @@ -83,14 +83,6 @@ public: /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ - - // python wrapped methods - KX_PYMETHOD_DOC(SCA_PropertyActuator,SetProperty); - KX_PYMETHOD_DOC(SCA_PropertyActuator,GetProperty); - KX_PYMETHOD_DOC(SCA_PropertyActuator,SetValue); - KX_PYMETHOD_DOC(SCA_PropertyActuator,GetValue); - - /* 5. - ... setObject, getObject, setProp2, getProp2, setMode, getMode*/ }; diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.cpp b/source/gameengine/GameLogic/SCA_PropertySensor.cpp index 96c769bd3d3..9c09c8410fb 100644 --- a/source/gameengine/GameLogic/SCA_PropertySensor.cpp +++ b/source/gameengine/GameLogic/SCA_PropertySensor.cpp @@ -324,14 +324,6 @@ PyTypeObject SCA_PropertySensor::Type = { }; PyMethodDef SCA_PropertySensor::Methods[] = { - //Deprecated functions ------> - {"getType", (PyCFunction) SCA_PropertySensor::sPyGetType, METH_NOARGS, (const char *)GetType_doc}, - {"setType", (PyCFunction) SCA_PropertySensor::sPySetType, METH_VARARGS, (const char *)SetType_doc}, - {"getProperty", (PyCFunction) SCA_PropertySensor::sPyGetProperty, METH_NOARGS, (const char *)GetProperty_doc}, - {"setProperty", (PyCFunction) SCA_PropertySensor::sPySetProperty, METH_VARARGS, (const char *)SetProperty_doc}, - {"getValue", (PyCFunction) SCA_PropertySensor::sPyGetValue, METH_NOARGS, (const char *)GetValue_doc}, - {"setValue", (PyCFunction) SCA_PropertySensor::sPySetValue, METH_VARARGS, (const char *)SetValue_doc}, - //<----- Deprecated {NULL,NULL} //Sentinel }; @@ -342,111 +334,4 @@ PyAttributeDef SCA_PropertySensor::Attributes[] = { { NULL } //Sentinel }; -/* 1. getType */ -const char SCA_PropertySensor::GetType_doc[] = -"getType()\n" -"\tReturns the type of check this sensor performs.\n"; -PyObject* SCA_PropertySensor::PyGetType() -{ - ShowDeprecationWarning("getType()", "the mode property"); - return PyLong_FromSsize_t(m_checktype); -} - -/* 2. setType */ -const char SCA_PropertySensor::SetType_doc[] = -"setType(type)\n" -"\t- type: KX_PROPSENSOR_EQUAL, KX_PROPSENSOR_NOTEQUAL,\n" -"\t KX_PROPSENSOR_INTERVAL, KX_PROPSENSOR_CHANGED,\n" -"\t or KX_PROPSENSOR_EXPRESSION.\n" -"\tSet the type of check to perform.\n"; -PyObject* SCA_PropertySensor::PySetType(PyObject* args) -{ - ShowDeprecationWarning("setType()", "the mode property"); - int typeArg; - - if (!PyArg_ParseTuple(args, "i:setType", &typeArg)) { - return NULL; - } - - if ( (typeArg > KX_PROPSENSOR_NODEF) - && (typeArg < KX_PROPSENSOR_MAX) ) { - m_checktype = typeArg; - } - - Py_RETURN_NONE; -} - -/* 3. getProperty */ -const char SCA_PropertySensor::GetProperty_doc[] = -"getProperty()\n" -"\tReturn the property with which the sensor operates.\n"; -PyObject* SCA_PropertySensor::PyGetProperty() -{ - ShowDeprecationWarning("getProperty()", "the 'propName' property"); - return PyUnicode_FromString(m_checkpropname); -} - -/* 4. setProperty */ -const char SCA_PropertySensor::SetProperty_doc[] = -"setProperty(name)\n" -"\t- name: string\n" -"\tSets the property with which to operate. If there is no property\n" -"\tof this name, the call is ignored.\n"; -PyObject* SCA_PropertySensor::PySetProperty(PyObject* args) -{ - ShowDeprecationWarning("setProperty()", "the 'propName' property"); - /* We should query whether the name exists. Or should we create a prop */ - /* on the fly? */ - char *propNameArg = NULL; - - if (!PyArg_ParseTuple(args, "s:setProperty", &propNameArg)) { - return NULL; - } - - CValue *prop = FindIdentifier(STR_String(propNameArg)); - if (!prop->IsError()) { - m_checkpropname = propNameArg; - } else { - ; /* error: bad property name */ - } - prop->Release(); - Py_RETURN_NONE; -} - -/* 5. getValue */ -const char SCA_PropertySensor::GetValue_doc[] = -"getValue()\n" -"\tReturns the value with which the sensor operates.\n"; -PyObject* SCA_PropertySensor::PyGetValue() -{ - ShowDeprecationWarning("getValue()", "the value property"); - return PyUnicode_FromString(m_checkpropval); -} - -/* 6. setValue */ -const char SCA_PropertySensor::SetValue_doc[] = -"setValue(value)\n" -"\t- value: string\n" -"\tSet the value with which the sensor operates. If the value\n" -"\tis not compatible with the type of the property, the subsequent\n" -"\t action is ignored.\n"; -PyObject* SCA_PropertySensor::PySetValue(PyObject* args) -{ - ShowDeprecationWarning("setValue()", "the value property"); - /* Here, we need to check whether the value is 'valid' for this property.*/ - /* We know that the property exists, or is NULL. */ - char *propValArg = NULL; - - if(!PyArg_ParseTuple(args, "s:setValue", &propValArg)) { - return NULL; - } - STR_String oldval = m_checkpropval; - m_checkpropval = propValArg; - if (validValueForProperty(m_proxy, NULL)) { - m_checkpropval = oldval; - return NULL; - } - Py_RETURN_NONE; -} - /* eof */ diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.h b/source/gameengine/GameLogic/SCA_PropertySensor.h index 3513fcdf5ae..a5bbfc8438b 100644 --- a/source/gameengine/GameLogic/SCA_PropertySensor.h +++ b/source/gameengine/GameLogic/SCA_PropertySensor.h @@ -88,18 +88,6 @@ public: /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ - /* 1. getType */ - KX_PYMETHOD_DOC_NOARGS(SCA_PropertySensor,GetType); - /* 2. setType */ - KX_PYMETHOD_DOC_VARARGS(SCA_PropertySensor,SetType); - /* 3. setProperty */ - KX_PYMETHOD_DOC_VARARGS(SCA_PropertySensor,SetProperty); - /* 4. getProperty */ - KX_PYMETHOD_DOC_NOARGS(SCA_PropertySensor,GetProperty); - /* 5. getValue */ - KX_PYMETHOD_DOC_NOARGS(SCA_PropertySensor,GetValue); - /* 6. setValue */ - KX_PYMETHOD_DOC_VARARGS(SCA_PropertySensor,SetValue); /** * Test whether this is a sensible value (type check) */ diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index 8ece7fb4ae1..ecaa8c508db 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -204,27 +204,7 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value) return false; } -/* warning, self is not the SCA_PythonController, its a PyObjectPlus_Proxy */ -PyObject* SCA_PythonController::sPyAddActiveActuator(PyObject* self, PyObject* args) -{ - ShowDeprecationWarning("GameLogic.addActiveActuator(act, bool)", "controller.activate(act) or controller.deactivate(act)"); - - PyObject* ob1; - int activate; - if (!PyArg_ParseTuple(args, "Oi:addActiveActuator", &ob1,&activate)) - return NULL; - - SCA_IActuator* actu = LinkedActuatorFromPy(ob1); - if(actu==NULL) - return NULL; - - bool boolval = (activate!=0); - m_sCurrentLogicManager->AddActiveActuator((SCA_IActuator*)actu,boolval); - Py_RETURN_NONE; -} - const char* SCA_PythonController::sPyGetCurrentController__doc__ = "getCurrentController()"; -const char* SCA_PythonController::sPyAddActiveActuator__doc__= "addActiveActuator(actuator,bool)"; PyTypeObject SCA_PythonController::Type = { PyVarObject_HEAD_INIT(NULL, 0) @@ -251,11 +231,6 @@ PyTypeObject SCA_PythonController::Type = { PyMethodDef SCA_PythonController::Methods[] = { {"activate", (PyCFunction) SCA_PythonController::sPyActivate, METH_O}, {"deactivate", (PyCFunction) SCA_PythonController::sPyDeActivate, METH_O}, - - //Deprecated functions ------> - {"setScript", (PyCFunction) SCA_PythonController::sPySetScript, METH_O}, - {"getScript", (PyCFunction) SCA_PythonController::sPyGetScript, METH_NOARGS}, - //<----- Deprecated {NULL,NULL} //Sentinel }; @@ -510,33 +485,6 @@ PyObject* SCA_PythonController::PyDeActivate(PyObject *value) Py_RETURN_NONE; } -/* 1. getScript */ -PyObject* SCA_PythonController::PyGetScript() -{ - ShowDeprecationWarning("getScript()", "the script property"); - return PyUnicode_FromString(m_scriptText); -} - -/* 2. setScript */ -PyObject* SCA_PythonController::PySetScript(PyObject* value) -{ - char *scriptArg = _PyUnicode_AsString(value); - - ShowDeprecationWarning("setScript()", "the script property"); - - if (scriptArg==NULL) { - PyErr_SetString(PyExc_TypeError, "expected a string (script name)"); - return NULL; - } - - /* set scripttext sets m_bModified to true, - so next time the script is needed, a reparse into byte code is done */ - - this->SetScriptText(scriptArg); - - Py_RETURN_NONE; -} - PyObject* SCA_PythonController::pyattr_get_script(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { //SCA_PythonController* self= static_cast<SCA_PythonController*>(static_cast<SCA_IController*>(static_cast<SCA_ILogicBrick*>(static_cast<CValue*>(static_cast<PyObjectPlus*>(self_v))))); diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp index 2b10f491378..a3a5cc2303e 100644 --- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp +++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp @@ -337,15 +337,6 @@ PyTypeObject SCA_RandomActuator::Type = { }; PyMethodDef SCA_RandomActuator::Methods[] = { - //Deprecated functions ------> - {"setSeed", (PyCFunction) SCA_RandomActuator::sPySetSeed, METH_VARARGS, (const char *)SetSeed_doc}, - {"getSeed", (PyCFunction) SCA_RandomActuator::sPyGetSeed, METH_NOARGS, (const char *)GetSeed_doc}, - {"getPara1", (PyCFunction) SCA_RandomActuator::sPyGetPara1, METH_NOARGS, (const char *)GetPara1_doc}, - {"getPara2", (PyCFunction) SCA_RandomActuator::sPyGetPara2, METH_NOARGS, (const char *)GetPara2_doc}, - {"getDistribution", (PyCFunction) SCA_RandomActuator::sPyGetDistribution, METH_NOARGS, (const char *)GetDistribution_doc}, - {"setProperty", (PyCFunction) SCA_RandomActuator::sPySetProperty, METH_VARARGS, (const char *)SetProperty_doc}, - {"getProperty", (PyCFunction) SCA_RandomActuator::sPyGetProperty, METH_NOARGS, (const char *)GetProperty_doc}, - //<----- Deprecated KX_PYMETHODTABLE(SCA_RandomActuator, setBoolConst), KX_PYMETHODTABLE_NOARGS(SCA_RandomActuator, setBoolUniform), KX_PYMETHODTABLE(SCA_RandomActuator, setBoolBernouilli), @@ -389,104 +380,6 @@ int SCA_RandomActuator::pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_ } } -/* 1. setSeed */ -const char SCA_RandomActuator::SetSeed_doc[] = -"setSeed(seed)\n" -"\t- seed: integer\n" -"\tSet the initial seed of the generator. Equal seeds produce\n" -"\tequal series. If the seed is 0, the generator will produce\n" -"\tthe same value on every call.\n"; -PyObject* SCA_RandomActuator::PySetSeed(PyObject* args) { - ShowDeprecationWarning("setSeed()", "the seed property"); - long seedArg; - if(!PyArg_ParseTuple(args, "i:setSeed", &seedArg)) { - return NULL; - } - - m_base->SetSeed(seedArg); - - Py_RETURN_NONE; -} -/* 2. getSeed */ -const char SCA_RandomActuator::GetSeed_doc[] = -"getSeed()\n" -"\tReturns the initial seed of the generator. Equal seeds produce\n" -"\tequal series.\n"; -PyObject* SCA_RandomActuator::PyGetSeed() -{ - ShowDeprecationWarning("getSeed()", "the seed property"); - return PyLong_FromSsize_t(m_base->GetSeed()); -} - -/* 4. getPara1 */ -const char SCA_RandomActuator::GetPara1_doc[] = -"getPara1()\n" -"\tReturns the first parameter of the active distribution. Refer\n" -"\tto the documentation of the generator types for the meaning\n" -"\tof this value."; -PyObject* SCA_RandomActuator::PyGetPara1() -{ - ShowDeprecationWarning("getPara1()", "the para1 property"); - return PyFloat_FromDouble(m_parameter1); -} - -/* 6. getPara2 */ -const char SCA_RandomActuator::GetPara2_doc[] = -"getPara2()\n" -"\tReturns the first parameter of the active distribution. Refer\n" -"\tto the documentation of the generator types for the meaning\n" -"\tof this value."; -PyObject* SCA_RandomActuator::PyGetPara2() -{ - ShowDeprecationWarning("getPara2()", "the para2 property"); - return PyFloat_FromDouble(m_parameter2); -} - -/* 8. getDistribution */ -const char SCA_RandomActuator::GetDistribution_doc[] = -"getDistribution()\n" -"\tReturns the type of the active distribution.\n"; -PyObject* SCA_RandomActuator::PyGetDistribution() -{ - ShowDeprecationWarning("getDistribution()", "the distribution property"); - return PyLong_FromSsize_t(m_distribution); -} - -/* 9. setProperty */ -const char SCA_RandomActuator::SetProperty_doc[] = -"setProperty(name)\n" -"\t- name: string\n" -"\tSet the property to which the random value is assigned. If the \n" -"\tgenerator and property types do not match, the assignment is ignored.\n"; -PyObject* SCA_RandomActuator::PySetProperty(PyObject* args) { - ShowDeprecationWarning("setProperty()", "the 'propName' property"); - char *nameArg; - if (!PyArg_ParseTuple(args, "s:setProperty", &nameArg)) { - return NULL; - } - - CValue* prop = GetParent()->FindIdentifier(nameArg); - - if (!prop->IsError()) { - m_propname = nameArg; - } else { - ; /* not found ... */ - } - prop->Release(); - - Py_RETURN_NONE; -} -/* 10. getProperty */ -const char SCA_RandomActuator::GetProperty_doc[] = -"getProperty(name)\n" -"\tReturn the property to which the random value is assigned. If the \n" -"\tgenerator and property types do not match, the assignment is ignored.\n"; -PyObject* SCA_RandomActuator::PyGetProperty() -{ - ShowDeprecationWarning("getProperty()", "the 'propName' property"); - return PyUnicode_FromString(m_propname); -} - /* 11. setBoolConst */ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setBoolConst, "setBoolConst(value)\n" diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.h b/source/gameengine/GameLogic/SCA_RandomActuator.h index c7d3fe21217..f84c44b43c9 100644 --- a/source/gameengine/GameLogic/SCA_RandomActuator.h +++ b/source/gameengine/GameLogic/SCA_RandomActuator.h @@ -99,16 +99,6 @@ class SCA_RandomActuator : public SCA_IActuator static PyObject* pyattr_get_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - // Deprecated methods -----> - KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator,SetSeed); - KX_PYMETHOD_DOC_NOARGS(SCA_RandomActuator,GetSeed); - KX_PYMETHOD_DOC_NOARGS(SCA_RandomActuator,GetPara1); - KX_PYMETHOD_DOC_NOARGS(SCA_RandomActuator,GetPara2); - KX_PYMETHOD_DOC_NOARGS(SCA_RandomActuator,GetDistribution); - KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator,SetProperty); - KX_PYMETHOD_DOC_NOARGS(SCA_RandomActuator,GetProperty); - // <----- - KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setBoolConst); KX_PYMETHOD_DOC_NOARGS(SCA_RandomActuator, setBoolUniform); KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setBoolBernouilli); diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.cpp b/source/gameengine/GameLogic/SCA_RandomSensor.cpp index a09d8328906..890875e61c6 100644 --- a/source/gameengine/GameLogic/SCA_RandomSensor.cpp +++ b/source/gameengine/GameLogic/SCA_RandomSensor.cpp @@ -152,11 +152,6 @@ PyTypeObject SCA_RandomSensor::Type = { }; PyMethodDef SCA_RandomSensor::Methods[] = { - //Deprecated functions -----> - {"setSeed", (PyCFunction) SCA_RandomSensor::sPySetSeed, METH_VARARGS, (const char *)SetSeed_doc}, - {"getSeed", (PyCFunction) SCA_RandomSensor::sPyGetSeed, METH_NOARGS, (const char *)GetSeed_doc}, - {"getLastDraw", (PyCFunction) SCA_RandomSensor::sPyGetLastDraw, METH_NOARGS, (const char *)GetLastDraw_doc}, - //<----- Deprecated {NULL,NULL} //Sentinel }; @@ -166,45 +161,6 @@ PyAttributeDef SCA_RandomSensor::Attributes[] = { {NULL} //Sentinel }; -/* 1. setSeed */ -const char SCA_RandomSensor::SetSeed_doc[] = -"setSeed(seed)\n" -"\t- seed: integer\n" -"\tSet the initial seed of the generator. Equal seeds produce\n" -"\tequal series. If the seed is 0, the generator will produce\n" -"\tthe same value on every call.\n"; -PyObject* SCA_RandomSensor::PySetSeed(PyObject* args) { - ShowDeprecationWarning("setSeed()", "the seed property"); - long seedArg; - if(!PyArg_ParseTuple(args, "i:setSeed", &seedArg)) { - return NULL; - } - - m_basegenerator->SetSeed(seedArg); - - Py_RETURN_NONE; -} - -/* 2. getSeed */ -const char SCA_RandomSensor::GetSeed_doc[] = -"getSeed()\n" -"\tReturns the initial seed of the generator. Equal seeds produce\n" -"\tequal series.\n"; -PyObject* SCA_RandomSensor::PyGetSeed() { - ShowDeprecationWarning("getSeed()", "the seed property"); - return PyLong_FromSsize_t(m_basegenerator->GetSeed()); -} - -/* 3. getLastDraw */ -const char SCA_RandomSensor::GetLastDraw_doc[] = -"getLastDraw()\n" -"\tReturn the last value that was drawn.\n"; -PyObject* SCA_RandomSensor::PyGetLastDraw() { - ShowDeprecationWarning("getLastDraw()", "the lastDraw property"); - return PyLong_FromSsize_t(m_lastdraw); -} - - PyObject* SCA_RandomSensor::pyattr_get_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { SCA_RandomSensor* self= static_cast<SCA_RandomSensor*>(self_v); diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.h b/source/gameengine/GameLogic/SCA_RandomSensor.h index 5e66c36cccf..f93cf57370e 100644 --- a/source/gameengine/GameLogic/SCA_RandomSensor.h +++ b/source/gameengine/GameLogic/SCA_RandomSensor.h @@ -59,13 +59,6 @@ public: /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ - - /* 1. setSeed */ - KX_PYMETHOD_DOC_VARARGS(SCA_RandomSensor,SetSeed); - /* 2. getSeed */ - KX_PYMETHOD_DOC_NOARGS(SCA_RandomSensor,GetSeed); - /* 3. getLastDraw */ - KX_PYMETHOD_DOC_NOARGS(SCA_RandomSensor,GetLastDraw); static PyObject* pyattr_get_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); |