diff options
author | Folkert de Vries <folkert@folkertdev.nl> | 2016-10-29 12:23:29 +0300 |
---|---|---|
committer | Folkert de Vries <folkert@folkertdev.nl> | 2016-10-29 12:23:29 +0300 |
commit | 0796f5a8ed8ed3b90778bcd4b8ec027b5a8ae3f9 (patch) | |
tree | 869008949ab9973ab603eea52edce9d77ba1aa44 /render_freestyle_svg.py | |
parent | a49ccb062769dcf8703d2590b485e8c3a9f8a01b (diff) |
Fixes T49855 - Exception when there is no line set
The UI code assumed the existence of an active lineset. Turns out that
the final lineset can be removed (unlike render layers, where there is
always at least one).
Diffstat (limited to 'render_freestyle_svg.py')
-rw-r--r-- | render_freestyle_svg.py | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/render_freestyle_svg.py b/render_freestyle_svg.py index 2d6484b0..6cc2e1b6 100644 --- a/render_freestyle_svg.py +++ b/render_freestyle_svg.py @@ -190,19 +190,28 @@ class SVGExporterLinesetPanel(bpy.types.Panel): scene = context.scene svg = scene.svg_export freestyle = scene.render.layers.active.freestyle_settings - linestyle = freestyle.linesets.active.linestyle - layout.active = (svg.use_svg_export and freestyle.mode != 'SCRIPT') - row = layout.row() - column = row.column() - column.prop(linestyle, 'use_export_strokes') + try: + linestyle = freestyle.linesets.active.linestyle - column = row.column() - column.active = svg.object_fill - column.prop(linestyle, 'use_export_fills') + except AttributeError: + # Linestyles can be removed, so 0 linestyles is possible. + # there is nothing to draw in those cases. + # see https://developer.blender.org/T49855 + return - row = layout.row() - row.prop(linestyle, "stroke_color_mode", expand=True) + else: + layout.active = (svg.use_svg_export and freestyle.mode != 'SCRIPT') + row = layout.row() + column = row.column() + column.prop(linestyle, 'use_export_strokes') + + column = row.column() + column.active = svg.object_fill + column.prop(linestyle, 'use_export_fills') + + row = layout.row() + row.prop(linestyle, "stroke_color_mode", expand=True) class SVGExport(bpy.types.PropertyGroup): |