ZBrushCentral

Is it possible to get subtool positional information into a text file using Zscript?

I am trying to export the world space transformation, position, scale and rotation information of my subtool to a text file using zscipt but I have not had any luck. I expect to get numbers but I get something that looks more like binary data.

Here’s the commands in my zcsript:

[VarDef,DD_ZData, 9]
[TransformGet, DD_ZData]
[VarSave, DD_ZData,“C:\Program Files (x86)\Pixologic\ZBrush 4R7 FL\ZScripts\MyZData.txt”]
[IPress,Tool:SubTool:SelectDown]
]/End of ZScript/

I also tried creating variables for all the position, scale and rotation and print that but no luck there either.
[VarDef,xPos,0]
[VarDef,yPos,0]
[VarDef,zPos,0]
[VarDef,xSc,0]
[VarDef,ySc,0]
[VarDef,zSc,0]
[VarDef,xRot,0]
[VarDef,yRot,0]
[VarDef,zRot,0]
[TransformGet, xPos, yPos, zPos, xSc, ySc, zSc, xRot, yRot, zRot]

Please let me know what you think/suggest.
Thanks,
BullFrog

Hi,

TransformGet/TransformSet and MTransformGet/MTransformSet relate to the on screen 2.5D coordinate system, not to polygonal transformations. The commands were used before we had subtools to place a tool, either 3D, 2D or 2.5D, on the 2.5D canvas. Or put another way, when you change the transform with TransformSet you are changing the transform of all subtools in relation to the 2.5D canvas. Transform changes with the above commands do not affect the vertices, should you export.

When you use [VarSave] it saves in a binary format that ZBrush uses for saving variables (typically with a .zvr extension). You would need to write the values as strings to a memory block using [MemWriteString] and then save the memory block to a file to get text output.

As TVeyes has said, the [TransformGet] command only gets the values as they relate to the ZBrush canvas, not the world space position of the model as it might be on export. You may be able to use the values in the Tool>Geometry>Position and Size sections, together with the Tool>Export Scale/Offset values, depending on what you are trying to do.

Thanks for the responses this is very helpful. I am new to zscripting and have a lot to learn.
I’ll give this a try and let you know if I have any questions. Basically I am attempting to convert my nanomesh instances to subtools and then export their positional data to a text file to then reproduce the nanomesh instancing into Maya. Hopefully in the future ZBrush will be able to export the nanomesh instancing via FBX.
BTW I am trying to convert my zscripts to zplugins but I haven’t been able to successfully create a zplugin yet. I imagine it’s a matter of saving the zplugin.txt file to the proper location/s. Not sure though. Looking through the online documentation I am not finding specific instructions on how to do properly install/convert a zplugin, even with the sample zscripts and zplugins provided. Do have any tips and/or suggestions on where I might find any tutorials or instructions on this subject?
-BullFrog

The code you need to create a plugin is explained here:
http://docs.pixologic.com/user-guide/customizing-zbrush/zscripting/interfaces/zplugin-interface/

Apart from that, all you need to do is put the ZSC file (that ZBrush automatically creates when you load a ZScript text file) in the ZBrush 4R7/ZStartup/ZPlugs folder (for 32bit ZBrush) and also in the ZBrush 4R7/ZStartup/ZPlugs64 (for 64bit). ZBrush will then load the plugin at startup.

I appreciate the response
I tried importing the zplugin text example provided on the webpage and then placing that into the zplugin folder as instructed but ZBrush just hanged upon reopening and I had to kill it remove the zplugin from the folder and then it opens ok without it. Not sure what the deal is there but I’ll just keep working on the zscript in the meantime. So I guess there isn’t a way to get the rotation values?
Thanks again for your help.
BullFrog

I don’t know why you had problems with the sample plugin code. I just tested it and it works fine. Post the code you used here and I’ll check it if you’d like me to.

Rotation values for subtools don’t exist as far as ZBrush is concerned, and each subtool is assumed to be upright and facing forward (X, Y & Z rotation all at zero).