this tool allows to create a blendshape layer based off of all the turned on blendshape layers at time of running script (it could be helpful when facial rigging and sculpting blendshapes in ZBrush). there may be bugs so please use/modify at your own risk.
//////creating a combination blendshape //given some layers already on //store morph target //turn off all layers //create new layer //turn on record for new layer //apply saved morph target //turn off all layers ///// //need some global variables in zscripting to pass information to different methods/functions/routines [VarDef, numberOfLayers, 0] //will hold number of layers [VarDef, layerNames(256), ""] //these are names of blendshape layers, string variable list //turn off all layers - assumes layer names are known [RoutineDef, turnOffAllLayers, [Loop, numberOfLayers, //[Note, layerNames(i)] [ISet, [StrMerge, "Tool:Layers:", layerNames(i)], 0] , i] ]//end proc //get number of layers [RoutineDef, getNumLayers, [VarSet, numberOfLayers, 0] [If, [IsEnabled,Tool:Layers:Layers Scrollbar], //store current scroll bar position [VarSet, tmpScrPos, [IGetSecondary,Tool:Layers:Layers Scrollbar]] //set scroll bar to a maximum to ensure it is at the top [ISet, Tool:Layers:Layers Scrollbar, 0, 256] [VarSet, numberOfLayers, [IGetSecondary, Tool:Layers:Layers Scrollbar]+1] [ISet, Tool:Layers:Layers Scrollbar, 0, tmpScrPos]//reset scroll bar , [If, [IsEnabled,"Tool:Layers:Layer Intensity"], [VarSet, numberOfLayers, 1] ] ] ]//end proc //get layer names [RoutineDef, getLayerNames, //go to top of layer list so can later scroll down [Loop, numberOfLayers, [If, [IsEnabled,Tool:Layers:SelectUp], [IPress,Tool:Layers:SelectUp] , [LoopExit] ] ] //get the names [Loop, numberOfLayers, [VarSet, layerNames(n), [IGetTitle,"Tool:Layers:Layer Intensity",0]] //select next layer [If, [IsEnabled, Tool:Layers:SelectDown], [IPress, Tool:Layers:SelectDown] ] , n] ]//end proc //will be the main routine called by client button [RoutineDef, doIt, //main part of method //store morph target [IPress, Tool:Morph Target:StoreMT] //do bit for getting blendshape layers and turning them all off [RoutineCall, getNumLayers] [RoutineCall, getLayerNames] [RoutineCall, turnOffAllLayers] //create new layer [IPress, Tool:Layers:New] //by default its record is on for new layer //apply saved morph target [IPress, Tool:Morph Target:Switch] //turn off all layers [RoutineCall, getNumLayers] [RoutineCall, getLayerNames] [RoutineCall, turnOffAllLayers] ] [IButton, createCombinationBlendshape, "create combination shape", //call method [RoutineCall, doIt] ]
//Inspired by //Marcus Civis https://www.zbrushcentral.com/t/q-layer-system-layer-count-etc/211339 //https://www.zbrushcentral.com/t/zscript-for-layers/205892/2
Thanks for looking