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

Group fill opacity

Explorer ,
Aug 27, 2013 Aug 27, 2013

Hi.

I'm trying to set the opacity and fillOpacity of all layers and groups to 100% (an later also store the previous values in an array and restore them when done).

This works fine for the artLayers but the layerSet object doesn't seem to have a fillOpacity property, yet I can set a fillOpacity value on a group manually.

So how do I set and retrieve the fillOpacity value of a group?

TOPICS
Actions and scripting
643
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
Adobe
Guru ,
Aug 27, 2013 Aug 27, 2013

You can get/set a layerSet's fillOpacity with Action Manager.

function getActiveLayerFillOpacity(){

    var ref = new ActionReference();

    ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );

    return executeActionGet(ref).getInteger(stringIDToTypeID("fillOpacity"));

};

function setActiveLayerFillOpacity( opacity ) {

    var desc = new ActionDescriptor();

        var ref = new ActionReference();

        ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );

    desc.putReference( charIDToTypeID('null'), ref );

        var layerDesc = new ActionDescriptor();

        layerDesc.putUnitDouble( stringIDToTypeID('fillOpacity'), charIDToTypeID('#Prc'), opacity );

    desc.putObject( charIDToTypeID('T   '), charIDToTypeID('Lyr '), layerDesc );

    executeAction( charIDToTypeID('setd'), desc, DialogModes.NO );

};

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 ,
Aug 27, 2013 Aug 27, 2013

Thanks.

I wish there was a way to do all these things using the DOM, this Action Manager just seems so messy.

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 ,
Aug 27, 2013 Aug 27, 2013

Ah, wait, setting still doesn't work on the fillOpacity of the group, only on an artLayer.

(Gettting "General Photoshop error... This functionality may not be available...) on the last line.

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
Guru ,
Aug 27, 2013 Aug 27, 2013
LATEST

Sorry, I posted code from my code library without testing. Either Adobe has changed something or my code never worked.

It is strange that both scriptlistener and actions record setting a layerSet fillOpacity but both fail on playback.

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