ZBrushCentral

identify polygroup via mouse position

Hi, I was wondering if there is a way of knowing which polygroup the mouse clicked on and assigning it’s ID to a variable. There must be some way to do this since zbrush knows which polygroup to isolate when you Ctrl+shift+click on a polygroup.

i’m basically building a plugin which assigns pre-defined masks to a basemesh I use. At the moment it works using buttons in the UI but I would like to make it more intuitive by clicking directly on the polygroup which I’d like to effect.

thanks!

Well, ZBrush being able to do something doesn’t mean it’s possible with zscript!

The PixolPick command will return the color under the cursor (or at a specified position). If you set things up so that the Flat Render is on, there’s no polypaint (Colorize off), and polyframes are on but without polylines which could confuse things, then PixolPick will return a different color for each group.

However, that’s about all you’ll get. You can’t isolate the group directly, or identify it in any other way. If you were to export an OBJ then that would have the groups in, and it might be possible to identify the group from the color but it would be tricky. (The group names - basically numbers - do correspond to a limited range of colors.)

Thanks for your suggestion! it seems a little fragile but i think it should do the trick :slight_smile:
I have another simple question regarding loops in zscripting… Basically I would like to know if there is a way to create an infinite loop (so that I can have it go on until “LoopExit” is called. I tried not defining the loop count as I was hoping that the default would be infinite but it simply didn’t run the commands within that loop. At the moment I’m getting away with just specifying a huge loop count but I don’t like patching things up like that. Thanks for your help so far

Yes, there’s no infinite loop so you have to do as you’ve been doing and set it large.