Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2012-03-03 06:47:01 +0400
committerDalai Felinto <dfelinto@gmail.com>2012-03-03 06:47:01 +0400
commit1f928833f3677fa47a10099205c9f7ffa9adfadb (patch)
tree85b6fb8af88d7d459830e7b3fb51f6b84e74cf50 /source/gameengine
parent95bba22af075148f9cbdb5a9b1ef41aeff1f560f (diff)
option for the Armature Actuator to change the influence of a bone constraint.
Also adds DampedTrackTo to the list of supported constraints in the BGE Test file: http://www.pasteall.org/blend/11715 Patch developed as part of a project to NF-UBC Nereus Program. Development time 'sponsored' by the project. www.nereusprogram.org
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Converter/BL_ArmatureActuator.cpp9
-rw-r--r--source/gameengine/Converter/BL_ArmatureActuator.h4
-rw-r--r--source/gameengine/Converter/BL_ArmatureConstraint.h5
-rw-r--r--source/gameengine/Converter/BL_ArmatureObject.cpp1
-rw-r--r--source/gameengine/Converter/KX_ConvertActuators.cpp2
5 files changed, 18 insertions, 3 deletions
diff --git a/source/gameengine/Converter/BL_ArmatureActuator.cpp b/source/gameengine/Converter/BL_ArmatureActuator.cpp
index 73403baa15e..3f4a261a972 100644
--- a/source/gameengine/Converter/BL_ArmatureActuator.cpp
+++ b/source/gameengine/Converter/BL_ArmatureActuator.cpp
@@ -53,7 +53,8 @@ BL_ArmatureActuator::BL_ArmatureActuator(SCA_IObject* obj,
const char *constraintname,
KX_GameObject* targetobj,
KX_GameObject* subtargetobj,
- float weight) :
+ float weight,
+ float influence) :
SCA_IActuator(obj, KX_ACT_ARMATURE),
m_constraint(NULL),
m_gametarget(targetobj),
@@ -61,6 +62,7 @@ BL_ArmatureActuator::BL_ArmatureActuator(SCA_IObject* obj,
m_posechannel(posechannel),
m_constraintname(constraintname),
m_weight(weight),
+ m_influence(influence),
m_type(type)
{
if (m_gametarget)
@@ -173,6 +175,10 @@ bool BL_ArmatureActuator::Update(double curtime, bool frame)
if (m_constraint)
m_constraint->SetWeight(m_weight);
break;
+ case ACT_ARM_SETINFLUENCE:
+ if (m_constraint)
+ m_constraint->SetInfluence(m_influence);
+ break;
}
}
return result;
@@ -216,6 +222,7 @@ PyAttributeDef BL_ArmatureActuator::Attributes[] = {
KX_PYATTRIBUTE_RW_FUNCTION("target", BL_ArmatureActuator, pyattr_get_object, pyattr_set_object),
KX_PYATTRIBUTE_RW_FUNCTION("subtarget", BL_ArmatureActuator, pyattr_get_object, pyattr_set_object),
KX_PYATTRIBUTE_FLOAT_RW("weight",0.0f,1.0f,BL_ArmatureActuator,m_weight),
+ KX_PYATTRIBUTE_FLOAT_RW("influence",0.0f,1.0f,BL_ArmatureActuator,m_influence),
KX_PYATTRIBUTE_INT_RW("type",0,ACT_ARM_MAXTYPE,false,BL_ArmatureActuator,m_type),
{ NULL } //Sentinel
};
diff --git a/source/gameengine/Converter/BL_ArmatureActuator.h b/source/gameengine/Converter/BL_ArmatureActuator.h
index 761d429f784..638640c27ce 100644
--- a/source/gameengine/Converter/BL_ArmatureActuator.h
+++ b/source/gameengine/Converter/BL_ArmatureActuator.h
@@ -54,7 +54,8 @@ public:
const char *constraintname,
KX_GameObject* targetobj,
KX_GameObject* subtargetobj,
- float weight);
+ float weight,
+ float influence);
virtual ~BL_ArmatureActuator();
@@ -88,6 +89,7 @@ private:
STR_String m_posechannel;
STR_String m_constraintname;
float m_weight;
+ float m_influence;
int m_type;
};
diff --git a/source/gameengine/Converter/BL_ArmatureConstraint.h b/source/gameengine/Converter/BL_ArmatureConstraint.h
index 89bad520563..0d79bb1cfa7 100644
--- a/source/gameengine/Converter/BL_ArmatureConstraint.h
+++ b/source/gameengine/Converter/BL_ArmatureConstraint.h
@@ -104,6 +104,11 @@ public:
con->weight = weight;
}
}
+ void SetInfluence(float influence)
+ {
+ if (m_constraint)
+ m_constraint->enforce = influence;
+ }
void SetTarget(KX_GameObject* target);
void SetSubtarget(KX_GameObject* subtarget);
diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp
index 5a44e1022ff..79efc8f7586 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.cpp
+++ b/source/gameengine/Converter/BL_ArmatureObject.cpp
@@ -287,6 +287,7 @@ void BL_ArmatureObject::LoadConstraints(KX_BlenderSceneConverter* converter)
// which constraint should we support?
switch (pcon->type) {
case CONSTRAINT_TYPE_TRACKTO:
+ case CONSTRAINT_TYPE_DAMPTRACK:
case CONSTRAINT_TYPE_KINEMATIC:
case CONSTRAINT_TYPE_ROTLIKE:
case CONSTRAINT_TYPE_LOCLIKE:
diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp
index e577a5e5f99..135a3b20d96 100644
--- a/source/gameengine/Converter/KX_ConvertActuators.cpp
+++ b/source/gameengine/Converter/KX_ConvertActuators.cpp
@@ -1060,7 +1060,7 @@ void BL_ConvertActuators(const char* maggiename,
bArmatureActuator* armAct = (bArmatureActuator*) bact->data;
KX_GameObject *tmpgob = converter->FindGameObject(armAct->target);
KX_GameObject *subgob = converter->FindGameObject(armAct->subtarget);
- BL_ArmatureActuator* tmparmact = new BL_ArmatureActuator(gameobj, armAct->type, armAct->posechannel, armAct->constraint, tmpgob, subgob, armAct->weight);
+ BL_ArmatureActuator* tmparmact = new BL_ArmatureActuator(gameobj, armAct->type, armAct->posechannel, armAct->constraint, tmpgob, subgob, armAct->weight, armAct->influence);
baseact = tmparmact;
break;
}