diff options
author | Diego Borghetti <bdiego@gmail.com> | 2008-07-02 04:23:02 +0400 |
---|---|---|
committer | Diego Borghetti <bdiego@gmail.com> | 2008-07-02 04:23:02 +0400 |
commit | 903a721c229bf3676805409a0f573480fbb15ac6 (patch) | |
tree | 3012080d2326fd068cd9c63dd0979a1ac92ac6de /source | |
parent | 382872a9dd6cf4553d6a1d9e28d2272128ec6deb (diff) |
branches/blender-2.47
Merge from trunk:
Revision: 15383
Revision: 15390
Revision: 15391
Revision: 15392
Revision: 15398
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/api2_2x/Lamp.c | 13 | ||||
-rw-r--r-- | source/blender/src/view.c | 36 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp | 14 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp | 3 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Camera.cpp | 8 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 9 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_MeshProxy.cpp | 12 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp | 12 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_PyConstraintBinding.cpp | 63 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_PythonInit.cpp | 20 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_VehicleWrapper.cpp | 33 |
11 files changed, 181 insertions, 42 deletions
diff --git a/source/blender/python/api2_2x/Lamp.c b/source/blender/python/api2_2x/Lamp.c index ef3174ac4ed..53d25a6429d 100644 --- a/source/blender/python/api2_2x/Lamp.c +++ b/source/blender/python/api2_2x/Lamp.c @@ -1520,12 +1520,11 @@ static PyObject *Lamp_oldsetType( BPy_Lamp * self, PyObject * value ) char *type = PyString_AsString(value); PyObject *arg, *error; - /* parse string argument */ - - if( !value ) - return ( EXPP_ReturnPyObjError( PyExc_TypeError, - "expected string argument" ) ); - + /* parse string argument */ + if( !type ) + return EXPP_ReturnPyObjError ( PyExc_TypeError, + "expected string argument" ); + /* check for valid arguments, set type accordingly */ if( !strcmp( type, "Lamp" ) ) @@ -1546,7 +1545,7 @@ static PyObject *Lamp_oldsetType( BPy_Lamp * self, PyObject * value ) /* build tuple, call wrapper */ - arg = Py_BuildValue( "(i)", type ); + arg = Py_BuildValue( "(i)", self->lamp->type ); error = EXPP_setterWrapper ( (void *)self, arg, (setter)Lamp_setType ); Py_DECREF ( arg ); return error; diff --git a/source/blender/src/view.c b/source/blender/src/view.c index 754400b9728..6cb8a4adf41 100644 --- a/source/blender/src/view.c +++ b/source/blender/src/view.c @@ -647,10 +647,6 @@ void viewmoveNDOFfly(int mode) if (G.vd->ndoffilter) filterNDOFvalues(fval); -// for(i=0;i<7;i++) printf("%f ",dval[i]); -// printf("\n"); - - // Scale input values // if(dval[6] == 0) return; // guard against divide by zero @@ -659,12 +655,6 @@ void viewmoveNDOFfly(int mode) // user scaling dval[i] = dval[i] * ndof_axis_scale[i]; - - // non-linear scaling - if(dval[i]<0.0f) - dval[i] = -1.0f * dval[i] * dval[i]; - else - dval[i] = dval[i] * dval[i]; } @@ -1174,18 +1164,16 @@ void viewmoveNDOF(int mode) // prevTime = now; // sbadjust *= 60 * frametime; /* normalize ndof device adjustments to 100Hz for framerate independence */ - /* fetch the current state of the ndof device */ + /* fetch the current state of the ndof device & enforce dominant mode if selected */ getndof(fval); - // printf(" motion command %f %f %f %f %f %f %f \n", fval[0], fval[1], fval[2], - // fval[3], fval[4], fval[5], fval[6]); - if (G.vd->ndoffilter) - filterNDOFvalues(fval); + if (G.vd->ndoffilter) + filterNDOFvalues(fval); // put scaling back here, was previously in ghostwinlay - fval[0] = fval[0] * (1.0f/1200.0f); - fval[1] = fval[1] * (1.0f/1200.0f); - fval[2] = fval[2] * (1.0f/1200.0f); + fval[0] = fval[0] * (1.0f/600.0f); + fval[1] = fval[1] * (1.0f/600.0f); + fval[2] = fval[2] * (1.0f/1100.0f); fval[3] = fval[3] * 0.00005f; fval[4] =-fval[4] * 0.00005f; fval[5] = fval[5] * 0.00005f; @@ -1213,14 +1201,16 @@ void viewmoveNDOF(int mode) VECCOPY(obofs, G.vd->ofs); } - /* calc an adjustment based on distance from camera */ - if (ob) { + /* calc an adjustment based on distance from camera + disabled per patch 14402 */ + d = 1.0f; + +/* if (ob) { VecSubf(diff, obofs, G.vd->ofs); d = VecLength(diff); } - else { - d = 1.0f; - } +*/ + reverse = (G.vd->persmat[2][1] < 0.0f) ? -1.0f : 1.0f; /*---------------------------------------------------- diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp index 3ade810c394..85921ae75ca 100644 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp +++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp @@ -158,6 +158,9 @@ PyObject* KX_NetworkMessageActuator::PySetToPropName( if (PyArg_ParseTuple(args, "s", &ToPropName)) { m_toPropName = ToPropName; } + else { + return NULL; + } Py_Return; } @@ -173,7 +176,10 @@ PyObject* KX_NetworkMessageActuator::PySetSubject( if (PyArg_ParseTuple(args, "s", &Subject)) { m_subject = Subject; } - + else { + return NULL; + } + Py_Return; } @@ -188,6 +194,9 @@ PyObject* KX_NetworkMessageActuator::PySetBodyType( if (PyArg_ParseTuple(args, "i", &BodyType)) { m_bodyType = BodyType; } + else { + return NULL; + } Py_Return; } @@ -203,6 +212,9 @@ PyObject* KX_NetworkMessageActuator::PySetBody( if (PyArg_ParseTuple(args, "s", &Body)) { m_body = Body; } + else { + return NULL; + } Py_Return; } diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp index e320453b7aa..944a9bc5e90 100644 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp +++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp @@ -228,6 +228,9 @@ PyObject* KX_NetworkMessageSensor::PySetSubjectFilterText( { m_subject = Subject; } + else { + return NULL; + } Py_Return; } diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp index 27e47d72bbe..3830d422138 100644 --- a/source/gameengine/Ketsji/KX_Camera.cpp +++ b/source/gameengine/Ketsji/KX_Camera.cpp @@ -588,7 +588,7 @@ KX_PYMETHODDEF_DOC(KX_Camera, sphereInsideFrustum, PyErr_SetString(PyExc_TypeError, "sphereInsideFrustum: Expected arguments: (center, radius)"); - Py_Return; + return NULL; } KX_PYMETHODDEF_DOC(KX_Camera, boxInsideFrustum, @@ -766,6 +766,10 @@ KX_PYMETHODDEF_DOC(KX_Camera, enableViewport, else EnableViewport(false); } + else { + return NULL; + } + Py_Return; } @@ -777,6 +781,8 @@ KX_PYMETHODDEF_DOC(KX_Camera, setViewport, if (PyArg_ParseTuple(args,"iiii",&left, &bottom, &right, &top)) { SetViewport(left, bottom, right, top); + } else { + return NULL; } Py_Return; } diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index fb636b23082..0ad08a4e8a6 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -1008,6 +1008,9 @@ PyObject* KX_GameObject::PyGetVelocity(PyObject* self, if (pypos) PyVecTo(pypos, point); } + else { + return NULL; + } if (m_pPhysicsController1) { @@ -1096,6 +1099,10 @@ PyObject* KX_GameObject::PySetParent(PyObject* self, this->SetParent(scene, obj); } + else { + return NULL; + } + Py_Return; } @@ -1122,7 +1129,7 @@ PyObject* KX_GameObject::PyGetMesh(PyObject* self, return meshproxy; } } - Py_Return; + return NULL; } diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp index 5c8fef1fca0..c7a251751cd 100644 --- a/source/gameengine/Ketsji/KX_MeshProxy.cpp +++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp @@ -157,6 +157,9 @@ PyObject* KX_MeshProxy::PyGetMaterialName(PyObject* self, { matname = m_meshobj->GetMaterialName(matid); } + else { + return NULL; + } return PyString_FromString(matname.Ptr()); @@ -174,6 +177,9 @@ PyObject* KX_MeshProxy::PyGetTextureName(PyObject* self, { matname = m_meshobj->GetTextureName(matid); } + else { + return NULL; + } return PyString_FromString(matname.Ptr()); @@ -195,6 +201,9 @@ PyObject* KX_MeshProxy::PyGetVertexArrayLength(PyObject* self, length = m_meshobj->GetVertexArrayLength(mat); } } + else { + return NULL; + } return PyInt_FromLong(length); @@ -217,6 +226,9 @@ PyObject* KX_MeshProxy::PyGetVertex(PyObject* self, vertexob = new KX_VertexProxy(this, vertex); } } + else { + return NULL; + } return vertexob; diff --git a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp index 27cfaefc076..2df4c6a9980 100644 --- a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp +++ b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp @@ -58,6 +58,9 @@ PyObject* KX_PhysicsObjectWrapper::PySetPosition(PyObject* self, { m_ctrl->setPosition(x,y,z); } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -72,6 +75,9 @@ PyObject* KX_PhysicsObjectWrapper::PySetLinearVelocity(PyObject* self, { m_ctrl->SetLinearVelocity(x,y,z,local != 0); } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -85,6 +91,9 @@ PyObject* KX_PhysicsObjectWrapper::PySetAngularVelocity(PyObject* self, { m_ctrl->SetAngularVelocity(x,y,z,local != 0); } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -97,6 +106,9 @@ PyObject* KX_PhysicsObjectWrapper::PySetActive(PyObject* self, { m_ctrl->SetActive(active!=0); } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp index 172882ff18d..c01d6a632a3 100644 --- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp +++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp @@ -82,12 +82,15 @@ static PyObject* gPySetGravity(PyObject* self, PyObject* kwds) { float x,y,z; - int len = PyTuple_Size(args); - if ((len == 3) && PyArg_ParseTuple(args,"fff",&x,&y,&z)) + if (PyArg_ParseTuple(args,"fff",&x,&y,&z)) { if (PHY_GetActiveEnvironment()) PHY_GetActiveEnvironment()->setGravity(x,y,z); } + else { + return NULL; + } + Py_INCREF(Py_None); return Py_None; } @@ -105,6 +108,10 @@ static PyObject* gPySetDebugMode(PyObject* self, } } + else { + return NULL; + } + Py_INCREF(Py_None); return Py_None; } @@ -122,6 +129,9 @@ static PyObject* gPySetNumTimeSubSteps(PyObject* self, PHY_GetActiveEnvironment()->setNumTimeSubSteps(substep); } } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -138,6 +148,9 @@ static PyObject* gPySetNumIterations(PyObject* self, PHY_GetActiveEnvironment()->setNumIterations(iter); } } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -155,6 +168,9 @@ static PyObject* gPySetDeactivationTime(PyObject* self, PHY_GetActiveEnvironment()->setDeactivationTime(deactive_time); } } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -171,6 +187,9 @@ static PyObject* gPySetDeactivationLinearTreshold(PyObject* self, PHY_GetActiveEnvironment()->setDeactivationLinearTreshold( linearDeactivationTreshold); } } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -187,6 +206,9 @@ static PyObject* gPySetDeactivationAngularTreshold(PyObject* self, PHY_GetActiveEnvironment()->setDeactivationAngularTreshold( angularDeactivationTreshold); } } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -202,6 +224,9 @@ static PyObject* gPySetContactBreakingTreshold(PyObject* self, PHY_GetActiveEnvironment()->setContactBreakingTreshold( contactBreakingTreshold); } } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -218,6 +243,9 @@ static PyObject* gPySetCcdMode(PyObject* self, PHY_GetActiveEnvironment()->setCcdMode( ccdMode); } } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -233,6 +261,9 @@ static PyObject* gPySetSorConstant(PyObject* self, PHY_GetActiveEnvironment()->setSolverSorConstant( sor); } } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -248,6 +279,9 @@ static PyObject* gPySetSolverTau(PyObject* self, PHY_GetActiveEnvironment()->setSolverTau( tau); } } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -264,6 +298,9 @@ static PyObject* gPySetSolverDamping(PyObject* self, PHY_GetActiveEnvironment()->setSolverDamping( damping); } } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -279,6 +316,9 @@ static PyObject* gPySetLinearAirDamping(PyObject* self, PHY_GetActiveEnvironment()->setLinearAirDamping( damping); } } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -295,6 +335,9 @@ static PyObject* gPySetUseEpa(PyObject* self, PHY_GetActiveEnvironment()->setUseEpa(epa); } } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } static PyObject* gPySetSolverType(PyObject* self, @@ -309,6 +352,9 @@ static PyObject* gPySetSolverType(PyObject* self, PHY_GetActiveEnvironment()->setSolverType(solverType); } } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -338,6 +384,9 @@ static PyObject* gPyGetVehicleConstraint(PyObject* self, } } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -395,6 +444,9 @@ static PyObject* gPyCreateConstraint(PyObject* self, } } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -421,6 +473,9 @@ static PyObject* gPyGetAppliedImpulse(PyObject* self, appliedImpulse = PHY_GetActiveEnvironment()->getAppliedImpulse(constraintid); } } + else { + return NULL; + } return PyFloat_FromDouble(appliedImpulse); } @@ -443,6 +498,10 @@ static PyObject* gPyRemoveConstraint(PyObject* self, PHY_GetActiveEnvironment()->removeConstraint(constraintid); } } + else { + return NULL; + } + Py_INCREF(Py_None); return Py_None; } diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index a80a7f04e8f..8ad4e0fc743 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -453,7 +453,7 @@ static PyObject* gPyEnableVisibility(PyObject*, } else { - Py_Return; + return NULL; } Py_Return; } @@ -477,6 +477,9 @@ static PyObject* gPyShowMouse(PyObject*, gp_Canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE); } } + else { + return NULL; + } Py_Return; } @@ -493,6 +496,9 @@ static PyObject* gPySetMousePosition(PyObject*, if (gp_Canvas) gp_Canvas->SetMousePosition(x,y); } + else { + return NULL; + } Py_Return; } @@ -596,6 +602,9 @@ static PyObject* gPySetMistStart(PyObject*, gp_Rasterizer->SetFogStart(miststart); } } + else { + return NULL; + } Py_Return; } @@ -614,6 +623,9 @@ static PyObject* gPySetMistEnd(PyObject*, gp_Rasterizer->SetFogEnd(mistend); } } + else { + return NULL; + } Py_Return; } @@ -651,6 +663,9 @@ static PyObject* gPyMakeScreenshot(PyObject*, gp_Canvas->MakeScreenShot(filename); } } + else { + return NULL; + } Py_Return; } @@ -666,6 +681,9 @@ static PyObject* gPyEnableMotionBlur(PyObject*, gp_Rasterizer->EnableMotionBlur(motionblurvalue); } } + else { + return NULL; + } Py_Return; } diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp index fba2ecc223b..7e8160a4d67 100644 --- a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp +++ b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp @@ -68,6 +68,8 @@ PyObject* KX_VehicleWrapper::PyAddWheel(PyObject* self, printf("attempt for addWheel: suspensionRestLength%f wheelRadius %f, hasSteering:%d\n",suspensionRestLength,wheelRadius,hasSteering); m_vehicle->AddWheel(motionState,aPos,aDir,aAxle,suspensionRestLength,wheelRadius,hasSteering); + } else { + return NULL; } Py_INCREF(Py_None); return Py_None; @@ -90,8 +92,7 @@ PyObject* KX_VehicleWrapper::PyGetWheelPosition(PyObject* self, MT_Vector3 pos(position[0],position[1],position[2]); return PyObjectFrom(pos); } - Py_INCREF(Py_None); - return Py_None; + return NULL; } PyObject* KX_VehicleWrapper::PyGetWheelRotation(PyObject* self, @@ -103,8 +104,7 @@ PyObject* KX_VehicleWrapper::PyGetWheelRotation(PyObject* self, { return PyFloat_FromDouble(m_vehicle->GetWheelRotation(wheelIndex)); } - Py_INCREF(Py_None); - return Py_None; + return NULL; } PyObject* KX_VehicleWrapper::PyGetWheelOrientationQuaternion(PyObject* self, @@ -120,8 +120,7 @@ PyObject* KX_VehicleWrapper::PyGetWheelOrientationQuaternion(PyObject* self, MT_Matrix3x3 ornmat(quatorn); return PyObjectFrom(ornmat); } - Py_INCREF(Py_None); - return Py_None; + return NULL; } @@ -155,6 +154,9 @@ PyObject* KX_VehicleWrapper::PyApplyEngineForce(PyObject* self, force *= -1.f;//someone reverse some conventions inside Bullet (axle winding) m_vehicle->ApplyEngineForce(force,wheelIndex); } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -170,6 +172,9 @@ PyObject* KX_VehicleWrapper::PySetTyreFriction(PyObject* self, { m_vehicle->SetWheelFriction(wheelFriction,wheelIndex); } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -185,6 +190,9 @@ PyObject* KX_VehicleWrapper::PySetSuspensionStiffness(PyObject* self, { m_vehicle->SetSuspensionStiffness(suspensionStiffness,wheelIndex); } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -199,6 +207,8 @@ PyObject* KX_VehicleWrapper::PySetSuspensionDamping(PyObject* self, if (PyArg_ParseTuple(args,"fi",&suspensionDamping,&wheelIndex)) { m_vehicle->SetSuspensionDamping(suspensionDamping,wheelIndex); + } else { + return NULL; } Py_INCREF(Py_None); return Py_None; @@ -214,6 +224,8 @@ PyObject* KX_VehicleWrapper::PySetSuspensionCompression(PyObject* self, if (PyArg_ParseTuple(args,"fi",&suspensionCompression,&wheelIndex)) { m_vehicle->SetSuspensionCompression(suspensionCompression,wheelIndex); + } else { + return NULL; } Py_INCREF(Py_None); return Py_None; @@ -230,6 +242,9 @@ PyObject* KX_VehicleWrapper::PySetRollInfluence(PyObject* self, { m_vehicle->SetRollInfluence(rollInfluence,wheelIndex); } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -246,6 +261,9 @@ PyObject* KX_VehicleWrapper::PyApplyBraking(PyObject* self, { m_vehicle->ApplyBraking(braking,wheelIndex); } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } @@ -264,6 +282,9 @@ PyObject* KX_VehicleWrapper::PySetSteeringValue(PyObject* self, { m_vehicle->SetSteeringValue(steeringValue,wheelIndex); } + else { + return NULL; + } Py_INCREF(Py_None); return Py_None; } |