From 4c182aef7ce0e8c26dd2b85c1fa2cd45c2ef64ea Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Tue, 8 Nov 2022 16:55:59 +0100 Subject: GPencil: Make Sculpt Auto-masking Global and not by Brush The auto-masking was working by Brush and this was very inconvenient because it was necessary set the options by Brush, now the options are global and can be set at once. Also, the automa-masking now works with `and` logic and not with `or` as before. That means that a stroke must meet all the conditions of the masking. Added new Layer and Material options to masking the strokes using the same Layer/Material of the selected stroke. Before, only Active Layer and Active Material could be masked. The options of masking has been moved to the top-bar using the same design of Mesh Sculpt masking. As result of the changes above, the following props changed: Removed: `brush.gpencil_settings.use_automasking_strokes` `brush.gpencil_settings.use_automasking_layer` `brush.gpencil_settings.use_automasking_material` Added: `tool_settings.gpencil_sculpt.use_automasking_stroke` `tool_settings.gpencil_sculpt.use_automasking_layer_stroke` `tool_settings.gpencil_sculpt.use_automasking_material_stroke` `tool_settings.gpencil_sculpt.use_automasking_layer_active` `tool_settings.gpencil_sculpt.use_automasking_material_active` Reviewed by: Julien Kaspar, Matias Mendiola, Daniel Martinez Lara --- source/blender/makesrna/intern/rna_brush.c | 20 --------------- source/blender/makesrna/intern/rna_sculpt_paint.c | 30 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 20 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 5ba31070e1d..ce51b52de39 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -1919,26 +1919,6 @@ static void rna_def_gpencil_options(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); - prop = RNA_def_property(srna, "use_automasking_stroke", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna( - prop, NULL, "sculpt_mode_flag", GP_SCULPT_FLAGMODE_AUTOMASK_STROKE); - RNA_def_property_ui_text(prop, "Auto-Masking Strokes", "Mask strokes below brush cursor"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); - - prop = RNA_def_property(srna, "use_automasking_layer", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "sculpt_mode_flag", GP_SCULPT_FLAGMODE_AUTOMASK_LAYER); - RNA_def_property_ui_text(prop, "Auto-Masking Layer", "Mask strokes using active layer"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); - - prop = RNA_def_property(srna, "use_automasking_material", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna( - prop, NULL, "sculpt_mode_flag", GP_SCULPT_FLAGMODE_AUTOMASK_MATERIAL); - RNA_def_property_ui_text(prop, "Auto-Masking Material", "Mask strokes using active material"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); - /* Material */ prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Material"); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 7ae9e25bab3..c5e7c6a6e91 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -1638,6 +1638,36 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + prop = RNA_def_property(srna, "use_automasking_stroke", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_AUTOMASK_STROKE); + RNA_def_property_ui_text(prop, "Auto-Masking Strokes", "Affect only strokes below the cursor"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + + prop = RNA_def_property(srna, "use_automasking_layer_stroke", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_AUTOMASK_LAYER_STROKE); + RNA_def_property_ui_text(prop, "Auto-Masking Layer", "Affect only strokes below the cursor"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + + prop = RNA_def_property(srna, "use_automasking_material_stroke", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_AUTOMASK_MATERIAL_STROKE); + RNA_def_property_ui_text(prop, "Auto-Masking Material", "Affect only strokes below the cursor"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + + prop = RNA_def_property(srna, "use_automasking_layer_active", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_AUTOMASK_LAYER_ACTIVE); + RNA_def_property_ui_text(prop, "Auto-Masking Layer", "Affect only the Active Layer"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + + prop = RNA_def_property(srna, "use_automasking_material_active", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_AUTOMASK_MATERIAL_ACTIVE); + RNA_def_property_ui_text(prop, "Auto-Masking Material", "Affect only the Active Material"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + /* custom falloff curve */ prop = RNA_def_property(srna, "multiframe_falloff_curve", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "cur_falloff"); -- cgit v1.2.3