[Bf-blender-cvs] [024386bb891] master: UI: Improvements to "Add Color Attribute" menu

Ethan-Hall noreply at git.blender.org
Thu Apr 28 17:48:12 CEST 2022


Commit: 024386bb891d9722c3ac0238532706cb67abdeb7
Author: Ethan-Hall
Date:   Thu Apr 28 10:47:23 2022 -0500
Branches: master
https://developer.blender.org/rB024386bb891d9722c3ac0238532706cb67abdeb7

UI: Improvements to "Add Color Attribute" menu

Allow the session to save the choice for domain and data type since
it is highly likely that the user intends to use the same settings
for subsequent color attributes.

Use expanded button selectors for domain and data type since there
are only two options for each.

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

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

M	source/blender/editors/geometry/geometry_attributes.cc

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

diff --git a/source/blender/editors/geometry/geometry_attributes.cc b/source/blender/editors/geometry/geometry_attributes.cc
index 452f1df86fb..f1c1fdf6255 100644
--- a/source/blender/editors/geometry/geometry_attributes.cc
+++ b/source/blender/editors/geometry/geometry_attributes.cc
@@ -344,6 +344,17 @@ static int geometry_attribute_convert_exec(bContext *C, wmOperator *op)
   return OPERATOR_FINISHED;
 }
 
+void geometry_color_attribute_add_ui(bContext *C, wmOperator *op)
+{
+  uiLayout *layout = op->layout;
+  uiLayoutSetPropSep(layout, true);
+  uiLayoutSetPropDecorate(layout, false);
+
+  uiItemR(layout, op->ptr, "name", 0, nullptr, ICON_NONE);
+  uiItemR(layout, op->ptr, "domain", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
+  uiItemR(layout, op->ptr, "data_type", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
+}
+
 void GEOMETRY_OT_color_attribute_add(wmOperatorType *ot)
 {
   /* identifiers */
@@ -355,6 +366,7 @@ void GEOMETRY_OT_color_attribute_add(wmOperatorType *ot)
   ot->poll = geometry_attributes_poll;
   ot->exec = geometry_color_attribute_add_exec;
   ot->invoke = WM_operator_props_popup_confirm;
+  ot->ui = geometry_color_attribute_add_ui;
 
   /* flags */
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -380,15 +392,12 @@ void GEOMETRY_OT_color_attribute_add(wmOperatorType *ot)
                       "Domain",
                       "Type of element that attribute is stored on");
 
-  RNA_def_property_flag(prop, PROP_SKIP_SAVE);
-
   prop = RNA_def_enum(ot->srna,
                       "data_type",
                       types,
                       CD_PROP_COLOR,
                       "Data Type",
                       "Type of data stored in attribute");
-  RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }
 
 static int geometry_color_attribute_set_render_exec(bContext *C, wmOperator *op)



More information about the Bf-blender-cvs mailing list