So I answer to my own initial question about how to identify the type of a ui item based on his path in Zbrush ui.
so we will hard code the list of Switches button, no need for io stream and read file etc… it gonna be faster that way.
here is a switch.h file with few item path which all are of type switch .
const char * switches[] =
{
"tool:geometry:smt", "tool:subtool:polygrp","tool:subtool:geometry", "tool:subtool:color", "tool:subtool:farthest",
"tool:subtool:outer", "tool:subtool:inner", "tool:subtool:double", "tool:subtool:tcorner",
"tool:subtool:tborder", "tool:geometry:suv"
}
and the code of the function in main.cpp
ZBRUSH_API float IsSwitchType(char* pStrValue, double optValue, char* pOptBuffer1, int optBuffer1Size,
char* pOptBuffer2, int optBuffer2Size, char** zData)
{
if (isdigit(*pStrValue))
return 0.0f;
int i = 0;
int s = (sizeof switches / sizeof switches[0]) - 1;
for (i = 0; i <=s; i++)
{
if (strcmp(switches[i], pStrValue) == 0)
return 1.0f;
}
return 0.0f;
}
zscript :
[VarSet, ERROR, -1]
[VarSet, ERROR, [FileExecute,[Var,dllName], "IsSwitchType", buttonPath]]
[If, ERROR < 0,
[Note,"An error has occured"]
[Exit]
,// else
[If, ERROR == 1,
[Note, [StrMerge, buttonPath, " is a switch item."]]
,// else
[If, ERROR == 0,
[Note, [StrMerge, buttonPath, " is not a switch item."]]
]
]
]
hope it helps!
Nicolas