Dropdown menu
ZFileUtils for ZBrush 4R8 has functions for creating a dropdown menu (similar to the 3D Text plugin).
For examples of how to use these functions, see the script included in the ZFileUtils zip file.
Creating a dropdown menu is straightforward but please make sure you use unique names for memory blocks as simply copying the examples could result in conflicts.
Initialize a new Dropdown
Function to Initialize a new Dropdown (the Dropdown is not shown, it’s initial data is created)
The function returns the ID (an integer value) of the new dropdown
-
- resultDropdown: ID (an integer value) of the new dropdown
[VarSet, resDropdown, [FileExecute, [Var, dllPath], DropdownNew]]
Delete a Dropdown
Function to Delete a Dropdown (the Dropdown doesn’t exist anymore after deletion)
-
- dropdown: the dropdown to delete
[RoutineDef, ZFU_DropdownDelete, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown],, [FileExecute, [Var, dllPath], DropdownDelete] ] , dropdown]
Clear a Dropdown
Function to Clear a Dropdown (the Dropdown still exists after clearing it, but it’s empty)
-
- dropdown: the dropdown to clear
[RoutineDef, ZFU_DropdownClear, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown],, [FileExecute, [Var, dllPath], DropdownClear] ] , dropdown]
Get Dropdown Strings count
Function to Get the strings count in a Dropdown
-
- dropdown: the dropdown
- resCount: the resulting count
[RoutineDef, ZFU_DropdownGetCount, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown], [VarSet, resCount, 0] , [VarSet, resCount, [FileExecute, [Var, dllPath], DropdownGetCount]] ] , dropdown, resCount]
Get Dropdown String
Function to Get a string in a Dropdown
-
- dropdown: the dropdown
- index2: the index2 in the dropdown list
- resStr: the resulting string
[RoutineDef, ZFU_DropdownGet, [VarSet, str, ""] [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown],, [If, [MemGetSize, ZFU_Mem_Temp],, [MemCreate, ZFU_Mem_Temp, 256]] [If, [FileExecute, [Var, dllPath], DropdownGet,, index2, ZFU_Mem_Temp],, [MemReadString, ZFU_Mem_Temp, str] ] [MemDelete, ZFU_Mem_Temp] ] [VarSet, resStr, str] , dropdown, index2, resStr]
Set Dropdown String
Function to Set a string in a Dropdown
-
- dropdown: the dropdown
- index2: the index in the dropdown list
- str: the new string value
[RoutineDef, ZFU_DropdownSet, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown],, [FileExecute, [Var, dllPath], DropdownSet, str, index2] ] , dropdown, index2, str]
Search Dropdown for String
Function to Search for a string in a Dropdown
-
- dropdown: the dropdown
- str: the string to search for
- resIndex: the resulting index (-1 if not found)
[RoutineDef, ZFU_DropdownFind, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown], [VarSet, resIndex, -1] , [VarSet, resIndex, [FileExecute, [Var, dllPath], DropdownFind, str]] ] , dropdown, str, resIndex]
Append Dropdown String
Function to Append a string at the end of a Dropdown
-
- dropdown: the dropdown
- str: the string to add
[RoutineDef, ZFU_DropdownAdd, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown],, [FileExecute, [Var, dllPath], DropdownAdd, str] ] , dropdown, str]
Insert Dropdown String
Function to Insert a string in a Dropdown
-
- dropdown: the dropdown
- index2: the index where to insert the string in the dropdown list (if index2 = list count, then the string is appended at the end)
- str: the string to insert
[RoutineDef, ZFU_DropdownInsert, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown],, [FileExecute, [Var, dllPath], DropdownInsert, str, index2] ] , dropdown, index2, str]
Remove Dropdown String
Function to Remove a string from the Dropdown
-
- dropdown: the dropdown
- index2: the index in the dropdown list
[RoutineDef, ZFU_DropdownRemove, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown],, [FileExecute, [Var, dllPath], DropdownRemove,, index2] ] , dropdown, index2]
Set Selected Dropdown String
Function to Set the selected string in a Dropdown
-
- dropdown: the dropdown
- index2: the index in the dropdown list
[RoutineDef, ZFU_DropdownSelect, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown],, [FileExecute, [Var, dllPath], DropdownSelect,, index2] ] , dropdown, index2]
Get Selected Dropdown String
Function to get the selected string in a Dropdown
-
- dropdown: the dropdown
- resIndex: the resulting index of the selected string in the dropdown list
[RoutineDef, ZFU_DropdownGetSelected, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown], [VarSet, resIndex, -1] , [VarSet, resIndex, [FileExecute, [Var, dllPath], DropdownGetSelected]] ] , dropdown, resIndex]
Show Dropdown
Function to Show/open a Dropdown and let the user selecting one of its strings
-
- dropdown: the dropdown ID
- buttonPath: the path to the button where to open the dropdown
- resIndex: the resulting index of the string selected by the user
[RoutineDef, ZFU_DropdownShow, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown],, [VarSet, resIndex, [FileExecute, [Var, dllPath], DropdownShow, buttonPath]] ] , dropdown, buttonPath, resIndex]