Only post the blender if we have blendable meshes to blend.

This commit is contained in:
Andrzej Kapolka 2014-03-18 17:19:42 -07:00
parent f8c14a5717
commit 0fc0d50bda
3 changed files with 14 additions and 1 deletions

View file

@ -54,6 +54,15 @@ QStringList FBXGeometry::getJointNames() const {
return names;
}
bool FBXGeometry::hasBlendedMeshes() const {
foreach (const FBXMesh& mesh, meshes) {
if (!mesh.blendshapes.isEmpty()) {
return true;
}
}
return false;
}
static int fbxGeometryMetaTypeId = qRegisterMetaType<FBXGeometry>();
template<class T> QVariant readBinaryArray(QDataStream& in) {

View file

@ -181,6 +181,8 @@ public:
int getJointIndex(const QString& name) const { return jointIndices.value(name) - 1; }
QStringList getJointNames() const;
bool hasBlendedMeshes() const;
};
Q_DECLARE_METATYPE(FBXGeometry)

View file

@ -610,7 +610,9 @@ void Model::simulate(float deltaTime, bool fullUpdate, const QVector<JointState>
}
// post the blender
QThreadPool::globalInstance()->start(new Blender(this, _geometry, geometry.meshes, _blendshapeCoefficients));
if (geometry.hasBlendedMeshes()) {
QThreadPool::globalInstance()->start(new Blender(this, _geometry, geometry.meshes, _blendshapeCoefficients));
}
}
void Model::updateJointState(int index) {