diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index df654cf3645..a8e0ca39c58 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -355,46 +355,65 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); /* create buttons */ - if(type == PROP_BOOLEAN && ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER)) { - /* special check for layer layout */ - int butw, buth, unit; - int cols= (len >= 20)? 2: 1; - int colbuts= len/(2*cols); - int layer_used= 0; + if(type == PROP_BOOLEAN) { + if(ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER)) { + /* special check for layer layout */ + int butw, buth, unit; + int cols= (len >= 20)? 2: 1; + int colbuts= len/(2*cols); + int layer_used= 0; - uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, 0)); + uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, 0)); - unit= UI_UNIT_X*0.75; - butw= unit; - buth= unit; - - if(ptr->type == &RNA_Armature) { - bArmature *arm= (bArmature *)ptr->data; - layer_used= arm->layer_used; + unit= UI_UNIT_X*0.75; + butw= unit; + buth= unit; + + if(ptr->type == &RNA_Armature) { + bArmature *arm= (bArmature *)ptr->data; + layer_used= arm->layer_used; + } + + for(b=0; bbuttonspacex; + } } + else { + /* not common, but good to support non layer boolean arrays */ + int *tmparray= MEM_callocN(sizeof(int)*len, "ui_item_array"); + RNA_property_boolean_get_array(ptr, prop, tmparray); - for(b=0; bbuttonspacex; + MEM_freeN(tmparray); + + uiBlockEndAlign(block); } } else if(subtype == PROP_MATRIX) { @@ -951,13 +970,14 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index uiBut *but; PropertyType type; char namestr[UI_MAX_NAME_STR]; - int len, w, h, slider, toggle, expand, icon_only, no_bg; + int len, is_array, w, h, slider, toggle, expand, icon_only, no_bg; uiBlockSetCurLayout(block, layout); /* retrieve info */ type= RNA_property_type(prop); - len= RNA_property_array_length(ptr, prop); + is_array= RNA_property_array_check(ptr, prop); + len= (is_array) ? RNA_property_array_length(ptr, prop) : 0; /* set name and icon */ if(!name) @@ -967,14 +987,16 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index if(ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER)) name= ui_item_name_add_colon(name, namestr); - else if(type == PROP_BOOLEAN && len && index == RNA_NO_INDEX) + else if(type == PROP_BOOLEAN && is_array && index == RNA_NO_INDEX) name= ui_item_name_add_colon(name, namestr); else if(type == PROP_ENUM && index != RNA_ENUM_VALUE) name= ui_item_name_add_colon(name, namestr); if(layout->root->type == UI_LAYOUT_MENU) { - if(type == PROP_BOOLEAN) - icon= (RNA_property_boolean_get(ptr, prop))? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT; + if(type == PROP_BOOLEAN && ((is_array == FALSE) || (index != RNA_NO_INDEX))) { + if(is_array) icon= (RNA_property_boolean_get_index(ptr, prop, index)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT; + else icon= (RNA_property_boolean_get(ptr, prop)) ? 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) { @@ -999,7 +1021,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index uiBlockSetEmboss(block, UI_EMBOSSN); /* array property */ - if(index == RNA_NO_INDEX && len > 0) + if(index == RNA_NO_INDEX && is_array) ui_item_array(layout, block, name, icon, ptr, prop, len, 0, 0, w, h, expand, slider, toggle, icon_only); /* enum item */ else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) {