Switch to full style
Post all Gimp scripts and script writing questions here
Post a reply

Re: Simple path shapes

Tue Oct 25, 2016 9:47 pm

i don't know how it's added ... i just get selection bounding box values.
and when there's no selection the bounding box should return 0,0 image.width and image.height.
unless there's a selection before calling my code.

Re: Simple path shapes

Tue Oct 25, 2016 11:14 pm

trandoductin wrote:i don't know how it's added ... i just get selection bounding box values.
and when there's no selection the bounding box should return 0,0 image.width and image.height.
unless there's a selection before calling my code.

your code starts by closing any selection "pdb.gimp_selection_none(image)"

Re: Simple path shapes

Tue Oct 25, 2016 11:24 pm

no because i want to allow user to apply ruler/protractor to
a selection as well.

Re: Simple path shapes

Wed Oct 26, 2016 12:09 am

I'm just an old scheme writer but I'm sure something is wrong with maths

protractor from 'Simple path shapes' starts as below
# Draw_Protractor Rel 1 [download: https://gimplearn.net/viewtopic.php?t=3&t=175#p512]
# Created by Tin Tran https://gimplearn.net
# Comments directed to http://gimpchat.com or http://gimpscripts.com

pdb.gimp_selection_none(image)
if sel == False:
x1 = 0
y1 = 0
x2 = W
y2 = H

W = float(abs(x2-x1))
H = float(abs(y2-y1))
radius = min(W,H)/2.0
midx = x1 + (W/2.0)
midy = y1 + (H/2.0)

Re: Simple path shapes

Wed Oct 26, 2016 2:38 am

Thanks for test

Rel 0.9:
- Repair of error for "Protractor" and "Ruler" (not centered when no selection).
- Show a selection, after you run the shape, when you select "In Selection" on the menu.
- Shapes "Protractor" rel 3: Draw marks as a single stroke for speed, outside and inside circle
- Add shape: "Wilber"

Re: Simple path shapes

Wed Oct 26, 2016 6:48 am

MrQ shapes (Wilber) and Ofnuts slinky. :)

Image

Re: Simple path shapes

Wed Oct 26, 2016 10:11 am

MareroQ and Rod: Love those renditions of Wilber!! Very Cute.

Re: Simple path shapes

Wed Oct 26, 2016 4:20 pm

which part seems wrong?

Re: Simple path shapes

Wed Oct 26, 2016 6:43 pm

trandoductin wrote:which part seems wrong?


Code formatted centered like this will give you an indentation error :)

Re: Simple path shapes

Wed Oct 26, 2016 6:51 pm

Nah Nah Nah (close but no cigar) In protractor you left me with a selection i did not start with, in ruler you also left a selection i did not start with and the horizontal rulers did not cover the entire width of the image :bawl

Re: Simple path shapes

Wed Oct 26, 2016 7:11 pm

There's no selection code at all it just draws a path/vector.
And I just tried ruler and it covered the entire width of image.

Re: Simple path shapes

Wed Oct 26, 2016 7:38 pm

I'm using 'Simple path shapes centered' Rel 9 on a 600x400 image with no selection in place and the output is below
Image

Re: Simple path shapes

Wed Oct 26, 2016 8:04 pm

The preferred output for using 'Simple path shapes centered' Rel 9 on a 600x400 image with no selection in place and the output is as per the 'draw percentage ruler' script below
Image

Re: Simple path shapes

Wed Oct 26, 2016 11:43 pm

'Simple path shapes' now returns a selection with the path due to this line added at the end↓
Image
An existing selection should be saved to a channel and a marker set to TRUE at the start of the script so it can be returned at the end

Re: Simple path shapes

Thu Oct 27, 2016 1:22 am

Will it be better?

Re: Simple path shapes

Thu Oct 27, 2016 2:37 am

MareroQ yes that looks perfect but I gather you increased the image size

Re: Simple path shapes

Thu Oct 27, 2016 6:03 am

'Draw percentage ruler' functions perfectly, if you can get 'Simple path shapes' to work the same for all shape choices that would be great

Re: Simple path shapes

Thu Oct 27, 2016 10:43 am

MareroQ,

I'm going to have to backtrack on my "just one" request and kindly request another: pie slices. It seems a tutorial in question utilizes the pie slice and I think it would make a very unique and widely used shape. Preferrably 1/8th, 1/4th, and half moon. Of course, this is a request, and is totally up to you for consideration. I do know there is a pie shape, however, it's 3/4 shapes, overlapped. Is it possible to render them in individual slices?

Re: Simple path shapes

Thu Oct 27, 2016 2:26 pm

I'm not sure that's it...

Re: Simple path shapes

Thu Oct 27, 2016 7:51 pm

Good morning MareroQ, your ruler still does not produce the desired outcome without a selection in place [such as full image size] should have output as below↓ (done after select-all)
Image
but instead the rulers are incorrect
Image
Also the length of the divisions on the ruler are tied to the stroke width rendering it impracticable to use the stroke feature.
at the start of the script if no selection is found select all and set your [in selection] toggle to yes remembering to set your return selection marker to no and run your script as if a selection was made
perhaps make the length of the divisions in ruler relate to the resize layer lengths
Post a reply