• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Contributor ,
Nov 07, 2017 Nov 07, 2017

Copy link to clipboard

Copied

Hi all,

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

20171107_brush_param.png

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,

Naoki

TOPICS
Actions and scripting

Views

1.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , Nov 08, 2017 Nov 08, 2017

This does not work in CS6, so I'm not particularly interested.
In CC2018, you can use this

// smooth_value = 66;


desc5.putInteger (stringIDToTypeID ("smooth"), smooth_value);
desc5.putDouble (stringIDToTypeID ("smoothingValue"), Math.round (smooth_value / 100 * 255));


By the way, "flow" and "opacity" have type INTEGERTYPE, and not UNITDOUBLE as you use.

upd.

also you can set

"smoothing"

"smoothingRadiusMode"

"smoothingCatchup"

"smoothingCatchupAtEnd"

"smoothingZoomCompensation"

to BOOLEANTYPE (true or f

...

Votes

Translate

Translate
Adobe
People's Champ ,
Nov 08, 2017 Nov 08, 2017

Copy link to clipboard

Copied

This does not work in CS6, so I'm not particularly interested.
In CC2018, you can use this

// smooth_value = 66;


desc5.putInteger (stringIDToTypeID ("smooth"), smooth_value);
desc5.putDouble (stringIDToTypeID ("smoothingValue"), Math.round (smooth_value / 100 * 255));


By the way, "flow" and "opacity" have type INTEGERTYPE, and not UNITDOUBLE as you use.

upd.

also you can set

"smoothing"

"smoothingRadiusMode"

"smoothingCatchup"

"smoothingCatchupAtEnd"

"smoothingZoomCompensation"

to BOOLEANTYPE (true or false)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 08, 2017 Nov 08, 2017

Copy link to clipboard

Copied

Adobe merged old smoothing and new smoothing.

You can disable it "smoothing": true/false or reset to default value. http://sklad.bereza.cz/00-jarda/00_screenshot/2017-10-20_003537.jpg No matter which value you put. It probably always will be 10 %

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 08, 2017 Nov 08, 2017

Copy link to clipboard

Copied

Hi Jarda,

Thank you very much for the tips. I've seeing the reset to 10% behavior.

Also thank you very much for sharing ActionManagerHumanizer code.

  GitHub - jardicc/ActionManagerHumanizer: This tool will reveal for you occult mystery of Photoshop A...

It is very helpful.

Thank you,

Naoki

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 08, 2017 Nov 08, 2017

Copy link to clipboard

Copied

Naoki-Hada   napsal(a)

Also thank you very much for sharing ActionManagerHumanizer code.

  GitHub - jardicc/ActionManagerHumanizer: This tool will reveal for you occult mystery of Photoshop A...

It is very helpful.

I updated this tool to version: 0.2 and added some examples:

GitHub - jardicc/ActionManagerHumanizer: This tool will reveal for you occult mystery of Photoshop A...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 08, 2017 Nov 08, 2017

Copy link to clipboard

Copied

LATEST

Hi Jarda,

Thank you very much again for the update.

I've verified the reset issue. It seems "smooth" is taking the setting value, but "smoothingValue" is required some value.

// verified working on Photoshop CC 2018

#include Humanizer-0.2.jsx

var smoothing_value = 34;

var desc = {

    "null": {

        "_ref": "paintbrushTool"

    },

    "to":{

        _obj:"currentToolOptions",

        _value: {

            "smooth":smoothing_value, // setting value

            "smoothingValue":true // Need some value here. It does not work without this line.

        }

    }

};

try{

    var descMod = Humanizer.objectToDescriptor(desc)[1]; // ActionDescriptor

    var descResult = executeAction(stringIDToTypeID("set"), descMod, DialogModes.NO);  // ActionDescriptor

    $.writeln("---descMod------------------");

    $.writeln(Humanizer.descriptorToJsonString (descMod));

    $.writeln("---descResult-----------------");

    $.writeln(Humanizer.descriptorToJsonString (descResult));

    $.writeln("---------------------");

}catch(e){

    $.writeln("EXCEPTION: " + e);

}

$.writeln("debug break");

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 08, 2017 Nov 08, 2017

Copy link to clipboard

Copied

r-bin​

Thank you very much for the code ().

I verified it is working on CC 2018.

Both line seems required. I found "smoothingValue" in below same section of Getter.jsx XML file.

Updated code.

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();

// smoothing: verified working

var smooth_value = 66;

desc5.putInteger (stringIDToTypeID ("smooth"), smooth_value);

desc5.putDouble (stringIDToTypeID ("smoothingValue"), Math.round (smooth_value / 100 * 255));

var id18 = stringIDToTypeID( "null" );

desc226.putObject( id12, id18, desc5 );

executeAction( idset, desc226, DialogModes.NO );

And the smoothingValue part in Getter.xml

capture_20171108_092144.png

Thank you,

Naoki

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines