ZBrushCentral

Question:zscript for managing layers

Question:
Would it be possible to create a zscript or various zscripts that could manage layers like the examples below?
Example 1: Turn record on and off selected layer

Example 2: Hide selected layer

Example 3: -Hide all layers but selected one
-If morph target stored, then delete Morph Target and Store new Morph Target
-If morph target not stored, then Store new Morph Target
-Unhide all hidden layers

Example 4: -Hide all layers
-If morph target stored, then delete Morph Target and Store new Morph Target
-If morph target not stored, then Store new Morph Target
-Unhide all hidden layers
Example 5: -Delete Morph Target, then Store new Morph Target

Thanks!

Yes, this is mostly straightforward. The tricky one is toggling record on/off, though you can do that by simulating a click on the icon:

//routine to toggle Record for current layer*************
[RoutineDef,ToggleRecord,
[VarSet,layerPath,[StrMerge,“Tool:Layers:”,[IGetTitle,“Tool:Layers:Layer Intensity”]]]
//turn on Layer recording if necessary
[VarSet,wid,[IWidth,layerPath]]
[If,([IModGet,layerPath]&1) != 1,
//set Intensity to 1 for recording
[ISet,Tool:Layers:Layer Intensity,1]
[IClick,layerPath,wid-28,5]//turn on recording

,//else turn off record [ISet,"Tool:Layers:Layer Intensity",0] ]//end if

]//end routine

Otherwise you can turn layer visibility on or off by setting the Layer Intensity slider. You need to step through the layers using the SelectDown and SelectUp buttons.

Thank you very much marcus,
I copied this to a text file and tried loading it through the Zscript panel. Is a button supposed to load somewhere?
So far I haven’t seen any effect.

Thanks.

You’re not going to with that code alone… He set up part of it but there are some bits missing. :slight_smile: Like [IButton,???,“whatevername”,//and some more

Yes, it’s a code snippet not a fully working example.

This is a very interesting demand and those script could potentially accelerate the use of layers by 10 fold!
It will be great to have them… And if I was better at zscript I will be doing them myself. :D:D:D

Anyone ?

THIS IS CLOSER BUT NOT FINISHED…OR MAYBE…HAVENT TRIED TO TEST
//routine to toggle Record for current layer*************
[RoutineDef,ToggleRecord,
[VarSet,layerPath,[StrMerge,“Tool:Layers:”,[IGetTitle,“Tool:Layers:Layer Intensity”]]]
//turn on Layer recording if necessary
[VarSet,wid,[IWidth,layerPath]]
[If,([IModGet,layerPath]&1) != 1,
//set Intensity to 1 for recording
[ISet,Tool:Layers:Layer Intensity,1]
[IClick,layerPath,wid-28,5]//turn on recording
,//else turn off record
[ISet,“Tool:Layers:Layer Intensity”,0]
]//end if
]//end routine
[VarDef,Edit,0]
[IButton,???,“Toggle”,//and some more
[If,1,
[RoutineCall,ToggleRecord]
, //or else do the following
[Note,“You must have an object in edit mode”,0,0]
[Exit]
]//end if
]//end file

Oh yes! thank you I will try it at once!

Still needs work…

Thanks Doug for the clarification.

I will have to look into this more, I have to learn zcripting to get this working.
Another thing I forgot to mention would be the ability to mask by layer through a zscript.
Is that possible by default in Zbrush?

You’ll need another button for that one. I posted a bunch of files(and a UI) :wink: Have at em :wink: And have fun with ZScript :slight_smile: