From df98fbe91b2fafea18ee0f900b9dc99ea436950e Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Mon, 12 May 2025 12:47:49 +0200 Subject: [PATCH] Fix #138613: Template Paths not resolved when using ALT+Click in Output To resolve, add path template handling to `BUTTONS_OT_file_browse` / `BUTTONS_OT_directory_browse`. Pull Request: https://projects.blender.org/blender/blender/pulls/138674 --- source/blender/editors/space_buttons/buttons_ops.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/blender/editors/space_buttons/buttons_ops.cc b/source/blender/editors/space_buttons/buttons_ops.cc index 2fe01d9e10d..625b9ada241 100644 --- a/source/blender/editors/space_buttons/buttons_ops.cc +++ b/source/blender/editors/space_buttons/buttons_ops.cc @@ -24,6 +24,7 @@ #include "BKE_context.hh" #include "BKE_library.hh" #include "BKE_main.hh" +#include "BKE_path_templates.hh" #include "BKE_report.hh" #include "BKE_screen.hh" @@ -302,6 +303,18 @@ static wmOperatorStatus file_browse_invoke(bContext *C, wmOperator *op, const wm path = RNA_property_string_get_alloc(&ptr, prop, nullptr, 0, nullptr); + if ((RNA_property_flag(prop) & PROP_PATH_SUPPORTS_TEMPLATES) != 0) { + const Scene *scene = CTX_data_scene(C); + const blender::Vector errors = BKE_path_apply_template( + path, + FILE_MAX, + BKE_build_template_variables(BKE_main_blendfile_path_from_global(), &scene->r)); + if (!errors.is_empty()) { + BKE_report_path_template_errors(op->reports, RPT_ERROR, path, errors); + return OPERATOR_CANCELLED; + } + } + /* Useful yet irritating feature, Shift+Click to open the file * Alt+Click to browse a folder in the OS's browser. */ if (event->modifier & (KM_SHIFT | KM_ALT)) {