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.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user