Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Smoothing a path: a better algorithm
#7
(04-25-2022, 09:49 PM)tmanni Wrote: ...
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.
...

For my own use, I have an unorganized collection of small Python functions, each written for some special problem at hand. But they are not so well designed or tested, so probably they are buggy, therefore bound to be changed every now and then. Making a module from every small function is not reasonable.

But that class BCurve is a different matter. There I agree with you. I use it in almost every plugin of mine, so it could well be made into a module. And, different plugins would each contain its own copy of the class BCurve, in its dedicated folder. And if I should later make changes in BCurve, different plugins could each have a different version of BCurve, and each plugin would work all right since there are no imports between them.

Right now I don't remember if I have any other such candidates for re-usable modules. But modules might be useful to organize a plugin, so that everything would not be in one big file.

I had some such ideas about modules before, and I first forgot but now remember that two years ago we had a short discussion with Ofnuts:

https://www.gimp-forum.net/Thread-Import...hon-plugin

and at that time I decided to abandon modules and to make each plugin one big file.

Now I made a small experiment of using modules, and succeeded, copying the idea from Ofnuts' example in Modules.zip in:

https://www.gimp-forum.net/Thread-Import...8#pid17158

where the crucial structure is:

Code:
import sys,os,os.path,re,glob,traceback
from gimpfu import *

me=os.path.abspath(sys.argv[0])
mydir=os.path.dirname(me)
sys.path.insert(0,mydir)

import module1,module2,module3

But am I right when I guess that in Gimp3 this trick of Ofnuts will not be needed but everything will be automatically right and only an import clause is needed? (In Gimp2 the trick seems necessary.)

(04-25-2022, 09:49 PM)tmanni Wrote: ...
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.

By all means, if you think it worth-while and good enough, please go ahead.

But what about maintaining? I have liked to have everything in my own hands, so that whenever I have wanted to make changes in some plugin, I have just made a new version and published it. If now you make it a core gimp plug-in, then how is maintaining done? It is out of my hands? If there is a need for changes, who will do them? And if I want to make changes what is the process?

Anyway, it will be interesting to see what you make from it.
Reply


Messages In This Thread
RE: Smoothing a path: a better algorithm - by Ottia Tuota - 04-26-2022, 02:22 PM

Forum Jump: