ArtRage 5 Product PageArtRage Lite Product PageArtRage for iOS Product PageArtRage for Android Product PageArtRage  Android Oil Painter Free Product PageArtRage  Free Demos Page

Page 1 of 5 123 ... LastLast
Results 1 to 10 of 46

Thread: Questions About Scripting

  1. #1
    Join Date
    Feb 2010
    Location
    Nevada
    Posts
    139

    Questions About Scripting

    I am really excited about the scripting possibilities on 3.5! I color a webcomic and there are certain setup tasks that must be performed each time. Now there is a way to reduce that drudgery...

    I do have some questions about scripting which I hope the ArtRage gurus can answer. If anyone else does too, please feel free to add to this thread!

    My first question (more of a comment, really) is that, on my PC, the Scripts folder did not default to the User Content folder! It was instead placed inside of My Documents: ArtRage Paintings. I like things to be consistent, so I manually moved the Script folder to User Content. However, "Tools: User Content: Open Scripts Folder... " still looks in the ArtRage Paintings folder.
    Cat Boxes, a web comic

  2. #2
    Join Date
    Feb 2010
    Location
    Nevada
    Posts
    139
    Is there a way to run a script and have it act upon a currently active painting rather than a blank canvas or the painting that was saved with the script?
    Cat Boxes, a web comic

  3. #3
    Join Date
    Oct 2007
    Location
    NC, USA
    Posts
    2,874
    Quote Originally Posted by terrygillooly View Post
    Is there a way to run a script and have it act upon a currently active painting rather than a blank canvas or the painting that was saved with the script?
    I'm not sure about the folder question in your first post, but for your question on having the Playback work over an existing image, there might be a way. Actually, two ways. The first thing that comes to mind, is editing the script file (through a text editor) to include the other drawing somehow. I haven't had enough time to really get into the code yet, though, so I haven't tested that. The other method, which I have just tested, is probably something that's not supposed to be working this way, so I'm not sure if they'll leave this in there, or not, upon updating the program.

    Here's what you need to do:
    1 - Set the Pencil to 1% pressure, and single click your mouse on a blank layer (Note: This will likely have you scratching your head, but bear with me...).

    2 - Copy the layer you made the mark on (Ctrl + C).

    3 - Begin Recording (File > Record Script).

    4 - Paste what you copied (Ctrl + V).
    This is done to get the program to record the process of the pasting. This will be essential for getting your playback to work over a different image during playback.
    5 - Do whatever it was you wanted to do for the rest of the image.
    Okay, so here's how this will work... After following the steps above, you'll be left with a script that wants to paste something. Because you only recorded the pasting process, and skipped the copy step, the program is going to use whatever is currently copied to the clipboard of the computer. This means if you (or a person playing the script back) goes online, right clicks an image, and selects "copy image" from the menu, that's the image ArtRage is going to paste onto a new layer when the script is played back.
    Nothing is easy to the unwilling.

  4. #4
    Join Date
    Jun 2011
    Location
    Hamburg Germany
    Posts
    472
    I'm really glad to see more people interested in this new feature with much potential. I think it has at least the same potential as stencils which are pretty obvious part of AR. Stencils are even its distinguishing mark, I'd say.

    Scripting feature is very new one and this implies some shortcomings at it's current state. What we need, is a bit more options for the script recorder. Option to crate scripts independent of current recorder context is quite essential IMO. We need some more options to eliminate or at least to minimize manual editing of script files. We need also some sort of script reference, just to understand the script file.

    I hope this feature will meet some more attention in further development and let it be an another property, which makes AR so unique.

  5. #5
    Join Date
    Mar 2006
    Location
    Ambient Design
    Posts
    3,839
    I'm soon going to post a few 'utility' type scripts for use.
    One does an automatic drop-shadow, another does a bevel, another does a 'cutout' effect, another draws a grid overlay.

    In a text editor you can edit the script. It's a unicode UTF16 text file.
    After all the header pre-amble - after "// Script data follows:" - add this line:
    int nLayer = CurrentLayerIndex()

    Then find any command that acts on a specific layer index, and replace the layer index with nLayer:


    Wait: 0.000s EvType: Command CommandID: CID_DuplicateSpecificLayer ParamType: uint32 Value: { nLayer }
    Wait: 0.000s EvType: Command CommandID: CID_SelectSpecificLayer ParamType: uint32 Value: { nLayer }
    Wait: 0.000s EvType: Command CommandID: LayerAdjustment ID: 0x000000000 Idx: nLayer Contrast: 0 Brightness: -1 Saturation: 0 Hue Shift: 0 Flatten: YES Colourize: NO
    Wait: 0.000s EvType: Command CommandID: LayerAdjustment ID: 0x000000002 Idx: nLayer Blur Radius: 4
    Wait: 0.000s EvType: Command CommandID: CID_SetSpecificLayerOpacity ParamType: LayerProp Value: { nLayer, 0.5 }
    Wait: 0.000s EvType: Command CommandID: LayerXForm Idx: nLayer Scale: (1, 1) Rot: -0 Off: (4, 4) MirH: NO MirV: NO Ras: NO
    Wait: 0.000s EvType: Command CommandID: CID_MergeSpecificLayerDown ParamType: uint32 Value: { (nLayer + 1) }
    AndyRage's mantra for graphics engine code:
    "Sure - how hard can it be?"

  6. #6
    Join Date
    Mar 2006
    Location
    Ambient Design
    Posts
    3,839
    I've got a couple more urgent things to complete this week, then I'm going to take a short break, and then I'm going to make some useful posts about things you can do with scripting.
    My brain is a bit fried at the moment.
    AndyRage's mantra for graphics engine code:
    "Sure - how hard can it be?"

  7. #7
    Join Date
    Jun 2011
    Location
    Hamburg Germany
    Posts
    472
    Holy cow! Procedural tools in form of scripts! Take your time Andy I'm sure things you're talking about will to convince everybody to use them.

    PS: Saying this, I'm certain about technical/programmatical nature of this matter, so I'm looking forward to see more convenient tools to handle AR-scripts. Thank you for insight

  8. #8
    Join Date
    Mar 2006
    Location
    Ambient Design
    Posts
    3,839
    As with all these things it takes time to get them perfect.
    We really needed to get the new update out the door - I think our loyal ArtRage users were getting worried we weren't doing an update because it had been so long.
    AndyRage's mantra for graphics engine code:
    "Sure - how hard can it be?"

  9. #9
    Join Date
    Aug 2007
    Location
    Germany
    Posts
    1,070
    wow, drop shadow, grid overlay!

    I wonder if it will be easier to use scripts than to manually duplicate the layer, adjust colour (set brightness to -100 to make it black), move layer down, transform to make it look like a drop shadow?
    or easier to use a third party filter to create a grid, use another third party filter to get rid of the white background of the grid?

    Andy, enjoy your break, but please come back soon

    PS: "fried brain" ... sounds like a nice painting as soon as I'll get my AR preferences restored I'm gonna work on a Fried Brain painting!!

  10. #10
    Join Date
    Mar 2006
    Location
    Ambient Design
    Posts
    3,839
    If you want the entire drop-shadow script, it looks like this:

    Code:
     
    //===========================================================================
    //===========================================================================
    //                            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: 1479
        Painting Height: 1122
        Painting DPI: 72
        // === Author data
        Author Name: "Andy Bearsley"
        Script Name: "Drop Shadow"
        Comment: "This script will generate a drop shadow for the current layer"
        Script Type: ""
        Script Feature Flags: 0
    </Header>
     
    //===========================================================================
    // ArtRage project features. Sets the startup state of the script:
    //===========================================================================
     
    //===========================================================================
    // Script data follows:
    //===========================================================================
    <Events>
    int nLayer = CurrentLayerIndex()
    string sLayerName = LayerName(nLayer)
    string sMessage = "Drop Shadow settings for layer %%nLayer"
    if (sLayerName.Length() > 0) {
     sMessage += "  ( %%sLayerName )"
    }
    // Check we can run on this layer (paint, text, or sticker)
    int nLayerType = LayerType(nLayer)
    if (nLayerType != 0 && nLayerType != 4 && nLayerType != 5) {
     MessageBox("This script wont work on layer groups. (Layer %%nLayer)")
     exit
    }  
    real rShadowRadius = 10
    real rShadowOpacity = 0.7
    real rShadowOffX = 10
    real rShadowOffY = 10
    flag fMergeResult = true 
    // Get the user data
    InputBox(sMessage + "\n\rShadow Radius (1 to 100): $$rShadowRadius\n\rShadow Opacity (0 - 1): $$rShadowOpacity\n\rShadow Offset X (-100 to 100): $$rShadowOffX\n\rShadow Offset Y (-100 to 100): $$rShadowOffY\n\rMerge Result: $$fMergeResult") 
    // Clamp user data to sensible ranges.
    if (rShadowRadius < 0) rShadowRadius = 0
    if (rShadowRadius > 10) rShadowRadius = 10
    if (rShadowOpacity < 0) rShadowOpacity = 0
    if (rShadowOpacity > 1) rShadowOpacity = 1
    if (rShadowOffX < -100) rShadowOffX = -100
    if (rShadowOffX > 100) rShadowOffX = 100
    if (rShadowOffY < -100) rShadowOffY = -100
    if (rShadowOffY > 100) rShadowOffY = 100
    // Apply drop shadow
    Wait: 0.000s EvType: Command CommandID: CID_DuplicateSpecificLayer ParamType: uint32 Value: { nLayer }
    Wait: 0.000s EvType: Command CommandID: CID_SelectSpecificLayer ParamType: uint32 Value: { nLayer }
    if (nLayerType != 0) {
     Wait: 0.000s EvType: Command CommandID: CID_RasteriseSpecificLayer ParamType: uint32 Value: { nLayer }
    }
    Wait: 0.000s EvType: Command CommandID: LayerAdjustment ID: 0x000000000 Idx: nLayer Contrast: 0 Brightness: -1 Saturation: 0 Hue Shift: 0 Flatten: YES Colourize: NO
    Wait: 0.000s EvType: Command CommandID: LayerAdjustment ID: 0x000000002 Idx: nLayer Blur Radius: rShadowRadius
    Wait: 0.000s EvType: Command CommandID: CID_SetSpecificLayerOpacity ParamType: LayerProp Value: { nLayer, rShadowOpacity }
    Wait: 0.000s EvType: Command CommandID: LayerXForm Idx: nLayer Scale: (1, 1) Rot: -0 Off: (rShadowOffX, rShadowOffY) MirH: NO MirV: NO Ras: NO
    // Apply merge if needed
    if (fMergeResult) {
     Wait: 0.000s EvType: Command CommandID: CID_MergeSpecificLayerDown ParamType: uint32 Value: { (nLayer + 1) }
    }
    // Fix names if not merged, then select the original layer.
    if (!fMergeResult) {
     Wait: 0.000s EvType: Command CommandID: LayerName Idx: nLayer Name: (sLayerName + " Shadow")
     Wait: 0.000s EvType: Command CommandID: LayerName Idx: (nLayer + 1) Name: sLayerName
     Wait: 0.000s EvType: Command CommandID: CID_SelectSpecificLayer ParamType: uint32 Value: { (nLayer + 1) }
    }
    It's a bit more intelligent than just doing the shadow. It prompts for user input, checks layer type in case it needs to rasterize (text or sticker layer) to get the duplicate layer to blur and adjust, optionally merges the result, and gives sensible names to the shadow layer.
    If you're copying the code from this window, make sure you save it as a unicode UTF16 file.
    AndyRage's mantra for graphics engine code:
    "Sure - how hard can it be?"

Posting Permissions

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