[Bf-blender-cvs] [1425b356b84] master: UI: Fix consistency issues with attribute tooltips and icons

Ethan-Hall noreply at git.blender.org
Thu Apr 28 20:09:02 CEST 2022


Commit: 1425b356b842377c8f83f271360f1fe67b4fa580
Author: Ethan-Hall
Date:   Thu Apr 28 13:08:34 2022 -0500
Branches: master
https://developer.blender.org/rB1425b356b842377c8f83f271360f1fe67b4fa580

UI: Fix consistency issues with attribute tooltips and icons

This patch modifies tooltips of attributes and UV maps to resolve
inconsistencies. It also restores the vertex color icon that went
missing from the UI lists when color attributes replaced vertex colors.

Fixes T97614

Differential Revision: https://developer.blender.org/D14768

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

M	release/scripts/startup/bl_ui/properties_data_mesh.py
M	source/blender/editors/geometry/geometry_attributes.cc
M	source/blender/makesrna/intern/rna_attribute.c
M	source/blender/makesrna/intern/rna_mesh.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py
index d7c885cf870..050bf56966f 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -600,7 +600,7 @@ class MESH_UL_color_attributes(UIList, ColorAttributesListBase):
 
         split = layout.split(factor=0.50)
         split.emboss = 'NONE'
-        split.prop(attribute, "name", text="")
+        split.prop(attribute, "name", text="", icon='GROUP_VCOL')
 
         sub = split.row()
         sub.alignment = 'RIGHT'
@@ -620,9 +620,9 @@ class MESH_UL_color_attributes(UIList, ColorAttributesListBase):
 
 
 class MESH_UL_color_attributes_selector(UIList, ColorAttributesListBase):
-    def draw_item(self, _context, layout, data, attribute, _icon, _active_data, _active_propname, _index):
+    def draw_item(self, _context, layout, _data, attribute, _icon, _active_data, _active_propname, _index):
         layout.emboss = 'NONE'
-        layout.prop(attribute, "name", text="", icon='COLOR')
+        layout.prop(attribute, "name", text="", icon='GROUP_VCOL')
 
 
 class DATA_PT_vertex_colors(DATA_PT_mesh_attributes, Panel):
diff --git a/source/blender/editors/geometry/geometry_attributes.cc b/source/blender/editors/geometry/geometry_attributes.cc
index b1c05cf44b1..7bba297af8c 100644
--- a/source/blender/editors/geometry/geometry_attributes.cc
+++ b/source/blender/editors/geometry/geometry_attributes.cc
@@ -136,7 +136,7 @@ static void next_color_attributes(struct ID *id, CustomDataLayer *layer)
 void GEOMETRY_OT_attribute_add(wmOperatorType *ot)
 {
   /* identifiers */
-  ot->name = "Add Geometry Attribute";
+  ot->name = "Add Attribute";
   ot->description = "Add attribute to geometry";
   ot->idname = "GEOMETRY_OT_attribute_add";
 
@@ -198,7 +198,7 @@ static int geometry_attribute_remove_exec(bContext *C, wmOperator *op)
 void GEOMETRY_OT_attribute_remove(wmOperatorType *ot)
 {
   /* identifiers */
-  ot->name = "Remove Geometry Attribute";
+  ot->name = "Remove Attribute";
   ot->description = "Remove attribute from geometry";
   ot->idname = "GEOMETRY_OT_attribute_remove";
 
@@ -358,8 +358,8 @@ static void geometry_color_attribute_add_ui(bContext *UNUSED(C), wmOperator *op)
 void GEOMETRY_OT_color_attribute_add(wmOperatorType *ot)
 {
   /* identifiers */
-  ot->name = "Add Geometry Attribute";
-  ot->description = "Add attribute to geometry";
+  ot->name = "Add Color Attribute";
+  ot->description = "Add color attribute to geometry";
   ot->idname = "GEOMETRY_OT_color_attribute_add";
 
   /* api callbacks */
@@ -374,7 +374,8 @@ void GEOMETRY_OT_color_attribute_add(wmOperatorType *ot)
   /* properties */
   PropertyRNA *prop;
 
-  prop = RNA_def_string(ot->srna, "name", "Color", MAX_NAME, "Name", "Name of color attribute");
+  prop = RNA_def_string(
+      ot->srna, "name", "Color", MAX_NAME, "Name", "Name of new color attribute");
   RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 
   static EnumPropertyItem domains[3] = {{ATTR_DOMAIN_POINT, "POINT", 0, "Vertex", ""},
@@ -428,7 +429,7 @@ static int geometry_color_attribute_set_render_exec(bContext *C, wmOperator *op)
 void GEOMETRY_OT_color_attribute_render_set(wmOperatorType *ot)
 {
   /* identifiers */
-  ot->name = "Set Render Color Attribute";
+  ot->name = "Set Render Color";
   ot->description = "Set default color attribute used for rendering";
   ot->idname = "GEOMETRY_OT_color_attribute_render_set";
 
diff --git a/source/blender/makesrna/intern/rna_attribute.c b/source/blender/makesrna/intern/rna_attribute.c
index 5efbebc9b97..d49bac15242 100644
--- a/source/blender/makesrna/intern/rna_attribute.c
+++ b/source/blender/makesrna/intern/rna_attribute.c
@@ -27,8 +27,12 @@ const EnumPropertyItem rna_enum_attribute_type_items[] = {
     {CD_PROP_FLOAT, "FLOAT", 0, "Float", "Floating-point value"},
     {CD_PROP_INT32, "INT", 0, "Integer", "32-bit integer"},
     {CD_PROP_FLOAT3, "FLOAT_VECTOR", 0, "Vector", "3D vector with floating-point values"},
-    {CD_PROP_COLOR, "FLOAT_COLOR", 0, "Color", "RGBA color with floating-point values"},
-    {CD_PROP_BYTE_COLOR, "BYTE_COLOR", 0, "Byte Color", "RGBA color with 8-bit values"},
+    {CD_PROP_COLOR, "FLOAT_COLOR", 0, "Color", "RGBA color with 32-bit floating-point values"},
+    {CD_PROP_BYTE_COLOR,
+     "BYTE_COLOR",
+     0,
+     "Byte Color",
+     "RGBA color with 8-bit positive integer values"},
     {CD_PROP_STRING, "STRING", 0, "String", "Text string"},
     {CD_PROP_BOOL, "BOOLEAN", 0, "Boolean", "True or false"},
     {CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"},
@@ -41,8 +45,12 @@ const EnumPropertyItem rna_enum_attribute_type_with_auto_items[] = {
     {CD_PROP_FLOAT, "FLOAT", 0, "Float", "Floating-point value"},
     {CD_PROP_INT32, "INT", 0, "Integer", "32-bit integer"},
     {CD_PROP_FLOAT3, "FLOAT_VECTOR", 0, "Vector", "3D vector with floating-point values"},
-    {CD_PROP_COLOR, "FLOAT_COLOR", 0, "Color", "RGBA color with floating-point values"},
-    {CD_PROP_BYTE_COLOR, "BYTE_COLOR", 0, "Byte Color", "RGBA color with 8-bit values"},
+    {CD_PROP_COLOR, "FLOAT_COLOR", 0, "Color", "RGBA color 32-bit floating-point values"},
+    {CD_PROP_BYTE_COLOR,
+     "BYTE_COLOR",
+     0,
+     "Byte Color",
+     "RGBA color with 8-bit positive integer values"},
     {CD_PROP_STRING, "STRING", 0, "String", "Text string"},
     {CD_PROP_BOOL, "BOOLEAN", 0, "Boolean", "True or false"},
     {CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"},
@@ -143,7 +151,7 @@ static int rna_Attribute_name_editable(PointerRNA *ptr, const char **r_info)
 {
   CustomDataLayer *layer = ptr->data;
   if (BKE_id_attribute_required(ptr->owner_id, layer)) {
-    *r_info = N_("Can't modify name of required geometry attribute");
+    *r_info = N_("Cannot modify name of required geometry attribute");
     return false;
   }
 
@@ -586,7 +594,8 @@ static void rna_def_attribute_float(BlenderRNA *brna)
 
   srna = RNA_def_struct(brna, "FloatAttribute", "Attribute");
   RNA_def_struct_sdna(srna, "CustomDataLayer");
-  RNA_def_struct_ui_text(srna, "Float Attribute", "Geometry attribute with floating-point values");
+  RNA_def_struct_ui_text(
+      srna, "Float Attribute", "Geometry attribute that stores floating-point values");
 
   prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
   RNA_def_property_struct_type(prop, "FloatAttributeValue");
@@ -618,7 +627,7 @@ static void rna_def_attribute_float_vector(BlenderRNA *brna)
   srna = RNA_def_struct(brna, "FloatVectorAttribute", "Attribute");
   RNA_def_struct_sdna(srna, "CustomDataLayer");
   RNA_def_struct_ui_text(
-      srna, "Float Vector Attribute", "Vector geometry attribute, with floating-point values");
+      srna, "Float Vector Attribute", "Geometry attribute that stores floating-point 3D vectors");
 
   prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
   RNA_def_property_struct_type(prop, "FloatVectorAttributeValue");
@@ -653,8 +662,10 @@ static void rna_def_attribute_float_color(BlenderRNA *brna)
   /* Float Color Attribute */
   srna = RNA_def_struct(brna, "FloatColorAttribute", "Attribute");
   RNA_def_struct_sdna(srna, "CustomDataLayer");
-  RNA_def_struct_ui_text(
-      srna, "Float Color Attribute", "Color geometry attribute, with floating-point values");
+  RNA_def_struct_ui_text(srna,
+                         "Float Color Attribute",
+                         "Geometry attribute that stores RGBA colors as floating-point values "
+                         "using 32-bits per channel");
 
   prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
   RNA_def_property_struct_type(prop, "FloatColorAttributeValue");
@@ -688,8 +699,10 @@ static void rna_def_attribute_byte_color(BlenderRNA *brna)
   /* Byte Color Attribute */
   srna = RNA_def_struct(brna, "ByteColorAttribute", "Attribute");
   RNA_def_struct_sdna(srna, "CustomDataLayer");
-  RNA_def_struct_ui_text(
-      srna, "Byte Color Attribute", "Color geometry attribute, with 8-bit values");
+  RNA_def_struct_ui_text(srna,
+                         "Byte Color Attribute",
+                         "Geometry attribute that stores RGBA colors as positive integer values "
+                         "using 8-bits per channel");
 
   prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
   RNA_def_property_struct_type(prop, "ByteColorAttributeValue");
@@ -726,7 +739,8 @@ static void rna_def_attribute_int(BlenderRNA *brna)
 
   srna = RNA_def_struct(brna, "IntAttribute", "Attribute");
   RNA_def_struct_sdna(srna, "CustomDataLayer");
-  RNA_def_struct_ui_text(srna, "Int Attribute", "Integer geometry attribute");
+  RNA_def_struct_ui_text(
+      srna, "Integer Attribute", "Geometry attribute that stores integer values");
 
   prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
   RNA_def_property_struct_type(prop, "IntAttributeValue");
@@ -755,7 +769,7 @@ static void rna_def_attribute_string(BlenderRNA *brna)
 
   srna = RNA_def_struct(brna, "StringAttribute", "Attribute");
   RNA_def_struct_sdna(srna, "CustomDataLayer");
-  RNA_def_struct_ui_text(srna, "String Attribute", "String geometry attribute");
+  RNA_def_struct_ui_text(srna, "String Attribute", "Geometry attribute that stores strings");
 
   prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
   RNA_def_property_struct_type(prop, "StringAttributeValue");
@@ -784,7 +798,7 @@ static void rna_def_attribute_bool(BlenderRNA *brna)
 
   srna = RNA_def_struct(brna, "BoolAttribute", "Attribute");
   RNA_def_struct_sdna(srna, "CustomDataLayer");
-  RNA_def_struct_ui_text(srna, "Bool Attribute", "Bool geometry attribute");
+  RNA_def_struct_ui_text(srna, "Bool Attribute", "Geometry attribute that stores booleans");
 
   prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
   RNA_def_property_struct_type(prop, "BoolAttributeValue");
@@ -812,7 +826,8 @@ static void rna_def_attribute_int8(BlenderRNA *brna)
 
   srna = RNA_def_struct(brna, "ByteIntAttribute", "Attribute");
   RNA_def_struct_sdna(srna, "CustomDataLayer");
-  RNA_def_struct_ui_text(srna, "8-bit

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list