ZBrushCentral

Questions about [SubToolGetStatus]

Hi!
So I took a look into [SubToolGetStatus] especially in combinations with folders and I am a bit confused. What I learned sofar is that the topmost Subtool in a folder holds the status of the folder (just like with boolean groups). This is great news, as I first was concerned the possibility to hide folder in the prefs, would create a nightmare to track.
Other Subtools in a folder don’t seem to have a special “is part of folder” flag though and this is where my confusion starts.
A Subtool that is part of a groups and gets hidden by the parent folder remains it’s status (e.g 17) although being not visible. I assume this was done to be able to restore the correct visibility of the content of the folder.
It makes [SubToolGetStatus] an unreliable source though, when looking through the complete Subtool list. I now have a list where a status of 17 can mean a Subtool outside a folder is visible, yet also be invisible to the user (although technically visible) inside of a hidden folder.
This in combination with the fact, that the status holds not information about Polypaint, feels like unused potential.
The status is easy to use (no name check->few lines), so it could be a slick all purpose solution. From what I have learned so far, it seems to make things more complicated though, as I now might need to check for the modifier and the status as well, to get the complete state of a Subtool.

Should I be mistaken and I simply need to wait a little longer for the documentation that will shed light on all my questions, please let me know :)!

I did a bit more digging and with the help of F@celessm!ndz on discord, we managed to come up with a solution that allows to track a Subtool’s visibility state using [SubtoolGetFolderIndex]. Which means I can now can start working with the new features :).

For the curious:

[IButton, “Subtool visible?”, ,
[VarSet,STStatus,[SubtoolGetStatus]]
[VarSet,STFolderIndex,[SubtoolGetFolderIndex]]

[If,(STFolderIndex > -1), //part of a folder
[If,(STStatus&2), //head of the folder
[If,(STStatus&1),
[Note,“Visible head of folder”]
,
[Note,“Invisible head of folder”] ]
,
[If,(STStatus&1), //member of the folder
[Note,“Visible in a folder”]
,
[Note,“Invisible in a folder”] ] ] ] [If,(STFolderIndex == -1), //not part of a folder
[If,(STStatus&1),
[Note,“Visible”]
,
[Note,“Invisible”]
]]]

Yeah, here’s my version:

[COLOR=#e3f149][[COLOR=#ed7033]RoutineDef, SubToolIsVisible,
[[COLOR=#ed7033]VarSet, [COLOR=#f8f8f8]isVisible, 0]
[[COLOR=#ed7033]VarSet,[COLOR=#f8f8f8]actIndex,[[COLOR=#ed7033]SubToolGetActiveIndex]]
[[COLOR=#ed7033]VarSet,[COLOR=#f8f8f8]st,[[COLOR=#ed7033]subtoolgetstatus,[COLOR=#f8f8f8]actIndex]]
[[COLOR=#ed7033]VarSet,[COLOR=#f8f8f8]fInd,[[COLOR=#ed7033]subtoolgetfolderindex,[COLOR=#f8f8f8]actIndex]]
[[COLOR=#ed7033]If,([COLOR=#f8f8f8]fInd > -1),[COLOR=#8c8c8c]//it’s in a folder
[[COLOR=#ed7033]VarSet,[COLOR=#f8f8f8]stFld,[[COLOR=#ed7033]subtoolgetstatus,[COLOR=#f8f8f8]fInd]][COLOR=#8c8c8c]//get folder visibility
[[COLOR=#ed7033]If,([[COLOR=#ed7033]Val,[COLOR=#f8f8f8]stFld]&0x2 == 0x2)&&([[COLOR=#ed7033]Val,[COLOR=#f8f8f8]st]&0x1 == 0x1),
[[COLOR=#ed7033]VarSet,[COLOR=#f8f8f8]isVisible,1]
]
, [COLOR=#8c8c8c]//else no folder
[[COLOR=#ed7033]If,([[COLOR=#ed7033]Val,[COLOR=#f8f8f8]st]&0x1 == 0x1),
[[COLOR=#ed7033]VarSet,[COLOR=#f8f8f8]isVisible,1]
]
]
, [COLOR=#f8f8f8]isVisible]

The above code could easily be adjusted to take an index instead of the subtool needing to be selected. (A big advantage with SubToolGetStatus over previous methods.)