ZBrushCentral

Renaming a tool

The question is quite simple. Is it possible to rename a tool through maxscript?

I found this post over here:
http://www.zbrushcentral.com/showthread.php?t=20995&highlight=rename+tool

which requires you to save the tool in order to be able to rename it. Is there any other way? or some sort of workaround you can think of?

Thanks a lot!

There’s no way through zscript. What are you wanting to do? - renaming may be unnecessary.

P.S. What’s ‘maxscript’ ? I think you must have the wrong forum… :wink:

oh god lol, my fault… I’m used to maxscript (for 3dsMax) haha,
well, basically I’m importing an obj so that it replaces the current subdivision of the current tool. Problem is, the obj has a different name than the tool, and I would like to preserve the tools name. :confused:

You could do this:

  1. Copy the OBJ file with a new name to your script’s Data folder.
  2. Import the OBJ copied at (1), which will have the same name as the ztool.
  3. Delete the OBJ copy file.

You’ll need to use the ZFileUtils DLL functions ‘Copy File’ and ‘Delete File’. You can read about the functions and download the DLL here: http://www.pixologic.com/docs/index.php?title=ZScript_FileUtils#Files_and_Directories

HTH,

oh! cool thanks! :smiley:

I forgot to mention that you need to pass the full path for a file to the DLL. You can find the full path from a local path by using the [FileNameResolvePath] zscript command. In this code snippet the zscript would be directly outside the ‘MyZScriptDat’ folder:

[VarSet,fileName,“MyZScriptData\Test.OBJ”]
[VarSet,fullPath,[FileNameResolvePath,fileName]]

This is important because you can’t be sure of where your users will have ZBrush or your script installed. Not everyone has stuff installed on a ‘C’ drive.

You can also use a special form of local path for ZBrush folders:

ZBRUSH_ZStartup
ZBRUSH_ZTools

so that, for example, this code:

[VarSet,fileName,[FileNameResolvePath,“ZBRUSH_ZScript\DefaultZScript.txt”]]

will give you the full path of the default zscript.

HTH,

hey! Just hat time to tackle this problem and I came up with a somewhat different solution. Just thought I’d share it here.

In my case I have now 3dsmax export the selected objecto a obj file. This file could be called Teapot01.obj, Sphere.obj, or whatever name the selected object in 3dsmax had.

So I have made 3dsmax export also an obj_name.txt
(That txt file has always the same name)
In it, though, I have the name of the object, which will tell zbrush what obj it has to look for.

[MemDelete, gomaxObjNameTxt]
(This string deletes the memory block, just in case it already exists in memory, you never know)

[VarDef, GomaxObjName, " "]
(This is creates the variable GomaxObjName, wich we will later on use to archive the string that we got from the txt file)

[MemCreateFromFile, gomaxObjNameTxt, “ZBRUSH_ZStartup\ZPlugs\GoMax\Import\obj_name.txt”]
(Creating the actual memory block from the txt file and giving it the name "gomaxObjNameTxt)

[MemReadString, gomaxObjNameTxt, GomaxObjName, 0, 1]
(I’m reading the string, which starts at 0, and I’m assigning it to GomaxObjName, which we created before. The “1” at the end means it reads until the line breaks)

[FileNameSetNext,[StrMerge,“ZBRUSH_ZStartup\ZPlugs\GoMax\Import”,GomaxObjName,".OBJ"]][IPress,Tool:Import]
(Finally I’m importing the obj, and I’m using "GomaxObjName variable instead of a fixed name)

[MemDelete, gomaxObjNameTxt]

(I’m deleting the memory block, since I don’t need it anymore)