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

Switching Sample Layers with shortcut key for Clone and Heal tool?

Explorer ,
Mar 10, 2020 Mar 10, 2020

Hello,

 

I'm looking to apply a short cut key that would toggle brush options to sample between the "Current Layer, Current & Below and All Layers" options when using clone stamp or heal stamps tools.

 

Is this optional?

 

Thanks in advance.

2.0K
Translate
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 2 Correct answers

People's Champ , Mar 10, 2020 Mar 10, 2020
Here is the script. Assign a hotkey to it (to them).

Remove the first lines of code to force selecting the healing brush.

 
Translate
People's Champ , Mar 13, 2020 Mar 13, 2020

OK ))

try
    {
    var r = new ActionReference();
    r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));
    r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

    var ret = executeActionGet(r);

    var options = ret.getObjectValue(stringIDToTypeID("currentToolOptions"));           
    var tool = ret.getEnumerationType(stringIDToTypeID("tool"));

    var s = options.getBoolean(charIDToTypeID("StmS"));
    var b =
...
Translate
Adobe
People's Champ ,
Mar 10, 2020 Mar 10, 2020
Here is the script. Assign a hotkey to it (to them).

Remove the first lines of code to force selecting the healing brush.

 
Translate
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
Explorer ,
Mar 13, 2020 Mar 13, 2020

Thank you, r-bin!

 

How may I correctly write an "if" statement in the script to toggle between these 2 actions using the same hotkey?

 

// Current layer

options.putBoolean(charIDToTypeID("StmS"), false);

options.putBoolean(charIDToTypeID("StmB"), false);

 

// Current & below

options.putBoolean(charIDToTypeID("StmS"), true);

options.putBoolean(charIDToTypeID("StmB"), true);

Translate
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
People's Champ ,
Mar 13, 2020 Mar 13, 2020

OK ))

try
    {
    var r = new ActionReference();
    r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));
    r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

    var ret = executeActionGet(r);

    var options = ret.getObjectValue(stringIDToTypeID("currentToolOptions"));           
    var tool = ret.getEnumerationType(stringIDToTypeID("tool"));

    var s = options.getBoolean(charIDToTypeID("StmS"));
    var b = options.getBoolean(charIDToTypeID("StmB"));

    if (s && b)
        {
        options.putBoolean(charIDToTypeID("StmS"), false);
        options.putBoolean(charIDToTypeID("StmB"), false);
        }
    else
        {
        options.putBoolean(charIDToTypeID("StmS"), true);
        options.putBoolean(charIDToTypeID("StmB"), true);
        }

    var r = new ActionReference();
    r.putClass(tool);

    var d = new ActionDescriptor();
    d.putReference(stringIDToTypeID("null"), r);
    d.putObject(stringIDToTypeID("to"), stringIDToTypeID("null"), options);

    executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
    }
catch (e) { /*alert(e)*/  }

Translate
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
Explorer ,
Mar 13, 2020 Mar 13, 2020

Very helpful, much appreciated!

 

Thanks again r-bin.

Translate
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
New Here ,
Jan 30, 2021 Jan 30, 2021

hi all, may i know how to apply this script to get this short cut? i really need this to speed up my editing. thanks you very much for the efford!

 

Mango

Translate
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
Community Beginner ,
Jan 28, 2022 Jan 28, 2022
LATEST

After you added the script it appears in the keyboard shortcuts option under 'Scripts'. Here you can assign the shortcut

Translate
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