You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of #1289 export to Lottie is called via "File" -> "Export" format.
Currently the Export dialog allows to select file type (just one option at the moment - "Lottie JSON"). But when export is done it creates two files - "json" and "html". It would be nice to have two filetype options - "Lottie JSON" and "Lottie HTML".
It could be implemented by having multiple exporters in a single plugin but I think allowing multiple plugins in the same directory (sharing the same codebase) is more future-proof.
I think import/export plugins should be separated from other plugins, listed in "Plugins" menu. I feel they are completely different "beast". ^__^
I think import/export plugins should be separated from other plugins, listed in "Plugins" menu. I feel they are completely different "beast". ^__^
Yeah after my export implementation they are stored in a separate list in the plugin manager.
I was thinking about reworking the way plugins are handled, having a proper Plugin class instead of a struct with direct member access.
Having accessor functions to plugin data could also allow translated strings to work better as they'd return the value based on the current locale (currently the plugin name is localized based when the plugin is loaded).
This would open up the possibility of having different kinds of plugin, maybe even using different interpreters instead of just python?
Reacted by Anish Gulati, rodolforg and Firas Hanife
Here's my proposal for improvements to the Plugin system:
Import/Export plugin description
<plugin>
<!-- translatable, not strictly needed for exporters but if in the future there is going to be something like a dialog to enable/disable plugins or whatever it might be worth keeping -->
<name>Plugin name</name>
<!-- A plugin can define multiple exporters -->
<exporter>
<!-- An exporter can have multiple extensions -->
<extension>.foo</extension>
<extension>.bar</extension>
<!-- Text shown in the Export dialog (translatable) -->
<description>Example exporter (*.foo, *.bar)</description>
<!-- worth having exec per exporter, in case a plugin wants to have different scripts for different formats --><!-- stdout/stderr attributes define how the output is to be handled by synfig "ignore" does nothing, "message" shows App::dialog_message_1b, "log", calls synfig::info --><!-- interpreter is the interpreted, "python" by default (and perhaps the only option for now) -->
<execstdout="log"stderr="message"interpreter="python">myscript.py</exec>
<!-- extra options for the plugin -->
<options>
<!-- will pass `--foobar 123` to `myscript.py` `type` is for future extensibility, to build a dialog for some options as some format might require them. For now it could be used to have different exporters using the same script-->
<optionname="--foobar"value="123"type="hidden" />
</options>
</exporter>
<importer><!-- same stuff as exporter --></importer>
</plugin>
The extra attributes for <exec> (all optional) and the idea of <options> to build
a dialog with plugin options can also be used by non import/export plugins.
Code changes
Support for importer plugins
Separate types for importers/exporters and other plugins
Generalize the code used to run the plugins, and move it in the plugin manager
Use an internal ID for the plugin instead of passing the path to the script when triggering plugins from the UI
I think import/export plugins should be separated from other plugins, listed in "Plugins" menu. I feel they are completely different "beast". ^__^
Yeah after my export implementation they are stored in a separate list in the plugin manager.
I mean to store them in completely different location and assume they might have different XML structure. ^__^
This way the format of regular plugins won't hold you from making changes to format of importer/exporter plugins.
Being said that, I am not against of implementation in #1313. This is just my thoughts. ^__^
...
<!-- An exporter can have multiple extensions -->
<extension>.foo</extension>
<extension>.bar</extension>
<!-- Text shown in the Export dialog (translatable) -->
<description>Example exporter (*.foo, *.bar)</description>
...
Looks cool!
I suggest to use <description>Example exporter</description> for description tag instead and have stuff from tags added automatically.
In this case, it would be nice for two tags generate two separate entries for filetype combobox:
Example exporter (*.foo)
Example exporter (*.bar)
instead of
Example exporter (*.foo, *.bar)
This will be easier for user to choose particular format (with single extension) and Synfig can add extension to filename automatically.
In latter case (I mean Example exporter (*.foo, *.bar)) there is uncertainty and user have type extension manually if he wants ".bar" instead of ".foo". ^__^
Another suggestion is to completely remove <description> and use string from <name> tag. ^__^
For <extension> tag I also suggest to remove dot at the start. ^__^
I see the different <extension> more as alternatives for the same format than separate formats (eg: .jpg .jpeg).
I agree that the (*.foo, *.bar) stuff can be automated but I'm not sure how it's supposed to work with internationalization (specifically right-to left languages).
I think it's worth having <description> in case a plugin exports different formats (eg: it might be a bit confusing to see "Lottie (.json)" "Lottie (.html)", I think it's probably better to allow having different descriptions, but maybe it can be optional?
For example, my plugin adds support for Telegram stickers, SVG, and other formats (all sharing the same codebase) so I think they should have different names in the dialog.
I agree that the (*.foo, *.bar) stuff can be automated but I'm not sure how it's supposed to work with internationalization (specifically right-to left languages).
Ah, okay, you right.
For example, my plugin adds support for Telegram stickers, SVG, and other formats (all sharing the same codebase) so I think they should have different names in the dialog.
You right, in this case you can have multiple <exporter> sections with different descriptions.
"Lottie (.json)", "Lottie (.html)"
I think having separate entries "Lottie (.json)" and "Lottie (.html)" is perfectly fine. This actually was my intention to get it like that when I started this issue. ^__^
Well, then we can just have 2 separate <exporter> entries for Lottie.
Activity
mbasaglia commentedon Mar 31, 2020
Link to my previous comment: #1289 (comment)
morevnaproject commentedon Mar 31, 2020
In response to #1289 (comment):
I think import/export plugins should be separated from other plugins, listed in "Plugins" menu. I feel they are completely different "beast". ^__^
mbasaglia commentedon Mar 31, 2020
Yeah after my export implementation they are stored in a separate list in the plugin manager.
I was thinking about reworking the way plugins are handled, having a proper Plugin class instead of a struct with direct member access.
Having accessor functions to plugin data could also allow translated strings to work better as they'd return the value based on the current locale (currently the plugin name is localized based when the plugin is loaded).
This would open up the possibility of having different kinds of plugin, maybe even using different interpreters instead of just python?
AnishGG commentedon Mar 31, 2020
Actually there is one more file
.log, that is also created. It stores the necessary logs, for instance if some kind of failure occurs.This would be amazing!
mbasaglia commentedon Mar 31, 2020
The need for logs could also be removed, maybe synfig can handle stdout/stderr from plugins a bit differently than what it currently does
mbasaglia commentedon Mar 31, 2020
Here's my proposal for improvements to the Plugin system:
Import/Export plugin description
The extra attributes for
<exec>(all optional) and the idea of<options>to builda dialog with plugin options can also be used by non import/export plugins.
Code changes
popenIt's all rather simple stuff, so if everything is ok I can start implementing it.
rodolforg commentedon Mar 31, 2020
I like your proposal!
My suggestions:
mbasaglia commentedon Mar 31, 2020
yeah those things are mentioned in the proposal.
rodolforg commentedon Mar 31, 2020
Oh sorry! I didn't the comment about supporting multiple exporters lol.
Regarding translations, I just proposed how it could be done.
mbasaglia commentedon Apr 1, 2020
I created a branch that implements most of the things listed in my proposal above.
It doesn't yet contain import plugins and options.
morevnaproject commentedon Apr 1, 2020
I mean to store them in completely different location and assume they might have different XML structure. ^__^
This way the format of regular plugins won't hold you from making changes to format of importer/exporter plugins.
Being said that, I am not against of implementation in #1313. This is just my thoughts. ^__^
Looks cool!
I suggest to use
<description>Example exporter</description>for description tag instead and have stuff from tags added automatically.In this case, it would be nice for two tags generate two separate entries for filetype combobox:
instead of
This will be easier for user to choose particular format (with single extension) and Synfig can add extension to filename automatically.
In latter case (I mean
Example exporter (*.foo, *.bar)) there is uncertainty and user have type extension manually if he wants ".bar" instead of ".foo". ^__^Another suggestion is to completely remove
<description>and use string from<name>tag. ^__^For
<extension>tag I also suggest to remove dot at the start. ^__^mbasaglia commentedon Apr 1, 2020
I see the different
<extension>more as alternatives for the same format than separate formats (eg: .jpg .jpeg).I agree that the (*.foo, *.bar) stuff can be automated but I'm not sure how it's supposed to work with internationalization (specifically right-to left languages).
I think it's worth having
<description>in case a plugin exports different formats (eg: it might be a bit confusing to see "Lottie (.json)" "Lottie (.html)", I think it's probably better to allow having different descriptions, but maybe it can be optional?For example, my plugin adds support for Telegram stickers, SVG, and other formats (all sharing the same codebase) so I think they should have different names in the dialog.
morevnaproject commentedon Apr 2, 2020
Ah, okay, you right.
You right, in this case you can have multiple
<exporter>sections with different descriptions.I think having separate entries "Lottie (.json)" and "Lottie (.html)" is perfectly fine. This actually was my intention to get it like that when I started this issue. ^__^
Well, then we can just have 2 separate
<exporter>entries for Lottie.Okay, everything is resolved then. ^__^
mbasaglia commentedon May 9, 2020
probably this can be closed now
morevnaproject commentedon May 9, 2020
Yes, thank you!