GPencil: Import SVG files #79875

Closed
opened 2020-08-18 12:25:51 +02:00 by Antonio Vazquez · 25 comments

Status: Import SVG files inside grease pencil drawings.


Team
Commissioner: @antoniov, @mendio, @pepe-school-land
Project leader: @antoniov
Project members: @antoniov, @mendio, @pepe-school-land, @filedescriptor

Description
Big picture: This import will allow to import drawings doen in other softwares to be used in grease pencil.

Use cases:

  • Import drawings done in other softwares.

Design:

  • The Gradients and Textures will not be imported.
  • For parsing SVG, NanoSVGopensource library is required.

Engineer plan:

After looking at several SVG parsers, we have decided to use NanoSVG because it's a very small library (only a header file) and covers all requirements. Other libraries are powerful and have a lot of features that we are not going to use never. Also, these other libraries are big and have a lot of dependencies.

Relevant links:
NanoSVG. https://github.com/memononen/nanosvg

**Status:** Import SVG files inside grease pencil drawings. --- **Team** **Commissioner:** @antoniov, @mendio, @pepe-school-land **Project leader:** @antoniov **Project members:** @antoniov, @mendio, @pepe-school-land, @filedescriptor **Description** **Big picture:** This import will allow to import drawings doen in other softwares to be used in grease pencil. **Use cases**: * Import drawings done in other softwares. **Design:** * The Gradients and Textures will not be imported. * For parsing SVG, `NanoSVG`opensource library is required. **Engineer plan:** * To do the import, a new C++ class will be added to the IO export module for grease pencil. * The import needs the open source `NanoSVG`. https://github.com/memononen/nanosvg After looking at several SVG parsers, we have decided to use `NanoSVG` because it's a very small library (only a header file) and covers all requirements. Other libraries are powerful and have a lot of features that we are not going to use never. Also, these other libraries are big and have a lot of dependencies. **Relevant links**: `NanoSVG`. https://github.com/memononen/nanosvg
Antonio Vazquez self-assigned this 2020-08-18 12:25:51 +02:00
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Member

Added subscribers: @antoniov, @mendio, @pepe-school-land

Added subscribers: @antoniov, @mendio, @pepe-school-land
Author
Member
[Import_SVG_addon.mp4](https://archive.blender.org/developer/F8791185/Import_SVG_addon.mp4)

Added subscriber: @SimplSam

Added subscriber: @SimplSam

Added subscriber: @Sdack

Added subscriber: @Sdack

Sorry to bother you but I'm doing a project which requires svg import and I'm struggling with the standard blender 2.8 branch, from 2.81 through 2.9 - I've been getting confused experimenting with all the eps 2 svg options in Illustrator and hope for a more reliable and simple path (excuse the pun)

This is an awesome feature and I was exited to see development so recently but I'm a bit unfamiliar with the developer site and how to find my way around so I hope you might be kind enough to point me to the most promising branch for svg to grease pencil?
Thanks in advance and Power to you fab folks for your work

Sorry to bother you but I'm doing a project which requires svg import and I'm struggling with the standard blender 2.8 branch, from 2.81 through 2.9 - I've been getting confused experimenting with all the eps 2 svg options in Illustrator and hope for a more reliable and simple path (excuse the pun) This is an awesome feature and I was exited to see development so recently but I'm a bit unfamiliar with the developer site and how to find my way around so I hope you might be kind enough to point me to the most promising branch for svg to grease pencil? Thanks in advance and Power to you fab folks for your work
Author
Member

@Sdack There isn't a branch with the SVG importer yet. My plan is put the patch for review in the next weeks (I'm waiting for a prerequisite). When the patch is ready, you just can download and test it. Also, I want put the SVG exporter for review.

@Sdack There isn't a branch with the SVG importer yet. My plan is put the patch for review in the next weeks (I'm waiting for a prerequisite). When the patch is ready, you just can download and test it. Also, I want put the SVG exporter for review.

Thanks Antonio,

I look forward to the patch when it's ready.

One issue I've identified with importing from illustrator files is where there is any shading in the vector. It appears that shading is achieved through many many layers of different colour overlaid on top of each other with only a tiny slice visible to the front view. I can't imagine how your importer may deal with this but I'm praying that it might because it's a pain trying to select and simplify such vector files.

Please find a sample attached. I separated the heads with the gradient effect into a separate file but include the original file too because I'm a novice in Illustrator and can't be sure my export will have worked properly.

Cheers

Nigel{F8809539}

1341 Heads with shaded eyes.ai

Thanks Antonio, I look forward to the patch when it's ready. One issue I've identified with importing from illustrator files is where there is any shading in the vector. It appears that shading is achieved through many many layers of different colour overlaid on top of each other with only a tiny slice visible to the front view. I can't imagine how your importer may deal with this but I'm praying that it might because it's a pain trying to select and simplify such vector files. Please find a sample attached. I separated the heads with the gradient effect into a separate file but include the original file too because I'm a novice in Illustrator and can't be sure my export will have worked properly. Cheers Nigel{[F8809539](https://archive.blender.org/developer/F8809539/1341.eps)} [1341 Heads with shaded eyes.ai](https://archive.blender.org/developer/F8809538/1341_Heads_with_shaded_eyes.ai)
Author
Member

Gradients are not supported because there is no way to convert to grease pencil. Here it is the result.

image.png

Cleaning the darwing....

image.png

Gradients are not supported because there is no way to convert to grease pencil. Here it is the result. ![image.png](https://archive.blender.org/developer/F8810029/image.png) Cleaning the darwing.... ![image.png](https://archive.blender.org/developer/F8810051/image.png)

Also... @Sdack - I think you could/should clean up the SVG file before you try and import it, as it is not a nice SVG to begin with (with all those fake gradients). But it is pretty OK without them. Tools like Inkscape or Affinity Designer can help to do that.

For fun... I have included a conversion - which went through Affinity Designer and some conversion processes before ending up in Blender. ++ I added some new fakey eyebrow highlights.

1341 Heads with shaded eyes - 1head-all-nobrow_afd_svg_ss_ Screenshot 2020-08-25 16.51.41x1920.png

Also... @Sdack - I think you could/should clean up the SVG file before you try and import it, as it is not a nice SVG to begin with (with all those fake gradients). But it is pretty OK without them. Tools like Inkscape or Affinity Designer can help to do that. For fun... I have included a conversion - which went through Affinity Designer and some conversion processes before ending up in Blender. ++ I added some new fakey eyebrow highlights. ![1341 Heads with shaded eyes - 1head-all-nobrow_afd_svg_ss_ Screenshot 2020-08-25 16.51.41x1920.png](https://archive.blender.org/developer/F8810706/1341_Heads_with_shaded_eyes_-_1head-all-nobrow_afd_svg_ss__Screenshot_2020-08-25_16.51.41x1920.png)

Hey guys,
Thanks heaps for your replies. Your results look better than mine. I struggled in Illustrator, which as a veteran VFX jockey, I'm not familiar with at all.
My SVG imports to Blender needed a lot of work moving layers apart and various attempts converting from curves to mesh then to Grease Pencil
I will look at Affinity Designer and Inkscape.
@SimplSam Would you be kind enough to send me the cleaned up blend file? I'd like to see what you did there.

It all looks very promising and I await the release of the patch eagerly. Still have a few weeks to go before I'm finished with this job and I'm thinking you might be the cavalry!
Cheers
Nigel

Hey guys, Thanks heaps for your replies. Your results look better than mine. I struggled in Illustrator, which as a veteran VFX jockey, I'm not familiar with at all. My SVG imports to Blender needed a lot of work moving layers apart and various attempts converting from curves to mesh then to Grease Pencil I will look at Affinity Designer and Inkscape. @SimplSam Would you be kind enough to send me the cleaned up blend file? I'd like to see what you did there. It all looks very promising and I await the release of the patch eagerly. Still have a few weeks to go before I'm finished with this job and I'm thinking you might be the cavalry! Cheers Nigel

Does this forum have a Private Message feature?

Does this forum have a Private Message feature?
Author
Member

@SimplSam No, but the blender.chat supports private messages.

@SimplSam No, but the blender.chat supports private messages.

@SimplSam I could meet you on Blender chat if that's what you're thinking...
Timing may be tricky, I'm in Byron Bay, the easternmost coastal town in Australia. GMT +10
or my email is nigelhaslam_AT_gmail.com
Cheers

@SimplSam I could meet you on Blender chat if that's what you're thinking... Timing may be tricky, I'm in Byron Bay, the easternmost coastal town in Australia. GMT +10 or my email is nigelhaslam_AT_gmail.com Cheers

Added subscriber: @winnie-jo

Added subscriber: @winnie-jo

In #79875#1000939, @antoniov wrote:

..... prerequisite). When the patch is ready, you just can download and test it.
Also, I want put the SVG exporter for review.

hi Antonio Vazquez

Do you mean make a new 'exporter add on'
or you want to update the line style svg exporter ?
(which would be great)

> In #79875#1000939, @antoniov wrote: ..... prerequisite). When the patch is ready, you just can download and test it. Also, I want put the SVG exporter for review. hi Antonio Vazquez Do you mean make a new 'exporter add on' or you want to update the line style svg exporter ? (which would be great)
Author
Member

@winnie-jo I'm developing a totally new exporter to SVG for grease pencil in C++, not an add-on.

@winnie-jo I'm developing a totally new exporter to SVG for grease pencil in C++, not an add-on.

Is that for stills or also animations ?

Is that for stills or also animations ?

Added subscriber: @JacobMerrill-1

Added subscriber: @JacobMerrill-1

Added subscriber: @SuneejSurendran-Nair

Added subscriber: @SuneejSurendran-Nair
Author
Member

Added subscriber: @filedescriptor

Added subscriber: @filedescriptor

This issue was referenced by blender/blender@a8a92cd15a

This issue was referenced by blender/blender@a8a92cd15a5251377474fbfdcf9ff0298a8457a9
Author
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'

Added subscriber: @GCreeper00

Added subscriber: @GCreeper00

Removed subscriber: @GCreeper00

Removed subscriber: @GCreeper00
Sign in to join this conversation.
No Milestone
No project
No Assignees
8 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#79875
No description provided.