modifier stack: lazy initialize normals
many modifiers were calculating normals, when those normals were ignored by the next modifier. now flag normals as dirty and recalculate for modifiers that set use `dependsOnNormals()` callback. Quick test on mesh with 12 modifiers (mostly build type), calculated normals 6 times, now it only runs once - so this will give some speedup too.
This commit is contained in:
@@ -160,6 +160,9 @@ typedef enum DMDirtyFlag {
|
|||||||
* without actually rebuilding dm (hence by defautl keeping same GPUDrawObject, and same colors
|
* without actually rebuilding dm (hence by defautl keeping same GPUDrawObject, and same colors
|
||||||
* buffer, which prevents update during a stroke!). */
|
* buffer, which prevents update during a stroke!). */
|
||||||
DM_DIRTY_MCOL_UPDATE_DRAW = 1 << 1,
|
DM_DIRTY_MCOL_UPDATE_DRAW = 1 << 1,
|
||||||
|
|
||||||
|
/* check this with modifier dependsOnNormals callback to see if normals need recalculation */
|
||||||
|
DM_DIRTY_NORMALS = 1 << 2,
|
||||||
} DMDirtyFlag;
|
} DMDirtyFlag;
|
||||||
|
|
||||||
typedef struct DerivedMesh DerivedMesh;
|
typedef struct DerivedMesh DerivedMesh;
|
||||||
@@ -560,6 +563,7 @@ void DM_free_poly_data(struct DerivedMesh *dm, int index, int count);
|
|||||||
/*sets up mpolys for a DM based on face iterators in source*/
|
/*sets up mpolys for a DM based on face iterators in source*/
|
||||||
void DM_DupPolys(DerivedMesh *source, DerivedMesh *target);
|
void DM_DupPolys(DerivedMesh *source, DerivedMesh *target);
|
||||||
|
|
||||||
|
void DM_ensure_normals(DerivedMesh *dm);
|
||||||
void DM_ensure_tessface(DerivedMesh *dm);
|
void DM_ensure_tessface(DerivedMesh *dm);
|
||||||
|
|
||||||
void DM_update_tessface_data(DerivedMesh *dm);
|
void DM_update_tessface_data(DerivedMesh *dm);
|
||||||
|
@@ -376,6 +376,14 @@ void DM_DupPolys(DerivedMesh *source, DerivedMesh *target)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DM_ensure_normals(DerivedMesh *dm)
|
||||||
|
{
|
||||||
|
if (dm->dirty & DM_DIRTY_NORMALS) {
|
||||||
|
dm->calcNormals(dm);
|
||||||
|
}
|
||||||
|
BLI_assert((dm->dirty & DM_DIRTY_NORMALS) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* note: until all modifiers can take MPoly's as input,
|
/* note: until all modifiers can take MPoly's as input,
|
||||||
* use this at the start of modifiers */
|
* use this at the start of modifiers */
|
||||||
void DM_ensure_tessface(DerivedMesh *dm)
|
void DM_ensure_tessface(DerivedMesh *dm)
|
||||||
@@ -818,16 +826,68 @@ DerivedMesh *mesh_create_derived(Mesh *me, Object *ob, float (*vertCos)[3])
|
|||||||
if (!dm)
|
if (!dm)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (vertCos)
|
if (vertCos) {
|
||||||
CDDM_apply_vert_coords(dm, vertCos);
|
CDDM_apply_vert_coords(dm, vertCos);
|
||||||
|
}
|
||||||
CDDM_calc_normals(dm);
|
|
||||||
|
|
||||||
return dm;
|
return dm;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***/
|
/***/
|
||||||
|
|
||||||
|
/* wrapper around ModifierTypeInfo.applyModifier that ensures valid normals */
|
||||||
|
|
||||||
|
static DerivedMesh *modwrap_applyModifier(
|
||||||
|
ModifierData *md, Object *ob,
|
||||||
|
DerivedMesh *dm,
|
||||||
|
ModifierApplyFlag flag)
|
||||||
|
{
|
||||||
|
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
|
if (mti->dependsOnNormals && mti->dependsOnNormals(md)) {
|
||||||
|
DM_ensure_normals(dm);
|
||||||
|
}
|
||||||
|
return mti->applyModifier(md, ob, dm, flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DerivedMesh *modwrap_applyModifierEM(
|
||||||
|
ModifierData *md, Object *ob,
|
||||||
|
BMEditMesh *em,
|
||||||
|
DerivedMesh *dm,
|
||||||
|
ModifierApplyFlag flag)
|
||||||
|
{
|
||||||
|
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
|
if (mti->dependsOnNormals && mti->dependsOnNormals(md)) {
|
||||||
|
DM_ensure_normals(dm);
|
||||||
|
}
|
||||||
|
return mti->applyModifierEM(md, ob, em, dm, flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void modwrap_deformVerts(
|
||||||
|
ModifierData *md, Object *ob,
|
||||||
|
DerivedMesh *dm,
|
||||||
|
float (*vertexCos)[3], int numVerts,
|
||||||
|
ModifierApplyFlag flag)
|
||||||
|
{
|
||||||
|
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
|
if (dm && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
|
||||||
|
DM_ensure_normals(dm);
|
||||||
|
}
|
||||||
|
mti->deformVerts(md, ob, dm, vertexCos, numVerts, flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void modwrap_deformVertsEM(
|
||||||
|
ModifierData *md, Object *ob,
|
||||||
|
BMEditMesh *em, DerivedMesh *dm,
|
||||||
|
float (*vertexCos)[3], int numVerts)
|
||||||
|
{
|
||||||
|
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||||
|
if (dm && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
|
||||||
|
DM_ensure_normals(dm);
|
||||||
|
}
|
||||||
|
mti->deformVertsEM(md, ob, em, dm, vertexCos, numVerts);
|
||||||
|
}
|
||||||
|
/* end modifier callback wrappers */
|
||||||
|
|
||||||
DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob,
|
DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob,
|
||||||
ModifierData *md, int build_shapekey_layers)
|
ModifierData *md, int build_shapekey_layers)
|
||||||
{
|
{
|
||||||
@@ -849,7 +909,7 @@ DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob,
|
|||||||
int numVerts;
|
int numVerts;
|
||||||
float (*deformedVerts)[3] = BKE_mesh_vertexCos_get(me, &numVerts);
|
float (*deformedVerts)[3] = BKE_mesh_vertexCos_get(me, &numVerts);
|
||||||
|
|
||||||
mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, 0);
|
modwrap_deformVerts(md, ob, NULL, deformedVerts, numVerts, 0);
|
||||||
dm = mesh_create_derived(me, ob, deformedVerts);
|
dm = mesh_create_derived(me, ob, deformedVerts);
|
||||||
|
|
||||||
if (build_shapekey_layers)
|
if (build_shapekey_layers)
|
||||||
@@ -863,7 +923,7 @@ DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob,
|
|||||||
if (build_shapekey_layers)
|
if (build_shapekey_layers)
|
||||||
add_shapekey_layers(tdm, me, ob);
|
add_shapekey_layers(tdm, me, ob);
|
||||||
|
|
||||||
dm = mti->applyModifier(md, ob, tdm, 0);
|
dm = modwrap_applyModifier(md, ob, tdm, 0);
|
||||||
|
|
||||||
if (tdm != dm) tdm->release(tdm);
|
if (tdm != dm) tdm->release(tdm);
|
||||||
}
|
}
|
||||||
@@ -937,8 +997,6 @@ static DerivedMesh *create_orco_dm(Object *ob, Mesh *me, BMEditMesh *em, int lay
|
|||||||
if (free) MEM_freeN(orco);
|
if (free) MEM_freeN(orco);
|
||||||
}
|
}
|
||||||
|
|
||||||
CDDM_calc_normals(dm);
|
|
||||||
|
|
||||||
return dm;
|
return dm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1372,6 +1430,20 @@ static void add_shapekey_layers(DerivedMesh *dm, Mesh *me, Object *UNUSED(ob))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called after calculating all modifiers.
|
||||||
|
*
|
||||||
|
* \note tessfaces should already be calculated.
|
||||||
|
*/
|
||||||
|
static void dm_ensure_display_normals(DerivedMesh *dm)
|
||||||
|
{
|
||||||
|
if ((dm->type == DM_TYPE_CDDM) &&
|
||||||
|
((dm->dirty & DM_DIRTY_NORMALS) || CustomData_has_layer(&dm->faceData, CD_NORMAL) == FALSE))
|
||||||
|
{
|
||||||
|
/* if normals are dirty we want to calculate vertex normals too */
|
||||||
|
CDDM_calc_normals_mapping_ex(dm, (dm->dirty & DM_DIRTY_NORMALS) ? false : true);
|
||||||
|
}
|
||||||
|
}
|
||||||
/* new value for useDeform -1 (hack for the gameengine):
|
/* new value for useDeform -1 (hack for the gameengine):
|
||||||
* - apply only the modifier stack of the object, skipping the virtual modifiers,
|
* - apply only the modifier stack of the object, skipping the virtual modifiers,
|
||||||
* - don't apply the key
|
* - don't apply the key
|
||||||
@@ -1468,7 +1540,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
|
|||||||
if (!deformedVerts)
|
if (!deformedVerts)
|
||||||
deformedVerts = BKE_mesh_vertexCos_get(me, &numVerts);
|
deformedVerts = BKE_mesh_vertexCos_get(me, &numVerts);
|
||||||
|
|
||||||
mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, deform_app_flags);
|
modwrap_deformVerts(md, ob, NULL, deformedVerts, numVerts, deform_app_flags);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
break;
|
break;
|
||||||
@@ -1491,7 +1563,6 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
|
|||||||
|
|
||||||
if (deformedVerts) {
|
if (deformedVerts) {
|
||||||
CDDM_apply_vert_coords(*deform_r, deformedVerts);
|
CDDM_apply_vert_coords(*deform_r, deformedVerts);
|
||||||
CDDM_calc_normals(*deform_r);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1582,11 +1653,10 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
|
|||||||
/* XXX, this covers bug #23673, but we may need normal calc for other types */
|
/* XXX, this covers bug #23673, but we may need normal calc for other types */
|
||||||
if (dm && dm->type == DM_TYPE_CDDM) {
|
if (dm && dm->type == DM_TYPE_CDDM) {
|
||||||
CDDM_apply_vert_coords(dm, deformedVerts);
|
CDDM_apply_vert_coords(dm, deformedVerts);
|
||||||
CDDM_calc_normals(dm);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mti->deformVerts(md, ob, dm, deformedVerts, numVerts, deform_app_flags);
|
modwrap_deformVerts(md, ob, dm, deformedVerts, numVerts, deform_app_flags);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DerivedMesh *ndm;
|
DerivedMesh *ndm;
|
||||||
@@ -1605,7 +1675,6 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
|
|||||||
dm = tdm;
|
dm = tdm;
|
||||||
|
|
||||||
CDDM_apply_vert_coords(dm, deformedVerts);
|
CDDM_apply_vert_coords(dm, deformedVerts);
|
||||||
CDDM_calc_normals(dm);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1616,7 +1685,6 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
|
|||||||
|
|
||||||
if (deformedVerts) {
|
if (deformedVerts) {
|
||||||
CDDM_apply_vert_coords(dm, deformedVerts);
|
CDDM_apply_vert_coords(dm, deformedVerts);
|
||||||
CDDM_calc_normals(dm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_init_wmcol)
|
if (do_init_wmcol)
|
||||||
@@ -1667,7 +1735,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ndm = mti->applyModifier(md, ob, dm, app_flags);
|
ndm = modwrap_applyModifier(md, ob, dm, app_flags);
|
||||||
|
|
||||||
if (ndm) {
|
if (ndm) {
|
||||||
/* if the modifier returned a new dm, release the old one */
|
/* if the modifier returned a new dm, release the old one */
|
||||||
@@ -1692,7 +1760,8 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
|
|||||||
DM_set_only_copy(orcodm, nextmask | CD_MASK_ORIGINDEX |
|
DM_set_only_copy(orcodm, nextmask | CD_MASK_ORIGINDEX |
|
||||||
(mti->requiredDataMask ?
|
(mti->requiredDataMask ?
|
||||||
mti->requiredDataMask(ob, md) : 0));
|
mti->requiredDataMask(ob, md) : 0));
|
||||||
ndm = mti->applyModifier(md, ob, orcodm, (app_flags & ~MOD_APPLY_USECACHE) | MOD_APPLY_ORCO);
|
|
||||||
|
ndm = modwrap_applyModifier(md, ob, orcodm, (app_flags & ~MOD_APPLY_USECACHE) | MOD_APPLY_ORCO);
|
||||||
|
|
||||||
if (ndm) {
|
if (ndm) {
|
||||||
/* if the modifier returned a new dm, release the old one */
|
/* if the modifier returned a new dm, release the old one */
|
||||||
@@ -1708,7 +1777,8 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
|
|||||||
|
|
||||||
nextmask &= ~CD_MASK_CLOTH_ORCO;
|
nextmask &= ~CD_MASK_CLOTH_ORCO;
|
||||||
DM_set_only_copy(clothorcodm, nextmask | CD_MASK_ORIGINDEX);
|
DM_set_only_copy(clothorcodm, nextmask | CD_MASK_ORIGINDEX);
|
||||||
ndm = mti->applyModifier(md, ob, clothorcodm, (app_flags & ~MOD_APPLY_USECACHE) | MOD_APPLY_ORCO);
|
|
||||||
|
ndm = modwrap_applyModifier(md, ob, clothorcodm, (app_flags & ~MOD_APPLY_USECACHE) | MOD_APPLY_ORCO);
|
||||||
|
|
||||||
if (ndm) {
|
if (ndm) {
|
||||||
/* if the modifier returned a new dm, release the old one */
|
/* if the modifier returned a new dm, release the old one */
|
||||||
@@ -1751,7 +1821,6 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
|
|||||||
dm->release(dm);
|
dm->release(dm);
|
||||||
|
|
||||||
CDDM_apply_vert_coords(finaldm, deformedVerts);
|
CDDM_apply_vert_coords(finaldm, deformedVerts);
|
||||||
CDDM_calc_normals(finaldm);
|
|
||||||
|
|
||||||
#if 0 /* For later nice mod preview! */
|
#if 0 /* For later nice mod preview! */
|
||||||
/* In case we need modified weights in CD_PREVIEW_MCOL, we have to re-compute it. */
|
/* In case we need modified weights in CD_PREVIEW_MCOL, we have to re-compute it. */
|
||||||
@@ -1769,22 +1838,14 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int recalc_normals = 0;
|
|
||||||
|
|
||||||
finaldm = CDDM_from_mesh(me, ob);
|
finaldm = CDDM_from_mesh(me, ob);
|
||||||
|
|
||||||
if (build_shapekey_layers) {
|
if (build_shapekey_layers) {
|
||||||
add_shapekey_layers(finaldm, me, ob);
|
add_shapekey_layers(finaldm, me, ob);
|
||||||
recalc_normals = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deformedVerts) {
|
if (deformedVerts) {
|
||||||
CDDM_apply_vert_coords(finaldm, deformedVerts);
|
CDDM_apply_vert_coords(finaldm, deformedVerts);
|
||||||
recalc_normals = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (recalc_normals) {
|
|
||||||
CDDM_calc_normals(finaldm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In this case, we should never have weight-modifying modifiers in stack... */
|
/* In this case, we should never have weight-modifying modifiers in stack... */
|
||||||
@@ -1848,11 +1909,9 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
|
|||||||
* note that this isn't a problem for subsurf (only quads) or editmode
|
* note that this isn't a problem for subsurf (only quads) or editmode
|
||||||
* which deals with drawing differently.
|
* which deals with drawing differently.
|
||||||
*
|
*
|
||||||
* Never calc vertex normals because other code ensures these are up to date.
|
* Only calc vertex normals if they are flagged as dirty.
|
||||||
*/
|
*/
|
||||||
if ((finaldm->type == DM_TYPE_CDDM) && (CustomData_has_layer(&finaldm->faceData, CD_NORMAL) == FALSE)) {
|
dm_ensure_display_normals(finaldm);
|
||||||
CDDM_calc_normals_mapping_ex(finaldm, TRUE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_GAMEENGINE
|
#ifdef WITH_GAMEENGINE
|
||||||
@@ -1984,9 +2043,9 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mti->deformVertsEM)
|
if (mti->deformVertsEM)
|
||||||
mti->deformVertsEM(md, ob, em, dm, deformedVerts, numVerts);
|
modwrap_deformVertsEM(md, ob, em, dm, deformedVerts, numVerts);
|
||||||
else
|
else
|
||||||
mti->deformVerts(md, ob, dm, deformedVerts, numVerts, 0);
|
modwrap_deformVerts(md, ob, dm, deformedVerts, numVerts, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DerivedMesh *ndm;
|
DerivedMesh *ndm;
|
||||||
@@ -1999,7 +2058,6 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
|
|||||||
dm = tdm;
|
dm = tdm;
|
||||||
|
|
||||||
CDDM_apply_vert_coords(dm, deformedVerts);
|
CDDM_apply_vert_coords(dm, deformedVerts);
|
||||||
CDDM_calc_normals(dm);
|
|
||||||
}
|
}
|
||||||
else if (cage_r && dm == *cage_r) {
|
else if (cage_r && dm == *cage_r) {
|
||||||
/* dm may be changed by this modifier, so we need to copy it
|
/* dm may be changed by this modifier, so we need to copy it
|
||||||
@@ -2013,7 +2071,6 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
|
|||||||
|
|
||||||
if (deformedVerts) {
|
if (deformedVerts) {
|
||||||
CDDM_apply_vert_coords(dm, deformedVerts);
|
CDDM_apply_vert_coords(dm, deformedVerts);
|
||||||
CDDM_calc_normals(dm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_init_wmcol) {
|
if (do_init_wmcol) {
|
||||||
@@ -2031,9 +2088,9 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
|
|||||||
DM_set_only_copy(orcodm, mask | CD_MASK_ORIGINDEX);
|
DM_set_only_copy(orcodm, mask | CD_MASK_ORIGINDEX);
|
||||||
|
|
||||||
if (mti->applyModifierEM)
|
if (mti->applyModifierEM)
|
||||||
ndm = mti->applyModifierEM(md, ob, em, orcodm, MOD_APPLY_ORCO);
|
ndm = modwrap_applyModifierEM(md, ob, em, orcodm, MOD_APPLY_ORCO);
|
||||||
else
|
else
|
||||||
ndm = mti->applyModifier(md, ob, orcodm, MOD_APPLY_ORCO);
|
ndm = modwrap_applyModifier(md, ob, orcodm, MOD_APPLY_ORCO);
|
||||||
|
|
||||||
if (ndm) {
|
if (ndm) {
|
||||||
/* if the modifier returned a new dm, release the old one */
|
/* if the modifier returned a new dm, release the old one */
|
||||||
@@ -2055,7 +2112,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mti->applyModifierEM)
|
if (mti->applyModifierEM)
|
||||||
ndm = mti->applyModifierEM(md, ob, em, dm, MOD_APPLY_USECACHE);
|
ndm = modwrap_applyModifierEM(md, ob, em, dm, MOD_APPLY_USECACHE);
|
||||||
else
|
else
|
||||||
ndm = mti->applyModifier(md, ob, dm, MOD_APPLY_USECACHE);
|
ndm = mti->applyModifier(md, ob, dm, MOD_APPLY_USECACHE);
|
||||||
|
|
||||||
@@ -2100,22 +2157,13 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
|
|||||||
if (!(cage_r && dm == *cage_r)) dm->release(dm);
|
if (!(cage_r && dm == *cage_r)) dm->release(dm);
|
||||||
|
|
||||||
CDDM_apply_vert_coords(*final_r, deformedVerts);
|
CDDM_apply_vert_coords(*final_r, deformedVerts);
|
||||||
CDDM_calc_normals(*final_r); /* was CDDM_calc_normals_mapping - campbell */
|
|
||||||
}
|
}
|
||||||
else if (dm) {
|
else if (dm) {
|
||||||
*final_r = dm;
|
*final_r = dm;
|
||||||
|
|
||||||
/* once we support skipping normal calculation with modifiers we may want to add this back */
|
|
||||||
#if 0 // was added for bmesh but is not needed
|
|
||||||
(*final_r)->calcNormals(*final_r);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else if (!deformedVerts && cage_r && *cage_r) {
|
else if (!deformedVerts && cage_r && *cage_r) {
|
||||||
/* cage should already have up to date normals */
|
/* cage should already have up to date normals */
|
||||||
*final_r = *cage_r;
|
*final_r = *cage_r;
|
||||||
#if 0 // was added for bmesh but is not needed
|
|
||||||
(*final_r)->calcNormals(*final_r);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* In this case, we should never have weight-modifying modifiers in stack... */
|
/* In this case, we should never have weight-modifying modifiers in stack... */
|
||||||
if (do_init_wmcol)
|
if (do_init_wmcol)
|
||||||
@@ -2152,6 +2200,9 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
|
|||||||
}
|
}
|
||||||
/* --- */
|
/* --- */
|
||||||
|
|
||||||
|
/* same as mesh_calc_modifiers */
|
||||||
|
dm_ensure_display_normals(*final_r);
|
||||||
|
|
||||||
/* add an orco layer if needed */
|
/* add an orco layer if needed */
|
||||||
if (dataMask & CD_MASK_ORCO)
|
if (dataMask & CD_MASK_ORCO)
|
||||||
add_orco_dm(ob, em, *final_r, orcodm, CD_ORCO);
|
add_orco_dm(ob, em, *final_r, orcodm, CD_ORCO);
|
||||||
@@ -2191,6 +2242,8 @@ static void mesh_build_data(Scene *scene, Object *ob, CustomDataMask dataMask,
|
|||||||
* but this avoids waiting on first stroke) */
|
* but this avoids waiting on first stroke) */
|
||||||
ob->sculpt->pbvh = ob->derivedFinal->getPBVH(ob, ob->derivedFinal);
|
ob->sculpt->pbvh = ob->derivedFinal->getPBVH(ob, ob->derivedFinal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BLI_assert(!(ob->derivedFinal->dirty & DM_DIRTY_NORMALS));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void editbmesh_build_data(Scene *scene, Object *obedit, BMEditMesh *em, CustomDataMask dataMask)
|
static void editbmesh_build_data(Scene *scene, Object *obedit, BMEditMesh *em, CustomDataMask dataMask)
|
||||||
@@ -2217,6 +2270,8 @@ static void editbmesh_build_data(Scene *scene, Object *obedit, BMEditMesh *em, C
|
|||||||
em->lastDataMask = dataMask;
|
em->lastDataMask = dataMask;
|
||||||
em->derivedFinal->needsFree = 0;
|
em->derivedFinal->needsFree = 0;
|
||||||
em->derivedCage->needsFree = 0;
|
em->derivedCage->needsFree = 0;
|
||||||
|
|
||||||
|
BLI_assert(!(em->derivedFinal->dirty & DM_DIRTY_NORMALS));
|
||||||
}
|
}
|
||||||
|
|
||||||
static CustomDataMask object_get_datamask(Scene *scene, Object *ob)
|
static CustomDataMask object_get_datamask(Scene *scene, Object *ob)
|
||||||
@@ -2271,6 +2326,7 @@ DerivedMesh *mesh_get_derived_final(Scene *scene, Object *ob, CustomDataMask dat
|
|||||||
if (!ob->derivedFinal || (dataMask & ob->lastDataMask) != dataMask)
|
if (!ob->derivedFinal || (dataMask & ob->lastDataMask) != dataMask)
|
||||||
mesh_build_data(scene, ob, dataMask, 0);
|
mesh_build_data(scene, ob, dataMask, 0);
|
||||||
|
|
||||||
|
if (ob->derivedFinal) { BLI_assert(!(ob->derivedFinal->dirty & DM_DIRTY_NORMALS)); }
|
||||||
return ob->derivedFinal;
|
return ob->derivedFinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2380,6 +2436,7 @@ DerivedMesh *editbmesh_get_derived_cage_and_final(Scene *scene, Object *obedit,
|
|||||||
}
|
}
|
||||||
|
|
||||||
*final_r = em->derivedFinal;
|
*final_r = em->derivedFinal;
|
||||||
|
if (em->derivedFinal) { BLI_assert(!(em->derivedFinal->dirty & DM_DIRTY_NORMALS)); }
|
||||||
return em->derivedCage;
|
return em->derivedCage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1841,6 +1841,7 @@ DerivedMesh *CDDM_from_curve_displist(Object *ob, ListBase *dispbase)
|
|||||||
|
|
||||||
dm = CDDM_new(totvert, totedge, 0, totloop, totpoly);
|
dm = CDDM_new(totvert, totedge, 0, totloop, totpoly);
|
||||||
dm->deformedOnly = 1;
|
dm->deformedOnly = 1;
|
||||||
|
dm->dirty |= DM_DIRTY_NORMALS;
|
||||||
|
|
||||||
cddm = (CDDerivedMesh *)dm;
|
cddm = (CDDerivedMesh *)dm;
|
||||||
|
|
||||||
@@ -2197,6 +2198,8 @@ void CDDM_apply_vert_coords(DerivedMesh *dm, float (*vertCoords)[3])
|
|||||||
|
|
||||||
for (i = 0; i < dm->numVertData; ++i, ++vert)
|
for (i = 0; i < dm->numVertData; ++i, ++vert)
|
||||||
copy_v3_v3(vert->co, vertCoords[i]);
|
copy_v3_v3(vert->co, vertCoords[i]);
|
||||||
|
|
||||||
|
cddm->dm.dirty |= DM_DIRTY_NORMALS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDDM_apply_vert_normals(DerivedMesh *dm, short (*vertNormals)[3])
|
void CDDM_apply_vert_normals(DerivedMesh *dm, short (*vertNormals)[3])
|
||||||
@@ -2211,6 +2214,8 @@ void CDDM_apply_vert_normals(DerivedMesh *dm, short (*vertNormals)[3])
|
|||||||
|
|
||||||
for (i = 0; i < dm->numVertData; ++i, ++vert)
|
for (i = 0; i < dm->numVertData; ++i, ++vert)
|
||||||
copy_v3_v3_short(vert->no, vertNormals[i]);
|
copy_v3_v3_short(vert->no, vertNormals[i]);
|
||||||
|
|
||||||
|
cddm->dm.dirty &= ~DM_DIRTY_NORMALS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDDM_calc_normals_mapping_ex(DerivedMesh *dm, const short only_face_normals)
|
void CDDM_calc_normals_mapping_ex(DerivedMesh *dm, const short only_face_normals)
|
||||||
@@ -2255,6 +2260,8 @@ void CDDM_calc_normals_mapping_ex(DerivedMesh *dm, const short only_face_normals
|
|||||||
|
|
||||||
CustomData_add_layer(&dm->faceData, CD_NORMAL, CD_ASSIGN,
|
CustomData_add_layer(&dm->faceData, CD_NORMAL, CD_ASSIGN,
|
||||||
face_nors, dm->numTessFaceData);
|
face_nors, dm->numTessFaceData);
|
||||||
|
|
||||||
|
cddm->dm.dirty &= ~DM_DIRTY_NORMALS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2285,6 +2292,8 @@ void CDDM_calc_normals(DerivedMesh *dm)
|
|||||||
|
|
||||||
BKE_mesh_calc_normals_poly(cddm->mvert, dm->numVertData, CDDM_get_loops(dm), CDDM_get_polys(dm),
|
BKE_mesh_calc_normals_poly(cddm->mvert, dm->numVertData, CDDM_get_loops(dm), CDDM_get_polys(dm),
|
||||||
dm->numLoopData, dm->numPolyData, poly_nors);
|
dm->numLoopData, dm->numPolyData, poly_nors);
|
||||||
|
|
||||||
|
cddm->dm.dirty &= ~DM_DIRTY_NORMALS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDDM_calc_normals_tessface(DerivedMesh *dm)
|
void CDDM_calc_normals_tessface(DerivedMesh *dm)
|
||||||
@@ -2305,6 +2314,8 @@ void CDDM_calc_normals_tessface(DerivedMesh *dm)
|
|||||||
|
|
||||||
BKE_mesh_calc_normals_tessface(cddm->mvert, dm->numVertData,
|
BKE_mesh_calc_normals_tessface(cddm->mvert, dm->numVertData,
|
||||||
cddm->mface, dm->numTessFaceData, face_nors);
|
cddm->mface, dm->numTessFaceData, face_nors);
|
||||||
|
|
||||||
|
cddm->dm.dirty &= ~DM_DIRTY_NORMALS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
@@ -74,10 +74,11 @@ typedef struct EditDerivedBMesh {
|
|||||||
float (*polyNos)[3];
|
float (*polyNos)[3];
|
||||||
} EditDerivedBMesh;
|
} EditDerivedBMesh;
|
||||||
|
|
||||||
static void emDM_calcNormals(DerivedMesh *UNUSED(dm))
|
static void emDM_calcNormals(DerivedMesh *dm)
|
||||||
{
|
{
|
||||||
/* Nothing to do: normals are already calculated and stored on the
|
/* Nothing to do: normals are already calculated and stored on the
|
||||||
* BMVerts and BMFaces */
|
* BMVerts and BMFaces */
|
||||||
|
dm->dirty &= ~DM_DIRTY_NORMALS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void emDM_recalcTessellation(DerivedMesh *UNUSED(dm))
|
static void emDM_recalcTessellation(DerivedMesh *UNUSED(dm))
|
||||||
|
@@ -157,7 +157,7 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
|
|||||||
/* note: i_alt is aligned with bmesh faces which may not always align with mpolys */
|
/* note: i_alt is aligned with bmesh faces which may not always align with mpolys */
|
||||||
mp = dm->getPolyArray(dm);
|
mp = dm->getPolyArray(dm);
|
||||||
mloop = dm->getLoopArray(dm);
|
mloop = dm->getLoopArray(dm);
|
||||||
face_normals = CustomData_get_layer(&dm->polyData, CD_NORMAL); /* can be NULL */
|
face_normals = (dm->dirty & DM_DIRTY_NORMALS) ? NULL : CustomData_get_layer(&dm->polyData, CD_NORMAL);
|
||||||
for (i = 0; i < dm->numPolyData; i++, mp++) {
|
for (i = 0; i < dm->numPolyData; i++, mp++) {
|
||||||
BMLoop *l_iter;
|
BMLoop *l_iter;
|
||||||
BMLoop *l_first;
|
BMLoop *l_first;
|
||||||
|
@@ -2602,6 +2602,7 @@ static DerivedMesh *createDomainGeometry(SmokeDomainSettings *sds, Object *ob)
|
|||||||
|
|
||||||
|
|
||||||
CDDM_calc_edges(result);
|
CDDM_calc_edges(result);
|
||||||
|
result->dirty |= DM_DIRTY_NORMALS;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3071,9 +3071,10 @@ static void ccgDM_recalcTessellation(DerivedMesh *UNUSED(dm))
|
|||||||
/* Nothing to do: CCG handles creating its own tessfaces */
|
/* Nothing to do: CCG handles creating its own tessfaces */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ccgDM_calcNormals(DerivedMesh *UNUSED(dm))
|
static void ccgDM_calcNormals(DerivedMesh *dm)
|
||||||
{
|
{
|
||||||
/* Nothing to do: CCG calculates normals during drawing */
|
/* Nothing to do: CCG calculates normals during drawing */
|
||||||
|
dm->dirty &= ~DM_DIRTY_NORMALS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
|
static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
|
||||||
|
@@ -2969,6 +2969,9 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
|
|||||||
BMEdge *eed_act = NULL;
|
BMEdge *eed_act = NULL;
|
||||||
BMVert *eve_act = NULL;
|
BMVert *eve_act = NULL;
|
||||||
|
|
||||||
|
if (cageDM) BLI_assert(!(cageDM->dirty & DM_DIRTY_NORMALS));
|
||||||
|
if (finalDM) BLI_assert(!(finalDM->dirty & DM_DIRTY_NORMALS));
|
||||||
|
|
||||||
if (em->bm->selected.last) {
|
if (em->bm->selected.last) {
|
||||||
BMEditSelection *ese = em->bm->selected.last;
|
BMEditSelection *ese = em->bm->selected.last;
|
||||||
/* face is handeled above */
|
/* face is handeled above */
|
||||||
@@ -3215,6 +3218,8 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
|
|||||||
if (!dm)
|
if (!dm)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (dm) BLI_assert(!(dm->dirty & DM_DIRTY_NORMALS));
|
||||||
|
|
||||||
/* Check to draw dynamic paint colors (or weights from WeightVG modifiers).
|
/* Check to draw dynamic paint colors (or weights from WeightVG modifiers).
|
||||||
* Note: Last "preview-active" modifier in stack will win! */
|
* Note: Last "preview-active" modifier in stack will win! */
|
||||||
if (DM_get_tessface_data_layer(dm, CD_PREVIEW_MCOL) && modifiers_isPreview(ob))
|
if (DM_get_tessface_data_layer(dm, CD_PREVIEW_MCOL) && modifiers_isPreview(ob))
|
||||||
|
@@ -565,11 +565,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
|
|||||||
|
|
||||||
if ((amd->offset_type & MOD_ARR_OFF_OBJ) && (amd->offset_ob)) {
|
if ((amd->offset_type & MOD_ARR_OFF_OBJ) && (amd->offset_ob)) {
|
||||||
/* Update normals in case offset object has rotation. */
|
/* Update normals in case offset object has rotation. */
|
||||||
|
result->dirty |= DM_DIRTY_NORMALS;
|
||||||
/* BMESH_TODO: check if normal recalc needed under any other
|
|
||||||
* conditions? */
|
|
||||||
|
|
||||||
CDDM_calc_normals(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BM_mesh_free(bm);
|
BM_mesh_free(bm);
|
||||||
@@ -591,9 +587,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
|||||||
|
|
||||||
result = arrayModifier_doArray(amd, md->scene, ob, dm, 0);
|
result = arrayModifier_doArray(amd, md->scene, ob, dm, 0);
|
||||||
|
|
||||||
//if (result != dm)
|
|
||||||
// CDDM_calc_normals_mapping(result);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -171,7 +171,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob,
|
|||||||
bm->ftoolflagpool == NULL); /* make sure we never alloc'd these */
|
bm->ftoolflagpool == NULL); /* make sure we never alloc'd these */
|
||||||
BM_mesh_free(bm);
|
BM_mesh_free(bm);
|
||||||
|
|
||||||
CDDM_calc_normals(result);
|
result->dirty |= DM_DIRTY_NORMALS;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -208,7 +208,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
|
|||||||
|
|
||||||
/* until we allow for dirty normal flag, always calc,
|
/* until we allow for dirty normal flag, always calc,
|
||||||
* note: calculating on the CDDM is faster then the BMesh equivalent */
|
* note: calculating on the CDDM is faster then the BMesh equivalent */
|
||||||
CDDM_calc_normals(result);
|
result->dirty |= DM_DIRTY_NORMALS;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -485,7 +485,7 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
|
|||||||
DM_ensure_tessface(result);
|
DM_ensure_tessface(result);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CDDM_calc_normals(result);
|
result->dirty |= DM_DIRTY_NORMALS;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -136,7 +136,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
|
|||||||
result = edgesplitModifier_do(emd, ob, derivedData);
|
result = edgesplitModifier_do(emd, ob, derivedData);
|
||||||
|
|
||||||
if (result != derivedData)
|
if (result != derivedData)
|
||||||
CDDM_calc_normals(result);
|
result->dirty |= DM_DIRTY_NORMALS;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -971,7 +971,7 @@ static DerivedMesh *explodeMesh(ExplodeModifierData *emd,
|
|||||||
/* finalization */
|
/* finalization */
|
||||||
CDDM_calc_edges_tessface(explode);
|
CDDM_calc_edges_tessface(explode);
|
||||||
CDDM_tessfaces_to_faces(explode);
|
CDDM_tessfaces_to_faces(explode);
|
||||||
CDDM_calc_normals(explode);
|
explode->dirty |= DM_DIRTY_NORMALS;
|
||||||
|
|
||||||
if (psmd->psys->lattice) {
|
if (psmd->psys->lattice) {
|
||||||
end_latt_deform(psmd->psys->lattice);
|
end_latt_deform(psmd->psys->lattice);
|
||||||
|
@@ -384,7 +384,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
|||||||
|
|
||||||
/* why is this needed? - campbell */
|
/* why is this needed? - campbell */
|
||||||
/* recalculate normals */
|
/* recalculate normals */
|
||||||
CDDM_calc_normals(result);
|
result->dirty |= DM_DIRTY_NORMALS;
|
||||||
|
|
||||||
/* free hashes */
|
/* free hashes */
|
||||||
BLI_ghash_free(vertHash, NULL, NULL);
|
BLI_ghash_free(vertHash, NULL, NULL);
|
||||||
|
@@ -330,7 +330,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
|||||||
result = mirrorModifier__doMirror(mmd, ob, derivedData);
|
result = mirrorModifier__doMirror(mmd, ob, derivedData);
|
||||||
|
|
||||||
if (result != derivedData)
|
if (result != derivedData)
|
||||||
CDDM_calc_normals(result);
|
result->dirty |= DM_DIRTY_NORMALS;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -386,6 +386,8 @@ static DerivedMesh *generate_ocean_geometry(OceanModifierData *omd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result->dirty |= DM_DIRTY_NORMALS;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -543,7 +545,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
|||||||
result = doOcean(md, ob, derivedData, 0);
|
result = doOcean(md, ob, derivedData, 0);
|
||||||
|
|
||||||
if (result != derivedData)
|
if (result != derivedData)
|
||||||
CDDM_calc_normals(result);
|
result->dirty |= DM_DIRTY_NORMALS;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -391,7 +391,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
|||||||
if (size)
|
if (size)
|
||||||
MEM_freeN(size);
|
MEM_freeN(size);
|
||||||
|
|
||||||
CDDM_calc_normals(result);
|
result->dirty |= DM_DIRTY_NORMALS;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -202,7 +202,7 @@ static DerivedMesh *applyModifier(ModifierData *md,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CDDM_calc_edges(result);
|
CDDM_calc_edges(result);
|
||||||
CDDM_calc_normals(result);
|
result->dirty |= DM_DIRTY_NORMALS;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -897,8 +897,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((ltmd->flag & MOD_SCREW_NORMAL_CALC) == 0) {
|
if ((ltmd->flag & MOD_SCREW_NORMAL_CALC) == 0) {
|
||||||
/* BMESH_TODO, we only need to get vertex normals here, this is way overkill */
|
result->dirty |= DM_DIRTY_NORMALS;
|
||||||
CDDM_calc_normals(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -1805,7 +1805,7 @@ static DerivedMesh *base_skin(DerivedMesh *origdm,
|
|||||||
BM_mesh_free(bm);
|
BM_mesh_free(bm);
|
||||||
|
|
||||||
CDDM_calc_edges(result);
|
CDDM_calc_edges(result);
|
||||||
CDDM_calc_normals(result);
|
result->dirty |= DM_DIRTY_NORMALS;
|
||||||
|
|
||||||
skin_set_orig_indices(result);
|
skin_set_orig_indices(result);
|
||||||
|
|
||||||
|
@@ -820,7 +820,7 @@ static DerivedMesh *applyModifier(
|
|||||||
|
|
||||||
/* must recalculate normals with vgroups since they can displace unevenly [#26888] */
|
/* must recalculate normals with vgroups since they can displace unevenly [#26888] */
|
||||||
if (dvert) {
|
if (dvert) {
|
||||||
CDDM_calc_normals(result);
|
result->dirty |= DM_DIRTY_NORMALS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numFaces == 0 && numEdges != 0) {
|
if (numFaces == 0 && numEdges != 0) {
|
||||||
|
@@ -54,7 +54,7 @@ static DerivedMesh *triangulate_dm(DerivedMesh *dm, const int flag)
|
|||||||
for (i = 0; i < total_edges; i++, me++)
|
for (i = 0; i < total_edges; i++, me++)
|
||||||
me->flag |= ME_EDGEDRAW | ME_EDGERENDER;
|
me->flag |= ME_EDGEDRAW | ME_EDGERENDER;
|
||||||
|
|
||||||
CDDM_calc_normals(result);
|
result->dirty |= DM_DIRTY_NORMALS;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -184,11 +184,9 @@ DerivedMesh *get_cddm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float
|
|||||||
else {
|
else {
|
||||||
dm = CDDM_copy(dm);
|
dm = CDDM_copy(dm);
|
||||||
CDDM_apply_vert_coords(dm, vertexCos);
|
CDDM_apply_vert_coords(dm, vertexCos);
|
||||||
|
dm->dirty |= DM_DIRTY_NORMALS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dm)
|
|
||||||
CDDM_calc_normals(dm);
|
|
||||||
|
|
||||||
return dm;
|
return dm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,7 +202,7 @@ DerivedMesh *get_dm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*
|
|||||||
|
|
||||||
if (vertexCos) {
|
if (vertexCos) {
|
||||||
CDDM_apply_vert_coords(dm, vertexCos);
|
CDDM_apply_vert_coords(dm, vertexCos);
|
||||||
//CDDM_calc_normals(dm);
|
dm->dirty |= DM_DIRTY_NORMALS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orco)
|
if (orco)
|
||||||
|
Reference in New Issue
Block a user