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!