[Blender export][Added] Traceback when Blender provides it

This commit is contained in:
Salvador E. Tropea 2023-09-08 12:52:42 -03:00
parent 16d0aef8a0
commit 6c2ec777a3
3 changed files with 10 additions and 3 deletions

View File

@ -97,5 +97,5 @@ repos:
hooks:
- id: vermin
# specify your target version here, OR in a Vermin config file as usual:
args: ['-t=2.7', '-t=3.7-', '--violations']
args: ['-t=3.7-', '--violations']
# (if your target is specified in a Vermin config, you may omit the 'args' entry entirely)

View File

@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `default_file_id`: can be used to create numbered PNGs
- `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
- Populate:
- Basic support for regular list items (#480)
- Help for the error levels

View File

@ -14,11 +14,12 @@ Dependencies:
import json
import os
import re
import sys
from tempfile import NamedTemporaryFile, TemporaryDirectory
from .error import KiPlotConfigurationError
from .kiplot import get_output_targets, run_output, run_command, register_xmp_import, config_output, configure_and_run
from .gs import GS
from .misc import MISSING_TOOL
from .misc import MISSING_TOOL, BLENDER_ERROR
from .optionable import Optionable, BaseOptions
from .out_base_3d import Base3D, Base3DOptionsWithHL
from .registrable import RegOutput
@ -535,6 +536,11 @@ class Blender_ExportOptions(BaseOptions):
raise KiPlotConfigurationError('Missing '+pcb3d_file)
return pcb3d_file
def analyze_errors(self, msg):
if 'Traceback ' in msg:
logger.error('Error from Blender run:\n'+msg[msg.index('Traceback '):])
sys.exit(BLENDER_ERROR)
def run(self, output):
if GS.ki5:
logger.error("`blender_export` needs KiCad 6+")
@ -638,7 +644,7 @@ class Blender_ExportOptions(BaseOptions):
cmd.extend(['--scene', f.name])
cmd.append(pcb3d_file)
# Execute the command
run_command(cmd)
self.analyze_errors(run_command(cmd))
if self.render_options.auto_crop:
for pov in self.point_of_view:
for o in self.outputs: