~ubuntu-branches/ubuntu/trusty/blender/trusty-proposed

« back to all changes in this revision

Viewing changes to source/blender/blenkernel/intern/armature.c

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2013-08-14 10:43:49 UTC
  • mfrom: (14.2.19 sid)
  • Revision ID: package-import@ubuntu.com-20130814104349-t1d5mtwkphp12dyj
Tags: 2.68a-3
* Upload to unstable
* debian/: python3.3 Depends simplified
  - debian/control: python3.3 Depends dropped
    for blender-data package
  - 0001-blender_thumbnailer.patch refreshed
* debian/control: libavcodec b-dep versioning dropped

Show diffs side-by-side

added added

removed removed

Lines of Context:
505
505
                if (prev->bone->segments == 1) {
506
506
                        /* find the previous roll to interpolate */
507
507
                        if (rest)
508
 
                                mult_m4_m4m4(difmat, imat, prev->bone->arm_mat);
 
508
                                mul_m4_m4m4(difmat, imat, prev->bone->arm_mat);
509
509
                        else
510
 
                                mult_m4_m4m4(difmat, imat, prev->pose_mat);
 
510
                                mul_m4_m4m4(difmat, imat, prev->pose_mat);
511
511
                        copy_m3_m4(result, difmat); /* the desired rotation at beginning of next bone */
512
512
 
513
513
                        vec_roll_to_mat3(h1, 0.0f, mat3); /* the result of vec_roll without roll */
543
543
 
544
544
                /* find the next roll to interpolate as well */
545
545
                if (rest)
546
 
                        mult_m4_m4m4(difmat, imat, next->bone->arm_mat);
 
546
                        mul_m4_m4m4(difmat, imat, next->bone->arm_mat);
547
547
                else
548
 
                        mult_m4_m4m4(difmat, imat, next->pose_mat);
 
548
                        mul_m4_m4m4(difmat, imat, next->pose_mat);
549
549
                copy_m3_m4(result, difmat); /* the desired rotation at beginning of next bone */
550
550
 
551
551
                vec_roll_to_mat3(h2, 0.0f, mat3); /* the result of vec_roll without roll */
844
844
 
845
845
        invert_m4_m4(obinv, target->obmat);
846
846
        copy_m4_m4(premat, target->obmat);
847
 
        mult_m4_m4m4(postmat, obinv, armOb->obmat);
 
847
        mul_m4_m4m4(postmat, obinv, armOb->obmat);
848
848
        invert_m4_m4(premat, postmat);
849
849
 
850
850
        /* bone defmats are already in the channels, chan_mat */
1109
1109
        invert_m4_m4(obmat, ob->obmat);
1110
1110
 
1111
1111
        /* multiply given matrix by object's-inverse to find pose-space matrix */
1112
 
        mult_m4_m4m4(outmat, inmat, obmat);
 
1112
        mul_m4_m4m4(outmat, inmat, obmat);
1113
1113
}
1114
1114
 
1115
1115
/* Convert World-Space Location to Pose-Space Location
1181
1181
                /* Compose the rotscale matrix for this bone. */
1182
1182
                if ((bone->flag & BONE_HINGE) && (bone->flag & BONE_NO_SCALE)) {
1183
1183
                        /* Parent rest rotation and scale. */
1184
 
                        mult_m4_m4m4(rotscale_mat, parbone->arm_mat, offs_bone);
 
1184
                        mul_m4_m4m4(rotscale_mat, parbone->arm_mat, offs_bone);
1185
1185
                }
1186
1186
                else if (bone->flag & BONE_HINGE) {
1187
1187
                        /* Parent rest rotation and pose scale. */
1192
1192
                        size_to_mat4(tmat, tscale);
1193
1193
 
1194
1194
                        /* Applies the parent pose scale to the rest matrix. */
1195
 
                        mult_m4_m4m4(tmat, tmat, parbone->arm_mat);
 
1195
                        mul_m4_m4m4(tmat, tmat, parbone->arm_mat);
1196
1196
 
1197
 
                        mult_m4_m4m4(rotscale_mat, tmat, offs_bone);
 
1197
                        mul_m4_m4m4(rotscale_mat, tmat, offs_bone);
1198
1198
                }
1199
1199
                else if (bone->flag & BONE_NO_SCALE) {
1200
1200
                        /* Parent pose rotation and rest scale (i.e. no scaling). */
1201
1201
                        float tmat[4][4];
1202
1202
                        copy_m4_m4(tmat, parchan->pose_mat);
1203
1203
                        normalize_m4(tmat);
1204
 
                        mult_m4_m4m4(rotscale_mat, tmat, offs_bone);
 
1204
                        mul_m4_m4m4(rotscale_mat, tmat, offs_bone);
1205
1205
                }
1206
1206
                else
1207
 
                        mult_m4_m4m4(rotscale_mat, parchan->pose_mat, offs_bone);
 
1207
                        mul_m4_m4m4(rotscale_mat, parchan->pose_mat, offs_bone);
1208
1208
 
1209
1209
                /* Compose the loc matrix for this bone. */
1210
1210
                /* NOTE: That version does not modify bone's loc when HINGE/NO_SCALE options are set. */
1224
1224
                        mul_m3_m3m3(bone_rotscale, tmat3, bone_rotscale);
1225
1225
 
1226
1226
                        copy_m4_m3(tmat4, bone_rotscale);
1227
 
                        mult_m4_m4m4(loc_mat, bone_loc, tmat4);
 
1227
                        mul_m4_m4m4(loc_mat, bone_loc, tmat4);
1228
1228
                }
1229
1229
                /* Those flags do not affect position, use plain parent transform space! */
1230
1230
                else if (bone->flag & (BONE_HINGE | BONE_NO_SCALE)) {
1231
 
                        mult_m4_m4m4(loc_mat, parchan->pose_mat, offs_bone);
 
1231
                        mul_m4_m4m4(loc_mat, parchan->pose_mat, offs_bone);
1232
1232
                }
1233
1233
                /* Else (i.e. default, usual case), just use the same matrix for rotation/scaling, and location. */
1234
1234
                else
1263
1263
        invert_m4(rotscale_mat);
1264
1264
        invert_m4(loc_mat);
1265
1265
 
1266
 
        mult_m4_m4m4(outmat, rotscale_mat, inmat_);
 
1266
        mul_m4_m4m4(outmat, rotscale_mat, inmat_);
1267
1267
        mul_v3_m4v3(outmat[3], loc_mat, inmat_[3]);
1268
1268
}
1269
1269
 
1277
1277
 
1278
1278
        BKE_pchan_to_pose_mat(pchan, rotscale_mat, loc_mat);
1279
1279
 
1280
 
        mult_m4_m4m4(outmat, rotscale_mat, inmat_);
 
1280
        mul_m4_m4m4(outmat, rotscale_mat, inmat_);
1281
1281
        mul_v3_m4v3(outmat[3], loc_mat, inmat_[3]);
1282
1282
}
1283
1283
 
1349
1349
        float imat[4][4];
1350
1350
 
1351
1351
        invert_m4_m4(imat, arm_mat);
1352
 
        mult_m4_m4m4(delta_mat, imat, pose_mat);
 
1352
        mul_m4_m4m4(delta_mat, imat, pose_mat);
1353
1353
}
1354
1354
 
1355
1355
/* **************** Rotation Mode Conversions ****************************** */
1474
1474
                theta = angle_normalized_v3v3(target, nor);
1475
1475
 
1476
1476
                /* Make Bone matrix*/
1477
 
                vec_rot_to_mat3(bMatrix, axis, theta);
 
1477
                axis_angle_normalized_to_mat3(bMatrix, axis, theta);
1478
1478
        }
1479
1479
        else {
1480
1480
                /* if nor is a multiple of target ... */
1490
1490
        }
1491
1491
 
1492
1492
        /* Make Roll matrix */
1493
 
        vec_rot_to_mat3(rMatrix, nor, roll);
 
1493
        axis_angle_normalized_to_mat3(rMatrix, nor, roll);
1494
1494
 
1495
1495
        /* Combine and output result */
1496
1496
        mul_m3_m3m3(mat, rMatrix, bMatrix);
1522
1522
                get_offset_bone_mat(bone, offs_bone);
1523
1523
 
1524
1524
                /* Compose the matrix for this bone  */
1525
 
                mult_m4_m4m4(bone->arm_mat, prevbone->arm_mat, offs_bone);
 
1525
                mul_m4_m4m4(bone->arm_mat, prevbone->arm_mat, offs_bone);
1526
1526
        }
1527
1527
        else {
1528
1528
                copy_m4_m3(bone->arm_mat, bone->bone_mat);
1596
1596
                }
1597
1597
                else if (pchan->bone->layer & layer_protected) {
1598
1598
                        ListBase proxylocal_constraints = {NULL, NULL};
1599
 
                        bPoseChannel pchanw = {NULL};
 
1599
                        bPoseChannel pchanw;
1600
1600
                        
1601
1601
                        /* copy posechannel to temp, but restore important pointers */
1602
1602
                        pchanw = *pchanp;
2523
2523
        for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
2524
2524
                if (pchan->bone) {
2525
2525
                        invert_m4_m4(imat, pchan->bone->arm_mat);
2526
 
                        mult_m4_m4m4(pchan->chan_mat, pchan->pose_mat, imat);
 
2526
                        mul_m4_m4m4(pchan->chan_mat, pchan->pose_mat, imat);
2527
2527
                }
2528
2528
        }
2529
2529
}