1. #16
    New Member Follow User Gallery
    Join Date
    Feb 2010
    Location
    Milan (Italy)
    Age
    39
    Posts
    18

    Default

    Cheers I believe that 25 brushes was the most recommended.
    There was a recent post regarding the formatting you mentioned.
    I use the Crimson Editor here for the scripts I do(and Notepad)
    Hey Doug, many thanks for the hints !

    Regarding the number of brushes I am not far away from the recommended # (30 vs 25) and so far the script is running smoothly (both with and without the [IFreeze] command.
    However thanks for the information ! At least now I am aware that a recommended # has been given.

    Regarding the text editor, I think I found the thread about the formatting post you were talking about :
    ZScript syntax highlighter for Sublime Text - beta
    Many thanks pointing me to that that: I downloaded Sublime Text 3 (I love that by default has a dark background instead of a white one) and the syntax text highlighter for ZScripting, and they seem to work pretty well-
    Andrea Massa - Environment Artist
    Portfolio
    - ArtStation - Linkedin

  2. #17

  3. #18
    New Member Follow User Gallery
    Join Date
    Feb 2010
    Location
    Milan (Italy)
    Age
    39
    Posts
    18

    Default

    Actually it was this thread with a link to a page.
    http://www.zbrushcentral.com/showthr...x-Highlighting
    Oh ok, I missed that one (for some reason).

    many thanks !
    Andrea Massa - Environment Artist
    Portfolio
    - ArtStation - Linkedin

  4. #19
    Senior Member Follow User Gallery
    Join Date
    Jul 2002
    Location
    Copenhagen
    Age
    45
    Posts
    2,561

    Default

    Hi Andrea,

    Sorry about the delay. I had a look at it last weekend but for some reason, the code I imagined would work simply did not.

    But I think I found the culprit. Reading a brush name during an [IKeyPress,...] did not work for me. Adding a slight delay solved the problem.

    So, the following code will flip the wrap mode according to the wrap mode of the currently selected brush. Any brushes that you hardcode will also need a variable to define which type of brush they are. The standard modelling, smoothing and masking brushes are supported but not the clip and selection brushes. I took those out as I tried to narrow down the problem, besides, they do not seem to be affected by the wrap mode setting.

    You still cannot hold any modifier keys while pressing the plugin button or the plugin might fail. Not sure what to do about that as the previous modifier key detection solution does not seem to work anymore.

    Edit: I just noticed copy / pasting the code does not preserve the indentation. So here is the file:

    FlipWrapModes.txt

    [IConfig, 4.5]

    [ISubPalette, "Zplugin:Brush WrapMode"]

    [VarSet, brushCount, 4]
    // brushes() defines the pathname and brushType() defines what type of brush it is.
    // 0: standard modeling brush.
    // 1: smooth brush.
    // 2: masking brush.
    [VarDef, brushes(brushCount), ""] [VarDef, brushType(brushCount), 0]
    [VarSet, brushes(0), "Brush:Clay"] [VarSet, brushType(0), 0]
    [VarSet, brushes(1), "Brush:Standard"] [VarSet, brushType(1), 0]
    [VarSet, brushes(2), "Brush:Smooth"] [VarSet, brushType(2), 1]
    [VarSet, brushes(3), "Brush:MaskPen"] [VarSet, brushType(3), 2]

    [IButton, "ZPlugin:Brush WrapMode:Flip WrapModes", "Flip WrapModes.",
    [IFreeze, // Stops interface updates while we switch brushes.
    // Store the currently selected modeling brush.
    [VarSet, currentBrush, [IGet, 30516]] // 30516 is the Brush slider.
    // Determine the new WrapMode
    [If, [IGet, "Brush:Curve:WrapMode"], // WrapMode is 1 or higher.
    [VarSet, newWrapMode, 0]
    ,
    [VarSet, newWrapMode, 1]
    ]
    // Set the new WrapMode for the currently selected brush.
    [ISet, "Brush:Curve:WrapMode", newWrapMode]
    // Store the currently selected smooth brush.
    [IKeyPress, SHIFT,
    [Delay, 0.05] // Apparently needed to read the brushName.
    [VarSet, brushName, [IGetTitle, 30516]]
    [VarSet, smoothPath, [StrMerge, "Brush:", brushName]]
    // Remove the . and space from the path.
    [VarSet, smoothPath, [StrExtract, smoothPath, 0, [StrLength, smoothPath] - 2]]
    [ISet, "Brush:Curve:WrapMode", newWrapMode]
    ]
    // Store the currenlty selected masking brush.
    [IKeyPress, CTRL,
    [Delay, 0.05] // Apparently needed to read the brushName.
    [VarSet, brushName, [IGetTitle, 30516]]
    [VarSet, maskPath, [StrMerge, "Brush:", brushName]]
    // Remove the . and space from the path.
    [VarSet, maskPath, [StrExtract, maskPath, 0, [StrLength, maskPath] - 2]]
    [ISet, "Brush:Curve:WrapMode", newWrapMode]
    ]
    // Then set WrapMode for the hardcoded brushes.
    [Loop, brushCount,
    // Checks if the interface path name or UI ID exists.
    [If, [IExists, brushes(index)],
    [If, brushType(index) == 0,
    [IPress, brushes(index)]
    [ISet, "Brush:Curve:WrapMode", newWrapMode]
    [LoopContinue] // No need to check for other brushType().
    ]
    [If, brushType(index) == 1,
    [IKeyPress, SHIFT,
    [IPress, brushes(index)]
    [ISet, "Brush:Curve:WrapMode", newWrapMode]
    ]
    [LoopContinue] // No need to check for other brushType().
    ]
    [If, brushType(index) == 2,
    [IKeyPress, CTRL,
    [IPress, brushes(index)]
    [ISet, "Brush:Curve:WrapMode", newWrapMode]
    ]
    ]
    ]
    , index]
    // Restore the previously selected smooth, mask and modeling brushes.
    [IKeyPress, SHIFT,
    [IPress, smoothPath]
    ]
    [IKeyPress, CTRL,
    [IPress, maskPath]
    ]
    [ISet, 30516, currentBrush]
    ] // End of IFreeze
    , /*DISABLED ?*/, /*BUTTON WIDTH*/, , /*BUTTON ICON*/, /*BUTTON HEIGHT*/]
    Mark

  5. #20
    New Member Follow User Gallery
    Join Date
    Feb 2010
    Location
    Milan (Italy)
    Age
    39
    Posts
    18

    Default

    Hi < Ash >,

    Sorry about the delay. I had a look at it last weekend but for some reason, the code I imagined would work simply did not.
    Hey Mark, don't worry, there was not rush at all, besides, the script that you previously helped me to develop works great: whenever I am scultping a tilable texture now I can easily tweak all the brushes I need in once click ! As to say: I was already pretty happy with the previous result.

    So many thanks for looking into it furthermore: I admit that being able to have also a couple of smooth and masking brushes affected by the WrapMode script would be pretty awesome).

    Your script looks great: I don't think that the fact to be able to hold any modifier key while running the script would matter (does it?). In the end as long as it sets the WrapMode value for the hardcoded brushes is all right.

    Pretty interesting the trick to define the "type of brush" !

    I will give a shot to the script tomorrow to see how it works.


    That said, many thanks again for taking the time to solve this issue for me !
    Andrea Massa - Environment Artist
    Portfolio
    - ArtStation - Linkedin

  6. #21
    Senior Member Follow User Gallery
    Join Date
    Jul 2002
    Location
    Copenhagen
    Age
    45
    Posts
    2,561

    Default

    I don't think that the fact to be able to hold any modifier key while running the script would matter (does it?).
    It matters in that ZBrush will tell you (possibly for each masking/smoothing brush) "This brush will be selected as the active 'masking' brush." and then ask you to press OK or skip this note until next restart.

    Not a big problem, just an inconvenience. With some earlier code it did fail for me, were holding SHIFT would select the main brush, i.e no change.

    That said, many thanks again for taking the time to solve this issue for me !
    You are welcome, just be ready for the ZScript quiz that I am going to send you later
    Mark

  7. #22
    New Member Follow User Gallery
    Join Date
    Feb 2010
    Location
    Milan (Italy)
    Age
    39
    Posts
    18

    Default

    the active 'masking' brush." and then ask you to press OK or skip this note until next restart.

    Not a big problem, just an inconvenience. With some earlier code it did fail for me, were holding SHIFT would select the main brush, i.e no change.
    Ahhhh understood: now I know which message you're talking about. "THE" silly message that I use to dismiss until the end of the session every time (I would really like that Pixologic would give us the opportunity to turn off that message.



    Btw not a big deal: after dismissing the first warning (until the end of the session) the rest should be fine.
    Andrea Massa - Environment Artist
    Portfolio
    - ArtStation - Linkedin

  8. #23
    New Member Follow User Gallery
    Join Date
    Feb 2010
    Location
    Milan (Italy)
    Age
    39
    Posts
    18

    Default

    Hey Mark,

    this morning I hard coded the brushes in your code and they all work great (including Smooth and Masking brushes).
    Also no Warning is displayed for Smooth and Masking brushes when running the script (the thing you were worried about).
    So at the end of the day you created a great script ! Many thanks again.

    Here follows the script code I created (with my ownd harcoded brushes) using your code: maybe someone else may find it useful.
    Apologies for the flat highlighting but I cannot get a decent colorcoding in Notepad++.
    I also attached the .txt file so to preserve the correct code indentation (as you did before).


    [IConfig,4.73]


    [ISubPalette, "Zplugin:Brush WrapMode"]


    [VarSet, brushCount, 34]
    // brushes() defines the pathname and brushType() defines what type of brush it is.
    // 0: standard modeling brush.
    // 1: smooth brush.
    // 2: masking brush.
    [VarDef, brushes(brushCount), ""] [VarDef, brushType(brushCount), 0]
    [VarSet, brushes(0), "Brush:Morph"] [VarSet, brushType(0), 0]
    [VarSet, brushes(1), "Brush:Standard"] [VarSet, brushType(1), 0]
    [VarSet, brushes(2), "Brusham_Standard"] [VarSet, brushType(2), 0]
    [VarSet, brushes(3), "Brush:hPolish"] [VarSet, brushType(3), 0]
    [VarSet, brushes(4), "Brush:Flatten"] [VarSet, brushType(4), 0]
    [VarSet, brushes(5), "Brush:Planar"] [VarSet, brushType(5), 0]
    [VarSet, brushes(6), "Brush:TrimDynamic"] [VarSet, brushType(6), 0]
    [VarSet, brushes(7), "Brush:TrimAdaptive"] [VarSet, brushType(7), 0]
    [VarSet, brushes(8), "Brush:TrimSmoothBorder"] [VarSet, brushType(8), 0]
    [VarSet, brushes(9), "Brush:MalletFast"] [VarSet, brushType(9), 0]
    [VarSet, brushes(10), "Brush:MalletFast2"] [VarSet, brushType(10), 0]
    [VarSet, brushes(11), "Brush:Move"] [VarSet, brushType(11), 0]
    [VarSet, brushes(12), "Brush:Move Elastic"] [VarSet, brushType(12), 0]
    [VarSet, brushes(13), "Brush:Alpha"] [VarSet, brushType(13), 0]
    [VarSet, brushes(14), "Brush:Clay"] [VarSet, brushType(14), 0]
    [VarSet, brushes(15), "Brush:ClayBuildup"] [VarSet, brushType(15), 0]
    [VarSet, brushes(16), "Brush:ClayTubes"] [VarSet, brushType(16), 0]
    [VarSet, brushes(17), "Brush:ClayPolish"] [VarSet, brushType(17), 0]
    [VarSet, brushes(18), "Brush:ajClay"] [VarSet, brushType(18), 0]
    [VarSet, brushes(19), "Brush:ajPolish"] [VarSet, brushType(19 ), 0]
    [VarSet, brushes(20), "Brush:ajNoise"] [VarSet, brushType(20), 0]
    [VarSet, brushes(21), "Brush:Orb.Cracks"] [VarSet, brushType(21), 0]
    [VarSet, brushes(22), "Brush:ajCracks"] [VarSet, brushType(22), 0]
    [VarSet, brushes(23), "Brush:ajPinch"] [VarSet, brushType(23), 0]
    [VarSet, brushes(24), "Brush:Pinch"] [VarSet, brushType(24), 0]
    [VarSet, brushes(25), "Brush:Inflat"] [VarSet, brushType(25), 0]
    [VarSet, brushes(26), "Brush:Magnify"] [VarSet, brushType(26), 0]
    [VarSet, brushes(27), "Brush:CurveTubeSnap"] [VarSet, brushType(27), 0]
    [VarSet, brushes(28), "Brush:CurveLineTube"] [VarSet, brushType(28), 0]
    [VarSet, brushes(29), "Brush:Smooth"] [VarSet, brushType(29), 1]
    [VarSet, brushes(30), "Brush:SmoothValleys"] [VarSet, brushType(30), 1]
    [VarSet, brushes(31), "Brush:SmoothPeaks"] [VarSet, brushType(31), 1]
    [VarSet, brushes(32), "Brush:MaskPen"] [VarSet, brushType(32), 2]
    [VarSet, brushes(33), "Brush:LazyMask"] [VarSet, brushType(33), 2]




    [IButton, "ZPlugin:brush WrapMode:WrapMode Main Brushes", "Toggle WrapMode of the Main Brushes between 0 an 1.",
    [IFreeze, // Stops interface updates while we switch brushes.
    // Store the currently selected modeling brush.
    [VarSet, currentBrush, [IGet, 30516]] // 30516 is the Brush slider.
    // Determine the new WrapMode
    [If, [IGet, "Brush:Curve:WrapMode"], // WrapMode is 1 or higher.
    [VarSet, newWrapMode, 0]
    ,
    [VarSet, newWrapMode, 1]
    ]
    // Set the new WrapMode for the currently selected brush.
    [ISet, "Brush:Curve:WrapMode", newWrapMode]
    // Store the currently selected smooth brush.
    [IKeyPress, SHIFT,
    [Delay, 0.05] // Apparently needed to read the brushName.
    [VarSet, brushName, [IGetTitle, 30516]]
    [VarSet, smoothPath, [StrMerge, "Brush:", brushName]]
    // Remove the . and space from the path.
    [VarSet, smoothPath, [StrExtract, smoothPath, 0, [StrLength, smoothPath] - 2]]
    [ISet, "Brush:Curve:WrapMode", newWrapMode]
    ]
    // Store the currenlty selected masking brush.
    [IKeyPress, CTRL,
    [Delay, 0.05] // Apparently needed to read the brushName.
    [VarSet, brushName, [IGetTitle, 30516]]
    [VarSet, maskPath, [StrMerge, "Brush:", brushName]]
    // Remove the . and space from the path.
    [VarSet, maskPath, [StrExtract, maskPath, 0, [StrLength, maskPath] - 2]]
    [ISet, "Brush:Curve:WrapMode", newWrapMode]
    ]
    // Then set WrapMode for the hardcoded brushes.
    [Loop, brushCount,
    // Checks if the interface path name or UI ID exists.
    [If, [IExists, brushes(index)],
    [If, brushType(index) == 0,
    [IPress, brushes(index)]
    [ISet, "Brush:Curve:WrapMode", newWrapMode]
    [LoopContinue] // No need to check for other brushType().
    ]
    [If, brushType(index) == 1,
    [IKeyPress, SHIFT,
    [IPress, brushes(index)]
    [ISet, "Brush:Curve:WrapMode", newWrapMode]
    ]
    [LoopContinue] // No need to check for other brushType().
    ]
    [If, brushType(index) == 2,
    [IKeyPress, CTRL,
    [IPress, brushes(index)]
    [ISet, "Brush:Curve:WrapMode", newWrapMode]
    ]
    ]
    ]
    , index]
    // Restore the previously selected smooth, mask and modeling brushes.
    [IKeyPress, SHIFT,
    [IPress, smoothPath]
    ]
    [IKeyPress, CTRL,
    [IPress, maskPath]
    ]
    [ISet, 30516, currentBrush]
    ] // End of IFreeze
    , /*DISABLED ?*/, /*BUTTON WIDTH*/, , /*BUTTON ICON*/, /*BUTTON HEIGHT*/]
    Attached Files Attached Files
    Andrea Massa - Environment Artist
    Portfolio
    - ArtStation - Linkedin

  9. #24
    Senior Member Follow User Gallery
    Join Date
    Jul 2002
    Location
    Copenhagen
    Age
    45
    Posts
    2,561

    Default

    That's great! Glad you are happy with it.

    The ZBrush warning message is only displayed if you hold SHIFT or CTRL when you press your WrapMode Main Brushes button.

    In order to get syntax highlighting (colorcoding) you will first need to copy your code and paste it into the ZBC Syntax Highlighter.
    Mark

  10. #25
    New Member Follow User Gallery
    Join Date
    Feb 2010
    Location
    Milan (Italy)
    Age
    39
    Posts
    18

    Default

    In order to get syntax highlighting (colorcoding) you will first need to copy your code and paste it into the ZBC Syntax Highlighter.
    Oh, right ! I didn't thought about that !

    Thanks for the tip.

    You are welcome, just be ready for the ZScript quiz that I am going to send you later
    Oh btw I missed this one before: which quiz?
    Andrea Massa - Environment Artist
    Portfolio
    - ArtStation - Linkedin

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •