New Hook's now use the objects center
When adding a hook to an existing selected object/bone, Use the location for the hook (instead of the selected vertices).
This commit is contained in:
@@ -503,6 +503,15 @@ static int add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob
|
|||||||
|
|
||||||
unit_m4(pose_mat);
|
unit_m4(pose_mat);
|
||||||
|
|
||||||
|
invert_m4_m4(obedit->imat, obedit->obmat);
|
||||||
|
if (mode == OBJECT_ADDHOOK_NEWOB) {
|
||||||
|
/* pass */
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* may overwrite with pose-bone location, below */
|
||||||
|
mul_v3_m4v3(cent, obedit->imat, ob->obmat[3]);
|
||||||
|
}
|
||||||
|
|
||||||
if (mode == OBJECT_ADDHOOK_SELOB_BONE) {
|
if (mode == OBJECT_ADDHOOK_SELOB_BONE) {
|
||||||
bArmature *arm = ob->data;
|
bArmature *arm = ob->data;
|
||||||
BLI_assert(ob->type == OB_ARMATURE);
|
BLI_assert(ob->type == OB_ARMATURE);
|
||||||
@@ -514,6 +523,8 @@ static int add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob
|
|||||||
pchan_act = BKE_pose_channel_active(ob);
|
pchan_act = BKE_pose_channel_active(ob);
|
||||||
if (LIKELY(pchan_act)) {
|
if (LIKELY(pchan_act)) {
|
||||||
invert_m4_m4(pose_mat, pchan_act->pose_mat);
|
invert_m4_m4(pose_mat, pchan_act->pose_mat);
|
||||||
|
mul_v3_m4v3(cent, ob->obmat, pchan_act->pose_mat[3]);
|
||||||
|
mul_v3_m4v3(cent, obedit->imat, cent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -521,6 +532,9 @@ static int add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copy_v3_v3(hmd->cent, cent);
|
||||||
|
|
||||||
|
|
||||||
/* matrix calculus */
|
/* matrix calculus */
|
||||||
/* vert x (obmat x hook->imat) x hook->obmat x ob->imat */
|
/* vert x (obmat x hook->imat) x hook->obmat x ob->imat */
|
||||||
/* (parentinv ) */
|
/* (parentinv ) */
|
||||||
|
Reference in New Issue
Block a user