Added icon_value property to GIZMO_GT_button_2d #108988

Open
Oxicid wants to merge 2 commits from Oxicid/blender:oxicid-GIZMO_GT_button_2d into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 23 additions and 13 deletions

View File

@ -133,8 +133,15 @@ static void button2d_draw_intern(const bContext *C,
const int draw_options = RNA_enum_get(gz->ptr, "draw_options");
if (button->is_init == false) {
button->is_init = true;
PropertyRNA *prop = RNA_struct_find_property(gz->ptr, "icon");
button->icon = -1;
PropertyRNA *icon_value = RNA_struct_find_property(gz->ptr, "icon_value");
if (RNA_property_is_set(gz->ptr, icon_value)) {
button->icon = RNA_property_int_get(gz->ptr, icon_value);
}
else {
PropertyRNA *prop = RNA_struct_find_property(gz->ptr, "icon");
if (RNA_property_is_set(gz->ptr, prop)) {
button->icon = RNA_property_enum_get(gz->ptr, prop);
}
@ -151,6 +158,7 @@ static void button2d_draw_intern(const bContext *C,
MEM_freeN(polys);
}
}
}
float color[4];
float matrix_final[4][4];
@ -409,6 +417,8 @@ static void GIZMO_GT_button_2d(wmGizmoType *gzt)
RNA_def_enum_flag(gzt->srna, "draw_options", rna_enum_draw_options, 0, "Draw Options", "");
RNA_def_property(gzt->srna, "icon_value", PROP_INT, PROP_NONE);
prop = RNA_def_property(gzt->srna, "icon", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_enum_icon_items);