Grease Pencil: Replace opacity modifier DNA flag for influence panel.

Use `BKE_panel_layout_panel_state_ensure` to get a panel open/close flag
without requiring a DNA flag.
This commit is contained in:
Lukas Tönne
2024-01-19 11:32:44 +01:00
parent 2eb6bc5ca3
commit 01d4e8a345
3 changed files with 8 additions and 11 deletions

View File

@@ -2542,11 +2542,10 @@ typedef enum GreasePencilModifierColorMode {
} GreasePencilModifierColorMode;
typedef enum GreasePencilOpacityModifierFlag {
MOD_GREASE_PENCIL_OPACITY_OPEN_INFLUENCE_PANEL = (1 << 0),
/* Use vertex group as opacity factors instead of influence. */
MOD_GREASE_PENCIL_OPACITY_USE_WEIGHT_AS_FACTOR = (1 << 1),
MOD_GREASE_PENCIL_OPACITY_USE_WEIGHT_AS_FACTOR = (1 << 0),
/* Set the opacity for every point in a stroke, otherwise multiply existing opacity. */
MOD_GREASE_PENCIL_OPACITY_USE_UNIFORM_OPACITY = (1 << 2),
MOD_GREASE_PENCIL_OPACITY_USE_UNIFORM_OPACITY = (1 << 1),
} GreasePencilOpacityModifierFlag;
typedef struct GreasePencilSubdivModifierData {

View File

@@ -7695,13 +7695,6 @@ static void rna_def_modifier_grease_pencil_opacity(BlenderRNA *brna)
srna, "rna_GreasePencilOpacityModifier_vertex_group_name_set");
rna_def_modifier_grease_pencil_custom_curve(srna);
prop = RNA_def_property(srna, "open_influence_panel", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(
prop, nullptr, "flag", MOD_GREASE_PENCIL_OPACITY_OPEN_INFLUENCE_PANEL);
RNA_def_property_ui_text(prop, "Open Influence Panel", "Open the influence panel");
RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, nullptr);
RNA_define_lib_overridable(true);
prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);

View File

@@ -17,6 +17,7 @@
#include "BKE_geometry_set.hh"
#include "BKE_grease_pencil.hh"
#include "BKE_modifier.hh"
#include "BKE_screen.hh"
#include "BLO_read_write.hh"
@@ -262,8 +263,12 @@ static void panel_draw(const bContext *C, Panel *panel)
}
}
LayoutPanelState *influence_panel_state = BKE_panel_layout_panel_state_ensure(
panel, "influence", true);
PointerRNA influence_state_ptr = RNA_pointer_create(
nullptr, &RNA_LayoutPanelState, influence_panel_state);
if (uiLayout *influence_panel = uiLayoutPanel(
C, layout, "Influence", ptr, "open_influence_panel"))
C, layout, "Influence", &influence_state_ptr, "is_open"))
{
modifier::greasepencil::draw_layer_filter_settings(C, influence_panel, ptr);
modifier::greasepencil::draw_material_filter_settings(C, influence_panel, ptr);