1 Reply Latest reply on Jun 19, 2016 2:46 AM by ivanmmmmm

    Simple operations with layers

    ivanmmmmm

      Please point me in the right direction (give short code or classes/methods names), I need to write a plugin (AI CC 2015) to do the following:

      1.- turn on/off visibility of a certain layer

      2.- set opacity of a certain layer (like in Window > Transparency panel)

      3.- select a certain layer in "Layers" panel

        • 1. Re: Simple operations with layers
          ivanmmmmm Level 1

          It seems I will have to answer the question myself:

           

               extern "C" AILayerSuite  *sAILayer;

               extern "C" AIArtSuite  *sAIArt;

               extern "C" AIBlendStyleSuite  *sAIBlendStyle;

           

              ASErr result = kNoErr;

           

              AILayerHandle lyr = NULL;

             

              result = sAILayer->GetNthLayer(0, &lyr);

           

          1.- turn on/off visibility of a certain layer

              result = sAILayer->SetLayerVisible(lyr, false);

          2.- set opacity of a certain layer (like in Window > Transparency panel)

              AIArtHandle art = NULL;

              result = sAIArt->GetFirstArtOfLayer(lyr, &art);

              result = sAIBlendStyle->SetOpacity(art, 0.5);

          3.- select a certain layer in "Layers" panel

              result = sAILayer->SetCurrentLayer(lyr);