Fix mask expand

This commit is contained in:
Joseph Eagar 2021-10-07 02:19:42 -07:00
parent e11ba956d2
commit ba584f6819
5 changed files with 25 additions and 11 deletions

@ -1 +1 @@
Subproject commit 8ce0741c51afec6a12b78c1ce21a7779e1f51c69
Subproject commit 3d01b77226fcd99024ffaa0c12a6c14f22914d9f

@ -1 +1 @@
Subproject commit eed6d6cc132d194efe018996d43a36ebc8d91ad4
Subproject commit e45804a3bb753006b6aeeef78327359fc724633c

View File

@ -89,6 +89,9 @@ def rna_idprop_ui_prop_default_set(item, prop, value):
ui_data.update(default=value)
def rna_idprop_ui_prop_get(item, prop, create=False):
return rna_idprop_ui_create(item, prop, 0.0)
def rna_idprop_ui_create(
item, prop, *, default,
min=0.0, max=1.0,

View File

@ -622,7 +622,9 @@ static float *sculpt_expand_spherical_falloff_create(Object *ob, const SculptVer
* boundary to a falloff value of 0. Then, it propagates that falloff to the rest of the mesh so it
* stays parallel to the boundary, increasing the falloff value by 1 on each step.
*/
static float *sculpt_expand_boundary_topology_falloff_create(Sculpt *sd, Object *ob, const SculptVertRef v)
static float *sculpt_expand_boundary_topology_falloff_create(Sculpt *sd,
Object *ob,
const SculptVertRef v)
{
SculptSession *ss = ob->sculpt;
const int totvert = SCULPT_vertex_count_get(ss);
@ -1407,9 +1409,8 @@ static void sculpt_expand_cancel(bContext *C, wmOperator *UNUSED(op))
/**
* Callback to update mask data per PBVH node.
*/
static void sculpt_expand_mask_update_task_cb(void *__restrict userdata,
const int i,
const TaskParallelTLS *__restrict UNUSED(tls))
ATTR_NO_OPT static void sculpt_expand_mask_update_task_cb(
void *__restrict userdata, const int i, const TaskParallelTLS *__restrict UNUSED(tls))
{
SculptThreadedTaskData *data = userdata;
SculptSession *ss = data->ob->sculpt;
@ -1433,7 +1434,12 @@ static void sculpt_expand_mask_update_task_cb(void *__restrict userdata,
}
if (expand_cache->preserve) {
new_mask = max_ff(new_mask, expand_cache->original_mask[vd.index]);
if (expand_cache->invert) {
new_mask = min_ff(new_mask, expand_cache->original_mask[vd.index]);
}
else {
new_mask = max_ff(new_mask, expand_cache->original_mask[vd.index]);
}
}
if (new_mask == initial_mask) {

View File

@ -117,7 +117,8 @@ static void sculpt_expand_task_cb(void *__restrict userdata,
int vi = vd.index;
float final_mask = *vd.mask;
if (data->mask_expand_use_normals) {
if (ss->filter_cache->normal_factor[BKE_pbvh_vertex_index_to_table(ss->pbvh, SCULPT_active_vertex_get(ss))] <
if (ss->filter_cache->normal_factor[BKE_pbvh_vertex_index_to_table(
ss->pbvh, SCULPT_active_vertex_get(ss))] <
ss->filter_cache->normal_factor[vd.index]) {
final_mask = 1.0f;
}
@ -309,8 +310,11 @@ typedef struct MaskExpandFloodFillData {
bool use_normals;
} MaskExpandFloodFillData;
static bool mask_expand_floodfill_cb(
SculptSession *ss, SculptVertRef from_vref, SculptVertRef to_vref, bool is_duplicate, void *userdata)
static bool mask_expand_floodfill_cb(SculptSession *ss,
SculptVertRef from_vref,
SculptVertRef to_vref,
bool is_duplicate,
void *userdata)
{
MaskExpandFloodFillData *data = userdata;
@ -424,7 +428,8 @@ static int sculpt_mask_expand_invoke(bContext *C, wmOperator *op, const wmEvent
ss->filter_cache->mask_update_last_it = 1;
ss->filter_cache->mask_update_current_it = 1;
ss->filter_cache->mask_update_it[BKE_pbvh_vertex_index_to_table(ss->pbvh, SCULPT_active_vertex_get(ss))] = 0;
ss->filter_cache
->mask_update_it[BKE_pbvh_vertex_index_to_table(ss->pbvh, SCULPT_active_vertex_get(ss))] = 0;
copy_v3_v3(ss->filter_cache->mask_expand_initial_co, SCULPT_active_vertex_co_get(ss));