ZBrushCentral

Q: zsphere values

hi

I am trying to obtain values from zspheres but having a bit of trouble:

The below only returns the position of zsphere. I have a hunch that I am not pointing to correct parent or child maybe but not sure. So all the values return -1 or 0 except the position x/y/z. I know -1 means it doesn’t exist. Which is also strange.

[ZSphereEdit,[VarSet,selIndex,[ZSphereGet,8,,]]] [ZSphereEdit,[VarSet,zsX,[ZSphereGet,1,selIndex,]]] [ZSphereEdit,[VarSet,zsY,[ZSphereGet,2,selIndex,]]] [ZSphereEdit,[VarSet,zsZ,[ZSphereGet,3,selIndex,]]] [ZSphereEdit,[VarSet,timeStampCount,[ZSphereGet,12,selIndex]]] [ZSphereEdit,[VarSet,timeStampIndex,[ZSphereGet,13,selIndex]]] [ZSphereEdit,[VarSet,flags,[ZSphereGet,14,selIndex]]] [ZSphereEdit,[VarSet,twistAngle,[ZSphereGet,15,selIndex]]] [ZSphereEdit,[VarSet,membrane,[ZSphereGet,16,selIndex]]] [ZSphereEdit,[VarSet,xRes,[ZSphereGet,17,selIndex]]] [ZSphereEdit,[VarSet,yRes,[ZSphereGet,18,selIndex]]] [ZSphereEdit,[VarSet,zRes,[ZSphereGet,19,selIndex]]]

Thanks for any advice

I’m not sure why you’re getting mixed results but I’m posting code below that works for me. To select a ZSphere, turn on Move mode (W on keyboard) before clicking the ZSphere you want, otherwise you’ll keep adding ZSpheres. Also, you can wrap the [ZSphereEdit] command around a whole bunch of code - simpler than repeating it the whole time.

[IButton,GetInfo,
[If,[ZSphereEdit,0],

[VarSet,currentZS,[ZSphereGet,8]]

[Note,[StrMerge,"

Current ZSphere index : “,[Val,currentZS],”
"],-1]//index

[ZSphereEdit,

[Note,[StrMerge,"xPos : “,[ZSphereGet,1,currentZS],”
"],-1]//xPos float

[Note,[StrMerge,"yPos : “,[ZSphereGet,2,currentZS],”
"],-1]//yPos float

[Note,[StrMerge,"zPos : “,[ZSphereGet,3,currentZS],”
"],-1]//zPos float

[Note,[StrMerge,"radius : “,[ZSphereGet,4,currentZS],”
"],-1]//radius float

[Note,[StrMerge,"color : “,[ZSphereGet,5,currentZS],”
"],-1]//color 0-16777215 long int

[Note,[StrMerge,"mask : “,[ZSphereGet,6,currentZS],”
"],-1]//mask 0-255 int

[Note,[StrMerge,"parent index : “,[ZSphereGet,7,currentZS],”
"],-1]//parent index short int

[Note,[StrMerge,"time stamp : “,[ZSphereGet,9,currentZS],”
"],-1]//time stamp short int

[Note,[StrMerge,"childs count : “,[ZSphereGet,10,currentZS],”
"],-1]//childs count short int

[Note,[StrMerge,"child index : “,[ZSphereGet,11,currentZS],”
"],-1]//child index short int

[Note,[StrMerge,"time stamp count : “,[ZSphereGet,12,currentZS],”
"],-1]//time stamp count short int

[Note,[StrMerge,"time stamp index : “,[ZSphereGet,13,currentZS],”
"],-1]//time stamp index short int

[Note,[StrMerge,"flags : “,[ZSphereGet,14,currentZS],”
"],-1]//flags int

[Note,[StrMerge,"twist angle : “,[ZSphereGet,15,currentZS],”
"],-1]//twist angle float

[Note,[StrMerge,"membrane : “,[ZSphereGet,16,currentZS],”
"],-1]//membrane int

[Note,[StrMerge,"X res : “,[ZSphereGet,17,currentZS],”
"],-1]//X res int

[Note,[StrMerge,"Y res : “,[ZSphereGet,18,currentZS],”
"],-1]//Y res int

[Note,[StrMerge,"Z res : “,[ZSphereGet,19,currentZS],”
"],-1]//Z res int

,0]

[Note,0]

]
]

Edit: your code is returning the correct values. For example, rotate one of the ZSpheres and you will see the Twist Angle change.

Hey Marcus

Thanks for your super help.

My time stamp returned 0 with I assumed was “the” time stamp but it wasn’t (used time stamp count :td:). It seems I am getting the correct values. My way of displaying the values as a group was not as elegant as yours :o
Nifty trick with the notes, is the “-1” to parent it to any notes open in the script session?

Just a few questions regarding these parameters. What is membrane and flags for? I would think that flags is another array you extract from the zsphere with flags or am I on the wrong track?
Membrane I have no idea

Then I am still working through your neuron script example you did but it seems that if I get to position 16 my zspheres cap, they won’t move passed that. Is this a bounding box thing in zbrush or something I am doing (prob me).

Lastly did you manually edit the code to look so perfectly color coded :D… if so wow thanks for the effort!!!

And lastly lastly… thanks again for your time an valued input.