6 Replies Latest reply on Nov 8, 2017 3:09 PM by Naoki-Hada

    [Q] Set Brush Smoothing  value by script (CC 2018 feature)

    Naoki-Hada Level 1

      Hi all,


      I'm struggling to set value on Brush's Smoothing on Photoshop UI part as below.



      From XTools' Getter.jsx file, it seems Smoothing is exported as following as same level of Opacity and Flow.

      XTools: xtools


      So I tried to modify from code from changing Opacity from following and the modified code.

      JavaScripts/SetPaintBrushOpacityAndOthers.jsx at master · TomRuark/JavaScripts · GitHub



      // Code from :  
      // https://github.com/TomRuark/JavaScripts/blob/master/SetPaintBrushOpacityAndOthers.jsx
      var idset = stringIDToTypeID( "set" );
      var desc226 = new ActionDescriptor();
      var idnull = stringIDToTypeID( "null" );
      var ref170 = new ActionReference();
      var idPbTl = stringIDToTypeID( "paintbrushTool" );
      ref170.putClass( idPbTl );
      desc226.putReference( idnull, ref170 );
      var id12 = stringIDToTypeID( "to" );
      var desc5 = new ActionDescriptor();
      // opacity
      var id13 = stringIDToTypeID( "opacity" );
      var id14 = stringIDToTypeID( "percentUnit" );
      desc5.putUnitDouble( id13, id14, 88 );
      // flow
      var id19 = stringIDToTypeID( "flow" );
      desc5.putUnitDouble( id19, id14, 77 );
      // TEST: smoothing: Not working
      var id99 = stringIDToTypeID( "smooth" );
      desc5.putUnitDouble( id99, id14, 66 );
      var id18 = stringIDToTypeID( "null" );
      desc226.putObject( id12, id18, desc5 );
      executeAction( idset, desc226, DialogModes.NO );


      Opacity and Flow can be set the value.

      Smoothing is not working.


      I still don't understand well on the ActionDescriptor's code and still learning.

      Any help, suggestions, tips, links are appreciated.


      Thank you,