Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My Gimp 3.0 Plug-in (group_selected_layers)
#2
Since you ask:
  • You should test it on 3.00 RC1 (and from my tests with my own code, do_set_i18n() has to return more that False. OTOH you can completely skip the definition, if you don't want to do I18N).
  • Sensitivity should be set to DRAWABLES (not plural) since you want more than one drawable selected
  • <Image>/Filters/Development/Python-Fu/ isn't where you put your script for general use. A much better place would be <Image>/Layer/Stack, or even <Layers> so that it appears in the right click menu of the Layers list. Also note the slight difference between set_menu_label() and add_menu_path() that hints that you can have the plugin in more than one menu (so, in both places mentioned above)(note: I didn't test this, but easy enough to try).
  • 'Run group-selected-layers' as a doc is a bit tautological. Something like Put selected layers in new group would be a bit more useful (same for the menu label...)
  • IMHO you should have a dialog to ask for a group name
  • selected_layers = image.get_selected_layers() is not really useful... all this data is in your n_drawables argument
  • Didn't run your script, but I wonder what happens when all layers are in the top level (parent is image). I think your script would try to insert the image under a group (or pass None as the layer to insert, that could catch the callee off-guard...)
  • print("ERROR: could not get any parents from selected layers") won't be visible to most users (have to be on Linux/OSX with Gimp started from a terminal, or on Windows using gimp-console). How about using Gimp.message()? But then since get_parent() always return something, this code will never be executed unless there are no layer as inputs, in which case see remark #2.
  • Gimp.PlugIn.__init__(self) should be super().__init__()
Reply


Messages In This Thread
RE: My Gimp 3.0 Plug-in (group_selected_layers) - by Ofnuts - Yesterday, 10:33 AM

Forum Jump: