1. #1
    New Member Follow User Gallery
    Join Date
    Jan 2014
    Posts
    6

    Post Headless ZRemesher Automation?

    Hi Everyone,

    Is there a way to create a headless automation that imports an obj into zbrush then calls zremesher to retopo it with some settings and export that obj back out?

    Any help would be really appreciated.

    Thanks!

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

    Default

    That would be straightforward to do in zscript I think, assuming you'd run the script from within ZBrush. Would you want to select a number of files to process?

  3. #3
    New Member Follow User Gallery
    Join Date
    Jan 2014
    Posts
    6

    Default ABNORMAL TERMINATION when loading ZScript

    Hi Marcus,

    Thanks for the reply sorry its been a while. I was able to create the ZScript from recording the commands as a txt file. I wrapped it in [If,1, code ] to run only once. This works well on my windows7 version of ZB 4R7 P3 however in windows10 same version it does an "Abnormal Termination" almost everytime. Any ideas on why this is getting hung up?

    Here is the script I am using

    [If,1,
    [IPress, HIDE]
    [IUnPress,Preferences:Lightbox:Open At Launch]
    [FileNameSetNext,"C:\Users\Username\Documents\Expor ts\meshToZremesher.obj"][IPress,Tool:Import]
    [IPress,Transform: Edit]
    [IPress,Transform:Fit]
    [IPress,Tool:Geometry:WeldPoints]
    [IPress,Transform:Activate Symmetry]
    [IPress,Transform:>X<]
    [IPress,Transform:>M<]
    [ISet,Tool:Geometry:Target Polygons Count,1.2]
    [ISet,Tool:Geometry:AdaptiveSize,50]
    [ISet,Tool:Geometry:AdaptiveSize,39]
    [FileNameSetNext,"C:\Users\Public\Documents/ZBrushData/Temp/objIn.goz"][IPress,Tool:Geometry:ZRemesher]
    [FileNameSetNext,"C:\Users\Username\Documents\Expor ts\zremesherMesh.obj"][FileNameSetNext,"C:\Users\Username\Documents\Expor ts\zremesherMesh.obj"][IPress,Tool:Export]
    [IKeyPress,78,[IPress,CLOSE]]
    ]/*End of ZScript*

    Thanks for your help

  4. #4
    Senior Member Follow User Gallery
    Join Date
    Feb 2015
    Location
    Paris
    Posts
    263

    Default

    1. not sure what "[if, 1,... " involve here really, i can't to help

    2. [ISet,Tool:Geometry:Target Polygons Count,1.2]

    you must to protect string that content white space
    this is correct but it's probably more a detail

    [ISet,"Tool:Geometry:Target Polygons Count",1.2]

    4. the last comment is missing the /, is that normal ?

    5. adaptive Size and fileNameSetNext is set two times

    6. Remesher use the goz format, and treat the file into a special dynamic library before to reimport the mesh into Zbrush

    So here my guess is that you need the path of the goz file after the remersher process, which should be that :

    [FileNameSetNext,"C:/Users/Public/Documents/ZBrushData/Temp/objOut.goz"]
    [IPress,Tool:Export]

    7. [Ipress close] followed by [ikeypress,78] even with 75 doesn't close Zbrush.
    Plugins & Toolsets for Zbrush 4R8 : zCycler Pro | Plugin Manager |Matiere 3d | Twitter | @Facelessmindz

  5. #5
    Senior Member Follow User Gallery
    Join Date
    Feb 2015
    Location
    Paris
    Posts
    263

    Default

    this works
    //ZBRUSH MACRO - Recorded in ZBrush version 4.73
    [IButton,???,"Press to run this macro. Macros can be aborted by pressing the ëescí key.",
    [IShowActions,0]
    [IConfig,4.73]
    [IUnPress,Preferences:Lightbox:Open At Launch]
    [FileNameSetNext,"C:\Users\Public\Documents/ZBrushData/Temp/polystarmesh.obj"][IPress,Tool:Import]
    [IPress,Transform: Edit]
    [IPress,Transform:Fit]
    [IPress,Tool:Geometry:WeldPoints]
    [IPress,Transform:Activate Symmetry]
    [IPress,Transform:>X<]
    [IPress,Transform:>M<]
    [ISet,Tool:Geometry:Target Polygons Count,1.2]
    [ISet,Tool:Geometry:AdaptiveSize,39]

    [IPress,Tool:Geometry:ZRemesher]

    [FileNameSetNext,"C:/Users/Public/Documents/ZBrushData/Temp/objOut.goz"]
    [IPress,Tool:Import]

    //export
    [FileNameSetNext,"C:\Users\Public\Documents/ZBrushData/Temp/polystarmesh2.obj"]
    [IPress,Tool:Export]

    ]

    Plugins & Toolsets for Zbrush 4R8 : zCycler Pro | Plugin Manager |Matiere 3d | Twitter | @Facelessmindz

  6. #6
    New Member Follow User Gallery
    Join Date
    Jan 2014
    Posts
    6

    Default

    Hi faceless

    thanks for the feedback, Im going to give this a try. The reason I was using the [if,1 code] was from this reference from Marcus

    http://www.zbrushcentral.com/showthr...p-from-a-C-app

    thats supposed to only let the script run once, I am not using a button I am instead launching zbrush from outside ZB and executing that zscript, thats why I needed it to run only once

  7. #7
    New Member Follow User Gallery
    Join Date
    Jan 2014
    Posts
    6

    Default Abnormal Termination Crash

    [If,1,
    [IShowActions,0]
    [IConfig,4.73]
    [IUnPress,Preferences:Lightbox:Open At Launch]
    [FileNameSetNext,"C:\Users\username\Documents\Worki ngFolder\meshToTest.obj"][IPress,Tool:Import]
    [IPress,Transform: Edit]
    [IPress,Transform:Fit]
    [IPress,Tool:Geometry:WeldPoints]
    [IPress,Transform:Activate Symmetry]
    [IPress,Transform:>X<]
    [IPress,Transform:>M<]
    [ISet,Tool:Geometry:Target Polygons Count,1.2]
    [ISet,Tool:Geometry:AdaptiveSize,39]
    [IPress,Tool:Geometry:ZRemesher]
    [FileNameSetNext,"C:/Users/Public/Documents/ZBrushData/Temp/objOut.goz"][IPress,Tool:Import]
    [FileNameSetNext,"C:\Users\Public\Documents/ZBrushData/Temp/polystarmesh2.obj"][IPress,Tool:Export]
    ]

    this is still doing Abnormal Termination on Windows10 machine. I took the code you provided and wrapped it in the [if,1, that Marcus had posted in a previous post. I need that since I am running this headless outside of zbrush and need the script to load and run only once per. Also the [IKeyPress,78,[IPress,CLOSE]] closes ZBrush everytime on my Windows 7 Machine with no problem.

    Any ideas? Thanks

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

    Default

    I've no idea why this should crash Windows 10 but you could try commenting out code until you isolate the crash. Also, you don't need to import the file from ZRemesher - it will do it automatically. I'd also change the file paths so there are only backslashes:

    [If,1,
    [IConfig,4.73]
    [IUnPress,Preferences:Lightbox:Open At Launch]
    [FileNameSetNext,"C:\Users\username\Documents\Worki ngFolder\meshToTest.obj"][IPress,Tool:Import]
    [IPress,Transform: Edit]
    [IPress,Transform:Fit]
    [IPress,Tool:Geometry:WeldPoints]
    [IPress,Transform:Activate Symmetry]
    [IPress,Transform:>X<]
    [IPress,Transform:>M<]
    [ISet,Tool:Geometry:Target Polygons Count,1.2]
    [ISet,Tool:Geometry:AdaptiveSize,39]
    [IPress,Tool:Geometry:ZRemesher]
    [FileNameSetNext,"C:\Users\Public\Documents\ZBrushD ata\Temp\polystarmesh2.obj"][IPress,Tool:Export]
    ]

  9. #9
    New Member Follow User Gallery
    Join Date
    Jan 2014
    Posts
    6

    Default

    Hi Marcus,

    Thanks for the info, I will give this a spin, also how would I change the file paths to contain backslashes only and specify the file name? Or do you mean in the earlier post from the thread where there was front and back slashes (\Public\Documents/ZBrushData/)? sorry if this is a stupid question I just want to make sure.
    Thanks!
    Last edited by elquixote; 05-20-16 at 04:15 PM. Reason: added text example

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

    Default

    Yes, I just meant that if you're hard-coding the paths to not have a mix of forward slashes and backslashes. ZBrush normally doesn't mind but I've no idea if Win 10 behaves differently.

  11. #11
    New Member Follow User Gallery
    Join Date
    Jan 2014
    Posts
    6

    Default

    ok great thank you very much for the info, seems to work right now.

  12. #12
    New Member Follow User Gallery
    Join Date
    Feb 2016
    Posts
    18

    Default

    I_m trying to make the code working in ZBr8 if anyone is interest or have any suggestion it will be great to share thoughts about that.
    G

  13. #13
    New Member Follow User Gallery
    Join Date
    Feb 2016
    Posts
    18

    Default

    The key seems in the script batch_process_script_02, but it need to be ported for R8, so I guess I need to wait a bit more

Tags for this Thread

Posting Permissions

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