diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-06-05 07:10:29 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-06-05 07:10:29 +0400 |
commit | e03bbcec651f35baca647b1c3fe79505ad546585 (patch) | |
tree | c1f2af2cc05e90adaeff56f8420d63d71c33e79a /source/blender/makesrna/intern | |
parent | 6d9fcdf9830e26b1d5c7e5dda5d86229126599e9 (diff) |
fix [#35453] "copy mirrored uv coords" doesn't work
- made precision configurable.
- report a warning when doubles are found since they cause problems.
added Polygon.center attribute to avoid calculating in python.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 7e54f665214..85a669adcc0 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -326,10 +326,17 @@ static void rna_MeshPolygon_normal_get(PointerRNA *ptr, float *values) Mesh *me = rna_mesh(ptr); MPoly *mp = (MPoly *)ptr->data; - /* BMESH_TODO: might be faster to look for a CD_NORMALS layer and use that */ BKE_mesh_calc_poly_normal(mp, me->mloop + mp->loopstart, me->mvert, values); } +static void rna_MeshPolygon_center_get(PointerRNA *ptr, float *values) +{ + Mesh *me = rna_mesh(ptr); + MPoly *mp = (MPoly *)ptr->data; + + BKE_mesh_calc_poly_center(mp, me->mloop + mp->loopstart, me->mvert, values); +} + static float rna_MeshPolygon_area_get(PointerRNA *ptr) { Mesh *me = (Mesh *)ptr->id.data; @@ -1880,6 +1887,12 @@ static void rna_def_mpolygon(BlenderRNA *brna) RNA_def_property_float_funcs(prop, "rna_MeshPolygon_normal_get", NULL, NULL); RNA_def_property_ui_text(prop, "Face normal", "Local space unit length normal vector for this polygon"); + prop = RNA_def_property(srna, "center", PROP_FLOAT, PROP_NONE); + RNA_def_property_array(prop, 3); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_float_funcs(prop, "rna_MeshPolygon_center_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Face center", "Center of the polygon"); + prop = RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_float_funcs(prop, "rna_MeshPolygon_area_get", NULL, NULL); |