Fix #118704: permit filepaths without extensions in STL batch mode

The STL exporter was enforcing file paths with an extension when used
from the file browser. This would cause oddness during Batch export mode
and was different than the prior Python based exporter[1].

Permit the exporter to accept names without an extension as before.

[1] [Prior python exporter](https://projects.blender.org/blender/blender-addons/src/branch/blender-v4.0-release/io_mesh_stl/__init__.py#L239)

Pull Request: https://projects.blender.org/blender/blender/pulls/118777
This commit is contained in:
Jesse Yurkovich
2024-02-27 07:46:29 +01:00
committed by Jesse Yurkovich
parent b16ef496a6
commit 5b65e2dd7c

View File

@@ -113,9 +113,12 @@ static bool wm_stl_export_check(bContext * /*C*/, wmOperator *op)
{
char filepath[FILE_MAX];
bool changed = false;
bool use_batch = RNA_boolean_get(op->ptr, "use_batch");
RNA_string_get(op->ptr, "filepath", filepath);
if (!BLI_path_extension_check(filepath, ".stl")) {
/* Enforce an extension on the filepath unless Batch mode is used. Batch mode
* will perform substitutions, including the extension, during its processing. */
if (!use_batch && !BLI_path_extension_check(filepath, ".stl")) {
BLI_path_extension_ensure(filepath, FILE_MAX, ".stl");
RNA_string_set(op->ptr, "filepath", filepath);
changed = true;