1. #1
    Senior Member Follow User Gallery
    Join Date
    Jul 2002
    Location
    Copenhagen
    Age
    50
    Posts
    2,561

    Question Screen coordinates of interface items

    Hi,

    I've been trying to send the screen coordinates of a ZBrush interface item to a dynamic library, but I am failing at the last hurdle.

    Using [IH/VPos,...] and [IWidth/Height,...] commands I can accurately detect the coordinates of a ZBrush interface item within the ZBrush window, but not the position of the ZBrush window itself. No problem. My script requires the user to activate it using a hotkey while the cursor is hovering over an interface item. I can instead send the coordinates as an offset from the ZBrush cursor position and make a system call to get the cursor screen coordinates from my dynamic library. Apply offset and voila! Everything works.

    Except reading the [IHPos,...] of the Projection Master button, for example, results in the coordinates of the button in the Plugin palette, not the Projection Master button I was hovering over next to the canvas (in the default UI config).

    Anyone come across this problem and solved it? I should mention that I have only tried this in the Mac version of ZBrush 4R5 but I do not imagine anything has changed in ZBrush 4R7P2 on PC.
    Mark

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

    Default

    Hi Mark,

    Good to see you here and that you are still zscripting.

    I remember coming across the issue you describe but I don't think I found a solution. It was a while ago though and I'll take another look. I'll let you know if I find out anything useful.

    All the best,

  3. #3
    Senior Member Follow User Gallery
    Join Date
    Jul 2002
    Location
    Copenhagen
    Age
    50
    Posts
    2,561

    Default

    Cheers Marcus.

    Yeah, just got back into zscripting recently. Trying to remember all the ins and outs, the idiosyncrasies, the gotchas, the dead ends and the unexplained commands (I am looking at you [IDialog,...]). It is like falling in love all over again

    Take care,
    Mark

  4. #4
    Senior Member Follow User Gallery
    Join Date
    Aug 2011
    Location
    Mebane, NC
    Posts
    4,194

    Default

    unexplained commands (I am looking at you [IDialog,...]). It is like falling in love all over again
    LOL. Welcome back, I look forward to what you might be cooking up. Ready to test

  5. #5
    Senior Member Follow User Gallery
    Join Date
    Jul 2002
    Location
    Copenhagen
    Age
    50
    Posts
    2,561

    Default

    Thank you very much Doug. I am glad to be, as you put it, "back". Hah. Back!

    Don't worry, I can follow your misconception. Perhaps because I was not active for a few years I was then "away"? But you need to realise, Doug, that none of us has ever truly been "away" or that we will ever be coming "back". When we all signed up for ZbrushCentral I bet only a few of us read the small print or told others about it. I won't bore you with the details but you and I are most definitely here to stay...we all are. Nobody leaves.

    As much as the screams and tears of children fed the energy craving monsters of Monsters, Inc. so do the squeals of delight and laughter feed the overlords at Pixologic. They are through and through, truly evil people.

    And that is all I have to say on the matter,



    But seriously, thanks for the welcome back
    Mark

  6. #6
    Senior Member Follow User Gallery
    Join Date
    Nov 2012
    Location
    BELGIUM Liège
    Age
    39
    Posts
    160

    Default

    Hi TVEyes, again I had exactly the same problem with ZSwatches. It seems that ZB's always referring to the first instance of the button when you query its position (so that's the one within it's original palette)...

    If you find a workaround for this, I'll be very pleased to know it !!!

    Have a nice day, try not to loose all your hair coding
    ZAdjustor Plugin for ZBrush : adjust Draw Size, Focal Shift and Z/RGB Intensity by simply moving your mouse/stylus while holding down a hotkey, just like in photoshop, mudbox, mari, maya... Many options.
    ZAdjustor0.92 for ZBrush 4R7/4R6 32bits OsX - (OSx version for ZB4R7 64bits coming soon)
    KeuPon is Jean-Julien JUPINET

  7. #7
    Senior Member Follow User Gallery
    Join Date
    Aug 2011
    Location
    Mebane, NC
    Posts
    4,194

    Default

    Must be a way to 'force update' somehow. Maybe you'll have to use a note interface? Lots of people would like this to work I made some color buttons with text on them, hack away at the code if you wish

  8. #8
    Senior Member Follow User Gallery
    Join Date
    Nov 2012
    Location
    BELGIUM Liège
    Age
    39
    Posts
    160

    Default

    For my swatchs, I had to rely on reading the color under the cursor when you click to know which swatch was clicked .
    That's why you can't have two times the same colour . But it gave a convenient way to reorganise the swatches (if the colour is already present, it swaps swatches positions). How hacky is that . And I won't even talk about how I forced the interface to update the button's image .
    ZAdjustor Plugin for ZBrush : adjust Draw Size, Focal Shift and Z/RGB Intensity by simply moving your mouse/stylus while holding down a hotkey, just like in photoshop, mudbox, mari, maya... Many options.
    ZAdjustor0.92 for ZBrush 4R7/4R6 32bits OsX - (OSx version for ZB4R7 64bits coming soon)
    KeuPon is Jean-Julien JUPINET

  9. #9

  10. #10
    Senior Member Follow User Gallery
    Join Date
    Jul 2002
    Location
    Copenhagen
    Age
    50
    Posts
    2,561

    Lightbulb

    Hi KeuPon. Would love to hear how you forced the interface to update the swatch button. My method was also hack. It involved [IClose,...]'ing the subpalette which contained the button, which seems to remove it from memory. Then reloading the script ( I think from a secondary script ) which restored the button. Using [IClose,...] first ensures the button works when you reload. The only problem with this method is the ever increasing button ID. At some point, a couple of thousand ID's later, ZBrush becomes unresponsive.

    As for the original question it looks like a dead end. We can probably get the horizontal position but only if the palette the UI item belongs to, is NOT in the left or right tray. To do that you can [IShow,...] the palette which shows the palette, centered horizontally at the cursor position. Then it would be a matter of subtracting the cursor's horizontal position from the palette's and adding the relative palette horizontal position of the UI item in question. I don't think that would work for the vertical position as palettes have variable height and might not even fit on the screen.

    A theoretical solution then. Though I think there are too many variables for it to work reliably. So that was that. What are you all up to? Seen any good movies lately
    Mark

Tags for this Thread

Posting Permissions

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