Commit: bc7068c4b9130a00116cef52fd5cc27926a63717 Author: Pablo Dobarro Date: Sat Apr 20 00:09:10 2019 +0200 Branches: sculpt-mode-features https://developer.blender.org/rBbc7068c4b9130a00116cef52fd5cc27926a63717
Add option to control de opacity of the sculpt mask =================================================================== M release/scripts/startup/bl_ui/space_view3d_toolbar.py M source/blender/draw/modes/sculpt_mode.c M source/blender/draw/modes/shaders/sculpt_mask_vert.glsl M source/blender/makesdna/DNA_scene_types.h M source/blender/makesrna/intern/rna_sculpt_paint.c =================================================================== diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 73021097218..b8fe0204abd 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1139,6 +1139,8 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel): col.prop(sculpt, "show_diffuse_color") col = flow.column() col.prop(sculpt, "show_mask") + col = flow.column() + col.prop(sculpt, "mask_opacity") class VIEW3D_PT_sculpt_options_unified(Panel, View3DPaintPanel): diff --git a/source/blender/draw/modes/sculpt_mode.c b/source/blender/draw/modes/sculpt_mode.c index ead539bc30f..4542790a3ef 100644 --- a/source/blender/draw/modes/sculpt_mode.c +++ b/source/blender/draw/modes/sculpt_mode.c @@ -138,6 +138,9 @@ static void SCULPT_cache_init(void *vedata) DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_MULTIPLY; psl->pass = DRW_pass_create("Sculpt Pass", state); stl->g_data->group_smooth = DRW_shgroup_create(e_data.shader_smooth, psl->pass); + const DRWContextState *drwctx = DRW_context_state_get(); + Sculpt *sd = drwctx->scene->toolsettings->sculpt; + DRW_shgroup_uniform_float_copy(stl->g_data->group_smooth, "maskOpacity", sd->mask_opacity); } } diff --git a/source/blender/draw/modes/shaders/sculpt_mask_vert.glsl b/source/blender/draw/modes/shaders/sculpt_mask_vert.glsl index 553a49f38df..d21ab846054 100644 --- a/source/blender/draw/modes/shaders/sculpt_mask_vert.glsl +++ b/source/blender/draw/modes/shaders/sculpt_mask_vert.glsl @@ -1,5 +1,6 @@ uniform mat4 ModelViewProjectionMatrix; +uniform float maskOpacity; in vec3 pos; in float msk; @@ -10,6 +11,6 @@ void main() { gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0); - float mask = 1.0 - msk * 0.75; + float mask = 1.0 - msk * 0.75 * maskOpacity; finalColor = vec4(mask, mask, mask, 1.0); } diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 75dda608975..cabdf244e44 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -987,11 +987,13 @@ typedef struct Sculpt { /* gravity factor for sculpting */ float gravity_factor; + /* mask opacity */ + float mask_opacity; + /* scale for constant detail size */ /** Constant detail resolution (Blender unit / constant_detail). */ float constant_detail; float detail_percent; - char _pad[4]; struct Object *gravity_object; } Sculpt; diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 6d805639940..c4681a33daa 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -750,6 +750,14 @@ static void rna_def_sculpt(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_ShowMask_update"); + prop = RNA_def_property(srna, "mask_opacity", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "mask_opacity"); + RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 2); + RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_ui_text(prop, "Mask Opacity", "Opacitiy of the sculpt mask"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_update"); + prop = RNA_def_property(srna, "detail_size", PROP_FLOAT, PROP_PIXEL); RNA_def_property_ui_range(prop, 0.5, 40.0, 10, 2); RNA_def_property_ui_text(prop, "Detail Size", "Maximum edge length for dynamic topology sculpting (in pixels)"); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs