diff options
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d_toolbar.py | 1 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 13 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sculpt_paint.c | 17 |
4 files changed, 30 insertions, 6 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index d331ddd53f4..cc85471943e 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1221,6 +1221,7 @@ class VIEW3D_PT_sculpt_topology(Panel, View3DPaintPanel): sub.active = brush and brush.sculpt_tool not in ('MASK') sub.prop(sculpt, "detail_size") sub.prop(sculpt, "detail_refine_method", text="") + sub.prop(sculpt, "detail_type_method", text="") col.separator() col.prop(sculpt, "use_smooth_shading") col.operator("sculpt.optimize") diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index e2df6a4a197..9b92ca6ccf8 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4485,10 +4485,15 @@ static void sculpt_stroke_update_step(bContext *C, struct PaintStroke *UNUSED(st sculpt_update_cache_variants(C, sd, ob, itemptr); sculpt_restore_mesh(sd, ob); - BKE_pbvh_bmesh_detail_size_set(ss->pbvh, - (ss->cache->radius / - (float)ups->pixel_radius) * - (float)sd->detail_size); + if (sd->flags & SCULPT_DYNTOPO_DETAIL_CONSTANT) { + BKE_pbvh_bmesh_detail_size_set(ss->pbvh, (float)sd->detail_size/100.0f); + } + else { + BKE_pbvh_bmesh_detail_size_set(ss->pbvh, + (ss->cache->radius / + (float)ups->pixel_radius) * + (float)sd->detail_size); + } if (sculpt_stroke_dynamic_topology(ss, brush)) { do_symmetrical_brush_actions(sd, ob, sculpt_topology_update); diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 8c4026e8b67..d66a1f3ab0b 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1626,7 +1626,10 @@ typedef enum SculptFlags { /* If set, dynamic-topology brushes will subdivide short edges */ SCULPT_DYNTOPO_SUBDIVIDE = (1 << 12), /* If set, dynamic-topology brushes will collapse short edges */ - SCULPT_DYNTOPO_COLLAPSE = (1 << 11) + SCULPT_DYNTOPO_COLLAPSE = (1 << 11), + + /* If set, dynamic-topology detail size will be constant in object space */ + SCULPT_DYNTOPO_DETAIL_CONSTANT = (1 << 13) } SculptFlags; #if (DNA_DEPRECATED_GCC_POISON == 1) diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 58274589126..e13e9b3cad4 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -357,6 +357,14 @@ static void rna_def_sculpt(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem detail_type_items[] = { + {0, "RELATIVE", 0, + "Relative Detail", "Mesh detail is relative to the brush size and detail size"}, + {SCULPT_DYNTOPO_DETAIL_CONSTANT, "CONSTANT", 0, + "Constant Detail", "Mesh detail is constant in object space according to detail size"}, + {0, NULL, 0, NULL, NULL} + }; + StructRNA *srna; PropertyRNA *prop; @@ -406,7 +414,7 @@ static void rna_def_sculpt(BlenderRNA *brna) "Show diffuse color of object and overlay sculpt mask on top of it"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_ShowDiffuseColor_update"); - prop = RNA_def_property(srna, "detail_size", PROP_INT, PROP_PIXEL); + prop = RNA_def_property(srna, "detail_size", PROP_INT, PROP_NONE); RNA_def_property_ui_range(prop, 2, 100, 0, -1); RNA_def_property_ui_text(prop, "Detail Size", "Maximum edge length for dynamic topology sculpting (in pixels)"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); @@ -429,6 +437,13 @@ static void rna_def_sculpt(BlenderRNA *brna) "In dynamic-topology mode, how to add or remove mesh detail"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + prop = RNA_def_property(srna, "detail_type_method", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags"); + RNA_def_property_enum_items(prop, detail_type_items); + RNA_def_property_ui_text(prop, "Detail Type Method", + "In dynamic-topology mode, how mesh detail size is calculated"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "gravity_factor"); RNA_def_property_range(prop, 0.0f, 1.0f); |