Skip to content

[Lottie Exporter] Export outlines without variable widths - #1647

Merged
ice0 merged 7 commits into
synfig:masterfrom
saurabh-ramola:variable_widths
Aug 30, 2020
Merged

ice0 merged 7 commits into
synfig:masterfrom
saurabh-ramola:variable_widths

Conversation

@saurabh-ramola

Copy link
Copy Markdown
Member

Added support for exporting outlines without variable widths. A few tweaks needed but there is a huge decrease in file size on checking so far 😃 .
@AnishGG please check

@saurabh-ramola
saurabh-ramola requested a review from AnishGG August 21, 2020 19:45
@lgtm-com

lgtm-com Bot commented Aug 21, 2020

Copy link
Copy Markdown

This pull request introduces 5 alerts when merging 3034754 into d8388ca - view on LGTM.com

new alerts:

  • 5 for Unused import

@lgtm-com

lgtm-com Bot commented Aug 22, 2020

Copy link
Copy Markdown

This pull request introduces 1 alert when merging 22aebc0 into d8388ca - view on LGTM.com

new alerts:

  • 1 for Unused import

@lgtm-com

lgtm-com Bot commented Aug 22, 2020

Copy link
Copy Markdown

This pull request introduces 1 alert when merging 3c336a5 into d8388ca - view on LGTM.com

new alerts:

  • 1 for Unused import

@saurabh-ramola

Copy link
Copy Markdown
Member Author

I think support for all possible parameters is now done

@morevnaproject

Copy link
Copy Markdown
Member

Question: how user can choose to export with variable outline width or not?

@AnishGG

AnishGG commented Aug 24, 2020

Copy link
Copy Markdown
Member

Question: how user can choose to export with variable outline width or not?

For now, @saurabh-ramola used "Exporting without variable width's" as the default option. But I think what we can do is: User selects Menu -> Export -> show a dialogue in which user selects whether to export with/without variable widths.
Finally we can call the lottie-exporter with a flag based on the option selected by the user.

@morevnaproject your views here please. ^__^
@saurabh-ramola in the mean time, you can look at the flag option and implement it if possible.

@saurabh-ramola

Copy link
Copy Markdown
Member Author

Question: how user can choose to export with variable outline width or not?

For now, @saurabh-ramola used "Exporting without variable width's" as the default option. But I think what we can do is: User selects Menu -> Export -> show a dialogue in which user selects whether to export with/without variable widths.
Finally we can call the lottie-exporter with a flag based on the option selected by the user.

@morevnaproject your views here please. ^__^
@saurabh-ramola in the mean time, you can look at the flag option and implement it if possible.

@AnishGG I have added an argument -without_variable_width which is False by default but user has the option to set it to True which will export outlines without variable widths when it calls the python file. But I don't know how to implement the GUI for it and how to call it from synfig-studio.

@lgtm-com

lgtm-com Bot commented Aug 24, 2020

Copy link
Copy Markdown

This pull request introduces 1 alert when merging ccbd1da into 51d7972 - view on LGTM.com

new alerts:

  • 1 for Unused import

@morevnaproject

Copy link
Copy Markdown
Member

Question: how user can choose to export with variable outline width or not?

I have added an argument -without_variable_width which is False by default but user has the option to set it to True which will export outlines without variable widths when it calls the python file. But I don't know how to implement the GUI for it and how to call it from synfig-studio.

I see two possibilities for this:

1. Add more export options in plugin.xml file.

Our plugin system now got improvements from @mbasaglia which allow to define multiple plugins in plugin.xml file. It is possible to call same python file, but specify different arguments. See specification here - #1309 (comment)

Currently, plugin.xml file of Lottie exporter has following entries:

<exporter>
       <extension>json</extension>
       <description>Lottie Animation (*.json)</description>
       <exec stdout="log">lottie-exporter.py</exec>
   </exporter>
   <exporter>
       <extension>html</extension>
       <description>Lottie HTML Preview (*.html)</description>
       <exec stdout="log">lottie-exporter.py</exec>
   </exporter>

you can add two more:

  • Lottie Animation [simplified outlines] (*.json)
  • Lottie HTML Preview [simplified outlines] (*.html)

2. Other way is to add parameter for Group Layer, called "Fixed outline width" [bool].

This parameter will tell Synfig to render all outline layers inside with fixed line width.

This approach is more complex than previous, but it has several advantages:

  • It is possible to define which parts of animation will use ordinary outline width and which will use fixed outline width (optimized outlines)
  • User can see the result directly in Synfig before exporting.

Regarding implementation, I recommend to look at how "Outline Grow" parameter works - https://wiki.synfig.org/Group_Layer#Outline_Grow_Parameter
Its principle is the same - it modifies how outlines are rendered inside of group.

@saurabh-ramola

Copy link
Copy Markdown
Member Author

Question: how user can choose to export with variable outline width or not?

I have added an argument -without_variable_width which is False by default but user has the option to set it to True which will export outlines without variable widths when it calls the python file. But I don't know how to implement the GUI for it and how to call it from synfig-studio.

I see two possibilities for this:

1. Add more export options in plugin.xml file.

Our plugin system now got improvements from @mbasaglia which allow to define multiple plugins in plugin.xml file. It is possible to call same python file, but specify different arguments. See specification here - #1309 (comment)

Currently, plugin.xml file of Lottie exporter has following entries:

<exporter>
       <extension>json</extension>
       <description>Lottie Animation (*.json)</description>
       <exec stdout="log">lottie-exporter.py</exec>
   </exporter>
   <exporter>
       <extension>html</extension>
       <description>Lottie HTML Preview (*.html)</description>
       <exec stdout="log">lottie-exporter.py</exec>
   </exporter>

you can add two more:

  • Lottie Animation [simplified outlines] (*.json)
  • Lottie HTML Preview [simplified outlines] (*.html)

2. Other way is to add parameter for Group Layer, called "Fixed outline width" [bool].

This parameter will tell Synfig to render all outline layers inside with fixed line width.

This approach is more complex than previous, but it has several advantages:

  • It is possible to define which parts of animation will use ordinary outline width and which will use fixed outline width (optimized outlines)
  • User can see the result directly in Synfig before exporting.

Regarding implementation, I recommend to look at how "Outline Grow" parameter works - https://wiki.synfig.org/Group_Layer#Outline_Grow_Parameter
Its principle is the same - it modifies how outlines are rendered inside of group.

Awesome, I'll start looking into this :)

@mbasaglia

Copy link
Copy Markdown
Contributor

I think the best option would be to extend the plugin system further, and allow options to be specified in the plugin.xml that would show a dialog before running the script.

Eg:

<exporter>
...
<option label="Simplify outlines" type="bool"/>

</exporter>

Otherwise you could display such a dialog from python

@saurabh-ramola

Copy link
Copy Markdown
Member Author

@mbasaglia , I added the option --without_variable_width which tells the python program to export outlines without variable width when set to True. I added the argument like this

parser.add_argument("--without_variable_width",action='store', default=False)
and made changes into the plugin file like this
<exporter>
<extension>html</extension>
<_description>Lottie HTML Preview without variable widths (*.html)</_description>
<exec stdout="log" interpreter="python">lottie-exporter.py</exec>
<options>
<option name="--without_variable_width" value="True" type="hidden" />
</options>
</exporter>
.

However, after compiling the changes,I exported the file using the new options I had added but the export did not pass the --without_variable_width argument and I still get the output as if the argument was set to False. Could you explain to me where I went wrong.

TIA

@mbasaglia

Copy link
Copy Markdown
Contributor

Options aren't implemented yet, but you can call a different python script

@saurabh-ramola

Copy link
Copy Markdown
Member Author

Added another script export_without_variable_width in the plugin.xml file to be called when user selects the option of exporting without variable widths.

@lgtm-com

lgtm-com Bot commented Aug 25, 2020

Copy link
Copy Markdown

This pull request introduces 1 alert when merging 165cbe1 into bb1a80b - view on LGTM.com

new alerts:

  • 1 for Unused import

@morevnaproject

Copy link
Copy Markdown
Member

I have made attempt to export a simple animated outlines and for some reason it doesn't exports animation.

File - lottie-outlines.sifz.zip

Also, I have noticed the resulting outline is much thicker (if we compare with same file exported with variable width) -
screenshot_001

@saurabh-ramola

Copy link
Copy Markdown
Member Author

Found the issue, there's a mistake in naming the outline dictionaries, fixing it now.

@saurabh-ramola

Copy link
Copy Markdown
Member Author

@morevnaproject can you check now?

@saurabh-ramola

Copy link
Copy Markdown
Member Author

Found the issue, there's a mistake in naming the outline dictionaries, fixing it now.

This wasn't the issue, the issue was a faulty frame appearing at the end of the dictionary.

@lgtm-com

lgtm-com Bot commented Aug 26, 2020

Copy link
Copy Markdown

This pull request introduces 1 alert when merging 2da843f into c7737d6 - view on LGTM.com

new alerts:

  • 1 for Unused import

@saurabh-ramola

Copy link
Copy Markdown
Member Author

The failing build happens as some of the PRs haven't been merged yet, but have passed review.

@morevnaproject

Copy link
Copy Markdown
Member

The failing build happens as some of the PRs haven't been merged yet, but have passed review.

I have fixed this now. ^__^

@morevnaproject

Copy link
Copy Markdown
Member

@morevnaproject can you check now?

Works good for me now! ^__^

@ice0
ice0 merged commit 2b8ea4d into synfig:master Aug 30, 2020
@ice0

ice0 commented Aug 30, 2020

Copy link
Copy Markdown
Collaborator

Merged. Thank you!

rodolforg added a commit to rodolforg/synfig that referenced this pull request Jul 8, 2021
- Convert methods not working with radius of simple circle layer (synfig#1101)
- [Lottie exporter] Add support for variable gamma correction (synfig#1174)
- Changes made to offsetKeyFrame file (synfig#1233)
- Add support for converters: sine, cos, integer, linear gradient, aTan2, Vector angle, radial_composite, radial gradient, vector x, vector y, power, dot product, logarithm, reciprocal, range, vector length, not (synfig#1236 synfig#1254 synfig#1286 synfig#1363 synfig#1409 synfig#1447 synfig#1446 synfig#1516 synfig#1515 synfig#1593 synfig#1586 synfig#1619 synfig#1606 synfig#1650 synfig#1587)
- Add support for blur layers (synfig#1505)
- Add support for Outline layer without variable widths (synfig#1647)
- Improve support for exported values (synfig#2182)
- Some code cleanup (synfig#1199 synfig#1213 synfig#1226 synfig#1456 synfig#2061)
rodolforg added a commit to rodolforg/synfig that referenced this pull request Jul 10, 2021
- Convert methods not working with radius of simple circle layer (synfig#1101)
- [Lottie exporter] Add support for variable gamma correction (synfig#1174)
- Changes made to offsetKeyFrame file (synfig#1233)
- Add support for converters: sine, cos, integer, linear gradient, aTan2, Vector angle, radial_composite, radial gradient, vector x, vector y, power, dot product, logarithm, reciprocal, range, vector length, not (synfig#1236 synfig#1254 synfig#1286 synfig#1363 synfig#1409 synfig#1447 synfig#1446 synfig#1516 synfig#1515 synfig#1593 synfig#1586 synfig#1619 synfig#1606 synfig#1650 synfig#1587)
- Add support for blur layers (synfig#1505)
- Add support for Outline layer without variable widths (synfig#1647)
- Improve support for exported values (synfig#2182)
- Some code cleanup (synfig#1199 synfig#1213 synfig#1226 synfig#1456 synfig#2061)
rodolforg added a commit to rodolforg/synfig that referenced this pull request Jul 10, 2021
- Convert methods not working with radius of simple circle layer (synfig#1101)
- [Lottie exporter] Add support for variable gamma correction (synfig#1174)
- Changes made to offsetKeyFrame file (synfig#1233)
- Add support for converters: sine, cos, integer, linear gradient, aTan2, Vector angle, radial_composite, radial gradient, vector x, vector y, power, dot product, logarithm, reciprocal, range, vector length, not (synfig#1236 synfig#1254 synfig#1286 synfig#1363 synfig#1409 synfig#1447 synfig#1446 synfig#1516 synfig#1515 synfig#1593 synfig#1586 synfig#1619 synfig#1606 synfig#1650 synfig#1587)
- Add support for blur layers (synfig#1505)
- Add support for Outline layer without variable widths (synfig#1647)
- Improve support for exported values (synfig#2182)
- Some code cleanup (synfig#1199 synfig#1213 synfig#1226 synfig#1456 synfig#2061)
@rodolforg rodolforg mentioned this pull request Jul 12, 2021
morevnaproject pushed a commit that referenced this pull request Jul 12, 2021
- Convert methods not working with radius of simple circle layer (#1101)
- [Lottie exporter] Add support for variable gamma correction (#1174)
- Changes made to offsetKeyFrame file (#1233)
- Add support for converters: sine, cos, integer, linear gradient, aTan2, Vector angle, radial_composite, radial gradient, vector x, vector y, power, dot product, logarithm, reciprocal, range, vector length, not (#1236 #1254 #1286 #1363 #1409 #1447 #1446 #1516 #1515 #1593 #1586 #1619 #1606 #1650 #1587)
- Add support for blur layers (#1505)
- Add support for Outline layer without variable widths (#1647)
- Improve support for exported values (#2182)
- Some code cleanup (#1199 #1213 #1226 #1456 #2061)
morevnaproject pushed a commit to morevnaproject/synfig that referenced this pull request Aug 9, 2021
- Convert methods not working with radius of simple circle layer (synfig#1101)
- [Lottie exporter] Add support for variable gamma correction (synfig#1174)
- Changes made to offsetKeyFrame file (synfig#1233)
- Add support for converters: sine, cos, integer, linear gradient, aTan2, Vector angle, radial_composite, radial gradient, vector x, vector y, power, dot product, logarithm, reciprocal, range, vector length, not (synfig#1236 synfig#1254 synfig#1286 synfig#1363 synfig#1409 synfig#1447 synfig#1446 synfig#1516 synfig#1515 synfig#1593 synfig#1586 synfig#1619 synfig#1606 synfig#1650 synfig#1587)
- Add support for blur layers (synfig#1505)
- Add support for Outline layer without variable widths (synfig#1647)
- Improve support for exported values (synfig#2182)
- Some code cleanup (synfig#1199 synfig#1213 synfig#1226 synfig#1456 synfig#2061)
morevnaproject pushed a commit to morevnaproject/synfig that referenced this pull request Aug 9, 2021
- Convert methods not working with radius of simple circle layer (synfig#1101)
- [Lottie exporter] Add support for variable gamma correction (synfig#1174)
- Changes made to offsetKeyFrame file (synfig#1233)
- Add support for converters: sine, cos, integer, linear gradient, aTan2, Vector angle, radial_composite, radial gradient, vector x, vector y, power, dot product, logarithm, reciprocal, range, vector length, not (synfig#1236 synfig#1254 synfig#1286 synfig#1363 synfig#1409 synfig#1447 synfig#1446 synfig#1516 synfig#1515 synfig#1593 synfig#1586 synfig#1619 synfig#1606 synfig#1650 synfig#1587)
- Add support for blur layers (synfig#1505)
- Add support for Outline layer without variable widths (synfig#1647)
- Improve support for exported values (synfig#2182)
- Some code cleanup (synfig#1199 synfig#1213 synfig#1226 synfig#1456 synfig#2061)
morevnaproject pushed a commit to morevnaproject/synfig that referenced this pull request Aug 10, 2021
- Convert methods not working with radius of simple circle layer (synfig#1101)
- [Lottie exporter] Add support for variable gamma correction (synfig#1174)
- Changes made to offsetKeyFrame file (synfig#1233)
- Add support for converters: sine, cos, integer, linear gradient, aTan2, Vector angle, radial_composite, radial gradient, vector x, vector y, power, dot product, logarithm, reciprocal, range, vector length, not (synfig#1236 synfig#1254 synfig#1286 synfig#1363 synfig#1409 synfig#1447 synfig#1446 synfig#1516 synfig#1515 synfig#1593 synfig#1586 synfig#1619 synfig#1606 synfig#1650 synfig#1587)
- Add support for blur layers (synfig#1505)
- Add support for Outline layer without variable widths (synfig#1647)
- Improve support for exported values (synfig#2182)
- Some code cleanup (synfig#1199 synfig#1213 synfig#1226 synfig#1456 synfig#2061)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants