Skip to main content
c.pfaffenbichler
Community Expert
Community Expert
July 3, 2009
Beantwortet

how to assess blend if-settings with javascript

  • July 3, 2009
  • 1 Antwort
  • 3087 Ansichten

Some time ago someone in the MacIntosh-forum declared their wish to use a layer’s Layer Style Blend If-setting’s result as a mask (for whatever reasons).

The »This Layer’s« effect is easily enough converted to a mask by grouping and flattening the layer and using the resulting transparency.

But the »Underlying Layer«-setting seems more difficult (naturally as they depend on other layers’ content).

Is there a way to get the current (for an RGB-file 32) numbers of a layer’s Blend If-settings with JavaScript?

Or is there a way to reset the This Layer-Blend If-settings, but leave the Underlying Layer-settings unchanged?

Any help appreciated.

Dieses Thema wurde für Antworten geschlossen.
Beste Antwort von xbytor2
It seems that I was wrong. The blending options are not part of the layerEffects descriptor. At least not in CS4. There was a time when you had to use a script by Xbytor named Styles.js to get the layerEffects descriptor. I tried that as well and it also doesn't return any blend settings.

The Blending Options are stored as part of the Style when you save the Style as a preset and/or save it to disk as a .asl file. Take a peek with a hex editor.

That information was not being read in (via Styles.js) as a part of the Style Descriptor. I've updated Styles.js so that you can now get the Blend Options descriptor:


http://ps-scripts.com/bb/viewtopic.php?t=2759

-X

1 Antwort

Inspiring
July 3, 2009

The blend if settings are part of the layer's effects descriptor. You can get the current setting from a layer and/or change those settings using the Action Manager API.

I don't fully understand what you are trying to do. Although you can get the Underlying Layer numbers they still depend on the other layer and I think would be hard to set with a script.

If you need help with the scriptlistner code to get and set those values let me know.

c.pfaffenbichler
Community Expert
Community Expert
July 3, 2009

Oh, I absolutely need help with those … thanks for Your indulgence!

What I’m after (and mainly for the challenge, not because I have an actual need for it at the moment) is getting the the same effect as the applied Blend If-settings through masks on a non-blend-if-layer (and I’m aware that they are then no longer »live« so to speak).

Anyway, I was operating under the assumption that one could produce an identical result when resetting the formerly top-layer and putting it below the other one and applying the inversed Underlying-settings as This Layer-settings to the newly top-layer.

Unfortunately that seems to apply only for the Gray-settings, but when the other channels are modified it doesn’t hold true.

So, even if it might not be any help here, I would like to know how I can get the values in a layer’s current settings.

Because when recording an edit with Scripting Listener I get something like:

var idsetd = charIDToTypeID( "setd" );

    var desc58 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref51 = new ActionReference();

        var idLyr = charIDToTypeID( "Lyr " );

        var idOrdn = charIDToTypeID( "Ordn" );

        var idTrgt = charIDToTypeID( "Trgt" );

        ref51.putEnumerated( idLyr, idOrdn, idTrgt );

    desc58.putReference( idnull, ref51 );

    var idT = charIDToTypeID( "T   " );

        var desc59 = new ActionDescriptor();

        var idBlnd = charIDToTypeID( "Blnd" );

            var list20 = new ActionList();

                var desc60 = new ActionDescriptor();

                var idChnl = charIDToTypeID( "Chnl" );

                    var ref52 = new ActionReference();

                    var idChnl = charIDToTypeID( "Chnl" );

                    var idChnl = charIDToTypeID( "Chnl" );

                    var idGry = charIDToTypeID( "Gry " );

                    ref52.putEnumerated( idChnl, idChnl, idGry );

                desc60.putReference( idChnl, ref52 );

                var idSrcB = charIDToTypeID( "SrcB" );

                desc60.putInteger( idSrcB, 0 );

                var idSrcl = charIDToTypeID( "Srcl" );

                desc60.putInteger( idSrcl, 0 );

                var idSrcW = charIDToTypeID( "SrcW" );

                desc60.putInteger( idSrcW, 255 );

                var idSrcm = charIDToTypeID( "Srcm" );

                desc60.putInteger( idSrcm, 255 );

etc.

with the values for all the handles.

But how can I access those numbers from within a Script, for example to apply only certain ones of them to another layer?