[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47304] trunk/blender/source/gameengine/ Converter: Fix for [#27472] " preserve volume for armature modifier does not work" based on code provided by Sergey Kurdakov.
Mitchell Stokes
mogurijin at gmail.com
Fri Jun 1 04:17:41 CEST 2012
Revision: 47304
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47304
Author: moguri
Date: 2012-06-01 02:17:35 +0000 (Fri, 01 Jun 2012)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/gameengine/Converter/BL_SkinDeformer.cpp
trunk/blender/source/gameengine/Converter/BL_SkinDeformer.h
Modified: trunk/blender/source/gameengine/Converter/BL_SkinDeformer.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_SkinDeformer.cpp 2012-05-31 22:21:56 UTC (rev 47303)
+++ trunk/blender/source/gameengine/Converter/BL_SkinDeformer.cpp 2012-06-01 02:17:35 UTC (rev 47304)
@@ -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 @@
#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 @@
m_dfnrToPC(NULL)
{
copy_m4_m4(m_obmat, bmeshobj->obmat);
+ m_deformflags = get_deformflags(bmeshobj);
};
BL_SkinDeformer::BL_SkinDeformer(
@@ -107,6 +126,7 @@
// 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 @@
// 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);
Modified: trunk/blender/source/gameengine/Converter/BL_SkinDeformer.h
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_SkinDeformer.h 2012-05-31 22:21:56 UTC (rev 47303)
+++ trunk/blender/source/gameengine/Converter/BL_SkinDeformer.h 2012-06-01 02:17:35 UTC (rev 47304)
@@ -109,6 +109,7 @@
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();
More information about the Bf-blender-cvs
mailing list