diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-22 18:54:48 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-22 18:55:48 +0300 |
commit | 79615c5adb46ffaa84d17b548074cec83d1071bb (patch) | |
tree | 448380708fbd10eedfe4bf2d2d978636d5cf4e6b /source/blender/makesrna | |
parent | 122e0105e29be18931731223522171bd2fc6ecbc (diff) |
Cleanup: nuke (nearly) all remaining usages of DM from RNA.
Only case remaining is a nasty ccgdm/opensubdiv update case, TBD once
subsurf case is addressed.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_main_api.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_api.c | 42 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sculpt_paint.c | 1 |
4 files changed, 19 insertions, 27 deletions
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 6ff3849e295..835d6e5117f 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -53,7 +53,6 @@ #include "BKE_camera.h" #include "BKE_collection.h" #include "BKE_curve.h" -#include "BKE_DerivedMesh.h" #include "BKE_displist.h" #include "BKE_mesh.h" #include "BKE_armature.h" diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index f86a3d8236a..7de8c30792d 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -68,7 +68,6 @@ static const EnumPropertyItem space_items[] = { #include "BKE_anim.h" #include "BKE_bvhutils.h" -#include "BKE_cdderivedmesh.h" #include "BKE_constraint.h" #include "BKE_context.h" #include "BKE_customdata.h" @@ -289,9 +288,9 @@ static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int #endif /* don't call inside a loop */ -static int dm_looptri_to_poly_index(DerivedMesh *dm, const MLoopTri *lt) +static int mesh_looptri_to_poly_index(Mesh *me_eval, const MLoopTri *lt) { - const int *index_mp_to_orig = dm->getPolyDataArray(dm, CD_ORIGINDEX); + const int *index_mp_to_orig = CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX); return index_mp_to_orig ? index_mp_to_orig[lt->poly] : lt->poly; } @@ -302,7 +301,7 @@ static void rna_Object_ray_cast( { bool success = false; - if (ob->derivedFinal == NULL) { + if (ob->runtime.mesh_eval == NULL) { BKE_reportf(reports, RPT_ERROR, "Object '%s' has no mesh data to be used for ray casting", ob->id.name + 2); return; } @@ -315,7 +314,7 @@ static void rna_Object_ray_cast( BVHTreeFromMesh treeData = {NULL}; /* no need to managing allocation or freeing of the BVH data. this is generated and freed as needed */ - bvhtree_from_mesh_get(&treeData, ob->derivedFinal, BVHTREE_FROM_LOOPTRI, 4); + BKE_bvhtree_from_mesh_get(&treeData, ob->runtime.mesh_eval, BVHTREE_FROM_LOOPTRI, 4); /* may fail if the mesh has no faces, in that case the ray-cast misses */ if (treeData.tree != NULL) { @@ -335,7 +334,7 @@ static void rna_Object_ray_cast( copy_v3_v3(r_location, hit.co); copy_v3_v3(r_normal, hit.no); - *r_index = dm_looptri_to_poly_index(ob->derivedFinal, &treeData.looptri[hit.index]); + *r_index = mesh_looptri_to_poly_index(ob->runtime.mesh_eval, &treeData.looptri[hit.index]); } } @@ -357,14 +356,14 @@ static void rna_Object_closest_point_on_mesh( { BVHTreeFromMesh treeData = {NULL}; - if (ob->derivedFinal == NULL) { + if (ob->runtime.mesh_eval == NULL) { BKE_reportf(reports, RPT_ERROR, "Object '%s' has no mesh data to be used for finding nearest point", ob->id.name + 2); return; } /* no need to managing allocation or freeing of the BVH data. this is generated and freed as needed */ - bvhtree_from_mesh_get(&treeData, ob->derivedFinal, BVHTREE_FROM_LOOPTRI, 4); + BKE_bvhtree_from_mesh_get(&treeData, ob->runtime.mesh_eval, BVHTREE_FROM_LOOPTRI, 4); if (treeData.tree == NULL) { BKE_reportf(reports, RPT_ERROR, "Object '%s' could not create internal data for finding nearest point", @@ -382,7 +381,7 @@ static void rna_Object_closest_point_on_mesh( copy_v3_v3(r_location, nearest.co); copy_v3_v3(r_normal, nearest.no); - *r_index = dm_looptri_to_poly_index(ob->derivedFinal, &treeData.looptri[nearest.index]); + *r_index = mesh_looptri_to_poly_index(ob->runtime.mesh_eval, &treeData.looptri[nearest.index]); goto finally; } @@ -409,10 +408,12 @@ static int rna_Object_is_deform_modified(Object *ob, Scene *scene, int settings) } #ifndef NDEBUG -void rna_Object_dm_info(struct Object *ob, int type, char *result) + +#include "BKE_mesh_runtime.h" + +void rna_Object_me_eval_info(struct Object *ob, int type, char *result) { - DerivedMesh *dm = NULL; - bool dm_release = false; + Mesh *me_eval = NULL; char *ret = NULL; result[0] = '\0'; @@ -420,24 +421,19 @@ void rna_Object_dm_info(struct Object *ob, int type, char *result) switch (type) { case 0: if (ob->type == OB_MESH) { - dm = CDDM_from_mesh(ob->data); - ret = DM_debug_info(dm); - dm_release = true; + me_eval = ob->data; } break; case 1: - dm = ob->derivedDeform; + me_eval = ob->runtime.mesh_deform_eval; break; case 2: - dm = ob->derivedFinal; + me_eval = ob->runtime.mesh_eval; break; } - if (dm) { - ret = DM_debug_info(dm); - if (dm_release) { - dm->release(dm); - } + if (me_eval) { + ret = BKE_mesh_runtime_debug_info(me_eval); if (ret) { strcpy(result, ret); MEM_freeN(ret); @@ -664,7 +660,7 @@ void RNA_api_object(StructRNA *srna) #ifndef NDEBUG /* mesh */ - func = RNA_def_function(srna, "dm_info", "rna_Object_dm_info"); + func = RNA_def_function(srna, "dm_info", "rna_Object_me_eval_info"); RNA_def_function_ui_description(func, "Returns a string for derived mesh data"); parm = RNA_def_enum(func, "type", mesh_dm_info_items, 0, "", "Modifier settings to apply"); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 573bbb5345b..0ebdab0c5bd 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -139,8 +139,6 @@ static const EnumPropertyItem part_hair_ren_as_items[] = { #include "BKE_cloth.h" #include "BKE_colortools.h" #include "BKE_deform.h" -#include "BKE_DerivedMesh.h" -#include "BKE_cdderivedmesh.h" #include "BKE_effect.h" #include "BKE_material.h" #include "BKE_modifier.h" diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index b89b2185a38..b1118e79354 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -104,7 +104,6 @@ const EnumPropertyItem rna_enum_symmetrize_direction_items[] = { #include "MEM_guardedalloc.h" #include "BKE_context.h" -#include "BKE_DerivedMesh.h" #include "BKE_particle.h" #include "BKE_pbvh.h" #include "BKE_pointcache.h" |