Page MenuHome

FreeStyle: SVG Export won't fill Contours
Closed, ResolvedPublic

Description

version 2.76 (sub 0), branch b'master', commit date b'2015-09-17' b'15:47', hash b'208e064', b'Release'
build date: b'Fri 09/18/2015', b'06:04 AM'
platform: b'Windows' 7 x64

FreeStyle SVG Export will not fill contours even if "Fill Contours" is checked.

Worked in 000dfc0

Event Timeline

No One (blackno666) updated the task description. (Show Details)
No One (blackno666) raised the priority of this task from to Needs Triage by Developer.
No One (blackno666) set Type to Bug.

It is no more sufficient.
There is a new panel named Freestyle Line Style Export in Render Layers Tab.

Now, you have to precise for what Linestyle strokes or fills are exported.

It looks like it s not enouch restricted for fills.
If Fills is checked to be exported for one lineset, Fills are exported for all linesets.

This is caused by rBA861519e, which allowed to choose which line sets to fill and which to not. But the new code didn't quite reflect old behavior, making line styles be unfilled by default. This is probably fine for the new files, but for the old files it only causes regression in behavior.

The fix could either be as simple as changing default value of use_export_fills to True or we can do a bit more invloved do_versiosn, like

1diff --git a/render_freestyle_svg.py b/render_freestyle_svg.py
2index 8863406..6728543 100644
3--- a/render_freestyle_svg.py
4+++ b/render_freestyle_svg.py
5@@ -88,6 +88,8 @@ from bpy.props import (
6 PointerProperty,
7 )
8
9+from bpy.app.handlers import persistent
10+
11
12 # use utf-8 here to keep ElementTree happy, end result is utf-16
13 svg_primitive = """<?xml version="1.0" encoding="ascii" standalone="no"?>
14@@ -642,6 +644,18 @@ def register_namespaces(namespaces=namespaces):
15 et.register_namespace(name, url)
16
17
18+@persistent
19+def do_versions(self):
20+ # We don't modify startup file because it assumes to
21+ # have all the default values only.
22+ if not bpy.data.is_saved:
23+ return
24+
25+ if bpy.data.version <= (2, 76, 0):
26+ for linestyle in bpy.data.linestyles:
27+ linestyle.use_export_fills = True
28+
29+
30 classes = (
31 SVGExporterPanel,
32 SVGExporterLinesetPanel,
33@@ -681,6 +695,8 @@ def register():
34 # register namespaces
35 register_namespaces()
36
37+ bpy.app.handlers.version_update.append(do_versions)
38+
39
40 def unregister():
41
42@@ -702,6 +718,8 @@ def unregister():
43 parameter_editor.callbacks_lineset_post.remove(SVGPathShaderCallback.lineset_post)
44 parameter_editor.callbacks_lineset_post.remove(SVGFillShaderCallback.lineset_post)
45
46+ bpy.app.handlers.version_update.remove(do_versions)
47+
48
49 if __name__ == "__main__":
50 register()

Sergey Sharybin (sergey) triaged this task as Confirmed, Medium priority.Sep 23 2015, 1:55 PM

Thank you @Sergey Sharybin (sergey) for the proposed fix.

@Folkert de Vries (flokkievids), could you please take a look at the patch and check out what would be the best solution?