Skip to content

Commit

Permalink
UPBGE: Fix deformer creation.
Browse files Browse the repository at this point in the history
Previously when a modifier deformer was detect the code checked if
a armature deformer or shape deformer was present to, in this case
the modifier deformer was created with an aramture object.

This cuased issues when the a shape deformer existed but without
any armature parent object. To avoid both checks, we only check if
the parent is an armature object.

Fix issue: #628.
  • Loading branch information
panzergame committed Oct 31, 2017
1 parent 050eea1 commit a84a3b1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions source/gameengine/Converter/BL_DeformableGameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,14 @@ void BL_DeformableGameObject::LoadDeformer()
meshblendobj = m_pBlenderObject;
}

bool bHasModifier = BL_ModifierDeformer::HasCompatibleDeformer(m_pBlenderObject);
bool bHasShapeKey = mesh->key && mesh->key->type == KEY_RELATIVE;
bool bHasDvert = mesh->dvert && m_pBlenderObject->defbase.first;
bool bHasArmature = BL_ModifierDeformer::HasArmatureDeformer(m_pBlenderObject) &&
parentobj && parentobj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE && meshblendobj && bHasDvert;
const bool isParentArmature = parentobj && parentobj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE;
const bool bHasModifier = BL_ModifierDeformer::HasCompatibleDeformer(m_pBlenderObject);
const bool bHasShapeKey = mesh->key && mesh->key->type == KEY_RELATIVE;
const bool bHasDvert = mesh->dvert && m_pBlenderObject->defbase.first;
const bool bHasArmature = BL_ModifierDeformer::HasArmatureDeformer(m_pBlenderObject) &&
isParentArmature && meshblendobj && bHasDvert;
#ifdef WITH_BULLET
bool bHasSoftBody = (!parentobj && (m_pBlenderObject->gameflag & OB_SOFT_BODY));
const bool bHasSoftBody = (!parentobj && (m_pBlenderObject->gameflag & OB_SOFT_BODY));
#endif

if (!meshblendobj) {
Expand All @@ -187,7 +188,7 @@ void BL_DeformableGameObject::LoadDeformer()
}

if (bHasModifier) {
if (bHasShapeKey || bHasArmature) {
if (isParentArmature) {
BL_ModifierDeformer *modifierDeformer = new BL_ModifierDeformer(this, blenderScene, meshblendobj, m_pBlenderObject,
meshobj, static_cast<BL_ArmatureObject *>(parentobj));
modifierDeformer->LoadShapeDrivers(parentobj);
Expand All @@ -198,7 +199,7 @@ void BL_DeformableGameObject::LoadDeformer()
}
}
else if (bHasShapeKey) {
if (bHasArmature) {
if (isParentArmature) {
BL_ShapeDeformer *shapeDeformer = new BL_ShapeDeformer(this, meshblendobj, m_pBlenderObject, meshobj,
static_cast<BL_ArmatureObject *>(parentobj));
shapeDeformer->LoadShapeDrivers(parentobj);
Expand All @@ -221,4 +222,3 @@ void BL_DeformableGameObject::LoadDeformer()
}
#endif
}

0 comments on commit a84a3b1

Please sign in to comment.