diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-03-17 19:09:20 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-03-17 19:28:49 +0300 |
commit | 2518f601094bfa14474c24c3a1e640b9fca0e6e2 (patch) | |
tree | e08f9598b274a575506a0ec2302ff29ecc3849d6 /source/blender/editors/gpencil | |
parent | 964375e36a2b2a56d12201a3a96dd4572e0a8827 (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/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index f8ad34e8d14..00fc6550459 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -2597,10 +2597,11 @@ void GPENCIL_OT_dissolve(wmOperatorType *ot) */ static bool gp_snap_poll(bContext *C) { - bGPdata *gpd = CTX_data_gpencil_data(C); ScrArea *sa = CTX_wm_area(C); + Object *ob = CTX_data_active_object(C); - return (gpd != NULL) && ((sa != NULL) && (sa->spacetype == SPACE_VIEW3D)); + return (ob != NULL) && (ob->type == OB_GPENCIL) && + ((sa != NULL) && (sa->spacetype == SPACE_VIEW3D)); } /* --------------------------------- */ @@ -2775,12 +2776,13 @@ void GPENCIL_OT_snap_to_cursor(wmOperatorType *ot) static int gp_snap_cursor_to_sel(bContext *C, wmOperator *UNUSED(op)) { - bGPdata *gpd = ED_gpencil_data_get_active(C); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); + Object *obact = CTX_data_active_object(C); + Object *ob_eval = DEG_get_evaluated_object(depsgraph, obact); + bGPdata *gpd = (bGPdata *)ob_eval->data; Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); - Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); - Object *obact = CTX_data_active_object(C); float *cursor = scene->cursor.location; float centroid[3] = {0.0f}; |