1. #1
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    10,451

    Default ZBrush 4R8 - changes affecting ZScript

    Hi,

    ZBrush 4R8 has some UI changes which affect how zscripts run, so some plugins and macros will need updating before they will work as expected in the new version. The changes primarily affect those scripts which deal with subtool visibility.

    Another change which won't affect older scripts but will be a useful enhancement to zscript is the ability to dispel the warning message that pops up for "un-doable" actions, such as deleting a subtool.

    Example is code below. The attached file is the same code so you can load directly in 4R8 for testing.

    Any problems or questions, let me know.


    //ZScript changes for 4R8

    [RoutineDef,CheckVersion,//check that version is 4R8
    [If,([ZBrushInfo,0]< 4.8),
    [Note,"This script is not for this version of ZBrush"]
    [Exit]
    ]
    ]//end of routine

    [RoutineDef,CheckSubTool,//check that we have a subtool
    [If,[IExists,Tool:SubTool:Select Down],
    //do nothing - all OK
    ,//else not a subtool
    [Exit]
    ]
    ]//end of routine

    [RoutineDef,DoIt,//start of routine
    //put code here for whatever you want to do
    [Note,"TEST"] //this note just to show - remove
    ]//end of routine



    [IButton,"Get All Vis","Check Visibility of All subtools",
    [RoutineCall,CheckVersion]
    [RoutineCall,CheckSubTool]
    [VarSet,activST,[SubToolGetActiveIndex]]//store active subtool
    [Loop,[SubToolGetCount],//loop through all subtools
    [SubToolSelect,[Val,n]]
    //check visibility
    [If,([IModGet,"Tool:Subtool 0"]&32 == 32),
    //code for visible subtool
    [Note,[StrMerge,"SubTool #",[Val,n]," is VISIBLE"],,1]
    ,
    //code for invisible subtool
    [Note,[StrMerge,"SubTool #",[Val,n]," is HIDDEN"],,1]
    ]
    ,n]//end loop
    [SubToolSelect,activST]//reselect active subtool
    ]//end button


    [IButton,"Do Visible","Run routine on Visible subtools",
    [RoutineCall,CheckVersion]
    [RoutineCall,CheckSubTool]
    [VarSet,activST,[SubToolGetActiveIndex]]//store active subtool
    [Loop,[SubToolGetCount],//loop through all subtools
    [SubToolSelect,[Val,n]]
    //check visibility
    [If,([IModGet,"Tool:Subtool 0"]&32 == 32),
    //code for visible subtool
    [RoutineCall,DoIt]
    ]
    ,n]//end loop
    [SubToolSelect,activST]//reselect active subtool
    ]//end button


    [IButton,"Get Selected Vis","Check Visibility of Selected subtool",
    [RoutineCall,CheckVersion]
    [RoutineCall,CheckSubTool]
    [VarSet,activST,[SubToolGetActiveIndex]]
    [ISet,Tool:Sub Tool:SubTool ScrollBar,0,([SubToolGetCount]-(activST+1))]
    [If,([IModGet,"Tool:Subtool 0"]&32 == 32),
    [Note,"Selected subtool is VISIBLE",,1]
    ,
    [Note,"Selected subtool is HIDDEN",,1]
    ]
    ]//end button


    [IButton,"Get Selected SubTool All Mods","Check Icon status of Selected subtool",
    [RoutineCall,CheckVersion]
    [RoutineCall,CheckSubTool]
    [VarSet,activST,[SubToolGetActiveIndex]]
    //positions scrollbar so subtool at top of list
    [ISet,Tool:Sub Tool:SubTool ScrollBar,0,([SubToolGetCount]-(activST+1))]
    //check the mods
    [If,([IModGet,"Tool:Subtool 0"]&32 == 32),
    [Note,"Is visible\n",,-1]
    ]
    [If,([IModGet,"Tool:Subtool 0"]&16 == 16),
    [Note,"Polypaint on\n",,-1]
    ]
    [If,([IModGet,"Tool:Subtool 0"]&1 == 1),
    [Note,"START\n",,-1]
    ]
    [If,([IModGet,"Tool:Subtool 0"]&2 == 2),
    [Note,"Addition\n",,-1]
    ]
    [If,([IModGet,"Tool:Subtool 0"]&4 == 4),
    [Note,"Subtraction\n",,-1]
    ]
    [If,([IModGet,"Tool:Subtool 0"]&8 == 8),
    [Note,"Intersection\n",,-1]
    ]
    [Note," "]//display result
    ]//end button

    //The "Action Is not Undoable" warning note can now be dismissed by ZScript
    //by using [IKeyPress,'1',...] to select the first option,
    //[IKeyPress,'2',...] for select the 2nd option, etc.
    //***Note that the ' ' is required.
    //Example for deleting a subtool:
    [IButton,"Delete Subtool","Delete selected subtool - without warning!",
    [RoutineCall,CheckVersion]
    [RoutineCall,CheckSubTool]
    //IKeyPress of 2 will select the second option of the dialog popup.
    [IKeyPress,'2',[IPress,Tool:SubTool: Delete]]
    ]//end button




    Code as a txt file: 4R8 ZScript Changes.txt


    ***Please Note : the ZFileUtils will need updating for ZBrush 4R8. This is in hand and should be released during the next week.

  2. #2
    Senior Member Follow User Gallery
    Join Date
    Oct 2005
    Location
    USA
    Age
    33
    Posts
    1,026

    Default

    Thanks for this Marcus, huge help!

    Has anything changed with the way ISwitch commands work in regards to toggling on and off a default UI item in 4r8?

    A lot of my ISwitch commands don't work the way the used to in 4r7p3. They seem to almost be intertwined, when I press any of my ISwitch buttons, one or more get turned on simultaneously and I can't sort it out.

    Hope that makes sense, and thanks again for your time.

  3. #3
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    10,451

    Default

    Hi Eric,

    I'm not aware of any changes to the way ISwitches function. What you describe sounds like an issue to do with when the plugin is loaded, and the default states of the switches, but I'd need to see the complete code to be certain. Do send me a private message if you wish.

  4. #4

    Default

    Marcus,
    Your're ahead of the game as always! Do you know of any new ZScript features or functions at all?

  5. #5
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    10,451

    Default

    Quote Originally Posted by Britney Zpheres
    Marcus,
    Your're ahead of the game as always! Do you know of any new ZScript features or functions at all?
    So far, only the modification to IKeyPress mentioned above, though I hope to add some useful stuff to the ZFileUtils in due course.

  6. #6

    Default

    Nice to see zscript also got an update.

  7. #7
    Senior Member Follow User Gallery
    Join Date
    Feb 2015
    Location
    Paris
    Posts
    188

    Default

    Hello Guys, thx Marcus for the full detail, iam sorry but i will just complain about a false Zscript improvement.
    they just had fixed the issue for one type of note interface, not for every of them. ;p

    1. still impossible to set a value for *bpr filters > "filter type" & "blend mode"
    2. it's still impossible to create a rollout menu

    3. they have reiterated for the imm viewer, thre is no button path or item id, it's impossible to change the active immBrush when the panel is displayed on top of the ui and you enter in the transform:move mode.
    I d like to make a Imm brush to Ztool, but its impossible.

    4. [Iclose, "brush:brushname"] doesn't work, you can't to clean up a zproject file, only by loading a new resource on the top of the one you want to remove. I like a way to clean up Zbrush resource without to restart zbrush.
    Plugins & Toolsets for Zbrush 4R8 : zCycler | zTexturer | Twitter | @Facelessmindz

  8. #8
    Senior Member Follow
    User Gallery
    Join Date
    Aug 2011
    Location
    Mebane, NC
    Posts
    4,127

    Default

    Some item id numbers have changed which WILL need editing in some macros.

  9. #9
    Senior Member Follow User Gallery
    Join Date
    Nov 2010
    Location
    Sydney, Australia
    Posts
    135

    Default

    Hi Marcus, any progress on 4R8 ZFileUtils?

    Cheers!

  10. #10
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    10,451

    Default

    Hi,

    It will be released next week. It will be worth the wait.

Posting Permissions

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