diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2010-07-26 22:37:47 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2010-07-26 22:37:47 +0400 |
commit | 8fb499c34f8dd9bd38c73c88cf2e588aae854606 (patch) | |
tree | d175811bef390cd7f3bc70e08557db955b515263 /source/blender/editors | |
parent | 10b124ae39c4cdbff6d6191177c3f77b2bc3d802 (diff) |
* Added a new RNA subtype, PROP_IMAGEPATH. It's the same as PROP_FILEPATH, but for images only.
* Changed UI code to display image browser for PROP_IMAGEPATH
* Set the icon_filepath RNA property for brushes to use PROP_IMAGEPATH
* Changed preview icon drawing to ignore unset icons
* Fixed const warnings in brush RNA
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 6 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index b7b9a2156ef..7044c10e523 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -508,12 +508,16 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, char *name, i type= RNA_property_type(prop); subtype= RNA_property_subtype(prop); - if(subtype == PROP_FILEPATH || subtype == PROP_DIRPATH) { + if(subtype == PROP_FILEPATH || subtype == PROP_DIRPATH || subtype == PROP_IMAGEPATH) { uiBlockSetCurLayout(block, uiLayoutRow(sub, 1)); uiDefAutoButR(block, ptr, prop, index, "", icon, x, y, w-UI_UNIT_X, h); /* BUTTONS_OT_file_browse calls uiFileBrowseContextProperty */ but= uiDefIconButO(block, BUT, "BUTTONS_OT_file_browse", WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, NULL); + if(subtype == PROP_IMAGEPATH) { + RNA_boolean_set(uiButGetOperatorPtrRNA(but), "filter_folder", 1); + RNA_boolean_set(uiButGetOperatorPtrRNA(but), "filter_image", 1); + } } else if(subtype == PROP_DIRECTION) { uiDefButR(block, BUT_NORMAL, 0, name, x, y, 100, 100, ptr, RNA_property_identifier(prop), index, 0, 0, -1, -1, NULL); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index b457bf42ed1..8cd42b271a9 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -748,6 +748,9 @@ static void widget_draw_preview(BIFIconID icon, float aspect, float alpha, rcti { int w, h, x, y, size; + if(!icon) + return; + w = rect->xmax - rect->xmin; h = rect->ymax - rect->ymin; size = MIN2(w, h); |