[Bf-blender-cvs] [d04eb72625e] refactor-mesh-uv-map-generic: Limit user settable length of layer names to 64 bytes

Martijn Versteegh noreply at git.blender.org
Fri Jan 6 00:31:59 CET 2023


Commit: d04eb72625e2d0fe455deaf3278e9df4bd2dc159
Author: Martijn Versteegh
Date:   Fri Jan 6 00:18:42 2023 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rBd04eb72625e2d0fe455deaf3278e9df4bd2dc159

Limit user settable length of layer names to 64 bytes

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

M	source/blender/editors/object/object_bake_api.c
M	source/blender/makesdna/DNA_customdata_types.h
M	source/blender/makesrna/intern/rna_attribute.c
M	source/blender/makesrna/intern/rna_mesh.c
M	source/blender/makesrna/intern/rna_mesh_api.c
M	source/blender/makesrna/intern/rna_modifier.c

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

diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index 20e9850b387..46d231726b1 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -2246,7 +2246,7 @@ void OBJECT_OT_bake(wmOperatorType *ot)
   RNA_def_string(ot->srna,
                  "uv_layer",
                  NULL,
-                 MAX_CUSTOMDATA_LAYER_NAME,
+                 MAX_CUSTOMDATA_LAYER_NAME_GUI,
                  "UV Layer",
                  "UV layer to override active");
 }
diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h
index e1d8976b932..7938944b822 100644
--- a/source/blender/makesdna/DNA_customdata_types.h
+++ b/source/blender/makesdna/DNA_customdata_types.h
@@ -56,6 +56,7 @@ typedef struct CustomDataLayer {
 } CustomDataLayer;
 
 #define MAX_CUSTOMDATA_LAYER_NAME 68
+#define MAX_CUSTOMDATA_LAYER_NAME_GUI 64
 
 typedef struct CustomDataExternal {
   /** FILE_MAX. */
diff --git a/source/blender/makesrna/intern/rna_attribute.c b/source/blender/makesrna/intern/rna_attribute.c
index 67d0e8adef5..2d7ab4fdd44 100644
--- a/source/blender/makesrna/intern/rna_attribute.c
+++ b/source/blender/makesrna/intern/rna_attribute.c
@@ -1191,7 +1191,7 @@ static void rna_def_attribute_group(BlenderRNA *brna)
   RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active_color");
 
   prop = RNA_def_property(srna, "default_color_name", PROP_STRING, PROP_NONE);
-  RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME);
+  RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME_GUI);
   RNA_def_property_string_funcs(prop,
                                 "rna_AttributeGroup_default_color_name_get",
                                 "rna_AttributeGroup_default_color_name_length",
@@ -1202,7 +1202,7 @@ static void rna_def_attribute_group(BlenderRNA *brna)
       "The name of the default color attribute used as a fallback for rendering");
 
   prop = RNA_def_property(srna, "active_color_name", PROP_STRING, PROP_NONE);
-  RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME);
+  RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME_GUI);
   RNA_def_property_string_funcs(prop,
                                 "rna_AttributeGroup_active_color_name_get",
                                 "rna_AttributeGroup_active_color_name_length",
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 45c9f583060..3cf59afb251 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -2739,6 +2739,7 @@ static void rna_def_mloopuv(BlenderRNA *brna)
   prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
   RNA_def_struct_name_property(srna, prop);
   RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshLoopLayer_name_set");
+  RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME_GUI);
   RNA_def_property_ui_text(prop, "Name", "Name of UV map");
   RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
 
@@ -2800,6 +2801,7 @@ static void rna_def_mloopcol(BlenderRNA *brna)
   prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
   RNA_def_struct_name_property(srna, prop);
   RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshLoopLayer_name_set");
+  RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME_GUI);
   RNA_def_property_ui_text(prop, "Name", "Name of Vertex color layer");
   RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
 
@@ -2860,6 +2862,7 @@ static void rna_def_MPropCol(BlenderRNA *brna)
   prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
   RNA_def_struct_name_property(srna, prop);
   RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshVertexLayer_name_set");
+  RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME_GUI);
   RNA_def_property_ui_text(prop, "Name", "Name of Sculpt Vertex color layer");
   RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
 
@@ -2920,6 +2923,7 @@ static void rna_def_mproperties(BlenderRNA *brna)
     prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); \
     RNA_def_struct_name_property(srna, prop); \
     RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshAnyLayer_name_set"); \
+    RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME_GUI); \
     RNA_def_property_ui_text(prop, "Name", ""); \
     RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all"); \
 \
@@ -2962,6 +2966,7 @@ static void rna_def_mproperties(BlenderRNA *brna)
     prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); \
     RNA_def_struct_name_property(srna, prop); \
     RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshAnyLayer_name_set"); \
+    RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME_GUI); \
     RNA_def_property_ui_text(prop, "Name", ""); \
     RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all"); \
 \
@@ -3003,6 +3008,7 @@ static void rna_def_mproperties(BlenderRNA *brna)
     prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); \
     RNA_def_struct_name_property(srna, prop); \
     RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshAnyLayer_name_set"); \
+    RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME_GUI); \
     RNA_def_property_ui_text(prop, "Name", ""); \
     RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all"); \
 \
@@ -3510,6 +3516,7 @@ static void rna_def_skin_vertices(BlenderRNA *brna, PropertyRNA *UNUSED(cprop))
   prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
   RNA_def_struct_name_property(srna, prop);
   RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshVertexLayer_name_set");
+  RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME_GUI);
   RNA_def_property_ui_text(prop, "Name", "Name of skin layer");
   RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
 
@@ -3672,6 +3679,7 @@ static void rna_def_face_map(BlenderRNA *brna)
   prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
   RNA_def_struct_name_property(srna, prop);
   RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshPolyLayer_name_set");
+  RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME_GUI);
   RNA_def_property_ui_text(prop, "Name", "Name of face map layer");
   RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
 
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c
index 0675c39299e..c843eafd2ef 100644
--- a/source/blender/makesrna/intern/rna_mesh_api.c
+++ b/source/blender/makesrna/intern/rna_mesh_api.c
@@ -248,7 +248,7 @@ void RNA_api_mesh(StructRNA *srna)
   parm = RNA_def_string(func,
                         "uvmap",
                         NULL,
-                        MAX_CUSTOMDATA_LAYER_NAME,
+                        MAX_CUSTOMDATA_LAYER_NAME_GUI,
                         "",
                         "Name of the UV map to use for tangent space computation");
 
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 6fafde78808..486ce1ae18a 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -3862,7 +3862,7 @@ static void rna_def_modifier_explode(BlenderRNA *brna)
 
   prop = RNA_def_property(srna, "particle_uv", PROP_STRING, PROP_NONE);
   RNA_def_property_string_sdna(prop, NULL, "uvname");
-  RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME);
+  RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME_GUI);
   RNA_def_property_ui_text(prop, "Particle UV", "UV map to change with particle age");
   RNA_def_property_update(prop, 0, "rna_Modifier_update");



More information about the Bf-blender-cvs mailing list