Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-12-15 08:42:23 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-12-15 08:42:23 +0300
commiteb8458b064c5a7553a3bd51c214c9669aaf550f9 (patch)
tree85063dfae53b799f6bceca854ecb4f338458d833 /source/blender/editors/space_file
parentacd7b81c2d3fa7828d28c1562fad10663d911783 (diff)
Centralized operator UI drawing into a new function uiLayoutOperatorButs(),
Operator drawing calls were duplicated in file selector panel, redo panels, redo & dialog popups. note, uiDefAutoButsRNA's column's argument was misleading, renamed to label_align.
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r--source/blender/editors/space_file/file_panels.c40
1 files changed, 12 insertions, 28 deletions
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index 109c5f0fdf6..4ce49251fdc 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -171,41 +171,25 @@ static void file_panel_operator_header(const bContext *C, Panel *pa)
BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname));
}
+static int file_panel_check_prop(PropertyRNA *prop)
+{
+ const char *prop_id= RNA_property_identifier(prop);
+ return !( strcmp(prop_id, "filepath") == 0 ||
+ strcmp(prop_id, "directory") == 0 ||
+ strcmp(prop_id, "filename") == 0
+ );
+}
+
static void file_panel_operator(const bContext *C, Panel *pa)
{
SpaceFile *sfile= CTX_wm_space_file(C);
wmOperator *op= sfile->op;
- int empty= 1, flag;
+ // int empty= 1, flag;
uiBlockSetFunc(uiLayoutGetBlock(pa->layout), file_draw_check_cb, NULL, NULL);
-
- if(op->type->ui) {
- op->layout= pa->layout;
- op->type->ui((bContext*)C, op);
- op->layout= NULL;
- }
- else {
- RNA_STRUCT_BEGIN(op->ptr, prop) {
- flag= RNA_property_flag(prop);
-
- if(flag & PROP_HIDDEN)
- continue;
- if(strcmp(RNA_property_identifier(prop), "filepath") == 0)
- continue;
- if(strcmp(RNA_property_identifier(prop), "directory") == 0)
- continue;
- if(strcmp(RNA_property_identifier(prop), "filename") == 0)
- continue;
-
- uiItemFullR(pa->layout, op->ptr, prop, -1, 0, 0, NULL, 0);
- empty= 0;
- }
- RNA_STRUCT_END;
- if(empty)
- uiItemL(pa->layout, "No properties.", 0);
- }
-
+ uiLayoutOperatorButs(C, pa->layout, op, file_panel_check_prop, '\0', UI_LAYOUT_OP_SHOW_EMPTY);
+
uiBlockSetFunc(uiLayoutGetBlock(pa->layout), NULL, NULL, NULL);
}