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
path: root/source
diff options
context:
space:
mode:
authorErwin Coumans <blender@erwincoumans.com>2009-05-24 10:31:47 +0400
committerErwin Coumans <blender@erwincoumans.com>2009-05-24 10:31:47 +0400
commit83bb096f24cb2252f90a77923bd1818930a2fed2 (patch)
treefd8c0854fac0f9d5bc830ab64fbfc0a1c4c181e6 /source
parent45f2463c833577852b2c9d3c85e435fc25b945bd (diff)
+ renamed pad3 to m_contactProcessingThreshold (thanks Campbell Barton/ideasman for confirming it is ok to rename it)
+ fixed Python method, PyArg_ParseTuple already checks for errors, no returning of NULL, thanks Campbell too) + added linear/angular spring for each of the 6DOFs of a generic 6dof constraint. This makes the generic 6dof constraint very versatile.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/object.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c2
-rw-r--r--source/blender/makesdna/DNA_object_types.h2
-rw-r--r--source/blender/src/buttons_logic.c4
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_ConstraintWrapper.cpp17
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp28
7 files changed, 37 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 9739668c7c7..ec068c35c11 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -985,7 +985,7 @@ Object *add_only_object(int type, char *name)
ob->gameflag= OB_PROP|OB_COLLISION;
ob->margin = 0.0;
/* ob->pad3 == Contact Processing Threshold */
- ob->pad3 = 1.;
+ ob->m_contactProcessingThreshold = 1.;
/* NT fluid sim defaults */
ob->fluidsimFlag = 0;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 0b0a97b7ec0..d8566e06ed7 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -8110,7 +8110,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Object *ob;
World *wrld;
for(ob = main->object.first; ob; ob= ob->id.next) {
- ob->pad3 = 1.; //pad3 is used for m_contactProcessingThreshold
+ ob->m_contactProcessingThreshold = 1.; //pad3 is used for m_contactProcessingThreshold
if(ob->parent) {
/* check if top parent has compound shape set and if yes, set this object
to compound shaper as well (was the behaviour before, now it's optional) */
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 11fa44fe488..741822b5a98 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -159,7 +159,7 @@ typedef struct Object {
float margin;
float max_vel; /* clamp the maximum velocity 0.0 is disabled */
float min_vel; /* clamp the maximum velocity 0.0 is disabled */
- float pad3; /* pad3 is now used for m_contactProcessingThreshold, can we still rename it? */
+ float m_contactProcessingThreshold;
char dt, dtx;
char totcol; /* copy of mesh or curve or meta */
diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c
index b0ce3c8a95b..c283cd18ca2 100644
--- a/source/blender/src/buttons_logic.c
+++ b/source/blender/src/buttons_logic.c
@@ -3204,7 +3204,7 @@ static uiBlock *advanced_bullet_menu(void *arg_ob)
if (ob->gameflag & OB_RIGID_BODY)
{
uiDefButF(block, NUM, 0, "CPT",
- xco+180, yco, 180, 19, &ob->pad3, 0.00, 1., 1, 0,
+ xco+180, yco, 180, 19, &ob->m_contactProcessingThreshold, 0.00, 1., 1, 0,
"Contact Processing Threshold");
yco -= 20;
@@ -3287,7 +3287,7 @@ static uiBlock *advanced_bullet_menu(void *arg_ob)
xco, yco, 180, 19, &ob->margin, 0.0, 1.0, 1, 0,
"Collision margin");
uiDefButF(block, NUM, 0, "CPT",
- xco+180, yco, 180, 19, &ob->pad3, 0.00, 1., 1, 0,
+ xco+180, yco, 180, 19, &ob->m_contactProcessingThreshold, 0.00, 1., 1, 0,
"Contact Processing Threshold");
}
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index a9c839595c2..d9e93d41f34 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -1422,7 +1422,7 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
///contact processing threshold is only for rigid bodies and static geometry, not 'dynamic'
if (objprop.m_angular_rigidbody || !objprop.m_dyna )
{
- objprop.m_contactProcessingThreshold = blenderobject->pad3;
+ objprop.m_contactProcessingThreshold = blenderobject->m_contactProcessingThreshold;
} else
{
objprop.m_contactProcessingThreshold = 0.f;
diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
index b0576424a47..b40100db2f7 100644
--- a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
@@ -59,22 +59,17 @@ PyObject* KX_ConstraintWrapper::PySetParam(PyObject* args, PyObject* kwds)
int len = PyTuple_Size(args);
int success = 1;
- if (len == 3)
+ int dof;
+ float minLimit,maxLimit;
+ success = PyArg_ParseTuple(args,"iff:setParam",&dof,&minLimit,&maxLimit);
+ if (success)
{
- int dof;
- float minLimit,maxLimit;
- success = PyArg_ParseTuple(args,"iff",&dof,&minLimit,&maxLimit);
- if (success)
- {
- m_physenv->setConstraintParam(m_constraintId,dof,minLimit,maxLimit);
- Py_RETURN_NONE;
- }
+ m_physenv->setConstraintParam(m_constraintId,dof,minLimit,maxLimit);
}
- return NULL;
+ Py_RETURN_NONE;
}
-
//python specific stuff
PyTypeObject KX_ConstraintWrapper::Type = {
#if (PY_VERSION_HEX >= 0x02060000)
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 561c370854f..58720c8cc30 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -922,7 +922,7 @@ int CcdPhysicsEnvironment::createUniversalD6Constraint(
bool useReferenceFrameA = true;
- genericConstraint = new btGeneric6DofConstraint(
+ genericConstraint = new btGeneric6DofSpringConstraint(
*rb0,*rb1,
frameInA,frameInB,useReferenceFrameA);
genericConstraint->setLinearLowerLimit(linearMinLimits);
@@ -1831,6 +1831,28 @@ void CcdPhysicsEnvironment::setConstraintParam(int constraintId,int param,float
break;
}
+ case 12: case 13: case 14: case 15: case 16: case 17:
+ {
+ //param 13-17 are for motorized springs on each of the degrees of freedom
+ btGeneric6DofSpringConstraint* genCons = (btGeneric6DofSpringConstraint*)typedConstraint;
+ int springIndex = param-12;
+ if (value0!=0.f)
+ {
+ bool springEnabled = true;
+ genCons->setStiffness(springIndex,value0);
+ genCons->enableSpring(springIndex,springEnabled);
+ if (value1>0.5f)
+ {
+ genCons->setEquilibriumPoint(springIndex);
+ }
+ } else
+ {
+ bool springEnabled = false;
+ genCons->enableSpring(springIndex,springEnabled);
+ }
+ break;
+ }
+
default:
{
}
@@ -2351,7 +2373,7 @@ int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl
frameInB = inv * globalFrameA;
bool useReferenceFrameA = true;
- genericConstraint = new btGeneric6DofConstraint(
+ genericConstraint = new btGeneric6DofSpringConstraint(
*rb0,*rb1,
frameInA,frameInB,useReferenceFrameA);
@@ -2375,7 +2397,7 @@ int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl
frameInB = rb0->getCenterOfMassTransform() * frameInA;
bool useReferenceFrameA = true;
- genericConstraint = new btGeneric6DofConstraint(
+ genericConstraint = new btGeneric6DofSpringConstraint(
*rb0,s_fixedObject2,
frameInA,frameInB,useReferenceFrameA);
}