Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Arrow Script
#81
The issue with gimp-image-get-active-vectors being removed is solved in a recent 2.99.13 commit by the introduction of the function gimp-image-get-selected-vectors.

Further good news is that the offsetting required to get arrows drawn correctly on layers that are offset from the image origin in V2.10 is not required in V2.99.13 - at least almost all of the changes required for V2.10 are not required. However, stroking a path on to an offset layer inV2.99.12 or V2.99.13 subtracts the offset of the layer from the path - hence the arrow shaft is drawn in the wrong place. If this only applied to the arrow script I would add code to work around this but the problem also seems to affect using the standard GIMP Stroke Path dialog. Also the standard Stroke Selection suffers from the same problem. I have changed the relevant two functions in my self-build version of 2.99.13 and the problems are fixed. I have created a GIMP issue with a file to demonstrate the problem. One of the developers has reproduced the problem using the file that I included with the issue but says that he failed to reproduce it when he created a file from scratch. I can't find a way to make the problem not appear.

My request is therefore, if you are interested in seeing a V2.99/V3 version of the arrow script can anyone get the problem not to appear? If so please let me have a copy of the file that shows the problem not appearing (if that makes sense).

The GIMP issue describes the steps that I took to demonstrate the problem - using V2.99.12 should show the problem, you don't need V2.99.13.

https://gitlab.gnome.org/GNOME/gimp/-/issues/8767

If we can't find a procedure to make the problem not occur then perhaps the developer was mistaken in what they saw. Alternatively if we can determine the procedure whereby the problem doesn't appear then perhaps I can work around it in the script.

If this can be sorted there will be a version of the arrow script for V2.99.14

As noted in the GIMP issue the path or selection has to be stroked with a paint tool - the problem doesn't occur if the "Stroke line" option is selected.
Reply
#82
(10-25-2022, 04:35 PM)programmer_ceds Wrote: Further good news is that the offsetting required to get arrows drawn correctly on layers that are offset from the image origin in V2.10 is not required in V2.99.13 - at least almost all of the changes required for V2.10 are not required.

Why are they changing this? The arrow script issue wasn't a gimp bug. Do you have a link to the issue that was raised requesting it?

(10-25-2022, 04:35 PM)programmer_ceds Wrote: However, stroking a path on to an offset layer inV2.99.12 or  V2.99.13 subtracts the offset of the layer from the path - hence the arrow shaft is drawn in the wrong place. If this only applied to the arrow script I would add code to work around this but the problem also seems to affect using the standard GIMP Stroke Path dialog. Also the standard Stroke Selection suffers from the same problem.

Hardly suprising, change the coordinates and there will be consequences, possibly more than you have found so far. Not to mention the many plugins that were handling the layer offset correctly will become broken.

(10-25-2022, 04:35 PM)programmer_ceds Wrote: As noted in the GIMP issue the path or selection has to be stroked with a paint tool - the problem doesn't occur if the "Stroke line" option is selected.  

I don't fancy using different coordinates depending on how I stroke the path.
Reply
#83
(10-26-2022, 03:25 AM)teapot Wrote: Why are they changing this? The arrow script issue wasn't a gimp bug. Do you have a link to the issue that was raised requesting it?

The arrow script bug that we were discussing previously was in V2.10.32 - the issue that I have raised relates to the behaviour of standard GIMP functions (Edit/Stroke Path and Edit/Stroke Selection) in GIMP V2.99.12/13 - it just happens that I noticed it when testing the V3 version of the arrow script and found that the arrow shafts were being drawn in the wrong place. This is not as a result of any change made to GIMP as a result of the recent arrow script changes - I didn't raise an issue for that (thankfully users of this site pointed out the error of my ways before I embarrassed myself on the GIMP site!) The code that is causing the problem lies in functions gimp_paint_core_stroke_vector() and gimp_paint_core_stroke_selection() (stroking selections has the same problem) in file app/paint/gimppaintcore-stroke.c this code remains unchanged from V2.10.32 - it is not something that has been introduced recently.

(10-26-2022, 03:25 AM)teapot Wrote: Hardly surprising, change the coordinates and there will be consequences, possibly more than you have found so far. Not to mention the many plugins that were handling the layer offset correctly will become broken.

That is quite possible but when the standard Edit/Stroke Path and Edit/Stroke Selection don't function correctly with offset layers there is a problem that needs to be fixed. It could be that I am doing something wrong but I can't see a problem with the procedure that I noted in the GIMP issue - if there is a problem with my procedure then I can see numerous others falling into the same trap.

If there is something that determines whether or not strokes appear in the correct place on offset layers then we need to know what that something is and how to recognise it. The latest comment from the developer suggests that there is a possibility that they may have been mistaken in thinking that the stroke sometimes appeared in the correct place (see the latest posts on the GIMP issue). However, if anyone else can get paths and/or selections stroked in the correct places in V2.99.12/13 I should like to hear from them (preferably with an xcf file that shows this working correctly).

(10-26-2022, 03:25 AM)teapot Wrote: I don't fancy using different coordinates depending on how I stroke the path.

Quite - the corrections that I have identified relate to the functions that stroke selections and paths (vectors) using the paintbrush tool - implementing these corrections will mean that stroking with a line or with a paint tool will result in the strokes appearing in the same places regardless of the method used to create the strokes.
Reply
#84
(10-26-2022, 09:58 AM)programmer_ceds Wrote:
(10-26-2022, 03:25 AM)teapot Wrote: Why are they changing this? The arrow script issue wasn't a gimp bug. Do you have a link to the issue that was raised requesting it?

The arrow script bug that we were discussing previously was in V2.10.32 - the issue that I have raised relates to the behaviour of standard GIMP functions (Edit/Stroke Path and Edit/Stroke Selection) in GIMP V2.99.12/13 - it just happens that I noticed it when testing the V3 version of the arrow script and found that the arrow shafts were being drawn in the wrong place. This is not as a result of any change made to GIMP as a result of the recent arrow script changes - I didn't raise an issue for that (thankfully users of this site pointed out the error of my ways before I embarrassed myself on the GIMP site!) The code that is causing the problem lies in functions gimp_paint_core_stroke_vector() and gimp_paint_core_stroke_selection() (stroking selections has the same problem) in file app/paint/gimppaintcore-stroke.c this code remains unchanged from V2.10.32 - it is not something that has been introduced recently.

(10-26-2022, 03:25 AM)teapot Wrote: Hardly surprising, change the coordinates and there will be consequences, possibly more than you have found so far. Not to mention the many plugins that were handling the layer offset correctly will become broken.

That is quite possible but when the standard Edit/Stroke Path and Edit/Stroke Selection don't function correctly with offset layers there is a problem that needs to be fixed. It could be that I am doing something wrong but I can't see a problem with the procedure that I noted in the GIMP issue - if there is a problem with my procedure then I can see numerous others falling into the same trap.

If there is something that determines whether or not strokes appear in the correct place on offset layers then we need to know what that something is and how to recognise it. The latest comment from the developer suggests that there is a possibility that they may have been mistaken in thinking that the stroke sometimes appeared in the correct place (see the latest posts on the GIMP issue). However, if anyone else can get paths and/or selections stroked in the correct places in V2.99.12/13 I should like to hear from them (preferably with an xcf file that shows this working correctly).

(10-26-2022, 03:25 AM)teapot Wrote: I don't fancy using different coordinates depending on how I stroke the path.

Quite - the corrections that I have identified relate to the functions that stroke selections and paths (vectors) using the paintbrush tool - implementing these corrections will mean that stroking with a line or with a paint tool will result in the strokes appearing in the same places regardless of the method used to create the strokes.

Thanks for your reply.

From a quick look, it might be commit 8934d43975 is causing the issue.  https://gitlab.gnome.org/GNOME/gimp/-/commit/8934d43975

It's part of GIMP_2_99_6-398-g8934d43975 and you were using V2.99.12/13.

Jehan says:

At this step, it is still very bugged and not really working properly. In particular, since we don't process the drawable offset early anymore (because it makes no sense when we pass a list of drawables with different offsets), I suspect that all the offset-related code will be very broken.
Reply
#85
(10-26-2022, 05:30 PM)teapot Wrote: Thanks for your reply.

From a quick look, it might be commit 8934d43975 is causing the issue.  https://gitlab.gnome.org/GNOME/gimp/-/commit/8934d43975

It's part of GIMP_2_99_6-398-g8934d43975 and you were using V2.99.12/13.

Jehan says:

At this step, it is still very bugged and not really working properly. In particular, since we don't process the drawable offset early anymore (because it makes no sense when we pass a list of drawables with different offsets), I suspect that all the offset-related code will be very broken.

I can't see the change that would make stroking with a line work (but that's not to say it isn't there). Function app/tools/gimppainttool-paint.c/gimp_paint_tool_paint_start() has had a similar change to ignore the drawable offset to the changes that I made to the two functions noted earlier which suggests that the changes that I have made might be correct. I have submitted an MR so we'll see whether or not this is accepted (or just ignored!)
Reply
#86
I have uploaded a new version of the zip file. This contains two versions of the arrow script (http://programmer97.byethost10.com/Files/arrow.zip)

arrow.scm is for GIMP versions up to and including V2.99.10

arrow_V3.scm is for GIMP versions V2.99.14 and later (until they change something else!)

(Only include one of these files in your scripts folder)

There is no version of the script for GIMP V2.99.12 as a function that the script relies on was removed without a replacement. A replacement function was included in V2.99.14.

Note that arrow_V3.scm will draw the arrow shaft in the wrong place if the arrow is drawn on the original layer (rather than creating a new layer for the arrow) and the original layer is offset. As noted above this is a problem with GIMP and not with the script - see the following links for details:

https://gitlab.gnome.org/GNOME/gimp/-/me...quests/764
https://gitlab.gnome.org/GNOME/gimp/-/issues/8767

The work-around until GIMP is fixed is to draw the arrow on a new layer if the original layer is offset.
Reply


Forum Jump: