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:
authorHans Goudey <h.goudey@me.com>2022-04-25 22:50:57 +0300
committerHans Goudey <h.goudey@me.com>2022-04-25 22:50:57 +0300
commit891268aa824f0fcaf54f56b3a8640a78282552d8 (patch)
tree913d69d897e77fb4d68e21ebc7d4a1a4ebc82b47 /source/blender/makesrna
parent8e1b16534d4061abbfa06ef24c0ded26eca42c54 (diff)
Mesh: Make vertex normal property read-only
This commit makes the `MeshVertex.normal` property read-only. In practice it already was, since the value could be overwritten at any time if code requests updated normals, so this just clarifies that position and avoids misleading users. Differential Revision: https://developer.blender.org/D14696
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 0e7c332f6a4..582d3061576 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -313,18 +313,6 @@ static void rna_MeshVertex_normal_get(PointerRNA *ptr, float *value)
copy_v3_v3(value, vert_normals[index]);
}
-static void rna_MeshVertex_normal_set(PointerRNA *ptr, const float *value)
-{
- Mesh *mesh = rna_mesh(ptr);
- float(*vert_normals)[3] = BKE_mesh_vertex_normals_for_write(mesh);
-
- const int index = (MVert *)ptr->data - mesh->mvert;
- BLI_assert(index >= 0);
- BLI_assert(index < mesh->totvert);
-
- copy_v3_v3(vert_normals[index], value);
-}
-
static float rna_MeshVertex_bevel_weight_get(PointerRNA *ptr)
{
MVert *mvert = (MVert *)ptr->data;
@@ -1740,11 +1728,9 @@ static void rna_def_mvert(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
- // RNA_def_property_float_sdna(prop, NULL, "no");
RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_float_funcs(
- prop, "rna_MeshVertex_normal_get", "rna_MeshVertex_normal_set", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_MeshVertex_normal_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Normal", "Vertex Normal");
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);