Making a Tool for Zbrush

Hey,

I’ve been trying to create a tool that will select all polys in Zbrush over/under a certain size. Does anyone have any idea how I would go around doing this? I’ve written simular tools in python for maya but I don’t even know where I would start for Zbrush and would appreciate any help!

Thanks,
Emma.

The ZScript language is pretty crude but it does have some of what you’d need. If you can repro your steps manually with the script recorder (under the ‘Zscript’ menu) on you’ll be able to see the relevant command.

Unfortunately there’s no easy api for inspecting faces – the Mesh3DGet command will give you some info about the currently selected tool, but I think it’s limited to global info (ie, vert count) rather than specifics about a particular vertex or face.

If you write a C++ plugin, the api passes a pointer-to-pointer for a block of bytes in memory; I’m not sure what that’s for (it’s not documented, AFAICT) – it might be a pointer to the current image (which would not be useful) but it might be a pointer to active tool, I’m not sure. The signature of an external method looks like this, where the char* arguments pointers to 255-byte blocks (of characters). Like I said, the char ** Zdata argument isn’t documented but it isn’t passed, maybe you could deduce it you had a simple tool like a cube active.

float DLL_EXPORT ExternalCommand(char* SomeText, double OptionalDouble, char* SomeMoreText, int SomeMoreTextSize, char* ReturnBuffer, int ReturnBufferSize, char** zData);

1 Like

Incidentally this seems like a good place to mention this:

It’s almost functional, though I would highly recommend not assuming you can just pick it up and run with it! I’d love more collaborators, both users and co-authors.

1 Like