Don't allocate MFace's by default
This removes CD_MASK_MFACE from CD_MASK_BAREMESH, CD_MASK_DERIVEDMESH and others. Callers that need it must explicitly add it to their data-masks.
This commit is contained in:
		@@ -1331,24 +1331,24 @@ static const char *LAYERTYPENAMES[CD_NUMTYPES] = {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
const CustomDataMask CD_MASK_BAREMESH =
 | 
			
		||||
    CD_MASK_MVERT | CD_MASK_MEDGE | CD_MASK_MFACE | CD_MASK_MLOOP | CD_MASK_MPOLY | CD_MASK_BWEIGHT;
 | 
			
		||||
    CD_MASK_MVERT | CD_MASK_MEDGE | CD_MASK_MLOOP | CD_MASK_MPOLY | CD_MASK_BWEIGHT;
 | 
			
		||||
const CustomDataMask CD_MASK_MESH =
 | 
			
		||||
    CD_MASK_MVERT | CD_MASK_MEDGE | CD_MASK_MFACE |
 | 
			
		||||
    CD_MASK_MDEFORMVERT | CD_MASK_MTFACE | CD_MASK_MCOL |
 | 
			
		||||
    CD_MASK_MVERT | CD_MASK_MEDGE |
 | 
			
		||||
    CD_MASK_MDEFORMVERT |
 | 
			
		||||
    CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR | CD_MASK_MDISPS |
 | 
			
		||||
    CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_MPOLY | CD_MASK_MLOOP |
 | 
			
		||||
    CD_MASK_MTEXPOLY | CD_MASK_RECAST | CD_MASK_PAINT_MASK |
 | 
			
		||||
    CD_MASK_GRID_PAINT_MASK | CD_MASK_MVERT_SKIN | CD_MASK_FREESTYLE_EDGE | CD_MASK_FREESTYLE_FACE |
 | 
			
		||||
    CD_MASK_CUSTOMLOOPNORMAL;
 | 
			
		||||
const CustomDataMask CD_MASK_EDITMESH =
 | 
			
		||||
    CD_MASK_MDEFORMVERT | CD_MASK_MTFACE | CD_MASK_MLOOPUV |
 | 
			
		||||
    CD_MASK_MDEFORMVERT | CD_MASK_MLOOPUV |
 | 
			
		||||
    CD_MASK_MLOOPCOL | CD_MASK_MTEXPOLY | CD_MASK_SHAPE_KEYINDEX |
 | 
			
		||||
    CD_MASK_MCOL | CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR |
 | 
			
		||||
    CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR |
 | 
			
		||||
    CD_MASK_MDISPS | CD_MASK_SHAPEKEY | CD_MASK_RECAST | CD_MASK_PAINT_MASK |
 | 
			
		||||
    CD_MASK_GRID_PAINT_MASK | CD_MASK_MVERT_SKIN | CD_MASK_CUSTOMLOOPNORMAL;
 | 
			
		||||
const CustomDataMask CD_MASK_DERIVEDMESH =
 | 
			
		||||
    CD_MASK_MDEFORMVERT | CD_MASK_MTFACE |
 | 
			
		||||
    CD_MASK_MCOL | CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_CLOTH_ORCO |
 | 
			
		||||
    CD_MASK_MDEFORMVERT |
 | 
			
		||||
    CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_CLOTH_ORCO |
 | 
			
		||||
    CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_MTEXPOLY | CD_MASK_PREVIEW_MLOOPCOL |
 | 
			
		||||
    CD_MASK_PROP_STR | CD_MASK_ORIGSPACE | CD_MASK_ORIGSPACE_MLOOP | CD_MASK_ORCO | CD_MASK_TANGENT |
 | 
			
		||||
    CD_MASK_PREVIEW_MCOL | CD_MASK_SHAPEKEY | CD_MASK_RECAST |
 | 
			
		||||
 
 | 
			
		||||
@@ -295,7 +295,8 @@ void BKE_object_handle_data_update(EvaluationContext *eval_ctx,
 | 
			
		||||
			/* this is to make sure we get render level duplis in groups:
 | 
			
		||||
			 * the derivedmesh must be created before init_render_mesh,
 | 
			
		||||
			 * since object_duplilist does dupliparticles before that */
 | 
			
		||||
			dm = mesh_create_derived_render(scene, ob, CD_MASK_BAREMESH | CD_MASK_MTFACE | CD_MASK_MCOL);
 | 
			
		||||
			CustomDataMask data_mask = CD_MASK_BAREMESH | CD_MASK_MFACE | CD_MASK_MTFACE | CD_MASK_MCOL;
 | 
			
		||||
			dm = mesh_create_derived_render(scene, ob, data_mask);
 | 
			
		||||
			dm->release(dm);
 | 
			
		||||
 | 
			
		||||
			for (psys = ob->particlesystem.first; psys; psys = psys->next)
 | 
			
		||||
 
 | 
			
		||||
@@ -215,7 +215,7 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l
 | 
			
		||||
		tmp_mmd.simple = true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	DM_set_only_copy(cddm, CD_MASK_BAREMESH | CD_MASK_MTFACE);
 | 
			
		||||
	DM_set_only_copy(cddm, CD_MASK_BAREMESH | CD_MASK_MFACE | CD_MASK_MTFACE);
 | 
			
		||||
 | 
			
		||||
	tmp_mmd.lvl = *lvl;
 | 
			
		||||
	tmp_mmd.sculptlvl = *lvl;
 | 
			
		||||
 
 | 
			
		||||
@@ -3485,7 +3485,7 @@ static int brush_add(PEData *data, short number)
 | 
			
		||||
	if (psmd->dm->deformedOnly || psys->part->use_modifier_stack)
 | 
			
		||||
		dm = psmd->dm;
 | 
			
		||||
	else {
 | 
			
		||||
		dm = mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
 | 
			
		||||
		dm = mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH | CD_MASK_MFACE);
 | 
			
		||||
		release_dm = true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -696,7 +696,7 @@ static bool remap_hair_emitter(Scene *scene, Object *ob, ParticleSystem *psys,
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		/* warning: this rebuilds target_psmd->dm! */
 | 
			
		||||
		dm = mesh_get_derived_deform(scene, target_ob, CD_MASK_BAREMESH);
 | 
			
		||||
		dm = mesh_get_derived_deform(scene, target_ob, CD_MASK_BAREMESH | CD_MASK_MFACE);
 | 
			
		||||
	}
 | 
			
		||||
	target_dm = target_psmd->dm;
 | 
			
		||||
	/* don't modify the original vertices */
 | 
			
		||||
 
 | 
			
		||||
@@ -130,6 +130,9 @@
 | 
			
		||||
 | 
			
		||||
/* ------------------------------------------------------------------------- */
 | 
			
		||||
 | 
			
		||||
#define CD_MASK_RENDER_INTERNAL \
 | 
			
		||||
    (CD_MASK_BAREMESH | CD_MASK_MFACE | CD_MASK_MTFACE | CD_MASK_MCOL)
 | 
			
		||||
 | 
			
		||||
static void split_v_renderfaces(ObjectRen *obr, int startvlak, int UNUSED(startvert), int UNUSED(usize), int vsize, int uIndex, int UNUSED(cyclu), int cyclv)
 | 
			
		||||
{
 | 
			
		||||
	int vLen = vsize-1+(!!cyclv);
 | 
			
		||||
@@ -3175,7 +3178,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
 | 
			
		||||
	/* origindex currently used when using autosmooth, or baking to vertex colors. */
 | 
			
		||||
	need_origindex = (do_autosmooth || ((re->flag & R_BAKING) && (re->r.bake_flag & R_BAKE_VCOL)));
 | 
			
		||||
 | 
			
		||||
	mask= CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL;
 | 
			
		||||
	mask = CD_MASK_RENDER_INTERNAL;
 | 
			
		||||
	if (!timeoffset)
 | 
			
		||||
		if (need_orco)
 | 
			
		||||
			mask |= CD_MASK_ORCO;
 | 
			
		||||
@@ -4581,10 +4584,12 @@ static void init_render_object_data(Render *re, ObjectRen *obr, int timeoffset)
 | 
			
		||||
			/* the emitter mesh wasn't rendered so the modifier stack wasn't
 | 
			
		||||
			 * evaluated with render settings */
 | 
			
		||||
			DerivedMesh *dm;
 | 
			
		||||
			const CustomDataMask mask = CD_MASK_RENDER_INTERNAL;
 | 
			
		||||
 | 
			
		||||
			if (re->r.scemode & R_VIEWPORT_PREVIEW)
 | 
			
		||||
				dm = mesh_create_derived_view(re->scene, ob, CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL);
 | 
			
		||||
				dm = mesh_create_derived_view(re->scene, ob, mask);
 | 
			
		||||
			else
 | 
			
		||||
				dm = mesh_create_derived_render(re->scene, ob,	CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL);
 | 
			
		||||
				dm = mesh_create_derived_render(re->scene, ob, mask);
 | 
			
		||||
			dm->release(dm);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -4884,7 +4889,7 @@ static void dupli_render_particle_set(Render *re, Object *ob, int timeoffset, in
 | 
			
		||||
			/* this is to make sure we get render level duplis in groups:
 | 
			
		||||
			 * the derivedmesh must be created before init_render_mesh,
 | 
			
		||||
			 * since object_duplilist does dupliparticles before that */
 | 
			
		||||
			dm = mesh_create_derived_render(re->scene, ob, CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL);
 | 
			
		||||
			dm = mesh_create_derived_render(re->scene, ob, CD_MASK_RENDER_INTERNAL);
 | 
			
		||||
			dm->release(dm);
 | 
			
		||||
 | 
			
		||||
			for (psys=ob->particlesystem.first; psys; psys=psys->next)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user