[Bf-extensions-cvs] [0796f5a] master: Fixes T49855 - Exception when there is no line set

Folkert de Vries noreply at git.blender.org
Sat Oct 29 11:26:08 CEST 2016


Commit: 0796f5a8ed8ed3b90778bcd4b8ec027b5a8ae3f9
Author: Folkert de Vries
Date:   Sat Oct 29 11:23:29 2016 +0200
Branches: master
https://developer.blender.org/rBA0796f5a8ed8ed3b90778bcd4b8ec027b5a8ae3f9

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).

===================================================================

M	render_freestyle_svg.py

===================================================================

diff --git a/render_freestyle_svg.py b/render_freestyle_svg.py
index 2d6484b..6cc2e1b 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):



More information about the Bf-extensions-cvs mailing list