ZBrushCentral

Set subtool name

I’m trying to figure out the syntax to rename a subtool. I guess you have to loop over the current subtools to get i’s index before you can access it’s existing name. And The re-naming part is what I’m stuck on.

// Define a string
[VarDef, s, “Gwen Stefani!”] // Why aren’t all your subtools named after pop stars?
[VarDef, subTName, “”]

[VarSet, activeSubT,[SubToolGetActiveIndex]]

[VarSet,totalSubTools,[SubToolGetCount]]

[Loop,totalSubTools,

[SubToolSelect,[Val,i]] //selects the subtool by number

[VarSet,subTName,[IGetTitle,Tool:ItemInfo]] //gets the tool name

[If, i == activeSubT,

// Rename subtool???

// [IPress,Tool:SubTool:Rename, s] // doesn’t work
[Set: Subtool.Name, s] // I have no idea I’m lost without dot notation

]

,i]

There’s no ‘official’ way to rename a subtool but there’s a hack. You create a file name with a ‘.dat’ extension and then import it. The file doesn’t need to exist.

In your code you get the current subtool name. You don’t need it in this instance but if you did you need to take off the end period that is in the name as it appears in the Item Info slider. I’ve added that in the code below:

// Define a string
[VarDef, s, “Gwen Stefani!”] // Why aren’t all your subtools named after pop stars?
[VarDef, subTName, “”]

[VarSet, activeSubT,[SubToolGetActiveIndex]]

[VarSet,totalSubTools,[SubToolGetCount]]

[Loop,totalSubTools,
[SubToolSelect,[Val,i]] //selects the subtool by number
[VarSet,subTName,[IGetTitle,Tool:ItemInfo]] //gets the tool name
[VarSet,subTName,[StrExtract,subTName,0,[StrLength,subTName]-2]]//this takes of the end period

[If, i == activeSubT,
[VarSet,newName,[StrMerge,[Var,s],".dat"]]//create a file name with .dat extension
[FileNameSetNext,newName]
[IPress,Tool:Import]//import the file - though it doesn’t exist!
]
,i]

Thanks… I think. That’s a bit hacky :frowning:

I was expecting to pass a string to

[IPress,Tool:SubTool:Rename]

at least

Well, it’s a hack that’s been in use a long time. And I can’t give you methods that don’t exist.

I’ve requested it to be added at a future date.
“I’ve added this to our development tracker. I’ll make sure to bring this up with the rest of the development team.”