View Full Version : Detecting active panel/window and rebinding keys
07-31-2012, 09:14 AM
Is it possible to construct an MEL If/else -statement that can detect if the user is in the UV Texture Window or not?
If so, how can I make a script that rebinds a keybind?
The idea here is to assign Shift W and Shift Q to rotate UV's clockwise and counter clockwise when in the UV-texture editor, and to assign these keys to something else when the user (me) goes back to working on anything but the UV texture editor.
Another thought, before I hit "submit":
Even if it's possible to construct all this in MEL - how would I create a script that "listens"? (ie: is always active, resides in the background and does an auto-detection every now and then).
07-31-2012, 09:53 AM
you don't need to auto-detect or rebind. You simply bind Shift-W (for example) to a new function you wrote. the first thing this function does is to query the current panel. if the panel is the texturePanel you do one thing, else you do another. You could keep adding "if" queries to nmake the same hotkey work differently on every different type of panel, even in "front" view or "top" view for example.
You just need to use the `getPanel` command to figure out which panel you are "in". that's pretty much it.
07-31-2012, 09:59 AM
What would I do without you on these forums? :D
That sounds like a much simpler way of doing it - typical me to always overcomplicate things.
Thanks for pointing me in the right direction!
07-31-2012, 12:30 PM
How do I evaluate a selection to find out what type is selected?
I know about the polyEvaluate command - but that one only returns the number of objects selected and not the type. What is the command for that?
I want something like (psuedo code):
Evaluate object type of selection
case <uvs>: perform command 1
case <edges>: perform command 2
07-31-2012, 02:50 PM
i wrote something simliar, a super-merge-component hotkey.
one hotkey - m - to merge verts, collapse edges, collapse faces and merge uvs.
i take the selection and filter what is selected into component buckets using the "filterExpand" command.
"polyListComponentConversion" is also helpful.
07-31-2012, 02:50 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.