Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-07-20 04:19:59 +0300
committerHans Goudey <h.goudey@me.com>2021-07-20 04:19:59 +0300
commit59eb71afa1d11ab0a1d5f741debc6989ec511ff9 (patch)
tree6593439cff754b2f33ee66dc5bb8a3bab1fe536f /source/blender/blenkernel/intern/mesh_convert.c
parent0e9c04a3ea85866d17498e4fbbbefa6aab440dc4 (diff)
Cleanup: Make function static, use const object argument
Also use `const Curve *` instead of `const Object *`, since the function works at a lower level than objects anyway. And also remove another unused function. Since this section of code for converting curves to meshes will likely be replaced, it's nicer to see which parts actually remain used at this point.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_convert.c')
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.c90
1 files changed, 38 insertions, 52 deletions
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);