1. #1
    Senior Member Follow User Gallery
    Join Date
    Jun 2011
    Location
    Cape Town
    Posts
    158

    Default 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

  2. #2
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    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,"\n\nCurrent ZSphere index : ",[Val,currentZS],"\n"],,-1]//index
    [ZSphereEdit,
    [Note,[StrMerge,"xPos : ",[ZSphereGet,1,currentZS],"\n"],,-1]//xPos float
    [Note,[StrMerge,"yPos : ",[ZSphereGet,2,currentZS],"\n"],,-1]//yPos float
    [Note,[StrMerge,"zPos : ",[ZSphereGet,3,currentZS],"\n"],,-1]//zPos float
    [Note,[StrMerge,"radius : ",[ZSphereGet,4,currentZS],"\n"],,-1]//radius float
    [Note,[StrMerge,"color : ",[ZSphereGet,5,currentZS],"\n"],,-1]//color 0-16777215 long int
    [Note,[StrMerge,"mask : ",[ZSphereGet,6,currentZS],"\n"],,-1]//mask 0-255 int
    [Note,[StrMerge,"parent index : ",[ZSphereGet,7,currentZS],"\n"],,-1]//parent index short int
    [Note,[StrMerge,"time stamp : ",[ZSphereGet,9,currentZS],"\n"],,-1]//time stamp short int
    [Note,[StrMerge,"childs count : ",[ZSphereGet,10,currentZS],"\n"],,-1]//childs count short int
    [Note,[StrMerge,"child index : ",[ZSphereGet,11,currentZS],"\n"],,-1]//child index short int
    [Note,[StrMerge,"time stamp count : ",[ZSphereGet,12,currentZS],"\n"],,-1]//time stamp count short int
    [Note,[StrMerge,"time stamp index : ",[ZSphereGet,13,currentZS],"\n"],,-1]//time stamp index short int
    [Note,[StrMerge,"flags : ",[ZSphereGet,14,currentZS],"\n"],,-1]//flags int
    [Note,[StrMerge,"twist angle : ",[ZSphereGet,15,currentZS],"\n"],,-1]//twist angle float
    [Note,[StrMerge,"membrane : ",[ZSphereGet,16,currentZS],"\n"],,-1]//membrane int
    [Note,[StrMerge,"X res : ",[ZSphereGet,17,currentZS],"\n"],,-1]//X res int
    [Note,[StrMerge,"Y res : ",[ZSphereGet,18,currentZS],"\n"],,-1]//Y res int
    [Note,[StrMerge,"Z res : ",[ZSphereGet,19,currentZS],"\n"],,-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.

  3. #3
    Senior Member Follow User Gallery
    Join Date
    Jun 2011
    Location
    Cape Town
    Posts
    158

    Default

    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 ). It seems I am getting the correct values. My way of displaying the values as a group was not as elegant as yours
    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 ... if so wow thanks for the effort!!!


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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •