diff --git a/CHANGELOG.md b/CHANGELOG.md index a21b99d0..42cc6f99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `fixed_auto_camera`: to avoid adjusting the automatic camera on each frame - Camera option to set the clip start (#484) - Traceback dump when Blender output contains it + - Subdirectory for each output generated (#541) - KiKit - Expand text variables and KiBot %X markers in text objects (see #497) - PCB Print: diff --git a/docs/samples/generic_plot.kibot.yaml b/docs/samples/generic_plot.kibot.yaml index 1d4e5ee2..04e4d76a 100644 --- a/docs/samples/generic_plot.kibot.yaml +++ b/docs/samples/generic_plot.kibot.yaml @@ -157,9 +157,11 @@ outputs: type: 'POINT' # [dict|list(dict)] Outputs to generate in the same run outputs: - # [string='%f-%i%I%v.%x'] Name for the generated file (%i='3D_blender_$VIEW' %x=VARIABLE). - # The extension is selected from the type. Affected by global options - - output: '%f-%i%I%v.%x' + # [string=''] Subdirectory for this output + - dir: '' + # [string='%f-%i%I%v.%x'] Name for the generated file (%i='3D_blender_$VIEW' %x=VARIABLE). + # The extension is selected from the type. Affected by global options + output: '%f-%i%I%v.%x' # [string='render'] [fbx,obj,x3d,gltf,stl,ply,blender,render] The format for the output. # The `render` type will generate a PNG image of the render result. # `fbx` is Kaydara's Filmbox, 'obj' is the Wavefront, 'x3d' is the new ISO/IEC standard diff --git a/docs/source/configuration/outputs/blender_export.rst b/docs/source/configuration/outputs/blender_export.rst index 2e99ec5b..d894b46f 100644 --- a/docs/source/configuration/outputs/blender_export.rst +++ b/docs/source/configuration/outputs/blender_export.rst @@ -148,6 +148,7 @@ Parameters: format, 'ply' is Polygon File Format (Stanford). Note that some formats includes the light and camera and others are just the 3D model (i.e. STL and PLY). + - ``dir`` :index:`: ` [string=''] Subdirectory for this output. - ``output`` :index:`: ` [string='%f-%i%I%v.%x'] Name for the generated file (%i='3D_blender_$VIEW' %x=VARIABLE). The extension is selected from the type. Affected by global options. diff --git a/kibot/out_blender_export.py b/kibot/out_blender_export.py index 7f54d057..9314a657 100644 --- a/kibot/out_blender_export.py +++ b/kibot/out_blender_export.py @@ -82,6 +82,8 @@ class BlenderOutputOptions(Optionable): self.output = GS.def_global_output """ Name for the generated file (%i='3D_blender_$VIEW' %x=VARIABLE). The extension is selected from the type """ + self.dir = '' + """ Subdirectory for this output """ self._unknown_is_error = True @@ -413,7 +415,7 @@ class Blender_ExportOptions(BaseOptions): val = res % order file_id = file_id.replace(res, val) self._expand_id += file_id - name = self._parent.expand_filename(output_dir, o.output) + name = self._parent.expand_filename(os.path.join(output_dir, o.dir), o.output) self._expand_id = cur_id return name