used to use this all the time…r8 kicks up an error now
…anyone else have a similar script or can fix this one to work in r8?
SCRIPT: HideSubtoolUnderMouse.txt
ERROR: #subToolPath
IN: [IPress,#subToolPath]
MrOneTwo said:
I actually got it working. It’s definately not perfect. There is a bug which is based on Alt + LMB subtool changing. I hacked a solution by changing a subtool to a one above on the list and then back to the one that is selected = it does nothing. It only fixes the Alt + LMB issue. Also because of this hack when you use it while first subtool is the active one it doesn’t select it after hiding the other one. It selects the one below.
The one time triggering is described in Zbrush scripting docs. It’s intentional (if you are loading script through z scripting palette). I compiled it into a button and threw it into ZStartup folder and now it works ok. Here is the code (unhiding doesn’t work for now):
[ISubPalette,“ZPlugin:Hide”]
[IButton,“ZPlugin:Hide:Toggle Vis”,“Toggle subtool visibility”,
[IConfig,4.6]
[IPress,Tool:SubTool:SelectUp]
[IPress,Tool:SubTool:SelectDown]
//store the scrollbar position
[VarSet,tmpScrollPos,[IGetSecondary,Tool:Sub Tool:SubTool ScrollBar]]
//find the selected subtool
[VarSet,totalSubTools,[StrExtract,[IGetTitle,Preferences:Misc:SubTools Count],10,256]]
[If,totalSubTools>8,
[VarSet,i,1]
[VarSet,subToolPath,“Tool:Sub Tool:SubTool 0”]
[Loop,totalSubTools,
[VarSet,scrollPos,(totalSubTools-i)]
[ISet,Tool:Sub Tool:SubTool ScrollBar,0,scrollPos]
[If,[IGetFlags,#subToolPath]>=9,
[VarSet,activeSubT,[IGetTitle, Tool:Current Tool]]
[LoopExit]
]
[VarInc,i]
]
,
[VarSet,scrollPos,tmpScrollPos]
[Loop,totalSubTools,
[VarSet,subToolPath,[StrMerge,"Tool:Sub Tool:SubTool ",[Val,n]]]
[If,[IGetFlags,#subToolPath]>=9,
[VarSet,activeSubT,[IGetTitle, Tool:Current Tool]]
[LoopExit]
]
,n]
]
//do select. . . ( marcus civis )
//[IPress,Preferences:Edit:Auto Select SubTool]
[IKeyPress,1064,[CanvasClick,[MouseHPos],[MouseVPos]]]
//[IUnPress,Preferences:Edit:Auto Select SubTool]
//
//and then set var1 to that selection
[VarSet,hideSubT,[IGetTitle, Tool:Current Tool]]
//hide var1
[If,([StrLength,hideSubT]==[StrLength,activeSubT])&&([StrFind,hideSubT,activeSubT]>-1),
//active subtool - do nothing
,//if it’s not the active subtool
[IModSet,[StrMerge,“Tool:SubTool:”,hideSubT],1]
]
//switch back to selected subtool
//set the scrollbar so subtool shows
[ISet,Tool:Sub Tool:SubTool ScrollBar,0,scrollPos]
//select subtool
[IPress,#subToolPath]
//reset scrollbar
[ISet,Tool:Sub Tool:SubTool ScrollBar,0,tmpScrollPos]
]
// unhide all
[IButton,“ZPlugin:Hide:Unhide All”,“Unhide all subtools.”,
[IConfig,4.6]
[VarSet,tmpScrollPos,[IGetSecondary,Tool:Sub Tool:SubTool ScrollBar]]
[VarDef, SubToolNumber,0] //variable to store number of subtools
[VarDef, CurrentSubtoolName,""]
[VarSet, SubToolNumber,[SubToolGetCount]] // Get number of subtool and assign it to SubToolNumber var
[Loop, SubToolNumber, //loop through each subtool
[subToolSelect, n]
[VarSet, CurrentSubtoolName,[IGetTitle, Tool:ItemInfo]] // assign name of currentsubT to CurrentSubtoolName
[IModSet,[StrMerge,"Tool:SubTool:",CurrentSubtoolName],17]
[ISet,Tool:Sub Tool:SubTool ScrollBar,0,tmpScrollPos]
,n]
]
Zscript syntax blows… at least for some one who codes in C/C++ and Python…