diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-02-10 14:06:07 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-02-10 14:08:42 +0300 |
commit | 6266b4139503bb614576f15ea4e90870ac5e597d (patch) | |
tree | 39149115b066f850d4ed64c2647774a44990524d | |
parent | b7a4aa544884c9a2a1223657875f060ad53b7b1e (diff) |
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
-rw-r--r-- | io_curve_svg/import_svg.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/io_curve_svg/import_svg.py b/io_curve_svg/import_svg.py index 333b8237..a1df2204 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]) |