zScript fbx exporting

I’ve started to dig into automating some of our pipeline with zBrush, and I am wondering if there is any documentation on the FBXExportDll? I can get the EXPORTS with Visual Studios Dumpbin app, but this doesnt give me the signatures of the exposed functions. I’m pretty new to zBrush land so maybe I am missing the simple help file?

Other folks must be automating export processes? Or is everyone just using GoZ which unfortunately doesn’t work for our requirements.

For posterity sake here are the exposed methods for the .dll. I can get Version to report back

[IButton, "Version Info", "Get the version info for the FBXExporter",
    [Note, [FileExecute,[Var, fbx_dll_path],Version]]
]

However ‘ExportFBX’ with a passed in file path crashes zBrush.

  1    0 00027220 AddDefaultCamera
  2    1 000271A0 AddShape
  3    2 0002A940 CheckName
  4    3 0002A980 ClearNameSet
  5    4 0002A820 CloseFolder
  6    5 00026EB0 CountFiles
  7    6 00027B20 CreateCamera
  8    7 00026DD0 CreateFolder
  9    8 00027150 CreateMesh
 10    9 00027F80 CreateScene
 11    A 00027FA0 DestroyScene
 12    B 0002A8E0 EmptyFolder
 13    C 000280A0 ExportFBX
 14    D 00028230 FileDelete
 15    E 0002A880 FileRename
 16    F 0002A7C0 GetFile
 17   10 00027070 GetMesh
 18   11 00026CA0 GetPublicFolder
 19   12 000273B0 GetZBrushCamera
 20   13 00028140 ImportExport
 21   14 00028180 ImportExportFBX
 22   15 00027FC0 ImportOBJ
 23   16 00026F90 ListFiles
 24   17 0002A790 OpenFolder
 25   18 000281C0 PLYExport
 26   19 000281F0 PLYImport
 27   1A 00028090 SetAxisFormat
 28   1B 00028030 SetCreaseAngle
 29   1C 00028050 SetEmbed
 30   1D 000280E0 SetImportOptions
 31   1E 00028010 SetNormals
 32   1F 000270F0 SetTexturePath
 33   20 00028070 SetTris
 34   21 00027770 SetZBrushCamera
 35   22 00028310 SplitOBJ
 36   23 0002A770 SwapVertices_GoZ
 37   24 00028210 TGAImport
 38   25 00026C90 Version
 39   26 00029E60 saveAsJpeg
 40   27 00029E40 saveAsTarga
 41   28 00029EA0 truncImageRefDAE

The public interface of FileExecute is pretty limited (a couple of 255-char string buffers and a float, or something like that) so unless you got lucky it might not do what you need.

OTOH if you’re comfortable will C / C++ you can write your own dll that handles the work and is accessible from ZScript with that narrower interface --you can make a function with this signature and do anything you want inside:

float DLL_EXPORT ExternalCommand(char* CommandNameBuffer, double optValue, char* ArgBuffer, int ArgBufferSize,
	char* ReturnBuffer, int ReturnBufferSize, char** zData)
{	
    /// your code here;
}

Then call that from ZScript. I don’t know however how to introspect that *zData pointer, I’ve never found documentation on what that looks like.

It might be easier to simple export OBJ and the reprocess that outside of Zbrush using the FBX SDK – that could be written in python using a filewatcher or maybe called explicitly using http://docs.pixologic.com/user-guide/customizing-zbrush/zscripting/zfileutils/

1 Like

Yeah I found the discussion around the DLL hacking. I could go that route, but I may double back on what the specific requirements are with the team before I open up the custom dll rabbit hole.

Was hoping zBrush wasn’t the oddly ui’d black box it appeared to be on first glance :slight_smile:

Was hoping zBrush wasn’t the oddly ui’d black box it appeared to be on first glance

That’s my opinion in a nutshell, alas. However an OBJ->FBX conversion in the background without user intervention, while not trivial, is totally doable; it’s what I do, in fact. There might be efficiencies or detail things I’m missing but it seems like a reasonable balance of expenditure and results for static meshes. Have not tried anything like snapshotted animations, however, that would change the equation

Thanks Steve! I got better clarification on requirements, and it opened up a few more avenues of exploration.