PDA

View Full Version : Selection to Stencil



Charlie
07-23-2011, 01:47 AM
This script creates a stencil from a selection. Only painted areas are included.

1) Select area
2) Run script


Questions for Ambient:
1) Since some scripts are useful as macros, will we be able to bind them to keyboard shortcuts?
2) Is there a command to fill a selection with the forground colour?








//================================================== =========================
//================================================== =========================
// ArtRage Script File.
//================================================== =========================
//================================================== =========================


//================================================== =========================
// Version Block - Script version and ArtRage version:
//================================================== =========================

<Version>
ArtRage Version: ArtRage 3 Studio Pro
ArtRage Build: 3.5.0
Professional Edition: Yes
Script Version: 1
</Version>


//================================================== =========================
// Header block - Info about the painting/person who generated this script:
//================================================== =========================

<Header>
// === Project data
Painting Name: "Untitled"
Painting Width: 1600
Painting Height: 860
Painting DPI: 72
//Mask Edge Map Width: 1600
//Mask Edge Map Height: 860
// === Author data
Author Name: "Charlie"
Script Name: "Selection to Stencil"
Comment: "Convert selection to stencil"
Script Type: ""
Script Feature Flags: 0
</Header>


//================================================== =========================
// ArtRage project features. Sets the startup state of the script:
//================================================== =========================


//================================================== =========================
// Script data follows:
//================================================== =========================



<Events>
Wait: 0.000s EvType: Command CommandID: Copy
Wait: 0.000s EvType: Command CommandID: Paste
int nLayer = CurrentLayerIndex()
Wait: 0.000s EvType: Command CommandID: CID_SelectSpecificLayer ParamType: uint32 Value: { nLayer }
Wait: 0.000s EvType: Command CommandID: CID_CreateStencilFromSpecificLayer ParamType: uint32 Value: { nLayer }
Wait: 0.000s EvType: Command CommandID: CID_DeleteSpecificLayer ParamType: uint32 Value: { nLayer }
Wait: 0.000s EvType: Command CommandID: Deselect All

Strandy
07-23-2011, 05:04 AM
Hm, your script didn't produce any stencil for me, but rather a nice error message instead

edited: OK, forgot to save as UTF 16. Now works as intended :)

MSIE
07-23-2011, 09:43 AM
very useful! :) thanks a lot!

Charlie
07-27-2011, 01:53 PM
Attached script to first post

Juz
07-27-2011, 02:30 PM
Hiya Charlie,
any chance of a script version that converts the opposite way from stencil to selection in the future ? :D:)

Charlie
07-28-2011, 12:31 PM
I'll have a go at Stencil to Selection but it makes you realise that there is a lot of overlap between stencils, selections and masks.

I'd like to be able to lock a stencil position and change it's transparency for example.

Juz
07-28-2011, 02:49 PM
Thanks Charlie I really appreciate your efforts :):)


I'd like to be able to lock a stencil position and change it's transparency for example.

Hear hear... +1 internets for you for that suggestion :D
Hate having to keep moving a stencil out of the way then using undo to put it back to check my progress on work while using them... opacity control would help that immensely. If the scripting language had enough flexibility to allow you to do that, you would bestowed with the title 'Supreme ARScript Master of the Universe' from me immediately :D:p

I find the marching ants on selections to be annoying at best... in photoshop you can just use Ctrl-H to hide the active selection I don't know if that can be done in artrage.

You're completely right about selections, stencils and masks all being similar.. same mask... different appearance.

Someonesane
07-28-2011, 03:13 PM
Yeah, I'd love to see an opacity change option for the stencils, and a way to hide the selection lines, as well. I've posted both suggestions before, around the forums here at some point in time (I think I even posted a suggestion image on how the stencil dial could work, someplace). Here's hoping we'll see them included in the future http://www2.ambientdesign.com/forums/images/icons/icon14.gif

terrygillooly
07-29-2011, 10:40 AM
Hate having to keep moving a stencil out of the way then using undo to put it back to check my progress on work while using them... opacity control would help that immensely. ....

I find the marching ants on selections to be annoying at best... in photoshop you can just use Ctrl-H to hide the active selection I don't know if that can be done in artrage.

I don't usually work with the stencil window open so to "hide" the stencil I right-click to move the canvas (just a small amount). This makes the stencil disappear for as long as I hold the click.

It also hides the 'marching ants.'

Of course, you can't do anything while right-clicking, but at least it gives you a clear view of your canvas.



You're completely right about selections, stencils and masks all being similar.. same mask... different appearance.

And also transparency locking!

semd74
07-29-2011, 11:41 AM
I could not get the script to work for me...

MSIE
07-29-2011, 11:51 AM
I don't usually work with the stencil window open so to "hide" the stencil I right-click to move the canvas (just a small amount). This makes the stencil disappear for as long as I hold the click.

It also hides the 'marching ants.'

that's what I do all the time, I've configured one of my wacom pen's keys to "right click" - so whenever I want to get rid of the marching ants (selection outline) or stencils, I just click the button on my pen and "move" the canvas a lil bit - ants and stencils disappear! :)


I could not get the script to work for me...
why not? any error messages?

Charlie
07-29-2011, 11:52 AM
Did you have a selection before running the script?
Is the script saved as UTF16?

DaveRage
07-29-2011, 12:23 PM
Make sure to save the script by clicking on the link at the bottom of the original post. You should then be able to run it. As Charlie said, let us know whether you have a selection before you run it though as that is important, and what happens in as much detail as possible.

Someonesane
07-29-2011, 01:33 PM
Also be sure that you're on a layer that has paint on it, as well, or the selection won't be able to copy anything.

I made a script that will take care of filling the selection part, for itself, but I'd rather not post it here without Charlie's consent. I don't want to step on any toes, after all.

Charlie
07-29-2011, 09:36 PM
Post it..... I was wondering about how to fill a selection from a script without a location.

Someonesane
07-30-2011, 03:37 AM
Post it..... I was wondering about how to fill a selection from a script without a location.


Yeah, about that.... I don't know if there is a way (I couldn't find one in the manual, anyhow). I basically just thought up of a way to do it in the program, and then recorded it. It's really not an ideal solution (which is part of the reason I hadn't posted it previously). What happens is the program creates a new layer and fills it, then uses undo to go back to where the selection is present, and uses that to cut away what isn't needed on the fill layer (which is copied, and pasted back, after the undo). What's left of the fill is then made into a stencil, and the fill layer deleted again. I did have to ensure that the right layers were always being used, however, so I did add in some code for that. It's a long process, for what should be a simple thing, I know.

Having just started to mess with it again, I've found an issue I didn't run into before (seems to not always be copying the layer correctly, or maybe it's the filling of it). For whatever it's worth, here it is: 58365

Charlie
07-30-2011, 08:00 AM
I can see that it is quite a convoluted sequence of steps.

It's interesting to note that even though both scripts use a selection to create a stencil, the results are quite different.

terrygillooly
07-30-2011, 01:01 PM
I basically just thought up of a way to do it in the program, and then recorded it. It's really not an ideal solution (which is part of the reason I hadn't posted it previously).

Hey, I like the way you implemented stencil fill. I never would have thought of that (which means if it pops up in one of my scripts, I stole the idea from you :)).

Line 57 looks strange when I open the script in my text editor. It looks like there are two commands on the same line.

Also, you might want to change the location of the stroke event, in case the script is run on a smaller painting.

JMMK
10-14-2011, 04:26 AM
Great Script.
(I find it especially useful to make text stencils)
__________________
Sorry for my bad English (I never had English education)