[Blender Export][Added] Subdirectory for each output

Closes #541
This commit is contained in:
Salvador E. Tropea 2024-01-02 12:51:43 -03:00
parent 2111a2d6b6
commit d074294ea6
4 changed files with 10 additions and 4 deletions

View File

@ -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:

View File

@ -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

View File

@ -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:`: <pair: output - blender_export - options - outputs; dir>` [string=''] Subdirectory for this output.
- ``output`` :index:`: <pair: output - blender_export - options - outputs; output>` [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.

View File

@ -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