3 Replies Latest reply on Feb 2, 2017 3:27 PM by JJMack

    Preparing a rendered exr with multiple render layers

    pierre_1610 Level 1

      I'm a complete newb to this so please bear with me. I want to automate the process of preparing rendered exr's

      I used the script listener to create what I need to do, however, some of my files have variables.

       

      For example, i may be supplied with i file that doesn't have certain elements in it, this obviously breaks the script.

       

      The example here shows that the file has layers called "multimatte.RGB" sometimes I have 1, the example bellow selects 3 layers but sometimes i don't have any layers named this. How do i get it to work as an if?

       

      var idslct = charIDToTypeID( "slct" );

          var desc179 = new ActionDescriptor();

          var idnull = charIDToTypeID( "null" );

              var ref163 = new ActionReference();

              var idLyr = charIDToTypeID( "Lyr " );

              ref163.putName( idLyr, "multimatte.RGB" );

          desc179.putReference( idnull, ref163 );

          var idMkVs = charIDToTypeID( "MkVs" );

          desc179.putBoolean( idMkVs, false );

      executeAction( idslct, desc179, DialogModes.NO );

       

      // =======================================================

      var idslct = charIDToTypeID( "slct" );

          var desc180 = new ActionDescriptor();

          var idnull = charIDToTypeID( "null" );

              var ref164 = new ActionReference();

              var idLyr = charIDToTypeID( "Lyr " );

              ref164.putName( idLyr, "multimatte2.RGB" );

          desc180.putReference( idnull, ref164 );

          var idselectionModifier = stringIDToTypeID( "selectionModifier" );

          var idselectionModifierType = stringIDToTypeID( "selectionModifierType" );

          var idaddToSelectionContinuous = stringIDToTypeID( "addToSelectionContinuous" );

          desc180.putEnumerated( idselectionModifier, idselectionModifierType, idaddToSelectionContinuous );

          var idMkVs = charIDToTypeID( "MkVs" );

          desc180.putBoolean( idMkVs, false );

      executeAction( idslct, desc180, DialogModes.NO );

       

      Thanks

        • 1. Re: Preparing a rendered exr with multiple render layers
          JJMack Most Valuable Participant

          Scriptlistener code is just like action steps. Everything is hard coded like that layer name.   What you do with scriptlistner code is to create functions with it.  You replace the variables that are set with hard coded values, To be set via a variable that you define and pass to the function.   You would replace the hard  value "multimatte.RGB" with a variable like myLayerName which you pass to you function

          function myLayerRender(myLayerName) {

              ...

          }

           

          The in your script you would use that function and code something like this;

           

          myLayerRender(app.activeDocument.activeLayer.name);

          • 2. Re: Preparing a rendered exr with multiple render layers
            pierre_1610 Level 1

            Thanks for the reply, I'm afraid it all went over my head.

             

            i think I need to read up on scripting a bit more.

            • 3. Re: Preparing a rendered exr with multiple render layers
              JJMack Most Valuable Participant

              Scripts are Programs. Actions are recording they always play what has been recorded no logic just step step step..... ScriptListener code though the code is ether VBS or JavaScript code it is a recording of Photoshop steps, step step step.  Untouched It Always plays what was recorded.   Because the recorded code in an script language you as a programmer can add logic to what was recorded.   You can edit Actions. You can add, remove change steps you can not add logic without using a Photoshop script.  Newer version of Photoshop has conditional actions however there are only a few conditions that can be tested and all actions use must be in the same action set very little logic few if conditionals.

               

              Action Manager code is required for all of Photoshop features are not supported, covered by Adobe DOM some things can not be scripted.   Action Manager Code the code that scriptlistener produces lets you get around that scripting problem