Mesh: mostly remove DerivedMesh for vertex parent
The exception is for subdivision surface which still uses derived mesh.
This commit is contained in:
parent
5b86899f21
commit
62a3dfec78
|
@ -2050,22 +2050,23 @@ static void give_parvert(Object *par, int nr, float vec[3])
|
|||
if (par->type == OB_MESH) {
|
||||
Mesh *me = par->data;
|
||||
BMEditMesh *em = me->edit_btmesh;
|
||||
DerivedMesh *dm;
|
||||
DerivedMesh *dm = NULL;
|
||||
Mesh *me_eval = (em) ? em->mesh_eval_final : par->runtime.mesh_eval;
|
||||
|
||||
#if 0 /* FIXME(campbell): use mesh for both. */
|
||||
dm = (em) ? em->derivedFinal : par->derivedFinal;
|
||||
#else
|
||||
/* Keep this until subsurf code ported away from derived mesh - campbell. */
|
||||
dm = par->derivedFinal;
|
||||
#endif
|
||||
if (dm && dm->type != DM_TYPE_CCGDM) {
|
||||
dm = NULL;
|
||||
}
|
||||
|
||||
if (dm) {
|
||||
if (me_eval) {
|
||||
int count = 0;
|
||||
int numVerts = dm->getNumVerts(dm);
|
||||
const int numVerts = me_eval->totvert;
|
||||
|
||||
if (nr < numVerts) {
|
||||
bool use_special_ss_case = false;
|
||||
|
||||
if (dm->type == DM_TYPE_CCGDM) {
|
||||
if (dm && dm->type == DM_TYPE_CCGDM) {
|
||||
ModifierData *md;
|
||||
VirtualModifierData virtualModifierData;
|
||||
use_special_ss_case = true;
|
||||
|
@ -2084,7 +2085,7 @@ static void give_parvert(Object *par, int nr, float vec[3])
|
|||
|
||||
if (!use_special_ss_case) {
|
||||
/* avoid dm->getVertDataArray() since it allocates arrays in the dm (not thread safe) */
|
||||
if (em && dm->type == DM_TYPE_EDITBMESH) {
|
||||
if (em && me_eval->runtime.is_original) {
|
||||
if (em->bm->elem_table_dirty & BM_VERT) {
|
||||
#ifdef VPARENT_THREADING_HACK
|
||||
BLI_mutex_lock(&vparent_lock);
|
||||
|
@ -2111,27 +2112,21 @@ static void give_parvert(Object *par, int nr, float vec[3])
|
|||
count++;
|
||||
}
|
||||
}
|
||||
else if (CustomData_has_layer(&dm->vertData, CD_ORIGINDEX) &&
|
||||
!(em && dm->type == DM_TYPE_EDITBMESH))
|
||||
else if (CustomData_has_layer(&me_eval->vdata, CD_ORIGINDEX) &&
|
||||
!(em && me_eval->runtime.is_original))
|
||||
{
|
||||
int i;
|
||||
|
||||
const int *index = CustomData_get_layer(&me_eval->vdata, CD_ORIGINDEX);
|
||||
/* Get the average of all verts with (original index == nr). */
|
||||
for (i = 0; i < numVerts; i++) {
|
||||
const int *index = dm->getVertData(dm, i, CD_ORIGINDEX);
|
||||
if (*index == nr) {
|
||||
float co[3];
|
||||
dm->getVertCo(dm, i, co);
|
||||
add_v3_v3(vec, co);
|
||||
for (int i = 0; i < numVerts; i++) {
|
||||
if (index[i] == nr) {
|
||||
add_v3_v3(vec, me_eval->mvert[i].co);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (nr < numVerts) {
|
||||
float co[3];
|
||||
dm->getVertCo(dm, nr, co);
|
||||
add_v3_v3(vec, co);
|
||||
add_v3_v3(vec, me_eval->mvert[nr].co);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
@ -2145,7 +2140,9 @@ static void give_parvert(Object *par, int nr, float vec[3])
|
|||
}
|
||||
else {
|
||||
/* use first index if its out of range */
|
||||
dm->getVertCo(dm, 0, vec);
|
||||
if (me_eval->totvert) {
|
||||
copy_v3_v3(vec, me_eval->mvert[0].co);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue