ZBrushCentral

Question: ToolGetCount

I’m trying to build a recursive function, which cycles through all the subtools. First I have to know how many subtools are present. I believe this is done through the ToolGetCount function, but every time I use it, it returns the value 0 (error code?). Bellow is an excerpt of my code with testing code. I tested it on a tool with 10 subtools.

I get 0 then END OF LINE, when I expect it to show 10, then count from 0 to 10, then END OF LINE…

// LOCAL VARIABLES [VarDef,lSubToolCount,0] [VarDef,lSubToolTotal,0] // Recursive Function: cycles through sub tools [VarSet,lSubToolTotal,ToolGetCount] [Note,lSubToolTotal] [Sleep,1] [If,lSubToolCount<lSubToolTotal, [Note,lSubToolCount] [Sleep,1] [VarSet,lSubToolCount,(lSubToolCount+1)] , // Else [Note,"END OF LINE"] [Exit]

you should use [SubtoolGetCount] instead
also there is no loop in your code to make it recursive.

This code check the subtool visibility, and popup a note is the subtool is visible or not.

[VarDef,subtoolName,""]
[VarDef,subtool(1024),0]
[VarSet,totalSubtools,[SubToolGetCount]]
[VarSet,activeSubtool,[SubToolGetActiveIndex]]

[If, activeSubtool==0, [SubToolSelect,1] ]

[Loop, totalSubtools,
[SubToolSelect,[Val,n]]
[VarSet,subtoolName,[IGetTitle,Tool:ItemInfo]]//gets the tool name
[VarSet,subtoolName,[StrExtract,subtoolName,0,[StrLength,subtoolName]-2]]// trim 2 chars from the end
[If,[IModGet,[StrMerge,“Tool:Sub Tool:”,#subtoolName]=]=>=16
,//cmds
[Note, “The subtool is visible”]
,//else
[Note, “The subtool is not visible”]
]

,n] //END LOOP