Cleanup: Remove old deprecated DerivedMesh functions
Were ifdef-ed for a long time.
This commit is contained in:
parent
7bf1eca495
commit
93aecd2b81
Notes:
blender-bot
2024-03-22 15:57:27 +01:00
Referenced by commit d2e473a2dd
, Cleanup: Remove unused "for_orco" argument to curve evaluation
|
@ -1199,136 +1199,6 @@ static void displist_surf_indices(DispList *dl)
|
|||
}
|
||||
}
|
||||
|
||||
/* XXX2.8(Sybren): unused function; impossible to test after porting to Mesh */
|
||||
#ifdef WITH_DERIVEDMESH_DEPRECATED_FUNCS
|
||||
static DerivedMesh *create_orco_dm(Depsgraph *depsgraph, Scene *scene, Object *ob)
|
||||
{
|
||||
DerivedMesh *dm;
|
||||
ListBase disp = {NULL, NULL};
|
||||
|
||||
/* OrcoDM should be created from underformed disp lists */
|
||||
BKE_displist_make_curveTypes_forOrco(depsgraph, scene, ob, &disp);
|
||||
dm = CDDM_from_curve_displist(ob, &disp);
|
||||
|
||||
BKE_displist_free(&disp);
|
||||
|
||||
return dm;
|
||||
}
|
||||
|
||||
static void add_orco_dm(Object *ob, DerivedMesh *dm, DerivedMesh *orcodm)
|
||||
{
|
||||
float(*orco)[3], (*layerorco)[3];
|
||||
int totvert, a;
|
||||
Curve *cu = ob->data;
|
||||
|
||||
totvert = dm->getNumVerts(dm);
|
||||
|
||||
orco = MEM_callocN(sizeof(float) * 3 * totvert, "dm orco");
|
||||
|
||||
if (orcodm->getNumVerts(orcodm) == totvert) {
|
||||
orcodm->getVertCos(orcodm, orco);
|
||||
}
|
||||
else {
|
||||
dm->getVertCos(dm, orco);
|
||||
}
|
||||
|
||||
for (a = 0; a < totvert; a++) {
|
||||
float *co = orco[a];
|
||||
co[0] = (co[0] - cu->loc[0]) / cu->size[0];
|
||||
co[1] = (co[1] - cu->loc[1]) / cu->size[1];
|
||||
co[2] = (co[2] - cu->loc[2]) / cu->size[2];
|
||||
}
|
||||
|
||||
if ((layerorco = DM_get_vert_data_layer(dm, CD_ORCO))) {
|
||||
memcpy(layerorco, orco, sizeof(float) * totvert);
|
||||
MEM_freeN(orco);
|
||||
}
|
||||
else {
|
||||
DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, orco);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* XXX2.8(Sybren): unused function; impossible to test after porting to Mesh */
|
||||
#ifdef WITH_DERIVEDMESH_DEPRECATED_FUNCS
|
||||
static void curve_calc_orcodm(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
DerivedMesh *dm_final,
|
||||
const bool for_render,
|
||||
const bool use_render_resolution)
|
||||
{
|
||||
/* this function represents logic of mesh's orcodm calculation
|
||||
* for displist-based objects
|
||||
*/
|
||||
VirtualModifierData virtualModifierData;
|
||||
ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData);
|
||||
ModifierData *pretessellatePoint;
|
||||
Curve *cu = ob->data;
|
||||
int required_mode;
|
||||
const bool editmode = (!for_render && (cu->editnurb || cu->editfont));
|
||||
DerivedMesh *ndm, *orcodm = NULL;
|
||||
ModifierApplyFlag app_flag = MOD_APPLY_ORCO;
|
||||
|
||||
if (use_render_resolution) {
|
||||
app_flag |= MOD_APPLY_RENDER;
|
||||
required_mode = eModifierMode_Render;
|
||||
}
|
||||
else {
|
||||
required_mode = eModifierMode_Realtime;
|
||||
}
|
||||
|
||||
const ModifierEvalContext mectx = {depsgraph, ob, app_flag};
|
||||
|
||||
pretessellatePoint = curve_get_tessellate_point(scene, ob, use_render_resolution, editmode);
|
||||
|
||||
if (editmode) {
|
||||
required_mode |= eModifierMode_Editmode;
|
||||
}
|
||||
|
||||
if (pretessellatePoint) {
|
||||
md = pretessellatePoint->next;
|
||||
}
|
||||
|
||||
/* If modifiers are disabled, we wouldn't be here because
|
||||
* this function is only called if there're enabled constructive
|
||||
* modifiers applied on the curve.
|
||||
*
|
||||
* This means we can create ORCO DM in advance and assume it's
|
||||
* never NULL.
|
||||
*/
|
||||
orcodm = create_orco_dm(depsgraph, scene, ob);
|
||||
|
||||
for (; md; md = md->next) {
|
||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||
|
||||
md->scene = scene;
|
||||
|
||||
if (!modifier_isEnabled(scene, md, required_mode)) {
|
||||
continue;
|
||||
}
|
||||
if (mti->type != eModifierTypeType_Constructive) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ndm = modwrap_applyModifier(md, &mectx, orcodm);
|
||||
|
||||
if (ndm) {
|
||||
/* if the modifier returned a new dm, release the old one */
|
||||
if (orcodm && orcodm != ndm) {
|
||||
orcodm->release(orcodm);
|
||||
}
|
||||
orcodm = ndm;
|
||||
}
|
||||
}
|
||||
|
||||
/* add an orco layer if needed */
|
||||
add_orco_dm(ob, dm_final, orcodm);
|
||||
|
||||
orcodm->release(orcodm);
|
||||
}
|
||||
#endif
|
||||
|
||||
void BKE_displist_make_surf(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
|
|
Loading…
Reference in New Issue