# A feature request for plugin development

**URL:** <https://forums.synfig.org/t/a-feature-request-for-plugin-development/12125>\
**Category:** Plugins\
**Created:** [May 3, 2021, 1:11pm UTC](https://forums.synfig.org/t/a-feature-request-for-plugin-development/12125 "2021-05-03T13:11:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![veermetri05](https://forums.synfig.org/user_avatar/forums.synfig.org/veermetri05/32/6904_2.png) [@veermetri05](https://forums.synfig.org/u/veermetri05)\
**Post date:** [May 3, 2021, 1:11pm UTC](https://forums.synfig.org/t/a-feature-request-for-plugin-development/12125/1 "2021-05-03T13:11:06Z")

</div>

Hello, I have developed these two plugins in Python

> [@A plugin origin to the center of object](https://forums.synfig.org/t/a-plugin-origin-to-the-center-of-object/12119):
>
> Here a plugin which will set it’s origin to center for all layers which will have bline and origin (doesn’t support groups yet) [Set the orgin to center.zip](https://forums.synfig.org/uploads/short-url/phFE0kLreSIL9QLCzGMg9hwe9Wl.zip) (3.8 KB) Extract the zip file and then move it to your plugins directory . Restart Synfig and you can see the option in plugin menu “Center the Origin”. This will center the origin. This is based on position of vertices the center is calculated by where the vertices are. Considering a imaginary rectangle around that object the midpoint is …

> [@A plugin to convert all outlines to advanced outlines](https://forums.synfig.org/t/a-plugin-to-convert-all-outlines-to-advanced-outlines/12111):
>
> I have created a plugin which will convert all the outlines to advanced outlines. Advantages over using the “Make Advanced Outline” (within Synfig studio): Preserves the color Preserves the width Useful if you want every outline to be advanced outline If you face any issues then please tell me, we will discuss and solve that. [Make advanced outline.zip](https://forums.synfig.org/uploads/short-url/gJ91xlaLLEKE2lto86prFVwsm8a.zip) (1.4 KB) Unzip the file and paste it in the plugins folder for your operating system. Restart the Synfig Desktop. The option is visible in …

I know how plugins are supposed to work in Synfig, they take sif file as input and return a sif file with it’s internal data modified. And there is no way for plugin to get input from user, here’s a example for why there is need for input from user.

For the plugin I created (which centers the origin) if there would be some kind of UI for the plugins to interact with users I can get the which layers the user want to center the origin. It’s not necessary that user always wants all the layers to be operated on.

I haven’t tried but taking input from command line doesn’t seem to be a good option, think of it like what if user wants to select multiple objects. If you would not be efficient to select all the options with command line.

**What do you want ?**

I think if we can use webview to provide a UI for the plugin it will be great feature for plugin developers. Software like Adobe AfterEffects do this, they have a web view panel which plugin developers can use to render UI .

**Why can’t you do it ?**

I am still learning C++ and I don’t have much experience with it, but if someone guided me so that I can properly start making improvements to the UI of Synfig, I would definitely help.

**How should we do it ?**  
I found this

> **[GitHub - webview/webview: Tiny cross-platform webview library for C/C++. Uses...](https://github.com/webview/webview)**
>
> Tiny cross-platform webview library for C/C++. Uses WebKit (GTK/Cocoa) and Edge WebView2 (Windows). - GitHub - webview/webview: Tiny cross-platform webview library for C/C++. Uses WebKit (GTK/Cocoa...

This can implemented with gtkmm, according to them “**It supports two-way JavaScript bindings (to call JavaScript from C/C++/Go and to call C/C++/Go from JavaScript).**” So we can call functions from JavaScript to C++ so we don’t need to have C++ knowledge for it. If some how we make all the function call available to JavaScript then plugin will be more powerful.

**Is this really necessary ?**  
I think it is really necessary, if Synfig allows for development of plugins which will also have control for UI then more powerful plugins can be developed, for example we can create something like [Animation Nodes](https://github.com/JacquesLucke/animation_nodes) (doesn’t use webview) for Synfig. It will give more potential for developers.

**What are other suggestions?**  
I don’t necessarily think webview is needed. But some way to show the UI is needed.

---

<div class="post-metadata">

**Author:** ![BobSynfig](https://forums.synfig.org/user_avatar/forums.synfig.org/bobsynfig/32/175_2.png) [@BobSynfig](https://forums.synfig.org/u/BobSynfig)\
**Post date:** [May 3, 2021, 2:22pm UTC](https://forums.synfig.org/t/a-feature-request-for-plugin-development/12125/2 "2021-05-03T14:22:54Z")

</div>

Thank you for your implication in the project 🙂  
As your can already use Python, I would suggest to use [PyGTK](https://en.wikipedia.org/wiki/PyGTK)  
GTK is the toolkit used in Synfig, it would bring consistency and also permit you to have experience for the UI of Synfig.  
After all, a language is just a kind of glue between elements 😉  
[Overview — PyGObject](https://pygobject.readthedocs.io/en/latest/)  
[The Python GTK+ 3 Tutorial — Python GTK+ 3 Tutorial 3.4 documentation](https://python-gtk-3-tutorial.readthedocs.io/en/latest/)

---

<div class="post-metadata">

**Author:** ![rodolforg](https://forums.synfig.org/letter_avatar_proxy/v4/letter/r/c68b51/32.png) [@rodolforg](https://forums.synfig.org/u/rodolforg)\
**Post date:** [May 3, 2021, 3:16pm UTC](https://forums.synfig.org/t/a-feature-request-for-plugin-development/12125/3 "2021-05-03T15:16:10Z")

</div>

It was one of our ideas for GSoC last year 🙂

I intend to play with it a bit for solving this issue [[Windows] Plugins are failed to execute when Synfig started with "--console" parameter. · Issue #1569 · synfig/synfig · GitHub](https://github.com/synfig/synfig/issues/1569) too.  
At first, it would provide some basic access to current document only. And later, it would provide some GUI interaction.

But now I’m focused on [solving](https://github.com/synfig/synfig/pull/2086) the [copy’n paste issues](https://github.com/synfig/synfig/issues/1393) (specially [skeleton’s](https://github.com/synfig/synfig/issues/714)) and a new (smaller) color editor that doesn’t [pollute the undo history](https://github.com/synfig/synfig/issues/1302).

Oh, and SVG importer (minor) improvements (like avoiding memory leak and supporting ellipse shape element…)

---

<div class="post-metadata">

**Author:** ![berteh](https://forums.synfig.org/user_avatar/forums.synfig.org/berteh/32/46_2.png) [@berteh](https://forums.synfig.org/u/berteh)\
**Post date:** [May 8, 2021, 3:41pm UTC](https://forums.synfig.org/t/a-feature-request-for-plugin-development/12125/4 "2021-05-08T15:41:02Z")

</div>

I think that pyGTK is the way to go for interactive scripts… But if you want a quick workaround you could just have the script modify only those objects (respectively outlines) which names start with a given character or word, and remove or not this prefix depending on some setting.

The user would then ‘simply’ need to rename the objects to be aligned, or outlines to be converted, and add, for instance, a ‘’\*’’ prefix (or suffix) before calling the script.
