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:
authorCampbell Barton <ideasman42@gmail.com>2009-11-03 20:51:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-11-03 20:51:22 +0300
commite4f90d93799fc77c5d2c16aeb9fdbfea2d4f5148 (patch)
tree8fa1cf2353c9c905299cad6dc5a658cd5c44e57e /source/blender/makesrna/intern/rna_mesh.c
parent89c2b9a77e81dfb19dc5d4f12fda71ca74eebc42 (diff)
quick port of smart project to 2.5x, no operator options yet
Diffstat (limited to 'source/blender/makesrna/intern/rna_mesh.c')
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index bdf60849a84..2f14ab0c98c 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -128,6 +128,17 @@ static void rna_MeshFace_normal_get(PointerRNA *ptr, float *values)
CalcNormFloat(me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co, values);
}
+static float rna_MeshFace_area_get(PointerRNA *ptr)
+{
+ Mesh *me= (Mesh*)ptr->id.data;
+ MFace *mface= (MFace*)ptr->data;
+
+ if(mface->v4)
+ return AreaQ3Dfl(me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co, me->mvert[mface->v4].co);
+ else
+ return AreaT3Dfl(me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co);
+}
+
/* notice red and blue are swapped */
static void rna_MeshColor_color1_get(PointerRNA *ptr, float *values)
{
@@ -1049,6 +1060,11 @@ static void rna_def_mface(BlenderRNA *brna)
RNA_def_property_float_funcs(prop, "rna_MeshFace_normal_get", NULL, NULL);
RNA_def_property_ui_text(prop, "face normal", "local space unit length normal vector for this face");
+ 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_MeshFace_area_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "face area", "read only area of the face");
+
prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_int_funcs(prop, "rna_MeshFace_index_get", NULL, NULL);