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>2018-07-26 02:59:56 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-07-26 04:53:53 +0300
commitdbd79c097c14d486fe79b91b916a9f854587b27e (patch)
treef3cf68fcccfbe24c8a052bec2ed0c3a155d7dae2 /source/blender/editors/space_file/file_panels.c
parent2df27fa6cf85a6b4534302a41d9588b550029b01 (diff)
WM: Add operator property poll callback
This allows operators to filter out properties from the auto-generated draw functions. Some custom draw functions can move to using this.
Diffstat (limited to 'source/blender/editors/space_file/file_panels.c')
-rw-r--r--source/blender/editors/space_file/file_panels.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index c02320de89e..c5350750af4 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -43,6 +43,7 @@
#include "MEM_guardedalloc.h"
#include "RNA_access.h"
+#include "RNA_define.h"
#include "ED_fileselect.h"
@@ -71,24 +72,26 @@ static void file_panel_operator_header(const bContext *C, Panel *pa)
BLI_strncpy(pa->drawname, RNA_struct_ui_name(op->type->srna), sizeof(pa->drawname));
}
-static bool file_panel_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
-{
- const char *prop_id = RNA_property_identifier(prop);
- return !(STREQ(prop_id, "filepath") ||
- STREQ(prop_id, "directory") ||
- STREQ(prop_id, "filename")
- );
-}
-
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;
UI_block_func_set(uiLayoutGetBlock(pa->layout), file_draw_check_cb, NULL, NULL);
- uiTemplateOperatorPropertyButs(C, pa->layout, op, file_panel_check_prop, '\0', UI_TEMPLATE_OP_PROPS_SHOW_EMPTY);
+ /* Hack: temporary hide.*/
+ const char *hide[3] = {"filepath", "directory", "filename"};
+ for (int i = 0; i < ARRAY_SIZE(hide); i++) {
+ PropertyRNA *prop = RNA_struct_find_property(op->ptr, "filepath");
+ RNA_def_property_flag(prop, PROP_HIDDEN);
+ }
+
+ uiTemplateOperatorPropertyButs(C, pa->layout, op, '\0', UI_TEMPLATE_OP_PROPS_SHOW_EMPTY);
+
+ for (int i = 0; i < ARRAY_SIZE(hide); i++) {
+ PropertyRNA *prop = RNA_struct_find_property(op->ptr, "filepath");
+ RNA_def_property_clear_flag(prop, PROP_HIDDEN);
+ }
UI_block_func_set(uiLayoutGetBlock(pa->layout), NULL, NULL, NULL);
}