forked from bartvdbraak/blender
support for PROP_ENUM_FLAG buttons, these were only supported by python.
This commit is contained in:
parent
25e3f68c7f
commit
e0289ff6fc
@ -811,7 +811,13 @@ static void ui_is_but_sel(uiBut *but)
|
||||
break;
|
||||
case ROW:
|
||||
case LISTROW:
|
||||
/* support for rna enum buts */
|
||||
if(but->rnaprop && (RNA_property_flag(but->rnaprop) & PROP_ENUM_FLAG)) {
|
||||
if((int)value & (int)but->hardmax) push= 1;
|
||||
}
|
||||
else {
|
||||
if(value == but->hardmax) push= 1;
|
||||
}
|
||||
break;
|
||||
case COL:
|
||||
push= 2;
|
||||
@ -1355,7 +1361,14 @@ void ui_set_but_val(uiBut *but, double value)
|
||||
RNA_property_float_set(&but->rnapoin, prop, value);
|
||||
break;
|
||||
case PROP_ENUM:
|
||||
if(RNA_property_flag(prop) & PROP_ENUM_FLAG) {
|
||||
int ivalue= (int)value;
|
||||
ivalue ^= RNA_property_enum_get(&but->rnapoin, prop); /* toggle for enum/flag buttons */
|
||||
RNA_property_enum_set(&but->rnapoin, prop, ivalue);
|
||||
}
|
||||
else {
|
||||
RNA_property_enum_set(&but->rnapoin, prop, value);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -103,7 +103,7 @@ typedef enum {
|
||||
#define UI_PANEL_MINY 70
|
||||
|
||||
/* uiBut->flag */
|
||||
#define UI_SELECT 1
|
||||
#define UI_SELECT 1 /* use when the button is pressed */
|
||||
#define UI_MOUSE_OVER 2
|
||||
#define UI_ACTIVE 4
|
||||
#define UI_HAS_ICON 8
|
||||
|
@ -917,8 +917,15 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
|
||||
if(layout->root->type == UI_LAYOUT_MENU) {
|
||||
if(type == PROP_BOOLEAN)
|
||||
icon= (RNA_property_boolean_get(ptr, prop))? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
|
||||
else if(type == PROP_ENUM && index == RNA_ENUM_VALUE)
|
||||
icon= (RNA_property_enum_get(ptr, prop) == value)? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
|
||||
else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) {
|
||||
int enum_value= RNA_property_enum_get(ptr, prop);
|
||||
if(RNA_property_flag(prop) & PROP_ENUM_FLAG) {
|
||||
icon= (enum_value & value)? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
|
||||
}
|
||||
else {
|
||||
icon= (enum_value == value)? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
slider= (flag & UI_ITEM_R_SLIDER);
|
||||
@ -948,7 +955,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
|
||||
uiDefButR(block, ROW, 0, name, 0, 0, w, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
|
||||
}
|
||||
/* expanded enum */
|
||||
else if(type == PROP_ENUM && expand)
|
||||
else if(type == PROP_ENUM && (expand || RNA_property_flag(prop) & PROP_ENUM_FLAG))
|
||||
ui_item_enum_expand(layout, block, ptr, prop, name, 0, 0, w, h, icon_only);
|
||||
/* property with separate label */
|
||||
else if(type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) {
|
||||
|
Loading…
Reference in New Issue
Block a user