diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-01-19 16:11:40 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-01-19 17:51:20 +0300 |
commit | 0af11a1742030c1cf2e24304a94fbb96c5138571 (patch) | |
tree | a45621e6b404d4e2e221cab3a50fe33e8265d9f0 /source/blender/makesrna/intern/rna_mesh_api.c | |
parent | 694806a9cfbfef8a8f4cfa0ab7d37a448d0f1bb3 (diff) |
Make use/computation of lnors consistant.
Issue was, when requesting (building) lnors for a mesh that has
autosmooth disabled, one would expect to simply get vnors as lnors.
Until now, it wasn't the case, which was bad e.g. for normal projections
of loops in recent remap code (projecting along split loop normals
when you would expect projection along vertex normals...).
Also, removed the 'angle' parameter from RNA's `mesh.calc_normals_split`.
This should *always* use mesh settings (both autosmooth and smoothresh),
otherwise once again we'd get inconsistencies in some cases.
Will update fbx and obj addons too.
Diffstat (limited to 'source/blender/makesrna/intern/rna_mesh_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh_api.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index cc1f57d8a14..015883d87ec 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -61,7 +61,7 @@ static const char *rna_Mesh_unit_test_compare(struct Mesh *mesh, struct Mesh *me return ret; } -static void rna_Mesh_calc_normals_split(Mesh *mesh, float min_angle) +static void rna_Mesh_calc_normals_split(Mesh *mesh) { float (*r_loopnors)[3]; float (*polynors)[3]; @@ -90,7 +90,7 @@ static void rna_Mesh_calc_normals_split(Mesh *mesh, float min_angle) BKE_mesh_normals_loop_split(mesh->mvert, mesh->totvert, mesh->medge, mesh->totedge, mesh->mloop, r_loopnors, mesh->totloop, mesh->mpoly, polynors, mesh->totpoly, - min_angle); + (mesh->flag & ME_AUTOSMOOTH) != 0, mesh->smoothresh); if (free_polynors) { MEM_freeN(polynors); @@ -117,7 +117,7 @@ static void rna_Mesh_calc_tangents(Mesh *mesh, ReportList *reports, const char * /* Compute loop normals if needed. */ if (!CustomData_has_layer(&mesh->ldata, CD_NORMAL)) { - rna_Mesh_calc_normals_split(mesh, (float)M_PI); + rna_Mesh_calc_normals_split(mesh); } BKE_mesh_loop_tangents(mesh, uvmap, r_looptangents, reports); @@ -164,10 +164,6 @@ void RNA_api_mesh(StructRNA *srna) func = RNA_def_function(srna, "calc_normals_split", "rna_Mesh_calc_normals_split"); RNA_def_function_ui_description(func, "Calculate split vertex normals, which preserve sharp edges"); - parm = RNA_def_float(func, "split_angle", M_PI, 0.0f, M_PI, "", - "Angle between polys' normals above which an edge is always sharp (180° to disable)", - 0.0f, M_PI); - RNA_def_property_subtype(parm, (PropertySubType)PROP_UNIT_ROTATION); func = RNA_def_function(srna, "free_normals_split", "rna_Mesh_free_normals_split"); RNA_def_function_ui_description(func, "Free split vertex normals"); |