Home Technical Talk

MEL how do I query if the texture window is open?

polycount sponsor
Offline / Send Message
malcolm polycount sponsor
I can't figure this out, I tried this, but it always returns true even if I close the window?

textureWindow -query -exists "polyTexturePlacementPanel1Window";

Replies

  • throttlekitty
    Offline / Send Message
    throttlekitty ngon master
    Try changing textureWindow to just window to use that query instead.

    According to the docs for textureWindow, the panel itself  (polyTexturePlacementPanel1) is created on startup and exists through the whole session. The panel is then added to the window (polyTexturePlacementPanel1Window), which can exist or not. Additionally, the panel can also be docked but retains the original name (polyTexturePlacementPanel1).
  • sprunghunt
    Offline / Send Message
    sprunghunt polycounter
    as @throttlekitty says if you use the 'window' command instead it'll help. If you use 'window' you can also query the visibility (-vis) instead of the existance (-exists) of the window. 

  • malcolm
    Offline / Send Message
    malcolm polycount sponsor
    Hi guys, neither of these suggestions work.

    This one always returns false, even if the UV editor is open
    window -query -exists "polyTexturePlacementPanel1";

    and this code just fails to find anything with an error
    window -query -vis "polyTexturePlacementPanel1";

    this also fails to find anything

    window -query -vis "polyTexturePlacementPanel1Window";





  • sprunghunt
    Offline / Send Message
    sprunghunt polycounter
    Here's another approach

    if you query what the parent of the window is:

    textureWindow -q -parent polyTexturePlacementPanel1;

    and this returns anything at all you know it's open

    eg: 

    if ((size(`textureWindow -q -parent polyTexturePlacementPanel1`)) == 0){<br><br>print "window is closed";<br><br>} else {<br><br>print "window is open";<br><br>}


    this won't tell you if you can actually see it - only if it's open
  • malcolm
    Offline / Send Message
    malcolm polycount sponsor
    Very clever, that's exactly what I needed. Thanks a lot!
Sign In or Register to comment.