1. #1
    New Member Follow User Gallery
    Join Date
    Mar 2015
    Posts
    10

    Default How to start writing a plugin for ZBrush (e.g. in C++)?

    Hi everyone,

    I was wondering how to start when I want to write a plugin for C++. I can't find any documentation, except for the ZScript language.

    But when you want to write something like the Decimation Master plugin, where do I start?

    And maybe, does someone have an example script project setup to share? That would help a quick start.

    Thanks!
    Fernando

  2. #2

  3. #3
    New Member Follow User Gallery
    Join Date
    Mar 2015
    Posts
    10

    Default

    Thank you Doug, that is a great start.

    One thing I would like to do is bypass certain ZBrush messages that stop an ZScript.

    For example when you click 'merge down' in the Sub Tool, a message will appear that can only be bypassed manually.

    Do you think I can program around such a message using a C++ plugin?

  4. #4
    Senior Member Follow User Gallery
    Join Date
    Aug 2011
    Location
    Mebane, NC
    Posts
    4,194

    Default

    Rather not venture a guess, that's what it would be.
    You have found the Command Reference more than likely. http://docs.pixologic.com/user-guide...ference/#Index
    You can also Export the Commands from within ZBrush(some of the online docs are not up to date yet )

  5. #5
    Senior Member Follow User Gallery
    Join Date
    May 2007
    Location
    Bellevue,WA
    Posts
    500

    Default

    I don't think you can bypass those messages with a dll ... I guess you could make a plugin that exports the subtools as obj for example, merge them and reimport them but that would be slow and not really efficient ... And all that just to save you one click ...
    For the merge down message , The user might have to press "always yes" only once, one time in the whole zb session and that would be it...
    __________________________________________________

    My GumRoad

    ZTree
    Terrain Tools (OS X)
    Terrain Tools (Win x64)

  6. #6
    Senior Member Follow User Gallery
    Join Date
    Jul 2002
    Location
    Copenhagen
    Age
    45
    Posts
    2,561

    Default

    If you are creating a user zplugin then, as Dargelos mentioned, it would be best to require the user to press "always yes". There is no reliable solution to using an external library to dismiss the note window based messages ZBrush displays, AFAIK.

    However, if you are creating a zplugin as part of an automation process that runs on a headless machine (i.e no user interaction at all), you might be able to duct tape a solution together.

    The solution requires that you can reliably determine where the zbrush message appears when Merge Down is pressed. If you can determine that then you can deduct where the OK button is located on the screen. Then you would create a dll that calls a function simulating a mouse click, at a specific position (the OK button) after a short time interval. The interval is required as we want the the external library to return control to zbrush so that our zplugin can press the Merge Down button.

    That should do it, in theory. The problem lies in the varying positions of the Merge Down message which can only reliably be determined when there is no user interaction at all.
    Mark

  7. #7
    Senior Member Follow User Gallery
    Join Date
    Aug 2011
    Location
    Mebane, NC
    Posts
    4,194

    Default

    Mmmm, duct tape. LOL Not the strongest though.

  8. #8
    New Member Follow User Gallery
    Join Date
    Mar 2015
    Posts
    10

    Default

    Thank you all for the feedback, that makes it really clear.

    I also read somewhere that you can't change processes as expected, only extend them.

    It's as though Pixologic wouldn't want anyone to perfectly fit ZBrush into their pipeline.

    Today all large and small 3D packages have an SDK or API of some sort.

    I really don't understand why Pixologic doesn't add this to their product, since ZBrush is the standard in so many ways and so many companies rely on it. ZScripting is very rich, but also limited in some ways.

    By the way, has anyone succesfully connected to a MySQL database from within ZBrush?

  9. #9
    Senior Member Follow User Gallery
    Join Date
    Jul 2002
    Location
    Copenhagen
    Age
    45
    Posts
    2,561

    Default

    Zscripting's foundation is pretty old now but it does allow you to accomplish most things, even if they sometimes must be done in roundabout ways.

    Although I have grown fond of the zscripting idiosyncrasies and enjoy writing scripts, much in the same way some people enjoy putting on full body latex suits and whipping each other, I would welcome a change. All that latex gives me a rash An SDK would be nice but a slightly lower level scripting API would be just as good.

    Just a thought on the note interface that the merge down button seems to use. If Pixologic could rearrange the OK and Cancel button, not in the note interface but in code, we could solve this particular problem in a reliable fashion. The first [NoteButton,...] you add to a note interface is the one you can trigger by pressing the spacebar or the return key. Then you would simply write [IKeyPress, 13, [IPress, "Tool:Sub Tool:MergeDown"]] where 13 is the ascii value for the return key. Right now we are triggering the Cancel button.

    In regards to connecting to a MySQL database I have not tried it but cannot see a reason why it would not work. Just keep in mind that you would need to write an external library to connect and any communication with ZBrush would be through a memory block your zscript supplies.
    Mark

  10. #10
    New Member Follow User Gallery
    Join Date
    Mar 2015
    Posts
    10

    Default

    Hi Mark,

    Thank you for your thoughts, I agree. I'll contact Pixologic and discuss with them other options, the default button arrangement so we could press them with a ZScript.

    I hope to hear that they have planned some kind of SDK/API solution...

  11. #11
    New Member Follow User Gallery
    Join Date
    Mar 2017
    Posts
    1

    Default Fix Note Interface dialogs!

    I've been trying to export displacement and normal maps on a render farm, but the Note Interface dialogs that appear when splitting polygroups is a huge blocker. Because we have no way to programmatically control the Note Interface when they pop up, I found it impossible to automate anything on the farm.
    We're dropping support for ZBrush in our pipeline because of this -- our attempts have been fruitless.

    @ZBrush: PLEASE FIX THIS MAJOR FLAW.

    Thanks,
    -dv

  12. #12
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    Quote Originally Posted by danvas
    Fix Note Interface dialogs!

    I've been trying to export displacement and normal maps on a render farm, but the Note Interface dialogs that appear when splitting polygroups is a huge blocker. Because we have no way to programmatically control the Note Interface when they pop up, I found it impossible to automate anything on the farm.
    We're dropping support for ZBrush in our pipeline because of this -- our attempts have been fruitless.

    @ZBrush: PLEASE FIX THIS MAJOR FLAW.
    You're not the first to ask for this - hopefully in 4R8.

  13. #13
    New Member Follow User Gallery
    Join Date
    Jun 2016
    Posts
    1

    Default Thank you very much!

    Thank you very much! I'm learning this stuff, and I need this stuff.

  14. #14
    New Member Follow User Gallery
    Join Date
    Mar 2004
    Posts
    7

    Default OFFER MY SUPPORT to build a SDK/API

    I'm waiting for a SDK/API solution for 14 years and was hoping the 2018 update would bring this.
    We are moving fast to procedural geometry, animations, texturing etc and I fear Pixologic doesn't understand, what a big impact this feature could have for ZBrush.

    I'm a developer specialized in procedural generation and hereby like to OFFER MY SUPPORT to build a user-friendly layer using C++ or Python which can model meshes without GUI interaction.

    Have a look at Blender Python, any WebGL sandbox/playground (eg babylon.js, shadertoy) to see how fun it is to automate complexity with a few lines of code and see the results immediately.

  15. #15
    New Member Follow User Gallery
    Join Date
    Mar 2004
    Posts
    7

    Default modern scripting in ZBrush

    I'm bumping this to see if there are any news about modern scripting in ZBrush with a real programming language like python.
    Are there any rumours?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •