Sculpt: Fix customdata_regen_active_refs

This commit is contained in:
Joseph Eagar 2021-10-05 18:38:29 -07:00
parent 12ff7b4297
commit 86ee4dc571
5 changed files with 1052 additions and 1072 deletions

View File

@ -953,6 +953,7 @@ void BKE_pbvh_update_vert_boundary_grids(PBVH *pbvh,
SculptVertRef vertex);
void BKE_pbvh_set_mdyntopo_verts(PBVH *pbvh, struct MDynTopoVert *mdyntopoverts);
#if 0
# include "DNA_meshdata_types.h"
ATTR_NO_OPT static void MV_ADD_FLAG(MDynTopoVert *mv, int flag)

View File

@ -74,7 +74,7 @@ BLI_STATIC_ASSERT(ARRAY_SIZE(((CustomData *)NULL)->typemap) == CD_NUMTYPES, "siz
static CLG_LogRef LOG = {"bke.customdata"};
bool CustomData_layout_is_same(const CustomData *_a, const CustomData *_b)
ATTR_NO_OPT bool CustomData_layout_is_same(const CustomData *_a, const CustomData *_b)
{
CustomData a = *_a;
CustomData b = *_b;
@ -2240,7 +2240,7 @@ void CustomData_update_typemap(CustomData *data)
}
}
static void customdata_regen_active_refs(CustomData *data)
void customdata_regen_active_refs(CustomData *data)
{
int i, j;
bool changed = false;
@ -2251,24 +2251,34 @@ static void customdata_regen_active_refs(CustomData *data)
CustomDataLayer *base = data->layers + data->typemap[layer->type];
int n = layer - base;
if (layer == base) {
continue;
}
layer->active = n == base->active;
layer->active_clone = n == base->active_clone;
layer->active_mask = n == base->active_mask;
layer->active_rnd = n == base->active_rnd;
}
/* regenerate active refs */
for (i = 0; i < CD_NUMTYPES; i++) {
if (data->typemap[i] != -1) {
CustomDataLayer *base = data->layers + data->typemap[i];
base->active = base->active_clone = base->active_mask = base->active_rnd = 0;
/* handle case of base layers being active */
for (int i = 0; i < CD_NUMTYPES; i++) {
if (data->typemap[i] == -1) {
continue;
}
CustomDataLayer *base = data->layers + data->typemap[i];
base->active = !base->active;
base->active_mask = !base->active_mask;
base->active_clone = !base->active_clone;
base->active_rnd = !base->active_rnd;
}
/* regenerate active refs */
/* set active n in base layer for all types */
for (i = 0; i < data->totlayer; i++) {
CustomDataLayer *layer = &data->layers[i];
CustomDataLayer *layer = data->layers + i;
CustomDataLayer *base = data->layers + data->typemap[layer->type];
int n = layer - base;

View File

@ -1598,11 +1598,15 @@ static bool edge_queue_tri_in_sphere(const EdgeQueue *q, BMFace *f)
#endif
/* Check if triangle intersects the sphere */
#if 1
float dis = dist_to_tri_sphere_simple((float *)q->center,
(float *)l->v->co,
(float *)l->next->v->co,
(float *)l->prev->v->co,
(float *)f->no);
#else
float dis = len_squared_v3v3(q->center, l->v->co);
#endif
return dis <= q->radius_squared;
}
@ -2593,14 +2597,14 @@ static void edge_queue_init(EdgeQueueContext *eq_ctx,
*
* The highest priority (lowest number) is given to the longest edge.
*/
static void long_edge_queue_create(EdgeQueueContext *eq_ctx,
PBVH *pbvh,
const float center[3],
const float view_normal[3],
float radius,
const bool use_frontface,
const bool use_projected,
const bool local_mode)
ATTR_NO_OPT static void long_edge_queue_create(EdgeQueueContext *eq_ctx,
PBVH *pbvh,
const float center[3],
const float view_normal[3],
float radius,
const bool use_frontface,
const bool use_projected,
const bool local_mode)
{
if (local_mode) {
edge_queue_create_local(

File diff suppressed because it is too large Load Diff

View File

@ -1677,6 +1677,8 @@ BMLogEntry *BM_log_entry_check_customdata(BMesh *bm, BMLog *log)
CustomData *cd1[4] = {&bm->vdata, &bm->edata, &bm->ldata, &bm->pdata};
CustomData *cd2[4] = {&entry->vdata, &entry->edata, &entry->ldata, &entry->pdata};
void customdata_regen_active_refs(CustomData * data);
for (int i = 0; i < 4; i++) {
if (!CustomData_layout_is_same(cd1[i], cd2[i])) {
printf("Customdata changed for undo\n");