[Bf-blender-cvs] [891268aa824] master: Mesh: Make vertex normal property read-only

Hans Goudey noreply at git.blender.org
Mon Apr 25 21:51:34 CEST 2022


Commit: 891268aa824f0fcaf54f56b3a8640a78282552d8
Author: Hans Goudey
Date:   Mon Apr 25 14:50:57 2022 -0500
Branches: master
https://developer.blender.org/rB891268aa824f0fcaf54f56b3a8640a78282552d8

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

===================================================================

M	source/blender/makesrna/intern/rna_mesh.c

===================================================================

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);



More information about the Bf-blender-cvs mailing list