2 Replies Latest reply: May 29, 2010 2:16 PM by habaki1 RSS

    Questions about brushes

    habaki1 Community Member

      Hello !

       

      Because i see some posts like "Determine number of brushes" (Thanks c.pfaffenbichler) that give informations in a magic way, i begin to think that i am perhaps wasting my time on tricky scripts that can be in fact replaced by some secret but simple actions.

       

      My purpose is to build a better environment for painting.

      The first step is to assign to each layer a specific context: Each layer must own a brush with properties, fg and bg colors, etc...

      As soon as a layer is selected its context is made current : current brush and diameter, current colors, etc...

       

      I already wrote a script that works fine. It catches events in order to record current informations like the current brush, because this information is not accessible with objects (on the contrary for instance the foreground color is accessible with app.foregroundColor). 

      But this script could be perhaps made a lot simplier if some infos can be obtained directly.

       

      So the best is to ask all my pending questions, because you certainly have the answers.

      When my script will be ready, i will publish it for free (i swear).

       

      1/ How to get the current tool ?

      2/ How to get the current brush ?

      3/ How to get the properties of the current brush ?

      3a/ How to get the brush diameter ?

      3b/ How to get and set the brush opacity ?

      3c/ How to get and set the brush flow ?

      3d/ How to get and set other brush properties ?

      4/ What is the format of an .ABR  file (where to find a doc about this format) ?

      5/ How to call a .exe

       

      Thank you for your answers on one or on several points above.

        • 1. Re: Questions about brushes
          Paul Riggott Community Member

          It might be best to have a look at this thread...

          http://www.ps-scripts.com/bb/viewtopic.php?f=25&t=2801

          • 2. Re: Questions about brushes
            habaki1 Community Member

            Thank you Paul!

             

            I found this simple script that is enough to access to a lot of infos:

             

            var ref = new ActionReference();
            ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
            var Desc = executeActionGet(ref);

             

            For instance below is a part of this descriptor: the currentToolOptions (printed with the "actionViewer" script i wrote).

            So to get opacity, flow and other properties is no more a problem.

             

             


            Key[0]:"flow" = Integer(41),
            Key[1]:'prVr' = Object(Type='brVr',
                Key[0]:'bVTy' = Integer(0),
                Key[1]:'fStp' = Integer(25),
                Key[2]:"jitter" = UnitDouble(Type="percentUnit", Val=0)
                ),
            Key[2]:'opVr' = Object(Type='brVr',
                Key[0]:'bVTy' = Integer(2),
                Key[1]:'fStp' = Integer(25),
                Key[2]:"jitter" = UnitDouble(Type="percentUnit", Val=0)
                ),
            Key[3]:"mode" = Enumerated(Type="blendMode", Val="normal"),
            Key[4]:"opacity" = Integer(43),
            Key[5]:"brush" = Object(Type="computedBrush",
                Key[0]:"diameter" = UnitDouble(Type="pixelsUnit", Val=13),
                Key[1]:"hardness" = UnitDouble(Type="percentUnit", Val=100),
                Key[2]:"angle" = UnitDouble(Type="angleUnit", Val=0),
                Key[3]:"roundness" = UnitDouble(Type="percentUnit", Val=100),
                Key[4]:"spacing" = UnitDouble(Type="percentUnit", Val=25),
                Key[5]:"interfaceIconFrameDimmed" = Boolean(true),
                Key[6]:"flipX" = Boolean(false),
                Key[7]:"flipY" = Boolean(false)
                ),
            Key[6]:"useTipDynamics" = Boolean(true),
            Key[7]:"flipX" = Boolean(false),
            Key[8]:"flipY" = Boolean(false),
            Key[9]:"minimumDiameter" = UnitDouble(Type="percentUnit", Val=0),
            Key[10]:"minimumRoundness" = UnitDouble(Type="percentUnit", Val=25),
            Key[11]:"tiltScale" = UnitDouble(Type="percentUnit", Val=200),
            Key[12]:'szVr' = Object(Type='brVr',
                Key[0]:'bVTy' = Integer(2),
                Key[1]:'fStp' = Integer(25),
                Key[2]:"jitter" = UnitDouble(Type="percentUnit", Val=0)
                ),
            Key[13]:"angleDynamics" = Object(Type='brVr',
                Key[0]:'bVTy' = Integer(0),
                Key[1]:'fStp' = Integer(25),
                Key[2]:"jitter" = UnitDouble(Type="percentUnit", Val=0)
                ),
            Key[14]:"roundnessDynamics" = Object(Type='brVr',
                Key[0]:'bVTy' = Integer(0),
                Key[1]:'fStp' = Integer(25),
                Key[2]:"jitter" = UnitDouble(Type="percentUnit", Val=0)
                ),
            Key[15]:"useScatter" = Boolean(false),
            Key[16]:"texture" = Object(Type="pattern",
                Key[0]:"name" = String("Canvas"),
                Key[1]:"ID" = String("bdc82908-af3b-11d5-9188-9025d38e8e3b")
                ),
            Key[17]:"textureScale" = UnitDouble(Type="percentUnit", Val=100),
            Key[18]:"invertTexture" = Boolean(true),
            Key[19]:"protectTexture" = Boolean(false),
            Key[20]:"useTexture" = Boolean(false),
            Key[21]:"dualBrush" = Object(Type="dualBrush",
                Key[0]:"useDualBrush" = Boolean(false)
                ),
            Key[22]:"useColorDynamics" = Boolean(false),
            Key[23]:"wetEdges" = Boolean(false),
            Key[24]:"noise" = Boolean(false),
            Key[25]:"smoothing" = Boolean(true),
            Key[26]:"usePaintDynamics" = Boolean(false),
            Key[27]:"repeat" = Boolean(false),
            Key[28]:"foregroundColor" = Object(Type="RGBColor",
                Key[0]:"red" = Double(0),
                Key[1]:"grain" = Double(0),
                Key[2]:"blue" = Double(0)
                )

             

             

            The whole descriptor gives 90KB of data, with the current tool, the list of loaded brushes (presetManager), etc.. It is magic.

             

            Unfortunalty, some other important infos seem to not be present, like for instance the name of the current brush.

            Is there some other ActionDescriptors to get somewhere ?