Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Smoothing a path: a better algorithm
#6
Quote:I am no coder and my code is usually quite messy.

Your code is not bad, a bit messy I admit, but your detailed comments throughout the code make it really easy to understand and to refactor.

Quote:Maintaining would be a nightmare.
Quote:
  1. I take that one routine and the matrix inversion code out and make them into a new file g2continuity.py.
  2. The rest is made into a file g2continuity_plugin.py.
  3. In the file g2continuity_plugin.py I write "from g2continuity import *"?

The reason of my suggestion; my previous post was bad; forget the "mathematical stuff", think RE-USABLE code: you have written several plug-ins related to bezier curves handling and if I'm not wrong (I don't have ridden your other plug-ins code), lots of code is shared between all these plug-ins. So, putting in a python module all RE-USABLE code (like the g2continuity  BCurve classes) would make your plug-ins easier and faster to develop and easier to maintain.

Quote:
  1. Then I make a .zip file from those two files? Or should I make one folder from those two files and a .zip from that?
  2. Then what? When I share the plugin, that .zip file is what I share?
  3. And the user unzippes it and places the contents in Gimp's plug-ins folder?
  4. From where does that "dedicated folder" of the plugin come?

In gimp 2.10.x, when you install a plug-in, you simply have to  copy a file in the plug-ins directory:
C:\Users\<user>\AppData\Roaming\GIMP\2.10\plug-ins\G2_continuity.py

In gimp 3 (but you can also do it in 2.10.x), every plug-in need to be put in a dedicated folder, inside the plug-ins directory:
C:\Users\<user>\AppData\Roaming\GIMP\2.10\plug-ins\G2_continuity\G2_continuity.py

So you can provide a plug-in with one python script and several others files like python modules, images, brushes, gradients, ... all you plug-in needs:
C:\Users\<user>\AppData\Roaming\GIMP\2.10\plug-ins\G2_continuity\G2_continuity-plug-in.py
C:\Users\<user>\AppData\Roaming\GIMP\2.10\plug-ins\G2_continuity\reusable-code-module.py

And to distribute your plug-in, simply put all these files in your zip archive.

Anyway, your g2continuity is a must have. My port to 2.99 is almost finished (already usable) but several things in the gimp api needs to be fixed/improved.
With your permission, I will make this plug-in a core gimp plug-in in the future gimp 2.99.x/3.0 release.
Reply


Messages In This Thread
RE: Smoothing a path: a better algorithm - by tmanni - 04-25-2022, 09:49 PM

Forum Jump: