Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

(MEL) is possible to query the dock location of UVToolkit?

(MEL) is possible to query the dock location of UVToolkit?

absoluteKelvin
Collaborator Collaborator
278 Views
2 Replies
Message 1 of 3

(MEL) is possible to query the dock location of UVToolkit?

absoluteKelvin
Collaborator
Collaborator

Just wanted to see if its possible to query the docked location of the UVToolkit inside the textureWindow. I have checked the workspaceControl documentation. There doesn't seem to be a query for -dockToControl, which is used to set the location.

 

Thanks in advance

https://www.artstation.com/kelvintam
0 Likes
279 Views
2 Replies
Replies (2)
Message 2 of 3

Kahylan
Advisor
Advisor

Hi!

 

I found a way to do it, but it's quite hacky, so I'm not sure how feasible this solution is.

 

Basically, the script checks the size of the UV Toolkit, then temporary resizes the width of the UV Editor to see if the width of the Toolkit changes to find out if it is docked top or bottom.

After that it checks the point with a distance of half the width and half the height from the top left corner of the UV editor to see if the UV Editor panel is there, if it isn't, it assumes that if found the UV Tool kit.

string $UVEditor = "polyTexturePlacementPanel1Window";
string $UVToolKit = "UVToolkitDockControl";

int $wUVE = `window -q -w $UVEditor`;
int $wTK = `workspaceControl -q -w $UVToolKit`;
int $hTK = `workspaceControl -q -h $UVToolKit`;
int $TopBottom;
int $found =0;


window -e -w ($wUVE +100) $UVEditor;
int $newWTK = `workspaceControl -q -w $UVToolKit`;
window -e -w $wUVE $UVEditor;

if ($newWTK == $wTK){
    $TopBottom = 0;
}
else{
    $TopBottom = 1;
}

int $TopLeftUVE[] = `window -q -tlc $UVEditor`;

string $scptPanels[] = `getPanel -sty "polyTexturePlacementPanel"`;

string $panl = `getPanel -ap ($TopLeftUVE[1]+ $wTK/2) ($TopLeftUVE[0]+ $hTK/2)`;

for ($each in $scptPanels)
    {
     if ( `gmatch $each $pnl`)
        {
             $found = 1;
             break;
        }
    }


if ($found == 1 && $TopBottom == 0){
    print("right");
}
else if ($found == 1 && $TopBottom == 1){
    print("Bottom");
}
else if ($found == 0 && $TopBottom == 0){
    print("left");
}
else if ($found == 0 && $TopBottom == 1){
    print("top");
}

Now as I said, this is quite hacky. For it to work the UV Editor has to be the window in front and the UV Toolkit has to be the only control docked to the UV Editor...

 

Sadly I couldn't figure out a more elegant way to do this. Maybe someone with more UI experience than me will have a better solution.

 

Anyway, I hope it helps!

 

Message 3 of 3

absoluteKelvin
Collaborator
Collaborator

thanks Kahylan . It seems the only way is to get into PyQt unfortunately. https://forums.autodesk.com/t5/maya-programming/how-do-i-find-out-where-a-workspacecontrol-is-docked... 

https://www.artstation.com/kelvintam
0 Likes