Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: Cycling through layer blend modes

  1. #1
    Join Date
    May 2014
    Location
    Portsmouth UK
    Posts
    739

    Cycling through layer blend modes

    I have created an ArtRage script file that allows the cycling through all of the layer blend modes on a mouse canvas click,
    which terminates when the Shift key is held down on a mouse canvas click.

    It seems to only work however when the play script dialog is stopped, it initially says "Awaiting Input..", see the video below :

    https://youtu.be/rmVACmVh6M0

    I have completely removed the Header Block and did play around with commenting out the script feature flags or setting them to all 0s but I still get the dialog, is this expected behaviour?

    Here is my code :

    Code:
    //===========================================================================
    //===========================================================================
    //                            ArtRage Script File.
    //          Cycle through all blend modes with a click on the canvas
    //                         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; 
    // All blend modes in order
    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 }
    int bm_len = bm_values.GetSize()
    int bm_index = 1
    while (true) {
     WaitResumeAtMouse()
     
     if (!KeyShiftIsDown()) {
      Wait: 0.000s EvType: Command CommandID: CID_SetSpecificLayerBlend ParamType: LayerTwoOp Value: { CurrentLayerIndex(), 3000000000+bm_values[bm_index] }
      
      bm_index++
     
      if (bm_index > bm_len-1) {
       bm_index = 0
      }
     }
     else {
      exit
     }
    }

  2. #2
    Join Date
    Nov 2013
    Posts
    1,993
    We're having a look, but the main problem is going to be that ArtRage doesn't really allow you to interact while a script is playing, only when a dialogue box with playback options pops up. The 'playing/awaiting' dialogue box is just there to show the script status, it isn't something you can disable. So you may have come up with the best possible workaround

    For an example of a script with repeating dialogue options, see https://forums.artrage.com/showthrea...620#post366620

  3. #3
    Join Date
    May 2014
    Location
    Portsmouth UK
    Posts
    739
    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
     }
    }
    Last edited by RedSaucers; 07-07-2019 at 10:00 PM.

  4. #4
    Join Date
    May 2013
    Location
    England
    Posts
    143
    I couldn’t find the YouTube video. Is it still there?

  5. #5
    Join Date
    May 2014
    Location
    Portsmouth UK
    Posts
    739

  6. #6
    Join Date
    May 2013
    Location
    England
    Posts
    143
    Found it and watched it. Very impressive - great coding ...

  7. #7
    Join Date
    May 2013
    Location
    England
    Posts
    143
    The thing I particularly want to do is create an Action that sets a Blend mode ...


    ... for a start

  8. #8
    Join Date
    May 2014
    Location
    Portsmouth UK
    Posts
    739
    I have created just this thing for all the blend modes!, I will look to post them on the forum for you!

  9. #9
    Join Date
    May 2014
    Location
    Portsmouth UK
    Posts
    739
    Here we go, just unzip and copy in the directory

    https://1drv.ms/u/s!AtMMyTeySVJKgbhU...nWQqQ?e=yPo6kT
    Last edited by RedSaucers; 06-10-2021 at 10:12 AM.

  10. #10
    Join Date
    May 2014
    Location
    Portsmouth UK
    Posts
    739
    and here is a quick video showing how the action shortcuts to the layer blend modes work :

    https://youtu.be/7hXd24fGXOM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •