From 891268aa824f0fcaf54f56b3a8640a78282552d8 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Mon, 25 Apr 2022 14:50:57 -0500 Subject: 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 --- source/blender/makesrna/intern/rna_mesh.c | 18 ++---------------- 1 file 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); -- cgit v1.2.3