ZBrushCentral

Droplists, Memory Blocks, and ZFU_DropdownGet

I’m trying to set something up using the new droplists, and I’m stuck on understanding exactly how they relate to the memory blocks (as used in the ZFU example).

I switched a couple things around, but it’s basically the same. I want an ADD to list button, and the list itself (selectable).

what I’ve noticed however, is that when I use ZFU_DropdownGet, I don’t seem to get the correct corresponding string name for the list item index that I would expect. It seems to get out of sync with the current index somehow, and I’m not sure how to make sure that I always retrieve the correct corresponding string name associated with an index.

It’s rather hard to explain, so I’ve attached an example, with a “Get Info” button that reports on the active index, corresponding string name, and the current MB string setting.

Also, and maybe similarly, why store the name string offset into a memory block, AND pass it to the ZFU (is that simply to handle the UI refresh, sort of like switches (delegated to UpdateZFUtilsUI))?

For the Get Info button, I think the problem is because you aren’t passing the list item index to the ZFU_DropdownGet routine. You get it using the ZFU_DropdownGetSelected routine, storing it in the dropIndex variable. This then needs to be used instead of “#selected” in the ZFU_DropdownGet routine call.

For your second question, yes, I think that keeping the current selection string in the memory block and passing that to the update UI routine is a way to avoid the name being reset to the default when the plugin reloads.

Wow, I’m a big dummy :smiley: How did I not see that, it was working all along, and my debug button had a bad variable. That was totally it. Thanks for the save again Marcus!

I have to say, I really like where the API is going. The new ZFU routines, and UI extensions are pretty great. I’m glad to see more UI support coming for plugins in the form of drop lists. It’s opening up some new possibilities. I do still wish we had better looking group boxes, similar to the rest of the UI, but this is really great.

Snapshots_UI_Wip.jpg