ZBrushCentral

Script suspended without any error shown

I wrote a simple script as following:
1, select one subtool;
2, TPoseMesh it;
3, import aother .obj mesh to the TPoseMesh created in step 2;
4, TPose->SubTool

When I run every step separately, they work fine. But if I put them together and run then fail. In exactly, the script’s suspended after step 2. Could someone explain this to me? I’m very confused now.

Here’s my little script:

[VarDef,SubToolCount,[SubToolGetCount]]
[VarDef,counter,0]
[Loop,1,
[SubToolSelect, counter]
[VarSet, subToolName, [IGetTitle,Tool:Item Info]]
[VarSet, subToolName, [StrExtract,subToolName,0, [StrLength,subToolName]-2]] // trims off end period ‘.’
[IPress, Zplugin:Transpose Master:TPoseMesh]
[SubToolSelect, 0]
[Note, subToolName, , 1]
//[FileNameSetNext, “G:\Project\3D_Project03\UMREAL\Pose\pose03\UHead.obj”]
[FileNameSetNext,[StrMerge,“G:\Project\3D_Project03\UMREAL\Pose\pose03”, subToolName, “.obj”]]
[IPress,Tool:Import]
[IPress, Zplugin:Transpose Master:TPose>SubTool]
//[Note, subToolName, , 1]
[VarSet, counter, (counter+1)]
]

I can’t to test out myself you script, but
a Coma is missing before the loop counter.

[Loop, RepeatCount, Commands group, Optional loop-counter variable
(starts at Zero)]

should be :
[VarDef,SubToolCount,[SubToolGetCount]]
[VarDef,counter,0]
[Loop,1,
[SubToolSelect, counter]
[VarSet, subToolName, [IGetTitle,Tool:Item Info]]
[VarSet, subToolName, [StrExtract,subToolName,0, [StrLength,subToolName]-2]] // trims off end period ‘.’
[IPress, Zplugin:Transpose Master:TPoseMesh]
[SubToolSelect, 0]
[Note, subToolName, , 1]
//[FileNameSetNext, “G:\Project\3D_Project03\UMREAL\Pose\pose03\UHead. obj”]
[FileNameSetNext,[StrMerge,“G:\Project\3D_Project03\UMREAL\Pose\pose 03”, subToolName, “.obj”]]
[IPress,Tool:Import]
[IPress, Zplugin:Transpose Master:TPose>SubTool]
//[Note, subToolName, , 1]
, // loop counter
[VarSet, counter, (counter+1)]
]

thanks for noted, f​:slight_smile:celess. But I tested it again, seems it’s not comma’s reason.

And I executed above steps by hand and recorded then export as txt file. When I check it I found there are many other scripts inside not only TPoseMesh or Import thing. Does it mean one simple command in ZBrush including many other script and shall copy them into my script?

Hi heroineism,

Unfortunately ZBrush only allows one zscript or plugin to be active at a time. This means that if you press a plugin button in your script then control passes to the plugin and your code stops running. There’s no way around this.

Recording a zscript while using a plugin like Transpose Master will record some of the plugin’s workings but not all, as some of the code is executed in a dynamic library, so playing back the recording will not give the same results.

HTH,

Thanks marcus_civis, it’s a bad news for me while it’s still an good explaination to my question. Look forward to next update of ZScript.

BTW, this script is for manually execute GOZ back from Maya to ZBrush. Because sometimes GOZ didn’t work for me with warning as wrong name or missing something, I don’t know why. But if I export transformaed mesh as obj file then import this file and replace TPoseMesh of the corresponding subtool, then execute TPose>SubTool, the reasult is exactly same as GOZ back from Maya. I just wandering why GOZ can’t work with same logic as above.

damn you’re right marcus, it not always make sense to me :slight_smile:

Heroineism you can still split your code into two functions “[RoutineDef/call ]”.

The first function gather data into vars that you save on the disk with varSave

then you finish with the [IPress, Zplugin:Transpose Master:TPoseMesh]

the second function , get the var using VarLoad
then you can apply the you code and finish with [IPress, Zplugin:Transpose Master:TPose>SubTool]

Thanks f​:slight_smile:celess for your suggestion. But my goal is to make a loop of every subtool and to perform TPoseMesh -> Import obj -> TPose>SubT process, automatically. Since once running TPoseMesh plugin will stop my script and the loop either, the script has no meaning anymore.

And I also found, I can’t locate that plugin button “Zplugin:Transpose Master:TPose>SubT”(or TPose>SubTool) in IPress or ButtonPress, I got only error if I perform these command. I don’t know why.

yes you’re right, especially with the Tpose function that can’t to work.

The path of the button you are looking for, if you do a CTRL and the cursor hover the plugin button you can get the path of the it so the “zplugin:Transpose Master:TPoseSubT” in your case.

Yes, I have tried many formats of this path like “Zplugin:Transpose Master:TPoseSubT” or “Zplugin:Transpose Master:TPose>SubT”, but just get an error as following. Totally confused.

124380f08c.png

Hi heroineism,

Normally doing as f​:slight_smile:celess says and holding Ctrl to see the button path will give you the right path but Transpose Master uses a trick to get the arrow in TPose>SubT. ZBrush displays the pipe character ‘|’ as an arrow on the button (but doesn’t display it at all in the button path shown with Ctrl, which is unfortunate). Anyway, the correct path is:
“ZPlugin:Transpose Master:TPose|SubT”

HTH,

Thanks marcus, that’s really tricky…

And I just found I don’t need TransPoseMaster anymore, all I need to do is to import obj into the lowest level of the subtool and make a loop for each subtool. It’s quite simple than I thought.

I’ve been having some similar trouble in regards to pressing UI buttons belonging to transpose master, it seems that from what i read in this thread there is no way to control transpose master??? I have a pre assembled zsphere rig and I just wanted to automise the following process:

  • having to import the rig
  • clicking on “storeTM rig”
  • switching to my character subtool
  • clicking on “PasteTM rig”
  • clicking on “TPoseMesh”
  • clicking on “TPose|SubT”

Is there no way of achieving this?

No, you can’t do that using zscript. It’s not possible to control a plugin using zscript because only one plugin/macro/zscript can be active at a time. The moment your script presses a plugin button control passes to the plugin and the rest of you script will not run.