From bbcb4be04fd468b8a93d919b4fc50767817ef701 Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Fri, 6 Sep 2019 23:33:11 +0200 Subject: Fix T69597: Changing Grease Pencil Layer in Dopesheet unlocks all layers The Dopesheet was unlocked all layers because it was using the same logic used in UI panel, but this was wrong. --- source/blender/blenkernel/BKE_gpencil.h | 2 +- source/blender/blenkernel/intern/gpencil.c | 8 +++++--- source/blender/editors/animation/anim_channels_edit.c | 2 +- source/blender/editors/space_action/action_select.c | 2 +- source/blender/makesrna/intern/rna_gpencil.c | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h index 011590100de..590f8258f7d 100644 --- a/source/blender/blenkernel/BKE_gpencil.h +++ b/source/blender/blenkernel/BKE_gpencil.h @@ -149,7 +149,7 @@ bool BKE_gpencil_layer_delframe(struct bGPDlayer *gpl, struct bGPDframe *gpf); struct bGPDlayer *BKE_gpencil_layer_getactive(struct bGPdata *gpd); void BKE_gpencil_layer_setactive(struct bGPdata *gpd, struct bGPDlayer *active); void BKE_gpencil_layer_delete(struct bGPdata *gpd, struct bGPDlayer *gpl); -void BKE_gpencil_layer_autolock_set(struct bGPdata *gpd); +void BKE_gpencil_layer_autolock_set(struct bGPdata *gpd, const bool unlock); /* Brush */ struct Material *BKE_gpencil_brush_material_get(struct Brush *brush); diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 47ed9f3bd83..9ac61c69d04 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -1017,7 +1017,7 @@ void BKE_gpencil_layer_setactive(bGPdata *gpd, bGPDlayer *active) } /* Set locked layers for autolock mode. */ -void BKE_gpencil_layer_autolock_set(bGPdata *gpd) +void BKE_gpencil_layer_autolock_set(bGPdata *gpd, const bool unlock) { BLI_assert(gpd != NULL); @@ -1041,8 +1041,10 @@ void BKE_gpencil_layer_autolock_set(bGPdata *gpd) /* If disable is better unlock all layers by default or it looks there is * a problem in the UI because the user expects all layers will be unlocked */ - for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { - gpl->flag &= ~GP_LAYER_LOCKED; + if (unlock) { + for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { + gpl->flag &= ~GP_LAYER_LOCKED; + } } } } diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 61b8e4a2341..afd2cdc2a2b 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -3114,7 +3114,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index, ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, gpl, ANIMTYPE_GPLAYER); /* update other layer status */ BKE_gpencil_layer_setactive(gpd, gpl); - BKE_gpencil_layer_autolock_set(gpd); + BKE_gpencil_layer_autolock_set(gpd, false); } /* Grease Pencil updates */ diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index cbf4d0628e6..912cd0407e3 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -1724,7 +1724,7 @@ static void mouse_action_keys(bAnimContext *ac, /* Update other layer status. */ if (BKE_gpencil_layer_getactive(gpd) != gpl) { BKE_gpencil_layer_setactive(gpd, gpl); - BKE_gpencil_layer_autolock_set(gpd); + BKE_gpencil_layer_autolock_set(gpd, false); WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL); } } diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 01ecf2f8cae..333f43e4292 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -151,7 +151,7 @@ static void rna_GPencil_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Pointe static void rna_GPencil_autolock(Main *bmain, Scene *scene, PointerRNA *ptr) { bGPdata *gpd = (bGPdata *)ptr->owner_id; - BKE_gpencil_layer_autolock_set(gpd); + BKE_gpencil_layer_autolock_set(gpd, true); /* standard update */ rna_GPencil_update(bmain, scene, ptr); -- cgit v1.2.3