Added detail_size to local dyntopo brush settings
This commit is contained in:
parent
fdc6fb2c53
commit
73c590e1eb
|
@ -814,6 +814,7 @@ class VIEW3D_PT_sculpt_dyntopo_advanced(Panel, View3DPaintPanel):
|
|||
do_prop("collapse")
|
||||
do_prop("cleanup")
|
||||
do_prop("spacing")
|
||||
do_prop("detail_size")
|
||||
do_prop("detail_range")
|
||||
do_prop("detail_percent")
|
||||
do_prop("constant_detail")
|
||||
|
|
|
@ -1953,7 +1953,9 @@ void BKE_brush_sculpt_reset(Brush *br)
|
|||
break;
|
||||
|
||||
case SCULPT_TOOL_SIMPLIFY:
|
||||
br->dyntopo.inherit = DYNTOPO_INHERIT_BITMASK &
|
||||
//don't use DYNTOPO_INHERIT_BITMASK, we want to include
|
||||
//future bits
|
||||
br->dyntopo.inherit = 0x7FFFFFFF &
|
||||
~(DYNTOPO_INHERIT_ALL | DYNTOPO_SUBDIVIDE | DYNTOPO_COLLAPSE);
|
||||
br->dyntopo.flag |= DYNTOPO_COLLAPSE | DYNTOPO_SUBDIVIDE;
|
||||
br->autosmooth_factor = 0.02;
|
||||
|
@ -2615,12 +2617,15 @@ void BKE_brush_get_dyntopo(Brush *brush, Sculpt *sd, DynTopoSettings *out)
|
|||
brush->dyntopo = *out = brush2.dyntopo;
|
||||
|
||||
brush_free_data((ID *)&brush2);
|
||||
} else if (!out->detail_size) {
|
||||
brush->dyntopo.inherit |= DYNTOPO_INHERIT_DETAIL_SIZE;
|
||||
brush->dyntopo.detail_size = 12.0;
|
||||
}
|
||||
|
||||
int inherit = out->inherit;
|
||||
|
||||
if (inherit & DYNTOPO_INHERIT_ALL) {
|
||||
inherit = 0x7FFFFFF;
|
||||
inherit = 0x7FFFFFFF;
|
||||
}
|
||||
|
||||
if (inherit & DYNTOPO_INHERIT_MODE) {
|
||||
|
@ -2638,6 +2643,10 @@ void BKE_brush_get_dyntopo(Brush *brush, Sculpt *sd, DynTopoSettings *out)
|
|||
}
|
||||
}
|
||||
|
||||
if (inherit & DYNTOPO_INHERIT_DETAIL_SIZE) {
|
||||
out->detail_size = sd->detail_size;
|
||||
}
|
||||
|
||||
if (inherit & DYNTOPO_INHERIT_DETAIL_RANGE) {
|
||||
out->detail_range = sd->detail_range;
|
||||
}
|
||||
|
|
|
@ -8590,7 +8590,7 @@ static void sculpt_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
|
|||
else {
|
||||
BKE_pbvh_bmesh_detail_size_set(ss->pbvh,
|
||||
(ss->cache->radius / ss->cache->dyntopo_pixel_radius) *
|
||||
(sd->detail_size * U.pixelsize) / 0.4f,
|
||||
(brush->cached_dyntopo.detail_size * U.pixelsize) / 0.4f,
|
||||
brush->cached_dyntopo.detail_range);
|
||||
}
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ static void pose_solve_scale_chain(SculptPoseIKChain *ik_chain, const float scal
|
|||
}
|
||||
}
|
||||
|
||||
static void do_pose_brush_task_cb_ex(void *__restrict userdata,
|
||||
ATTR_NO_OPT static void do_pose_brush_task_cb_ex(void *__restrict userdata,
|
||||
const int n,
|
||||
const TaskParallelTLS *__restrict UNUSED(tls))
|
||||
{
|
||||
|
@ -222,7 +222,7 @@ typedef struct PoseGrowFactorTLSData {
|
|||
int pos_count;
|
||||
} PoseGrowFactorTLSData;
|
||||
|
||||
static void pose_brush_grow_factor_task_cb_ex(void *__restrict userdata,
|
||||
ATTR_NO_OPT static void pose_brush_grow_factor_task_cb_ex(void *__restrict userdata,
|
||||
const int n,
|
||||
const TaskParallelTLS *__restrict tls)
|
||||
{
|
||||
|
@ -255,7 +255,7 @@ static void pose_brush_grow_factor_task_cb_ex(void *__restrict userdata,
|
|||
BKE_pbvh_vertex_iter_end;
|
||||
}
|
||||
|
||||
static void pose_brush_grow_factor_reduce(const void *__restrict UNUSED(userdata),
|
||||
ATTR_NO_OPT static void pose_brush_grow_factor_reduce(const void *__restrict UNUSED(userdata),
|
||||
void *__restrict chunk_join,
|
||||
void *__restrict chunk)
|
||||
{
|
||||
|
@ -267,7 +267,7 @@ static void pose_brush_grow_factor_reduce(const void *__restrict UNUSED(userdata
|
|||
|
||||
/* Grow the factor until its boundary is near to the offset pose origin or outside the target
|
||||
* distance. */
|
||||
static void sculpt_pose_grow_pose_factor(Sculpt *sd,
|
||||
ATTR_NO_OPT static void sculpt_pose_grow_pose_factor(Sculpt *sd,
|
||||
Object *ob,
|
||||
SculptSession *ss,
|
||||
float pose_origin[3],
|
||||
|
@ -549,7 +549,7 @@ static bool pose_face_sets_floodfill_cb(
|
|||
* \param r_pose_origin: Must be a valid pointer.
|
||||
* \param r_pose_factor: Optional, when set to NULL it won't be calculated.
|
||||
*/
|
||||
void SCULPT_pose_calc_pose_data(Sculpt *sd,
|
||||
ATTR_NO_OPT void SCULPT_pose_calc_pose_data(Sculpt *sd,
|
||||
Object *ob,
|
||||
SculptSession *ss,
|
||||
float initial_location[3],
|
||||
|
@ -635,7 +635,7 @@ static SculptPoseIKChain *pose_ik_chain_new(const int totsegments, const int tot
|
|||
}
|
||||
|
||||
/* Init the origin/head pairs of all the segments from the calculated origins. */
|
||||
static void pose_ik_chain_origin_heads_init(SculptPoseIKChain *ik_chain,
|
||||
ATTR_NO_OPT static void pose_ik_chain_origin_heads_init(SculptPoseIKChain *ik_chain,
|
||||
const float initial_location[3])
|
||||
{
|
||||
float origin[3];
|
||||
|
@ -671,7 +671,7 @@ static int pose_brush_num_effective_segments(const Brush *brush)
|
|||
return brush->pose_ik_segments;
|
||||
}
|
||||
|
||||
static SculptPoseIKChain *pose_ik_chain_init_topology(Sculpt *sd,
|
||||
ATTR_NO_OPT static SculptPoseIKChain *pose_ik_chain_init_topology(Sculpt *sd,
|
||||
Object *ob,
|
||||
SculptSession *ss,
|
||||
Brush *br,
|
||||
|
@ -753,7 +753,7 @@ static SculptPoseIKChain *pose_ik_chain_init_topology(Sculpt *sd,
|
|||
return ik_chain;
|
||||
}
|
||||
|
||||
static SculptPoseIKChain *pose_ik_chain_init_face_sets(
|
||||
ATTR_NO_OPT static SculptPoseIKChain *pose_ik_chain_init_face_sets(
|
||||
Sculpt *sd, Object *ob, SculptSession *ss, Brush *br, const float radius)
|
||||
{
|
||||
|
||||
|
@ -862,7 +862,7 @@ static bool pose_face_sets_fk_find_masked_floodfill_cb(
|
|||
return SCULPT_vertex_has_face_set(ss, to_vr, data->initial_face_set);
|
||||
}
|
||||
|
||||
static bool pose_face_sets_fk_set_weights_floodfill_cb(
|
||||
ATTR_NO_OPT static bool pose_face_sets_fk_set_weights_floodfill_cb(
|
||||
SculptSession *ss, SculptVertRef UNUSED(from_v), SculptVertRef to_v, bool UNUSED(is_duplicate), void *userdata)
|
||||
{
|
||||
PoseFloodFillData *data = userdata;
|
||||
|
@ -870,7 +870,7 @@ static bool pose_face_sets_fk_set_weights_floodfill_cb(
|
|||
return !SCULPT_vertex_has_face_set(ss, to_v, data->masked_face_set);
|
||||
}
|
||||
|
||||
static SculptPoseIKChain *pose_ik_chain_init_face_sets_fk(
|
||||
ATTR_NO_OPT static SculptPoseIKChain *pose_ik_chain_init_face_sets_fk(
|
||||
Sculpt *sd, Object *ob, SculptSession *ss, const float radius, const float *initial_location)
|
||||
{
|
||||
const int totvert = SCULPT_vertex_count_get(ss);
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
\
|
||||
.mtex = _DNA_DEFAULT_MTex, \
|
||||
.mask_mtex = _DNA_DEFAULT_MTex, \
|
||||
.dyntopo = {0.4f, 25.0f, 3.0f, DYNTOPO_COLLAPSE|DYNTOPO_SUBDIVIDE, DYNTOPO_DETAIL_RELATIVE, DYNTOPO_INHERIT_ALL, 25},\
|
||||
.dyntopo = {0.4f, 25.0f, 12.0f, 3.0f, DYNTOPO_COLLAPSE|DYNTOPO_SUBDIVIDE, DYNTOPO_DETAIL_RELATIVE, DYNTOPO_INHERIT_ALL, 25},\
|
||||
.concave_mask_factor = 0.75f\
|
||||
}
|
||||
|
||||
|
|
|
@ -631,12 +631,13 @@ enum {
|
|||
DYNTOPO_INHERIT_DETAIL_PERCENT = 1<<12,
|
||||
DYNTOPO_INHERIT_MODE = 1<<13,
|
||||
DYNTOPO_INHERIT_CONSTANT_DETAIL = 1<<14,
|
||||
DYNTOPO_INHERIT_SPACING = 1<<15
|
||||
DYNTOPO_INHERIT_SPACING = 1<<15,
|
||||
DYNTOPO_INHERIT_DETAIL_SIZE = 1<<16
|
||||
//make sure to update DYNTOPO_INHERIT_BITMASK when adding flags here
|
||||
};
|
||||
|
||||
//represents all possible inherit flags
|
||||
#define DYNTOPO_INHERIT_BITMASK ((1<<16)-1)
|
||||
#define DYNTOPO_INHERIT_BITMASK ((1<<17)-1)
|
||||
|
||||
//dyntopo mode
|
||||
enum {
|
||||
|
|
|
@ -153,10 +153,12 @@ typedef struct BrushGpencilSettings {
|
|||
typedef struct DynTopoSettings {
|
||||
float detail_range;
|
||||
float detail_percent;
|
||||
float detail_size;
|
||||
float constant_detail;
|
||||
short flag, mode;
|
||||
int inherit;
|
||||
int spacing;
|
||||
int _pad[1];
|
||||
} DynTopoSettings;
|
||||
|
||||
typedef struct Brush {
|
||||
|
|
|
@ -369,6 +369,7 @@ static EnumPropertyItem rna_enum_brush_dyntopo_inherit[] = {
|
|||
{DYNTOPO_INHERIT_CONSTANT_DETAIL, "CONSTANT_DETAIL", ICON_NONE, "Constant Detail", ""},
|
||||
{DYNTOPO_INHERIT_SPACING, "SPACING", ICON_NONE, "Spacing", ""},
|
||||
{DYNTOPO_CLEANUP, "CLEANUP", ICON_NONE, "Cleanup", ""},
|
||||
{DYNTOPO_INHERIT_DETAIL_SIZE, "DETAIL_SIZE", ICON_NONE, "Detail Size", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
|
@ -1190,6 +1191,14 @@ static void rna_def_dyntopo_settings(BlenderRNA *brna) {
|
|||
prop, "Detail Percent", "");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop = RNA_def_property(srna, "detail_size", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "detail_size");
|
||||
RNA_def_property_range(prop, 0.0, 100.0);
|
||||
RNA_def_property_ui_range(prop, 0.0, 50.0, 0.1, 4);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Detail Size", "");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop = RNA_def_property(srna, "detail_range", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "detail_range");
|
||||
RNA_def_property_range(prop, 0.0, 1.0);
|
||||
|
|
Loading…
Reference in New Issue