ZBrushCentral

Weard ZTool reading error on Mac

Hi, I have strange read errors on the Mac, when I try to read in a .ztl I saved.
I made a test script to see what was the problem. I have to say, this works on PC, I have both Mac and PC for debugging scripts and programs.

[IButton, “Zplugin:Savetest Plugin:TestButton”
,“Test button”
,// Commands
[FileNameSetNext, “/Users/Shared/ZBrushData2021/3dcwProjects/Testing/Testing_001.ztl”]
[IPress,Tool:Save As]

// Things I need to do where I need the saving and loading for.
// Until here everything runs OK, it starts with loading it back!

[FileNameSetNext, “/Users/Shared/ZBrushData2021/3dcwProjects/Testing/Testing_001.ztl”]
[IPress,Tool:Load Tool]
,0
,1
]

Now the path exist, and there is read and write permission. Actually the saving is done perfectly. But when It reads back I get these errors.

Schermafbeelding 2020-11-05 om 15.19.06

Schermafbeelding 2020-11-05 om 15.21.53

Why is the reading not working, while it uses exact the same path and filename?

Thank you for the help
David

Well I figured something out!

When I write the ZTL file, the path is used like supposed. But when you read a .ztl ZBrush has very strange behavior on a mac. It adds /Applications/ZBrush 2021/ to the path.

Why? I have absolutely no idea?

But one thing on a Mac ZBrush is always at /Applications/ZBrush 2021/ so for my plugin, I make use of that and do my reading and writing there. And that is working.

David

If you are hard-coding a path for ZBrush on MacOs then you need to make sure there is a “!:” [exclamation mark followed by colon] at the start of the path. For some reason ZBrush needs this. Alternatively, use [FileNameResolvePath] for the path and that should do it.

As a side note, the “!:” will need to be removed if passing the path from zscript to a dynamic library. This can be done using [StrExtract]:

[VarSet,filePath,[StrExtract,filePath,2,256]]

HTH,
Marcus

1 Like