diff options
Diffstat (limited to 'source/blender/editors/space_file/file_panels.c')
-rw-r--r-- | source/blender/editors/space_file/file_panels.c | 83 |
1 files changed, 41 insertions, 42 deletions
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index 058ba9bfef3..023dff704c7 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -53,59 +53,58 @@ static bool file_panel_operator_poll(const bContext *C, PanelType *UNUSED(pt)) { - SpaceFile *sfile = CTX_wm_space_file(C); - return (sfile && sfile->op); + SpaceFile *sfile = CTX_wm_space_file(C); + return (sfile && sfile->op); } static void file_panel_operator_header(const bContext *C, Panel *pa) { - SpaceFile *sfile = CTX_wm_space_file(C); - wmOperator *op = sfile->op; + SpaceFile *sfile = CTX_wm_space_file(C); + wmOperator *op = sfile->op; - BLI_strncpy(pa->drawname, RNA_struct_ui_name(op->type->srna), sizeof(pa->drawname)); + BLI_strncpy(pa->drawname, RNA_struct_ui_name(op->type->srna), sizeof(pa->drawname)); } static void file_panel_operator(const bContext *C, Panel *pa) { - SpaceFile *sfile = CTX_wm_space_file(C); - wmOperator *op = sfile->op; - - UI_block_func_set(uiLayoutGetBlock(pa->layout), file_draw_check_cb, NULL, NULL); - - /* Hack: temporary hide.*/ - const char *hide[] = {"filepath", "files", "directory", "filename"}; - for (int i = 0; i < ARRAY_SIZE(hide); i++) { - PropertyRNA *prop = RNA_struct_find_property(op->ptr, hide[i]); - if (prop) { - RNA_def_property_flag(prop, PROP_HIDDEN); - } - } - - uiTemplateOperatorPropertyButs( - C, pa->layout, op, UI_BUT_LABEL_ALIGN_NONE, - UI_TEMPLATE_OP_PROPS_SHOW_EMPTY); - - /* Hack: temporary hide.*/ - for (int i = 0; i < ARRAY_SIZE(hide); i++) { - PropertyRNA *prop = RNA_struct_find_property(op->ptr, hide[i]); - if (prop) { - RNA_def_property_clear_flag(prop, PROP_HIDDEN); - } - } - - UI_block_func_set(uiLayoutGetBlock(pa->layout), NULL, NULL, NULL); + SpaceFile *sfile = CTX_wm_space_file(C); + wmOperator *op = sfile->op; + + UI_block_func_set(uiLayoutGetBlock(pa->layout), file_draw_check_cb, NULL, NULL); + + /* Hack: temporary hide.*/ + const char *hide[] = {"filepath", "files", "directory", "filename"}; + for (int i = 0; i < ARRAY_SIZE(hide); i++) { + PropertyRNA *prop = RNA_struct_find_property(op->ptr, hide[i]); + if (prop) { + RNA_def_property_flag(prop, PROP_HIDDEN); + } + } + + uiTemplateOperatorPropertyButs( + C, pa->layout, op, UI_BUT_LABEL_ALIGN_NONE, UI_TEMPLATE_OP_PROPS_SHOW_EMPTY); + + /* Hack: temporary hide.*/ + for (int i = 0; i < ARRAY_SIZE(hide); i++) { + PropertyRNA *prop = RNA_struct_find_property(op->ptr, hide[i]); + if (prop) { + RNA_def_property_clear_flag(prop, PROP_HIDDEN); + } + } + + UI_block_func_set(uiLayoutGetBlock(pa->layout), NULL, NULL, NULL); } void file_panels_register(ARegionType *art) { - PanelType *pt; - - pt = MEM_callocN(sizeof(PanelType), "spacetype file operator properties"); - strcpy(pt->idname, "FILE_PT_operator"); - strcpy(pt->label, N_("Operator")); - strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); - pt->poll = file_panel_operator_poll; - pt->draw_header = file_panel_operator_header; - pt->draw = file_panel_operator; - BLI_addtail(&art->paneltypes, pt); + PanelType *pt; + + pt = MEM_callocN(sizeof(PanelType), "spacetype file operator properties"); + strcpy(pt->idname, "FILE_PT_operator"); + strcpy(pt->label, N_("Operator")); + strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); + pt->poll = file_panel_operator_poll; + pt->draw_header = file_panel_operator_header; + pt->draw = file_panel_operator; + BLI_addtail(&art->paneltypes, pt); } |