Issue #1:
When the code of the plugin is first run (which is sort of when the data is initialized) it seems that the Gimp context isn’t complete, so calls such as Gimp.Brush.get_by_name('confetti')
return nothing. So if you want to separate data initialization from the code, well, tough luck.
Issue #2:
I have spent most of the day fighting the use of the noneOK
and defaultToContext
flags. It appears that defaultToContext
is really willBeClobberedByContextEvenIfDefined
but I don’t get the purpose of noneOK
since If the resource is not defined Gimp also uses the resource from the context. So how are these really supposed to work?
In addition it seems that something somewhere remembers settings (I have scoured plug-in-settings/
between Gimp restarts of course). It went like this:
- I start all my tests with a resource argument called
'brush'
that was by default set to theConfetti
brush withdefaultToContext=True
. - So in the dialog I get that brush displayed with the context brush despite it being expected to be
Confetti
- I want to investigate the effect of
defaultToContext
so set it to False: the brush is still the context brush - I define 4 brush args called
brush1
tobrush4
to which I assign each of the combos ofnoneOK
anddefaultToContext
. At last, two of them show theConfetti
brush (the ones with thedefaultToContext=False
. - I add a fifth brush
brush5
where the flags assume the defaults in my code (alsodefaultToContext=False
). It displays asConfetti
as expected. - I just change the name back to
brush
and now the brush displays as the context brush. - Acid test: I only change the procedure identifier in the
.py
and the brushbrush
is back toConfetti
- I change back to the original procedure name and the context brush reappears
- Plot twist: if I then use “Reset to factory defaults” the Confetti brush reappears… (but not if I use “Reset to initial values”)
Or is it just because the name brush
is used somewhere? (after all I can’t use image
as an argument name already).