Hello,
I’ve been doing a lot of ZScripting recently and for the most part it’s working fine and as I expect. However, I’ve hit a bug which seems very specific and 100% reproducible.
- Create an “IFreeze” block containing a section of code where you loop through all SubTools, selecting each one in turn
- At the end of the loop you will not be able to use some hotkeys for common actions (eg. Ctrl+Shift+Click to toggle polygroup visibility)
- Additionally, Tooltips will no longer display at all
- The only way to resolve this is to restart ZBrush
- Removing the IFreeze block (so that the display updates every time a SubTool is selected by the script) means that this issue will not occur - hotkeys and tooltips will be fine after script execution
- Interestingly, this only occurs if you loop through the SubTools. If you just select a single SubTool via script inside the IFreeze block, then nothing breaks.
I’ve got an example here; it’s based on a script that loops through all SubTools and sets their SDiv level to a value specified by a slider. In this example I’ve just removed all specific stuff - the bug still occurs even if all you do is loop through selecting each SubTool and never actually do anything with the SubTool, as long as IFreeze is on.
// Set all SubTools to a specified SDiv level.
[RoutineDef, sd_SetSDiv,
[IShowActions, 0]
[IFreeze, // Comment this out to make the script work without breaking hotkeys/tooltips
[If, [IExists, "Tool:SubTool:SelectDown"], // Just make sure that the SubTool palette exists first...
[VarSet, numSubTools, [StrExtract, [IGetTitle, "Preferences:Misc:SubTools Count"], 10, 256]]
// Get to the top subtool
[ISet, "Tool:Sub Tool:SubTool ScrollBar", 0, ( #numSubTools - 1 )]
[IPress, "Tool:Sub Tool 0"]
[VarSet, stIndex, [Val, #numSubTools]]
[Loop, #numSubTools,
[VarDec, stIndex]
[ISet, "Tool:Sub Tool:SubTool ScrollBar", 0, #stIndex]
[If, [IsEnabled, "Tool:Sub Tool 0"], [IPress, "Tool:Sub Tool 0"]]
]
]
] // Comment this out if you've commented out IFreeze
[IShowActions, -1]
]
For the time being, I’ve just removed the IFreeze - the script works fine and nothing breaks. However, I feel like it should work (and be faster?), so I’d like to know if anyone knows what’s going on here. It’d be nice if IFreeze didn’t break stuff at the end…
Help me, marcus_civis, you’re my only hope!
(Or anyone else who knows a way around this would be nice).
Cheers,
-MoP