Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2020-03-17 19:09:20 +0300
committerAntonio Vazquez <blendergit@gmail.com>2020-03-17 19:28:49 +0300
commit2518f601094bfa14474c24c3a1e640b9fca0e6e2 (patch)
treee08f9598b274a575506a0ec2302ff29ecc3849d6 /source/blender/blenkernel/intern/gpencil.c
parent964375e36a2b2a56d12201a3a96dd4572e0a8827 (diff)
GPencil: Fix Parent layer not working
The parenting was using the old logic, but with new engine the draw is done using eval data. Fixed the depsgraph relationship missing with bones to get an update when the bone is transformed. Also fixed Snap cursor to Selected
Diffstat (limited to 'source/blender/blenkernel/intern/gpencil.c')
-rw-r--r--source/blender/blenkernel/intern/gpencil.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index c0b40721ccc..0be92b7533d 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -4034,42 +4034,35 @@ void BKE_gpencil_update_layer_parent(const Depsgraph *depsgraph, Object *ob)
}
bGPdata *gpd = (bGPdata *)ob->data;
- bGPDspoint *pt;
- int i;
- float diff_mat[4][4];
float cur_mat[4][4];
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
if ((gpl->parent != NULL) && (gpl->actframe != NULL)) {
- Object *ob_eval = DEG_get_evaluated_object(depsgraph, gpl->parent);
-
+ Object *ob_parent = DEG_get_evaluated_object(depsgraph, gpl->parent);
/* calculate new matrix */
if ((gpl->partype == PAROBJECT) || (gpl->partype == PARSKEL)) {
- invert_m4_m4(cur_mat, ob_eval->obmat);
+ copy_m4_m4(cur_mat, ob_parent->obmat);
}
else if (gpl->partype == PARBONE) {
- bPoseChannel *pchan = BKE_pose_channel_find_name(ob_eval->pose, gpl->parsubstr);
- if (pchan) {
- float tmp_mat[4][4];
- mul_m4_m4m4(tmp_mat, ob_eval->obmat, pchan->pose_mat);
- invert_m4_m4(cur_mat, tmp_mat);
+ 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);
+ }
+ else {
+ unit_m4(cur_mat);
}
}
/* only redo if any change */
if (!equals_m4m4(gpl->inverse, cur_mat)) {
-
- /* first apply current transformation to all strokes */
- BKE_gpencil_parent_matrix_get(depsgraph, ob, gpl, diff_mat);
- /* undo local object */
- sub_v3_v3(diff_mat[3], ob->obmat[3]);
-
LISTBASE_FOREACH (bGPDstroke *, gps, &gpl->actframe->strokes) {
+ bGPDspoint *pt;
+ int i;
for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
- mul_m4_v3(diff_mat, &pt->x);
+ mul_m4_v3(gpl->inverse, &pt->x);
+ mul_m4_v3(cur_mat, &pt->x);
}
}
- /* set new parent matrix */
- copy_m4_m4(gpl->inverse, cur_mat);
}
}
}