diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_mesh.h | 16 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh_convert.c | 90 |
2 files changed, 40 insertions, 66 deletions
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 6eb0ae439c9..7846619577e 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -126,8 +126,8 @@ void BKE_mesh_eval_delete(struct Mesh *mesh_eval); struct Mesh *BKE_mesh_copy_for_eval(struct Mesh *source, bool reference); /* These functions construct a new Mesh, - * contrary to BKE_mesh_from_nurbs which modifies ob itself. */ -struct Mesh *BKE_mesh_new_nomain_from_curve(struct Object *ob); + * contrary to BKE_mesh_to_curve_nurblist which modifies ob itself. */ +struct Mesh *BKE_mesh_new_nomain_from_curve(const struct Object *ob); struct Mesh *BKE_mesh_new_nomain_from_curve_displist(const struct Object *ob, const struct ListBase *dispbase); @@ -143,23 +143,11 @@ int BKE_mesh_mface_index_validate(struct MFace *mface, struct Mesh *BKE_mesh_from_object(struct Object *ob); void BKE_mesh_assign_object(struct Main *bmain, struct Object *ob, struct Mesh *me); void BKE_mesh_from_metaball(struct ListBase *lb, struct Mesh *me); -int BKE_mesh_nurbs_displist_to_mdata(const struct Object *ob, - const struct ListBase *dispbase, - struct MVert **r_allvert, - int *r_totvert, - struct MEdge **r_alledge, - int *r_totedge, - struct MLoop **r_allloop, - struct MPoly **r_allpoly, - struct MLoopUV **r_alluv, - int *r_totloop, - int *r_totpoly); void BKE_mesh_from_nurbs_displist(struct Main *bmain, struct Object *ob, struct ListBase *dispbase, const char *obdata_name, bool temporary); -void BKE_mesh_from_nurbs(struct Main *bmain, struct Object *ob); void BKE_mesh_to_curve_nurblist(const struct Mesh *me, struct ListBase *nurblist, const int edge_users_test); diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c index 71a0c6999b0..0e4fe91e577 100644 --- a/source/blender/blenkernel/intern/mesh_convert.c +++ b/source/blender/blenkernel/intern/mesh_convert.c @@ -213,19 +213,18 @@ static void make_edges_mdata_extend( /* Initialize mverts, medges and, faces for converting nurbs to mesh and derived mesh */ /* use specified dispbase */ -int BKE_mesh_nurbs_displist_to_mdata(const Object *ob, - const ListBase *dispbase, - MVert **r_allvert, - int *r_totvert, - MEdge **r_alledge, - int *r_totedge, - MLoop **r_allloop, - MPoly **r_allpoly, - MLoopUV **r_alluv, - int *r_totloop, - int *r_totpoly) +static int mesh_nurbs_displist_to_mdata(const Curve *cu, + const ListBase *dispbase, + MVert **r_allvert, + int *r_totvert, + MEdge **r_alledge, + int *r_totedge, + MLoop **r_allloop, + MPoly **r_allpoly, + MLoopUV **r_alluv, + int *r_totloop, + int *r_totpoly) { - const Curve *cu = ob->data; MVert *mvert; MPoly *mpoly; MLoop *mloop; @@ -238,7 +237,7 @@ int BKE_mesh_nurbs_displist_to_mdata(const Object *ob, /* 2d polys are filled with DL_INDEX3 displists */ (CU_DO_2DFILL(cu) == false) || /* surf polys are never filled */ - (ob->type == OB_SURF)); + BKE_curve_type_get(cu) == OB_SURF); /* count */ LISTBASE_FOREACH (const DispList *, dl, dispbase) { @@ -493,17 +492,17 @@ Mesh *BKE_mesh_new_nomain_from_curve_displist(const Object *ob, const ListBase * MLoopUV *alluv = NULL; int totvert, totedge, totloop, totpoly; - if (BKE_mesh_nurbs_displist_to_mdata(ob, - dispbase, - &allvert, - &totvert, - &alledge, - &totedge, - &allloop, - &allpoly, - &alluv, - &totloop, - &totpoly) != 0) { + if (mesh_nurbs_displist_to_mdata(ob->data, + dispbase, + &allvert, + &totvert, + &alledge, + &totedge, + &allloop, + &allpoly, + &alluv, + &totloop, + &totpoly) != 0) { /* Error initializing mdata. This often happens when curve is empty */ return BKE_mesh_new_nomain(0, 0, 0, 0, 0); } @@ -537,7 +536,7 @@ Mesh *BKE_mesh_new_nomain_from_curve_displist(const Object *ob, const ListBase * return mesh; } -Mesh *BKE_mesh_new_nomain_from_curve(Object *ob) +Mesh *BKE_mesh_new_nomain_from_curve(const Object *ob) { ListBase disp = {NULL, NULL}; @@ -555,7 +554,6 @@ void BKE_mesh_from_nurbs_displist( Object *ob1; Mesh *me_eval = (Mesh *)ob->runtime.data_eval; Mesh *me; - Curve *cu; MVert *allvert = NULL; MEdge *alledge = NULL; MLoop *allloop = NULL; @@ -563,20 +561,20 @@ void BKE_mesh_from_nurbs_displist( MPoly *allpoly = NULL; int totvert, totedge, totloop, totpoly; - cu = ob->data; + Curve *cu = ob->data; if (me_eval == NULL) { - if (BKE_mesh_nurbs_displist_to_mdata(ob, - dispbase, - &allvert, - &totvert, - &alledge, - &totedge, - &allloop, - &allpoly, - &alluv, - &totloop, - &totpoly) != 0) { + if (mesh_nurbs_displist_to_mdata(cu, + dispbase, + &allvert, + &totvert, + &alledge, + &totedge, + &allloop, + &allpoly, + &alluv, + &totloop, + &totpoly) != 0) { /* Error initializing */ return; } @@ -668,18 +666,6 @@ void BKE_mesh_from_nurbs_displist( } } -void BKE_mesh_from_nurbs(Main *bmain, Object *ob) -{ - Curve *cu = (Curve *)ob->data; - ListBase disp = {NULL, NULL}; - - if (ob->runtime.curve_cache) { - disp = ob->runtime.curve_cache->disp; - } - - BKE_mesh_from_nurbs_displist(bmain, ob, &disp, cu->id.name, false); -} - typedef struct EdgeLink { struct EdgeLink *next, *prev; void *edge; @@ -1118,8 +1104,8 @@ static Mesh *mesh_new_from_curve_type_object(Object *object) BKE_mesh_from_nurbs_displist( NULL, temp_object, &temp_object->runtime.curve_cache->disp, curve->id.name + 2, true); - /* BKE_mesh_from_nurbs changes the type to a mesh, check it worked. If it didn't the curve did - * not have any segments or otherwise would have generated an empty mesh. */ + /* BKE_mesh_from_nurbs_displist changes the type to a mesh, check it worked. If it didn't + * the curve did not have any segments or otherwise would have generated an empty mesh. */ if (temp_object->type != OB_MESH) { BKE_id_free(NULL, temp_object->data); BKE_id_free(NULL, temp_object); |