Cleanup: remove unused DerivedMesh code.

Differential Revision: https://developer.blender.org/D3736
This commit is contained in:
Sebastian Parborg 2018-09-27 15:54:10 +02:00 committed by Brecht Van Lommel
parent 975a40dceb
commit a16e5b8efa
23 changed files with 53 additions and 405 deletions

View File

@ -37,8 +37,6 @@ typedef unsigned int (*DualConTri)[3];
typedef unsigned int (*DualConLoop);
struct DerivedMesh;
typedef struct DualConInput {
DualConLoop mloop;

View File

@ -1149,60 +1149,6 @@ DerivedMesh *mesh_create_derived(Mesh *me, float (*vertCos)[3])
return dm;
}
/* XXX2.8(Sybren): can be removed once DerivedMesh port is done */
#ifdef WITH_DERIVEDMESH_DEPRECATED_FUNCS
DerivedMesh *mesh_create_derived_for_modifier(
struct Depsgraph *depsgraph, Scene *scene, Object *ob,
ModifierData *md, int build_shapekey_layers)
{
Mesh *me = ob->data;
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
DerivedMesh *dm;
KeyBlock *kb;
ModifierEvalContext mectx = {depsgraph, ob, 0};
md->scene = scene;
if (!(md->mode & eModifierMode_Realtime)) {
return NULL;
}
if (mti->isDisabled && mti->isDisabled(md, 0)) {
return NULL;
}
if (build_shapekey_layers && me->key && (kb = BLI_findlink(&me->key->block, ob->shapenr - 1))) {
BKE_keyblock_convert_to_mesh(kb, me);
}
if (mti->type == eModifierTypeType_OnlyDeform) {
int numVerts;
float (*deformedVerts)[3] = BKE_mesh_vertexCos_get(me, &numVerts);
modwrap_deformVerts(md, &mectx, NULL, deformedVerts, numVerts);
dm = mesh_create_derived(me, deformedVerts);
if (build_shapekey_layers)
add_shapekey_layers(dm, me, ob);
MEM_freeN(deformedVerts);
}
else {
DerivedMesh *tdm = mesh_create_derived(me, NULL);
if (build_shapekey_layers)
add_shapekey_layers(tdm, me, ob);
dm = modwrap_applyModifier(md, &mectx, tdm);
ASSERT_IS_VALID_DM(dm);
if (tdm != dm) tdm->release(tdm);
}
return dm;
}
#endif
static float (*get_editbmesh_orco_verts(BMEditMesh *em))[3]
{
BMIter iter;

View File

@ -113,7 +113,7 @@ typedef enum eDepsObjectComponentType {
DEG_OB_COMP_ANIMATION,
/* Transform Component (Parenting/Constraints) */
DEG_OB_COMP_TRANSFORM,
/* Geometry Component (DerivedMesh/Displist) */
/* Geometry Component (Mesh/Displist) */
DEG_OB_COMP_GEOMETRY,
/* Evaluation-Related Outer Types (with Subdata) */

View File

@ -1765,7 +1765,7 @@ void DepsgraphRelationBuilder::build_shapekeys(Key *key)
* ==========================
*
* The evaluation of geometry on objects is as follows:
* - The actual evaluated of the derived geometry (e.g. DerivedMesh, DispList)
* - The actual evaluated of the derived geometry (e.g. Mesh, DispList)
* occurs in the Geometry component of the object which references this.
* This includes modifiers, and the temporary "ubereval" for geometry.
* Therefore, each user of a piece of shared geometry data ends up evaluating

View File

@ -122,7 +122,7 @@ typedef enum eDepsNode_Type {
DEG_NODE_TYPE_ANIMATION,
/* Transform Component (Parenting/Constraints) */
DEG_NODE_TYPE_TRANSFORM,
/* Geometry Component (DerivedMesh/Displist) */
/* Geometry Component (Mesh/Displist) */
DEG_NODE_TYPE_GEOMETRY,
/* Sequencer Component (Scene Only) */
DEG_NODE_TYPE_SEQUENCER,

View File

@ -86,7 +86,6 @@ void EDBM_selectmode_to_scene(struct bContext *C);
void EDBM_mesh_make(struct Object *ob, const int select_mode, const bool add_key_index);
void EDBM_mesh_free(struct BMEditMesh *em);
void EDBM_mesh_load(struct Main *bmain, struct Object *ob);
struct DerivedMesh *EDBM_mesh_deform_dm_get(struct BMEditMesh *em);
/* flushes based on the current select mode. if in vertex select mode,
* verts select/deselect edges and faces, if in edge select mode,

View File

@ -44,7 +44,6 @@
#include "BKE_modifier.h"
#include "BKE_report.h"
#include "BKE_editmesh.h"
#include "BKE_DerivedMesh.h"
#include "BKE_unit.h"
#include "BKE_layer.h"

View File

@ -328,7 +328,7 @@ void EDBM_mesh_make(Object *ob, const int select_mode, const bool add_key_index)
}
/**
* \warning This can invalidate the #DerivedMesh cache of other objects (for linked duplicates).
* \warning This can invalidate the #Mesh runtime cache of other objects (for linked duplicates).
* Most callers should run #DEG_id_tag_update on \a ob->data, see: T46738, T46913
*/
void EDBM_mesh_load(Main *bmain, Object *ob)
@ -1367,19 +1367,6 @@ void EDBM_update_generic(BMEditMesh *em, const bool do_tessface, const bool is_d
/** \} */
/* -------------------------------------------------------------------- */
/** \name Data Access
* \{ */
DerivedMesh *EDBM_mesh_deform_dm_get(BMEditMesh *em)
{
return ((em->derivedFinal != NULL) &&
(em->derivedFinal->type == DM_TYPE_EDITBMESH) &&
(em->derivedFinal->deformedOnly != false)) ? em->derivedFinal : NULL;
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Operator Helpers
* \{ */

View File

@ -54,10 +54,14 @@ struct wmEvent;
struct wmOperator;
struct wmOperatorType;
struct wmWindowManager;
struct DMCoNo;
struct UndoStep;
enum ePaintMode;
typedef struct CoNo {
float co[3];
float no[3];
} CoNo;
/* paint_stroke.c */
typedef bool (*StrokeGetLocation)(struct bContext *C, float location[3], const float mouse[2]);
typedef bool (*StrokeTestStart)(struct bContext *C, struct wmOperator *op, const float mouse[2]);
@ -161,7 +165,7 @@ void PAINT_OT_weight_sample_group(struct wmOperatorType *ot);
struct VertProjHandle;
struct VertProjHandle *ED_vpaint_proj_handle_create(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob,
struct DMCoNo **r_vcosnos);
struct CoNo **r_vcosnos);
void ED_vpaint_proj_handle_update(
struct Depsgraph *depsgraph, struct VertProjHandle *vp_handle,
/* runtime vars */

View File

@ -2472,7 +2472,7 @@ struct VPaintData {
uint paintcol;
struct VertProjHandle *vp_handle;
struct DMCoNo *vertexcosnos;
struct CoNo *vertexcosnos;
/* modify 'me->mcol' directly, since the derived mesh is drawing from this
* array, otherwise we need to refresh the modifier stack */

View File

@ -39,7 +39,6 @@
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
#include "BKE_DerivedMesh.h" /* XXX To be removed, only used for DMCoNo struct */
#include "BKE_context.h"
#include "BKE_mesh_iterators.h"
#include "BKE_mesh_runtime.h"
@ -56,7 +55,7 @@
/* stored while painting */
struct VertProjHandle {
DMCoNo *vcosnos;
CoNo *vcosnos;
bool use_update;
@ -85,7 +84,7 @@ static void vpaint_proj_dm_map_cosnos_init__map_cb(
const float no_f[3], const short no_s[3])
{
struct VertProjHandle *vp_handle = userData;
DMCoNo *co_no = &vp_handle->vcosnos[index];
CoNo *co_no = &vp_handle->vcosnos[index];
/* check if we've been here before (normal should not be 0) */
if (!is_zero_v3(co_no->no)) {
@ -127,7 +126,7 @@ static void vpaint_proj_dm_map_cosnos_update__map_cb(
struct VertProjUpdate *vp_update = userData;
struct VertProjHandle *vp_handle = vp_update->vp_handle;
DMCoNo *co_no = &vp_handle->vcosnos[index];
CoNo *co_no = &vp_handle->vcosnos[index];
/* find closest vertex */
{
@ -187,13 +186,13 @@ static void vpaint_proj_dm_map_cosnos_update(
struct VertProjHandle *ED_vpaint_proj_handle_create(
struct Depsgraph *depsgraph, Scene *scene, Object *ob,
DMCoNo **r_vcosnos)
CoNo **r_vcosnos)
{
struct VertProjHandle *vp_handle = MEM_mallocN(sizeof(struct VertProjHandle), __func__);
Mesh *me = ob->data;
/* setup the handle */
vp_handle->vcosnos = MEM_mallocN(sizeof(DMCoNo) * me->totvert, "vertexcosnos map");
vp_handle->vcosnos = MEM_mallocN(sizeof(CoNo) * me->totvert, "vertexcosnos map");
vp_handle->use_update = false;
/* sets 'use_update' if needed */

View File

@ -258,92 +258,15 @@ bool view3d_camera_border_hack_test = false;
/* ***************** BACKBUF SEL (BBS) ********* */
#ifdef USE_MESH_DM_SELECT
static void bbs_obmode_mesh_verts__mapFunc(void *userData, int index, const float co[3],
const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
{
drawMVertOffset_userData *data = userData;
MVert *mv = &data->mvert[index];
if (!(mv->flag & ME_HIDE)) {
int selcol;
GPU_select_index_get(data->offset + index, &selcol);
immAttrib1u(data->col, selcol);
immVertex3fv(data->pos, co);
}
}
static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset)
{
drawMVertOffset_userData data;
Mesh *me = ob->data;
MVert *mvert = me->mvert;
data.mvert = mvert;
data.offset = offset;
const int imm_len = dm->getNumVerts(dm);
if (imm_len == 0) return;
GPUVertFormat *format = immVertexFormat();
data.pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
data.col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U32, 1, GPU_FETCH_INT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE));
immBeginAtMost(GPU_PRIM_POINTS, imm_len);
dm->foreachMappedVert(dm, bbs_obmode_mesh_verts__mapFunc, &data, DM_FOREACH_NOP);
immEnd();
immUnbindProgram();
}
#else
static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *UNUSED(dm), int offset)
static void bbs_obmode_mesh_verts(Object *ob, int offset)
{
Mesh *me = ob->data;
GPUBatch *batch = DRW_mesh_batch_cache_get_verts_with_select_id(me, offset);
GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
GPU_batch_draw(batch);
}
#endif
#ifdef USE_MESH_DM_SELECT
static void bbs_mesh_verts__mapFunc(void *userData, int index, const float co[3],
const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
{
drawBMOffset_userData *data = userData;
BMVert *eve = BM_vert_at_index(data->bm, index);
if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
int selcol;
GPU_select_index_get(data->offset + index, &selcol);
immAttrib1u(data->col, selcol);
immVertex3fv(data->pos, co);
}
}
static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset)
{
drawBMOffset_userData data;
data.bm = em->bm;
data.offset = offset;
GPUVertFormat *format = immVertexFormat();
data.pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
data.col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U32, 1, GPU_FETCH_INT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE));
immBeginAtMost(GPU_PRIM_POINTS, em->bm->totvert);
dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, &data, DM_FOREACH_NOP);
immEnd();
immUnbindProgram();
}
#else
static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *UNUSED(dm), int offset)
static void bbs_mesh_verts(BMEditMesh *em, int offset)
{
GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE));
@ -352,50 +275,8 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *UNUSED(dm), int offset)
GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
GPU_batch_draw(batch);
}
#endif
#ifdef USE_MESH_DM_SELECT
static void bbs_mesh_wire__mapFunc(void *userData, int index, const float v0co[3], const float v1co[3])
{
drawBMOffset_userData *data = userData;
BMEdge *eed = BM_edge_at_index(data->bm, index);
if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
int selcol;
GPU_select_index_get(data->offset + index, &selcol);
immAttrib1u(data->col, selcol);
immVertex3fv(data->pos, v0co);
immVertex3fv(data->pos, v1co);
}
}
static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *dm, int offset)
{
drawBMOffset_userData data;
data.bm = em->bm;
data.offset = offset;
GPUVertFormat *format = immVertexFormat();
const int imm_len = dm->getNumEdges(dm) * 2;
if (imm_len == 0) return;
data.pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
data.col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U32, 1, GPU_FETCH_INT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
GPU_line_width(1.0f);
immBeginAtMost(GPU_PRIM_LINES, imm_len);
dm->foreachMappedEdge(dm, bbs_mesh_wire__mapFunc, &data);
immEnd();
immUnbindProgram();
}
#else
static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *UNUSED(dm), int offset)
static void bbs_mesh_wire(BMEditMesh *em, int offset)
{
GPU_line_width(1.0f);
@ -404,63 +285,8 @@ static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *UNUSED(dm), int offset)
GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
GPU_batch_draw(batch);
}
#endif
#ifdef USE_MESH_DM_SELECT
static void bbs_mesh_face(BMEditMesh *em, DerivedMesh *dm, const bool use_select)
{
UNUSED_VARS(dm);
drawBMOffset_userData data;
data.bm = em->bm;
const int tri_len = em->tottri;
const int imm_len = tri_len * 3;
const char hflag_skip = use_select ? BM_ELEM_HIDDEN : (BM_ELEM_HIDDEN | BM_ELEM_SELECT);
if (imm_len == 0) return;
GPUVertFormat *format = immVertexFormat();
data.pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
data.col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U32, 1, GPU_FETCH_INT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
immBeginAtMost(GPU_PRIM_TRIS, imm_len);
if (use_select == false) {
int selcol;
GPU_select_index_get(0, &selcol);
immAttrib1u(data.col, selcol);
}
int index = 0;
while (index < tri_len) {
const BMFace *f = em->looptris[index][0]->f;
const int ntris = f->len - 2;
if (!BM_elem_flag_test(f, hflag_skip)) {
if (use_select) {
int selcol;
GPU_select_index_get(BM_elem_index_get(f) + 1, &selcol);
immAttrib1u(data.col, selcol);
}
for (int t = 0; t < ntris; t++) {
immVertex3fv(data.pos, em->looptris[index][0]->v->co);
immVertex3fv(data.pos, em->looptris[index][1]->v->co);
immVertex3fv(data.pos, em->looptris[index][2]->v->co);
index++;
}
}
else {
index += ntris;
}
}
immEnd();
immUnbindProgram();
}
#else
static void bbs_mesh_face(BMEditMesh *em, DerivedMesh *UNUSED(dm), const bool use_select)
static void bbs_mesh_face(BMEditMesh *em, const bool use_select)
{
Mesh *me = em->ob->data;
GPUBatch *batch;
@ -479,100 +305,31 @@ static void bbs_mesh_face(BMEditMesh *em, DerivedMesh *UNUSED(dm), const bool us
GPU_batch_draw(batch);
}
}
#endif
#ifdef USE_MESH_DM_SELECT
static void bbs_mesh_solid__drawCenter(void *userData, int index, const float cent[3], const float UNUSED(no[3]))
{
drawBMOffset_userData *data = (drawBMOffset_userData *)userData;
BMFace *efa = BM_face_at_index(userData, index);
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
int selcol;
GPU_select_index_get(index + 1, &selcol);
immAttrib1u(data->col, selcol);
immVertex3fv(data->pos, cent);
}
}
static void bbs_mesh_face_dot(BMEditMesh *em, DerivedMesh *dm)
{
drawBMOffset_userData data; /* don't use offset */
data.bm = em->bm;
GPUVertFormat *format = immVertexFormat();
data.pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
data.col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U32, 1, GPU_FETCH_INT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
GPU_point_size(UI_GetThemeValuef(TH_FACEDOT_SIZE));
immBeginAtMost(GPU_PRIM_POINTS, em->bm->totface);
dm->foreachMappedFaceCenter(dm, bbs_mesh_solid__drawCenter, &data, DM_FOREACH_NOP);
immEnd();
immUnbindProgram();
}
#else
static void bbs_mesh_face_dot(BMEditMesh *em, DerivedMesh *UNUSED(dm))
static void bbs_mesh_face_dot(BMEditMesh *em)
{
Mesh *me = em->ob->data;
GPUBatch *batch = DRW_mesh_batch_cache_get_facedots_with_select_id(me, 1);
GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
GPU_batch_draw(batch);
}
#endif
/* two options, facecolors or black */
static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d,
Object *ob, DerivedMesh *dm, bool use_faceselect)
Object *ob, bool use_faceselect)
{
if (use_faceselect) {
bbs_mesh_face(em, dm, true);
bbs_mesh_face(em, true);
if (check_ob_drawface_dot(scene, v3d, ob->dt)) {
bbs_mesh_face_dot(em, dm);
bbs_mesh_face_dot(em);
}
}
else {
bbs_mesh_face(em, dm, false);
bbs_mesh_face(em, false);
}
}
#ifdef USE_MESH_DM_SELECT
/* must have called GPU_framebuffer_index_set beforehand */
static DMDrawOption bbs_mesh_solid_hide2__setDrawOpts(void *userData, int index)
{
Mesh *me = userData;
if (!(me->mpoly[index].flag & ME_HIDE)) {
return DM_DRAW_OPTION_NORMAL;
}
else {
return DM_DRAW_OPTION_SKIP;
}
}
static void bbs_mesh_solid_verts(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
Mesh *me = ob->data;
DerivedMesh *dm = mesh_get_derived_final(depsgraph, scene, ob, scene->customdata_mask);
DM_update_materials(dm, ob);
/* Only draw faces to mask out verts, we don't want their selection ID's. */
const int G_f_orig = G.f;
G.f &= ~G_BACKBUFSEL;
dm->drawMappedFaces(dm, bbs_mesh_solid_hide2__setDrawOpts, NULL, NULL, me, DM_DRAW_SKIP_HIDDEN);
G.f |= (G_f_orig & G_BACKBUFSEL);
bbs_obmode_mesh_verts(ob, dm, 1);
bm_vertoffs = me->totvert + 1;
dm->release(dm);
}
#else
static void bbs_mesh_solid_verts(Depsgraph *UNUSED(depsgraph), Scene *UNUSED(scene), Object *ob)
{
Mesh *me = ob->data;
@ -593,10 +350,9 @@ static void bbs_mesh_solid_verts(Depsgraph *UNUSED(depsgraph), Scene *UNUSED(sce
G.f |= (G_f_orig & G_BACKBUFSEL);
bbs_obmode_mesh_verts(ob, NULL, 1);
bbs_obmode_mesh_verts(ob, 1);
bm_vertoffs = me->totvert + 1;
}
#endif
static void bbs_mesh_solid_faces(Scene *UNUSED(scene), Object *ob)
{
@ -632,13 +388,9 @@ void draw_object_backbufsel(
Mesh *me = ob->data;
BMEditMesh *em = me->edit_btmesh;
DerivedMesh *dm = editbmesh_get_derived_cage(depsgraph, scene, ob, em, CD_MASK_BAREMESH);
BM_mesh_elem_table_ensure(em->bm, BM_VERT | BM_EDGE | BM_FACE);
DM_update_materials(dm, ob);
bbs_mesh_solid_EM(em, scene, v3d, ob, dm, (select_mode & SCE_SELECT_FACE) != 0);
bbs_mesh_solid_EM(em, scene, v3d, ob, (select_mode & SCE_SELECT_FACE) != 0);
if (select_mode & SCE_SELECT_FACE)
bm_solidoffs = 1 + em->bm->totface;
else {
@ -649,7 +401,7 @@ void draw_object_backbufsel(
/* we draw edges if edge select mode */
if (select_mode & SCE_SELECT_EDGE) {
bbs_mesh_wire(em, dm, bm_solidoffs);
bbs_mesh_wire(em, bm_solidoffs);
bm_wireoffs = bm_solidoffs + em->bm->totedge;
}
else {
@ -659,7 +411,7 @@ void draw_object_backbufsel(
/* we draw verts if vert select mode. */
if (select_mode & SCE_SELECT_VERTEX) {
bbs_mesh_verts(em, dm, bm_wireoffs);
bbs_mesh_verts(em, bm_wireoffs);
bm_vertoffs = bm_wireoffs + em->bm->totvert;
}
else {
@ -667,8 +419,6 @@ void draw_object_backbufsel(
}
ED_view3d_polygon_offset(rv3d, 0.0);
dm->release(dm);
}
else {
Mesh *me = ob->data;

View File

@ -45,7 +45,7 @@ struct MPoly;
struct MVert;
struct PBVH;
/* Buffers for non-DerivedMesh drawing */
/* Buffers for drawing from PBVH grids. */
typedef struct GPU_PBVH_Buffers GPU_PBVH_Buffers;
/* build */

View File

@ -69,7 +69,6 @@
#include "BKE_material.h"
#include "BKE_node.h"
#include "BKE_scene.h"
#include "BKE_DerivedMesh.h"
#include "GPU_draw.h"
#include "GPU_extensions.h"

View File

@ -95,7 +95,7 @@ typedef struct MLoop {
* There is no attempt to maintain this data's validity over time, any changes to the underlying mesh
* invalidate the #MLoopTri array, which will need to be re-calculated.
*
* Users normally access this via #DerivedMesh.getLoopTriArray.
* Users normally access this via #BKE_mesh_runtime_looptri_ensure.
* In rare cases its calculated directly, with #BKE_mesh_recalc_looptri.
*
* Typical usage includes:

View File

@ -43,7 +43,6 @@
#include "BKE_animsys.h"
#include "BKE_data_transfer.h"
#include "BKE_DerivedMesh.h"
#include "BKE_dynamicpaint.h"
#include "BKE_effect.h"
#include "BKE_mesh_mapping.h"

View File

@ -100,7 +100,6 @@ static const EnumPropertyItem rna_enum_studio_light_orientation_items[] = {
#include "DNA_screen_types.h"
#include "BKE_blender.h"
#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_main.h"
@ -468,11 +467,7 @@ static void rna_userdef_opensubdiv_update(Main *bmain, Scene *UNUSED(scene), Poi
object;
object = object->id.next)
{
if (object->derivedFinal != NULL &&
object->derivedFinal->type == DM_TYPE_CCGDM)
{
DEG_id_tag_update(&object->id, OB_RECALC_OB);
}
DEG_id_tag_update(&object->id, OB_RECALC_OB);
}
}

View File

@ -164,7 +164,7 @@ void fluidsim_free(FluidsimModifierData *fluidmd)
}
#ifdef WITH_MOD_FLUID
/* read .bobj.gz file into a fluidsimDerivedMesh struct */
/* read .bobj.gz file into a fluidsimMesh struct */
static Mesh *fluidsim_read_obj(const char *filename, const MPoly *mp_example)
{
int wri = 0, i;

View File

@ -183,38 +183,6 @@ static bool dependsOnNormals(ModifierData *md)
return (omd->geometry_mode != MOD_OCEAN_GEOM_GENERATE);
}
#if 0
static void dm_get_bounds(DerivedMesh *dm, float *sx, float *sy, float *ox, float *oy)
{
/* get bounding box of underlying dm */
int v, totvert = dm->getNumVerts(dm);
float min[3], max[3], delta[3];
MVert *mvert = dm->getVertDataArray(dm, 0);
copy_v3_v3(min, mvert->co);
copy_v3_v3(max, mvert->co);
for (v = 1; v < totvert; v++, mvert++) {
min[0] = min_ff(min[0], mvert->co[0]);
min[1] = min_ff(min[1], mvert->co[1]);
min[2] = min_ff(min[2], mvert->co[2]);
max[0] = max_ff(max[0], mvert->co[0]);
max[1] = max_ff(max[1], mvert->co[1]);
max[2] = max_ff(max[2], mvert->co[2]);
}
sub_v3_v3v3(delta, max, min);
*sx = delta[0];
*sy = delta[1];
*ox = min[0];
*oy = min[1];
}
#endif
#ifdef WITH_OCEANSIM
typedef struct GenerateOceanGeometryData {

View File

@ -35,7 +35,6 @@
#include "DNA_material_types.h"
#include "BKE_customdata.h"
#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_library.h"

View File

@ -48,10 +48,14 @@
#ifndef MATH_STANDALONE
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "BKE_customdata.h"
#include "BKE_DerivedMesh.h"
#include "BKE_editmesh_bvh.h"
#include "BKE_library.h"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
#include "bmesh.h"
@ -1045,7 +1049,7 @@ static PyObject *C_BVHTree_FromBMesh(PyObject *UNUSED(cls), PyObject *args, PyOb
}
/* return various derived meshes based on requested settings */
static DerivedMesh *bvh_get_derived_mesh(
static Mesh *bvh_get_mesh(
const char *funcname, struct Scene *scene, Object *ob,
bool use_deform, bool use_render, bool use_cage)
{
@ -1130,7 +1134,7 @@ static PyObject *C_BVHTree_FromObject(PyObject *UNUSED(cls), PyObject *args, PyO
PyObject *py_ob, *py_scene;
Object *ob;
struct Scene *scene;
DerivedMesh *dm;
Mesh *mesh;
bool use_deform = true;
bool use_render = false;
bool use_cage = false;
@ -1156,24 +1160,27 @@ static PyObject *C_BVHTree_FromObject(PyObject *UNUSED(cls), PyObject *args, PyO
return NULL;
}
dm = bvh_get_derived_mesh("BVHTree", scene, ob, use_deform, use_render, use_cage);
if (dm == NULL) {
mesh = bvh_get_mesh("BVHTree", scene, ob, use_deform, use_render, use_cage);
if (mesh == NULL) {
return NULL;
}
/* Get data for tessellation */
{
lt = dm->getLoopTriArray(dm);
lt = BKE_mesh_runtime_looptri_ensure(mesh);
tris_len = (unsigned int)dm->getNumLoopTri(dm);
coords_len = (unsigned int)dm->getNumVerts(dm);
tris_len = (unsigned int)BKE_mesh_runtime_looptri_len(mesh);
coords_len = (unsigned int)mesh->totvert;
coords = MEM_mallocN(sizeof(*coords) * (size_t)coords_len, __func__);
tris = MEM_mallocN(sizeof(*tris) * (size_t)tris_len, __func__);
dm->getVertCos(dm, coords);
MVert *mv = mesh->mvert;
for (int i = 0; i < mesh->totvert; i++, mv++) {
copy_v3_v3(coords[i], mv->co);
}
mloop = dm->getLoopArray(dm);
mloop = mesh->mloop;
}
{
@ -1186,7 +1193,8 @@ static PyObject *C_BVHTree_FromObject(PyObject *UNUSED(cls), PyObject *args, PyO
tree = BLI_bvhtree_new((int)tris_len, epsilon, PY_BVH_TREE_TYPE_DEFAULT, PY_BVH_AXIS_DEFAULT);
if (tree) {
orig_index = MEM_mallocN(sizeof(*orig_index) * (size_t)tris_len, __func__);
orig_normal = dm->getPolyDataArray(dm, CD_NORMAL); /* can be NULL */
CustomData *pdata = &mesh->pdata;
orig_normal = CustomData_get_layer(pdata, CD_NORMAL); /* can be NULL */
if (orig_normal) {
orig_normal = MEM_dupallocN(orig_normal);
}
@ -1209,7 +1217,7 @@ static PyObject *C_BVHTree_FromObject(PyObject *UNUSED(cls), PyObject *args, PyO
BLI_bvhtree_balance(tree);
}
dm->release(dm);
BKE_id_free(NULL, mesh);
return bvhtree_CreatePyObject(
tree, epsilon,

View File

@ -37,7 +37,6 @@
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* called by meshtools */
struct DerivedMesh;
struct Depsgraph;
struct ImagePool;
struct MTex;

View File

@ -55,7 +55,6 @@
#include "BKE_animsys.h"
#include "BKE_colorband.h"
#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_material.h"