Fix T91481: Grease Pencil Layer Double Transformations

Use the inverse of the grease pencil object. This patch fixes the issue for bones and objects.

Maniphest Tasks: T91481

Differential Revision: https://developer.blender.org/D12539
This commit is contained in:
Henrik Dick 2021-09-17 13:29:05 +02:00 committed by Antonio Vazquez
parent e1d7ce005f
commit 9a41b44197
Notes: blender-bot 2023-02-14 06:21:59 +01:00
Referenced by issue #91481, Grease Pencil Layer Double Transformations
Referenced by issue #82793, problem with parenting GreasePencil Layer to armature Bone
1 changed files with 2 additions and 3 deletions

View File

@ -3063,13 +3063,12 @@ void BKE_gpencil_update_layer_transforms(const Depsgraph *depsgraph, Object *ob)
Object *ob_parent = DEG_get_evaluated_object(depsgraph, gpl->parent);
/* calculate new matrix */
if (ELEM(gpl->partype, PAROBJECT, PARSKEL)) {
copy_m4_m4(cur_mat, ob_parent->obmat);
mul_m4_m4m4(cur_mat, ob->imat, ob_parent->obmat);
}
else if (gpl->partype == PARBONE) {
bPoseChannel *pchan = BKE_pose_channel_find_name(ob_parent->pose, gpl->parsubstr);
if (pchan != NULL) {
copy_m4_m4(cur_mat, ob->imat);
mul_m4_m4m4(cur_mat, ob_parent->obmat, pchan->pose_mat);
mul_m4_series(cur_mat, ob->imat, ob_parent->obmat, pchan->pose_mat);
}
else {
unit_m4(cur_mat);