/shapekeyimport

Blender add-on to import shapekeys

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Demo

Blender add-on to import paths as shape keys

This add-on lets you import paths from an SVG file as paths as well as shape keys

Supported Blender versions
2.8+ and 3.x (Script File - shapekeyimport_2_8.py)
2.79b (Script File - shapekeyimport.py)

Installation

For Blender 2.8+ and 3.x, download shapekeyimport_2_8.py; for 2.79b download svgimport.py

In Blender select File->User Preferences
Click install Add-ons tab and then Install Add-on from File
Select the downloaded file
Check the 'Import Paths and Shape Keys' option in the add-ons dialog

You can invoke the add-on in 2.79 by pressing spacebar or in 2.8+ / 3.x by pressing F3 in the 3d view and selecting the
'Import Paths & Shape Keys' option
The add-on is also accesible from Import menu under File

'demo.blend' and 'demo ver 2.blend' illustrate the basic functionality and the new enhancements of version 2. You can import one of the SVGs (via import shape keys option) in a new blender file to verify the functionality.

Quick start

Demo (SVG Editor: Inkscape)
Group the paths in the SVG editor, make sure the group is in some Layer and the target is the first node in the XML group node <svg:g>
Invoke the add-on in Blender, select the svg file and click 'Import Paths & Shapekeys' button
The target now has the shapekeys that correspond to the paths in the svg group

(SVG Editor: Inkscape and others)
Alternatively, you can create target-shapekey relationship by adding an xml attribute 'shapekeys' in the
target path and setting its value to the comma separated IDs of the shapekey paths
In case you are using SVG Editor other than Inkscape, you may have to uncheck 'Import by Group' checkbox

The introductory video and the enhancements overview are a good starting point for exploring the add-on functionality

Examples & Demos

You can find here the demo files used on this page as well as some samples demonstrating the add-on functionality

Limitations

Exercise caution when using this add-on in production as it's in beta stage

As of now the Add-on is tested with Inkscape only. If you face issues with other SVG editors, try exporting the file as plain SVG
Please report such and other issues along with the sample files here and I will look into them as soon as I can

Keep watching this space, as there will be updates to the code as and when bugs are discovered and fixed

Credits

The add-on file includes python converted a2c js function (Copyright (C) 2013-2015 by Vitaly Puzrin) and some portion imported from svgpathtools (Copyright (c) 2015 Andrew Allan Port, Copyright (c) 2013-2014 Lennart Regebro)
A few of the bezier curve related algorithms were inspired by the answers on stackoverflow; their links can be found in the code.

License

MIT