GPv3: Mask toggle in dopesheet channel
Add `use_mask` property in dopesheet layer channel. Also add an icon to the `use_mask` property. Pull Request: https://projects.blender.org/blender/blender/pulls/121259
This commit is contained in:
committed by
Falk David
parent
c4e1be73b6
commit
a42e2a5a29
@@ -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
|
||||
|
||||
@@ -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<std::string> 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;
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user