[Bf-extensions-cvs] [6266b41] master: SVGParseFloat() improved parsing of scientific notation
Sergey Sharybin
noreply at git.blender.org
Wed Feb 10 12:10:28 CET 2016
Commit: 6266b4139503bb614576f15ea4e90870ac5e597d
Author: Sergey Sharybin
Date: Wed Feb 10 12:06:07 2016 +0100
Branches: master
https://developer.blender.org/rBA6266b4139503bb614576f15ea4e90870ac5e597d
SVGParseFloat() improved parsing of scientific notation
io_curve_svg.import_svg.SVGParseFloat() may parse a float containing scientific
notation without an exponent sign. For example, 1e3 is a legal float value
according to the <number> syntax:
https://www.w3.org/TR/SVG11/types.html#DataTypeNumber
Example SVG file:
https://upload.wikimedia.org/wikipedia/commons/2/2f/Google_2015_logo.svg
Patch by Zac Mullett (aka zmullett), thanks!
Reviewers: sergey
Projects: #addons
Differential Revision: https://developer.blender.org/D1755
===================================================================
M io_curve_svg/import_svg.py
===================================================================
diff --git a/io_curve_svg/import_svg.py b/io_curve_svg/import_svg.py
index 333b823..a1df220 100644
--- a/io_curve_svg/import_svg.py
+++ b/io_curve_svg/import_svg.py
@@ -102,13 +102,10 @@ def SVGParseFloat(s, i=0):
token += s[i]
i += 1
- if s[i].isdigit():
- while i < n and s[i].isdigit():
- token += s[i]
- i += 1
- else:
- raise Exception('Invalid float value near ' +
- s[start:start + 10])
+ if s[i].isdigit():
+ while i < n and s[i].isdigit():
+ token += s[i]
+ i += 1
else:
raise Exception('Invalid float value near ' + s[start:start + 10])
More information about the Bf-extensions-cvs
mailing list