Fix for invalid custom data checks in armature and lattice functions.
authorLukas Tönne <lukas.toenne@gmail.com>
Wed, 5 Mar 2014 14:11:36 +0000 (15:11 +0100)
committerLukas Tönne <lukas.toenne@gmail.com>
Wed, 5 Mar 2014 14:13:50 +0000 (15:13 +0100)
Testing for custom data availability with getVertData and index 0 fails
on assert for empty meshes (the index must be in valid range). Better
use getVertDataArray which has no requirement for specific index.

source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/lattice.c

index 29d322e330e3397cd0d5539ff0dc174c53e10826..11a34ce9d389332b69feb69591ba41b3ac0f7c80 100644 (file)
@@ -888,7 +888,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, float
                if (ELEM(target->type, OB_MESH, OB_LATTICE)) {
                        /* if we have a DerivedMesh, only use dverts if it has them */
                        if (dm) {
-                               use_dverts = (dm->getVertData(dm, 0, CD_MDEFORMVERT) != NULL);
+                               use_dverts = (dm->getVertDataArray(dm, CD_MDEFORMVERT) != NULL);
                        }
                        else if (dverts) {
                                use_dverts = TRUE;
index 8330fefa0ae877c55f86b5135d6af829f0ef5c9d..72462eed30c42a6dff49b00b020579d5bcd49d35 100644 (file)
@@ -894,7 +894,7 @@ void lattice_deform_verts(Object *laOb, Object *target, DerivedMesh *dm,
        if (target && target->type == OB_MESH) {
                /* if there's derived data without deformverts, don't use vgroups */
                if (dm) {
-                       use_vgroups = (dm->getVertData(dm, 0, CD_MDEFORMVERT) != NULL);
+                       use_vgroups = (dm->getVertDataArray(dm, CD_MDEFORMVERT) != NULL);
                }
                else {
                        Mesh *me = target->data;