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:
authorMitchell Stokes <mogurijin@gmail.com>2012-06-01 06:17:35 +0400
committerMitchell Stokes <mogurijin@gmail.com>2012-06-01 06:17:35 +0400
commit0e73b64d62efca35568fe3a704ca15bc4b82822b (patch)
tree94ea0f39727bd9b7eec6964ccb80b666fd41ae91 /source/gameengine/Converter
parent03ae47e45f2c9095f88e8009694d2ee97aab8563 (diff)
Fix for [#27472] "preserve volume for armature modifier does not work" based on code provided by Sergey Kurdakov. Now more deformation flags are being passed to armature_deform_verts(). Note: this fix is only for the Blender vertex deformer, not the BGE deformer.
Diffstat (limited to 'source/gameengine/Converter')
-rw-r--r--source/gameengine/Converter/BL_SkinDeformer.cpp22
-rw-r--r--source/gameengine/Converter/BL_SkinDeformer.h1
2 files changed, 22 insertions, 1 deletions
diff --git a/source/gameengine/Converter/BL_SkinDeformer.cpp b/source/gameengine/Converter/BL_SkinDeformer.cpp
index ab275fa773a..9bbf07a3ed2 100644
--- a/source/gameengine/Converter/BL_SkinDeformer.cpp
+++ b/source/gameengine/Converter/BL_SkinDeformer.cpp
@@ -49,6 +49,7 @@
#include "DNA_action_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
+#include "DNA_modifier_types.h"
#include "BLI_utildefines.h"
#include "BKE_armature.h"
#include "BKE_action.h"
@@ -66,6 +67,23 @@ extern "C"{
#define __NLA_DEFNORMALS
//#undef __NLA_DEFNORMALS
+short get_deformflags(struct Object *bmeshobj)
+{
+ short flags = ARM_DEF_VGROUP;
+
+ ModifierData *md;
+ for (md = (ModifierData*)bmeshobj->modifiers.first; md; md = (ModifierData*)md->next)
+ {
+ if (md->type == eModifierType_Armature)
+ {
+ flags |= ((ArmatureModifierData*)md)->deformflag;
+ break;
+ }
+ }
+
+ return flags;
+}
+
BL_SkinDeformer::BL_SkinDeformer(BL_DeformableGameObject *gameobj,
struct Object *bmeshobj,
class RAS_MeshObject *mesh,
@@ -82,6 +100,7 @@ BL_SkinDeformer::BL_SkinDeformer(BL_DeformableGameObject *gameobj,
m_dfnrToPC(NULL)
{
copy_m4_m4(m_obmat, bmeshobj->obmat);
+ m_deformflags = get_deformflags(bmeshobj);
};
BL_SkinDeformer::BL_SkinDeformer(
@@ -107,6 +126,7 @@ BL_SkinDeformer::BL_SkinDeformer(
// in the calculation, so we must use the matrix of the original object to
// simulate a pure replacement of the mesh.
copy_m4_m4(m_obmat, bmeshobj_new->obmat);
+ m_deformflags = get_deformflags(bmeshobj_new);
}
BL_SkinDeformer::~BL_SkinDeformer()
@@ -201,7 +221,7 @@ void BL_SkinDeformer::BlenderDeformVerts()
// set reference matrix
copy_m4_m4(m_objMesh->obmat, m_obmat);
- armature_deform_verts( par_arma, m_objMesh, NULL, m_transverts, NULL, m_bmesh->totvert, ARM_DEF_VGROUP, NULL, NULL );
+ armature_deform_verts( par_arma, m_objMesh, NULL, m_transverts, NULL, m_bmesh->totvert, m_deformflags, NULL, NULL );
// restore matrix
copy_m4_m4(m_objMesh->obmat, obmat);
diff --git a/source/gameengine/Converter/BL_SkinDeformer.h b/source/gameengine/Converter/BL_SkinDeformer.h
index dd8577b382e..8e3d5851573 100644
--- a/source/gameengine/Converter/BL_SkinDeformer.h
+++ b/source/gameengine/Converter/BL_SkinDeformer.h
@@ -109,6 +109,7 @@ protected:
bool m_recalcNormal;
bool m_copyNormals; // dirty flag so we know if Apply() needs to copy normal information (used for BGEDeformVerts())
struct bPoseChannel** m_dfnrToPC;
+ short m_deformflags;
void BlenderDeformVerts();
void BGEDeformVerts();