ZBrushCentral

Zbrush 2019 - run on visible subtools script

The zscript code I had to run a specific command on multiple visible subtools no longer seems to work in Zbrush 2019.1.2. Has anyone been able to get this to work? If so, can you share your code sample?

Thanks!

Hi Eric,

There is this thread which may help (I’m giving the old ZBC address because I used BBcode colors for my answer which doesn’t work here)
http://archive.zbrushcentral.com/showthread.php?217179-Questions-about-SubToolGetStatus

Thank you for the reply Marcus! I could be mistaken but it seems like that code has more to do with Subtool folders, which could also be useful…

But I THINK what I need is something closer to this code you posted for zbrush 4r8 except updated to work on 2019.1.2

http://archive.zbrushcentral.com/showthread.php?207263-ZBrush-4R8-changes-affecting-ZScript-P2-included&p=1210742&viewfull=1#post1210742

But I could be way off. When I run the code you posted for Do Visible",“Run routine on Visible subtools” in Zbrush 2019.1.2 it runs on all subtools, regardless if they are visible or not. That’s what I’m trying to solve for.

Thanks again!

Hi Eric,

That is what you want. The point is it takes care of folders if they exist but they don’t have to. Try this:

[RoutineDef, SubToolIsVisible, [VarSet, isVisible, 0] [VarSet,st,[SubToolGetStatus,id]] [VarSet,fInd,[SubToolGetFolderIndex,id]] [If,(fInd > -1),//it's in a folder [VarSet,stFld,[SubToolGetStatus,fInd]]//get folder visibility [If,([Val,stFld]&0x2 == 0x2)&&([Val,st]&0x1 == 0x1), [VarSet,isVisible,1] ] , //else no folder [If,([Val,st]&0x1 == 0x1), [VarSet,isVisible,1] ] ] ,isVisible,id] [IButton,"Do Visible","Run routine on Visible subtools", [VarSet,activST,[SubToolGetActiveIndex]]//store active subtool [VarSet,isVis,0] [Loop,[SubToolGetCount],//loop through all subtools [SubToolSelect,[Val,n]] //check visibility [RoutineCall,SubToolIsVisible,isVis,[Val,n]] [If,(isVis), //code for visible subtool [Note,[StrMerge,"SubTool ",[Val,n]," is Visible"]] //[RoutineCall,DoIt] ,//else [Note,[StrMerge,"SubTool ",[Val,n]," is Hidden"]] ] ,n]//end loop [SubToolSelect,activST]//reselect active subtool ]//end button
1 Like

That is exactly what I want! Thank you!!! Macrus FTW as always :smile:

You’re welcome Eric! I forgot to mention that with this method you don’t actually need to select the subtool each time. The code would still work if you removed the [SubToolSelect,[Val,n]] line. Or you could move that line to the “//code for visible subtool” section, so the subtool was selected only if it was visible.

Good to know, looks like that speeds things up a bit. Thanks again Marcus!

1 Like