Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-10-18 19:46:09 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-10-18 19:49:06 +0400
commitc35a649a0a6c3c07bb8d56caba680887f726b9e9 (patch)
tree544196c5705d8f1af22a8502043f6084d864e954 /release/scripts/freestyle
parentfc7752b53c793a6985525d4c099108a97cd7867e (diff)
Freestyle: lazy load 'export_svg'
Loading XML module, registering etree namespaces... etc on startup for everyone on chance someone may want to export an SVG from Freestyle is unacceptable. This shouldn't have got through the review. also disable loading when built without freestyle.
Diffstat (limited to 'release/scripts/freestyle')
-rw-r--r--release/scripts/freestyle/modules/export_svg.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/release/scripts/freestyle/modules/export_svg.py b/release/scripts/freestyle/modules/export_svg.py
index 777fc736d20..9d6e13f4bd6 100644
--- a/release/scripts/freestyle/modules/export_svg.py
+++ b/release/scripts/freestyle/modules/export_svg.py
@@ -23,7 +23,6 @@ import bpy
import xml.etree.cElementTree as et
from bpy.path import abspath
-from bpy.app.handlers import persistent
from bpy_extras.object_utils import world_to_camera_view
from freestyle.types import StrokeShader, BinaryPredicate1D, Interface0DIterator
@@ -266,12 +265,10 @@ def indent_xml(elem, level=0, indentsize=4):
# - callbacks - #
-@persistent
+# called from: bpy.app.handlers.render_init
def svg_export_header(scene):
- render = scene.render
- if not (render.use_freestyle and render.use_svg_export):
- return
# create new file (overwrite existing)
+ render = scene.render
width, height = render.resolution_x, render.resolution_y
scale = render.resolution_percentage / 100
@@ -283,16 +280,15 @@ def svg_export_header(scene):
print("SVG export: invalid path")
-@persistent
+# called from: bpy.app.handlers.render_complete
def svg_export_animation(scene):
- """makes an animation of the exported SVG file """
+ # makes an animation of the exported SVG file
render = scene.render
- if render.use_freestyle and render.use_svg_export and render.svg_mode == 'ANIMATION':
- write_animation(abspath(render.svg_path), scene.frame_start, render.fps)
+ write_animation(abspath(render.svg_path), scene.frame_start, render.fps)
def write_animation(filepath, frame_begin, fps=25):
- """Adds animate tags to the specified file."""
+ # Adds animate tags to the specified file.
tree = et.parse(filepath)
root = tree.getroot()