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:
Diffstat (limited to 'source/blender/makesrna/intern/rna_mesh.c')
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index ecdd0c949bd..86b2aa4fb2b 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -591,6 +591,23 @@ static void rna_MeshVertex_groups_begin(CollectionPropertyIterator *iter, Pointe
rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);
}
+static void rna_MeshVertex_undeformed_co_get(PointerRNA *ptr, float values[3])
+{
+ Mesh *me = rna_mesh(ptr);
+ MVert *mvert = (MVert *)ptr->data;
+ float (*orco)[3] = CustomData_get_layer(&me->vdata, CD_ORCO);
+
+ if (orco) {
+ /* orco is normalized to 0..1, we do inverse to match mvert->co */
+ float loc[3], size[3];
+
+ BKE_mesh_texspace_get(me->texcomesh ? me->texcomesh : me, loc, NULL, size);
+ madd_v3_v3v3v3(values, loc, orco[(mvert - me->mvert)], size);
+ }
+ else
+ copy_v3_v3(values, mvert->co);
+}
+
static int rna_CustomDataLayer_active_get(PointerRNA *ptr, CustomData *data, int type, int render)
{
int n = ((CustomDataLayer *)ptr->data) - data->layers;
@@ -1638,6 +1655,12 @@ static void rna_def_mvert(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_int_funcs(prop, "rna_MeshVertex_index_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Index", "Index number of the vertex");
+
+ prop = RNA_def_property(srna, "undeformed_co", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Undeformed Location", "For meshes with modifiers applied, the coordinate of the vertex with no deforming modifiers applied, as used for generated texture coordinates. ");
+ RNA_def_property_float_funcs(prop, "rna_MeshVertex_undeformed_co_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
}
static void rna_def_medge(BlenderRNA *brna)