diff --git a/scripts/startup/bl_ui/properties_data_grease_pencil.py b/scripts/startup/bl_ui/properties_data_grease_pencil.py index 8d1b162f214..6cbe189de9a 100644 --- a/scripts/startup/bl_ui/properties_data_grease_pencil.py +++ b/scripts/startup/bl_ui/properties_data_grease_pencil.py @@ -46,7 +46,7 @@ class GreasePencil_LayerMaskPanel: grease_pencil = ob.data layer = grease_pencil.layers.active - self.layout.prop(layer, "use_masks", text="") + self.layout.prop(layer, "use_masks", text="", toggle=0) def draw(self, context): layout = self.layout diff --git a/source/blender/editors/animation/anim_channels_defines.cc b/source/blender/editors/animation/anim_channels_defines.cc index c4117633a94..f965ebf5f38 100644 --- a/source/blender/editors/animation/anim_channels_defines.cc +++ b/source/blender/editors/animation/anim_channels_defines.cc @@ -5584,6 +5584,26 @@ static void draw_grease_pencil_layer_widgets(bAnimListElem *ale, channel_height); } + /* Mask layer. */ + offset -= ICON_WIDTH; + UI_block_emboss_set(block, UI_EMBOSS_NONE); + PropertyRNA *layer_mask_prop = RNA_struct_find_property(&ptr, "use_masks"); + + const std::optional layer_mask_rna_path = RNA_path_from_ID_to_property( + &ptr, layer_mask_prop); + if (RNA_path_resolve_property(&id_ptr, layer_mask_rna_path->c_str(), &ptr, &layer_mask_prop)) { + uiDefAutoButR(block, + &ptr, + layer_mask_prop, + array_index, + "", + ICON_CLIPUV_HLT, + offset, + rect->ymin, + ICON_WIDTH, + channel_height); + } + /* Layer opacity. */ const short width = SLIDER_WIDTH * 0.6; offset -= width; diff --git a/source/blender/editors/interface/templates/interface_template_grease_pencil_layer_tree.cc b/source/blender/editors/interface/templates/interface_template_grease_pencil_layer_tree.cc index 316e237dea2..b3b54daea95 100644 --- a/source/blender/editors/interface/templates/interface_template_grease_pencil_layer_tree.cc +++ b/source/blender/editors/interface/templates/interface_template_grease_pencil_layer_tree.cc @@ -258,10 +258,7 @@ class LayerViewItem : public AbstractTreeViewItem { sub = uiLayoutRow(&row, true); uiLayoutSetActive(sub, layer_.parent_group().use_masks()); - const int icon_mask = (layer_.base.flag & GP_LAYER_TREE_NODE_HIDE_MASKS) == 0 ? - ICON_CLIPUV_DEHLT : - ICON_CLIPUV_HLT; - uiItemR(sub, &layer_ptr, "use_masks", UI_ITEM_R_ICON_ONLY, nullptr, icon_mask); + uiItemR(sub, &layer_ptr, "use_masks", UI_ITEM_R_ICON_ONLY, nullptr, ICON_NONE); sub = uiLayoutRow(&row, true); uiLayoutSetActive(sub, layer_.parent_group().use_onion_skinning()); diff --git a/source/blender/makesrna/intern/rna_grease_pencil.cc b/source/blender/makesrna/intern/rna_grease_pencil.cc index 36d9eab488f..a7999626d6c 100644 --- a/source/blender/makesrna/intern/rna_grease_pencil.cc +++ b/source/blender/makesrna/intern/rna_grease_pencil.cc @@ -409,6 +409,7 @@ static void rna_def_grease_pencil_layer(BlenderRNA *brna) /* Use Masks. */ prop = RNA_def_property(srna, "use_masks", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_icon(prop, ICON_CLIPUV_HLT, -1); RNA_def_property_boolean_negative_sdna( prop, "GreasePencilLayerTreeNode", "flag", GP_LAYER_TREE_NODE_HIDE_MASKS); RNA_def_property_ui_text(