2 Replies Latest reply on Mar 26, 2017 4:55 PM by Philip Bowser

    How to tell if item is Adjustment Layer

    Philip Bowser

      I'm creating an extension and I need to be able to tell the difference between Adjustment layers and Color Mattes in the project bin. They just show up as stills in their metadata. Is there a way to do this?

       

      I was able to figure out when an item is a Title as the codec shows up as "Titl" even though the MediaType shows up as "Still Image". But the Adjustment layers codec gives me "RAW " which is the same as a regular still image.

       

      Is there a method that I'm not aware of to determine an items type?

      Any help is greatly appreciated!

      Thanks

        • 1. Re: How to tell if item is Adjustment Layer
          geordiem74078114 Level 1

          +1!

           

          Same here, I've managed to infer a bunch of stuff from other properties.  Here's a test script I wrote, works best if you have test items in the project root:

           

          function removeAllNamespace(xml)
          {
                    var ns =new Namespace();
                    var d=xml.descendants();
                    for (var i=0;i<d.length();i++)
                  d[i].setNamespace(ns);
          }
          
          
          for(var c = 0; c < app.project.rootItem.children.numItems; c++) {
                  var i = app.project.rootItem.children[c];
                  $.writeln("======= " + i.name + "======= ");
                  $.writeln("type: " + i.type);
                  $.writeln("canChangeMediaPath: " + i.canChangeMediaPath());
                  $.writeln("mediaPath: " + i.getMediaPath());
                  var xmlRoot = new XML (i.getProjectMetadata());
                  removeAllNamespace(xmlRoot);       
                  $.writeln("XML Codec: " + xmlRoot.child(0).child(0).child("Column.PropertyText.Codec"));
                  $.writeln("");
          }
          

           

          Here's the result with some test items of different types:

          ======= Bin======= 
          type: 2
          canChangeMediaPath: false
          mediaPath: 
          XML Codec: 
          
          
          ======= music_Adventurous_00_BREAK_00.wma======= 
          type: 1
          canChangeMediaPath: true
          mediaPath: \\wexfile\evoke\Audio\ModularMusicEdits\Adventurous\00\wma\music_Adventurous_00_BREAK_00.wma
          XML Codec: 
          
          
          ======= Sequence 01======= 
          canChangeMediaPath: false
          type: 1
          mediaPath: 
          XML Codec: 
          
          
          ======= IMG_20161227_141732.jpg======= 
          type: 1
          canChangeMediaPath: true
          mediaPath: C:\Users\gemof\Downloads\IMG_20161227_141732.jpg
          XML Codec: RAW 
          
          
          ======= Unity - DefaultScene_RecordTakes.unity - UnityProject_HCap - PC, Mac & Linux Standalone_ _DX11_ 4_27_2016 3_33_01 PM.mp4======= 
          type: 1
          canChangeMediaPath: true
          mediaPath: \\wexfile\evoke\User\Geordie\Unity - DefaultScene_RecordTakes.unity - UnityProject_HCap - PC, Mac & Linux Standalone_ _DX11_ 4_27_2016 3_33_01 PM.mp4
          XML Codec: H.264
          
          
          ======= Title 01======= 
          type: 1
          canChangeMediaPath: true
          mediaPath: 
          XML Codec: Titl
          
          
          ======= Color Matte======= 
          type: 1
          canChangeMediaPath: true
          mediaPath: 
          XML Codec: RAW 
          
          
          ======= Adjustment Layer======= 
          type: 1
          canChangeMediaPath: true
          mediaPath: 
          XML Codec: RAW 
          

           

          I think the only thing you can't distinguished between here is a Color Matt and Adjustment Layer

          • 2. Re: How to tell if item is Adjustment Layer
            Philip Bowser Level 1

            Wow that's still a lot closer than I was. Thanks for this.

            Also, I love this removeAllNamespace function you've created. My solution to this was definitely not as elegant.

             

            Fingers crossed they put this info into the metadata!