10 Replies Latest reply on Jun 28, 2016 1:01 PM by Jaxiter

    Set spacing for brush

    jayanam Level 1

      HI, I want to set hardness for a brush, but when I use a function to do so, the spacing and diameter is set to 25 automatically. So I use this function to set hardness, spacing and  diameter:

       

        function setBrushFeatures(Diameter,Hardness,Spacing) { 

        var ref = new ActionReference(); 

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

        var appDesc = executeActionGet(ref); 

        var toolDesc = appDesc.getObjectValue(stringIDToTypeID('currentToolOptions')); 

        var brushDesc = toolDesc.getObjectValue(stringIDToTypeID('brush')); 

       

       

        var desc = new ActionDescriptor(); 

        var ref = new ActionReference(); 

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

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

        var desc1 = new ActionDescriptor(); 

       

        desc1.putDouble(stringIDToTypeID('diameter'), Diameter); 

       

        desc1.putDouble(stringIDToTypeID('hardness'), Hardness); 

       

        desc1.putDouble(stringIDToTypeID('spacing'), Spacing); 

       

        var desc5 = new ActionDescriptor(); 

        var idnull = charIDToTypeID( "null" ); 

        var ref3 = new ActionReference(); 

        var idBrsh = charIDToTypeID( "Brsh" ); 

        var idOrdn = charIDToTypeID( "Ordn" ); 

        var idTrgt = charIDToTypeID( "Trgt" ); 

        ref3.putEnumerated( idBrsh, idOrdn, idTrgt ); 

        desc5.putReference( idnull, ref3 ); 

       

         desc5.putObject(charIDToTypeID('T   '), charIDToTypeID('Brsh'), desc1); 

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

      }

       

      This works but the spacing is not applied, what am I missing?

       

      Cheers

      Matthias