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>2010-01-04 18:25:21 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-01-04 18:25:21 +0300
commit61a8f370f547e9b39ada252b285b09a3aa92b42d (patch)
treea99c20f21bf9ac03404f3c4f8d5b4949d73fda29 /source/blender/makesrna
parentd077ea6c6c1e8718773980dcd752f1f8af6094a5 (diff)
patch from Guillaume Bouchard for setting vertex normals, (lost when existing editmode but still useful in some cases)
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 528544d09dd..f8bfa105c12 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -81,6 +81,15 @@ static void rna_MeshVertex_normal_get(PointerRNA *ptr, float *value)
value[2]= mvert->no[2]/32767.0f;
}
+static void rna_MeshVertex_normal_set(PointerRNA *ptr, float *value)
+{
+ MVert *mvert= (MVert*)ptr->data;
+
+ mvert->no[0] = (short) (value[0] * 32767.0f);
+ mvert->no[1] = (short) (value[1] * 32767.0f);
+ mvert->no[2] = (short) (value[2] * 32767.0f);
+}
+
static float rna_MeshVertex_bevel_weight_get(PointerRNA *ptr)
{
MVert *mvert= (MVert*)ptr->data;
@@ -1027,9 +1036,8 @@ static void rna_def_mvert(BlenderRNA *brna)
prop= RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
RNA_def_property_float_sdna(prop, NULL, "no");
- RNA_def_property_float_funcs(prop, "rna_MeshVertex_normal_get", NULL, NULL);
+ RNA_def_property_float_funcs(prop, "rna_MeshVertex_normal_get", "rna_MeshVertex_normal_set", NULL);
RNA_def_property_ui_text(prop, "Normal", "Vertex Normal");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
prop= RNA_def_property(srna, "selected", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);