I have improved on my script above to allow selection of both blend modes and opacity on canvas touch, here is a video demonstration :
https://youtu.be/1TDk22qzU6A
and here is my script
Code:
//===========================================================================
//===========================================================================
// ArtRage Script File.
//
// SET SELECTED LAYER BLEND MODE / OPACITY
// USING CANVAS PIXEL POSITION OF PEN ON CANVAS
//
// Left half of canvas & Y Pixel - layer blend mode
// Right half of canvas & Y Pixel - layer opacity
//
// by James Dyer (RedSaucers)
//===========================================================================
//===========================================================================
//===========================================================================
// Version Block - Script version and ArtRage version:
//===========================================================================
<Version>
ArtRage Version: ArtRage 3 5
ArtRage Build: 5.0.5
Professional Edition: Yes
Script Version: 1
</Version>
//===========================================================================
// and now for the code!
//===========================================================================
intarray bm_values;
bm_values ={ 169, 194, 192, 193, 195, 178, 170, 176, 185, 186,
171, 177, 184, 187, 179, 181, 180, 188, 189, 190,
191, 182, 183, 172, 173, 174, 175 } // all blend mode ids in order
int nWidth = PaintingWidth();
int nHeight = PaintingHeight();
real x
real y
while (true) {
// wait for the pen to touch the canvas
WaitSampleMouse()
// get the x and y coords of the pen
x = MouseX();
y = MouseY();
if (!KeyShiftIsDown()) { // a script exit strategy if Shift and pen down is selected
if (y >= 0 && y <= nHeight) { // only perform layer actions if pen is within canvas vertical
// the left half of the canvas o set up blend modes
if (x >= 0 && x < nWidth / 2) {
int bm_index = (y / nHeight) * bm_values.GetSize()
Wait: 0.000s EvType: Command CommandID: CID_SetSpecificLayerBlend ParamType: LayerTwoOp Value: { CurrentLayerIndex(), 3000000000+bm_values[bm_index] }
}
// the right half of the canvas to set up opacity
else if (x >= nWidth / 2 && x <= nWidth) {
real opacity = (nHeight - y) / nHeight
Wait: 0.000s EvType: Command CommandID: CID_SetSpecificLayerOpacity ParamType: LayerProp Value: { CurrentLayerIndex(), opacity }
}
}
}
else {
exit // Executing exit strategy
}
}