diff options
author | Ethan-Hall <Ethan1080> | 2022-04-28 18:47:23 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-04-28 18:47:23 +0300 |
commit | 024386bb891d9722c3ac0238532706cb67abdeb7 (patch) | |
tree | c53c1e85c069718541aaaf9ac623af06d9a384e8 /source/blender/editors/geometry | |
parent | f4718d52f348666a91ff1aab66a6e495c299c8fd (diff) |
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
Diffstat (limited to 'source/blender/editors/geometry')
-rw-r--r-- | source/blender/editors/geometry/geometry_attributes.cc | 15 |
1 files changed, 12 insertions, 3 deletions
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) |