Adverti horiz upsell

Nightshade UV Editor 2.1.3 for Maya (maya script)

Nightshade UV Editor extends the Maya's UV Texture Editor with tools, scripts and a UI that greatly speed up the time it takes doing UV work.

License
Button download
27,670 Downloads

Compatibility

  • 2017, 2016, 2015, 2014, 2013

Operating Systems

  • Mac
  • Windows

History

Created:09/11/2012
Last Modified:09/11/2016
File Size: 3.2 MB

Feature Request

Hotkeys and use of preselection?

Status:pending
Date:12/29/2015
Submitted by:Treidge Treidge
Hello, Martin! First of all — thank you for your wonderful tool. It really makes a difference for Maya. I'm enjoying the use of NSUV, but can't stop to wonder — is there a way to set up some hotkeys for its operations? I can see this as a killer-feature, if implemented in a proper way. For example, it would be terrific if we could do something along with following: 1) Assign a hotkey for an operation. For example, Orient Shells to the Selected Edges. 2) Hover the mouse cursor over the target edge and see how it is highlighted in red (preselected). 3) Hit a hotkey for Orient Shells to the Selected Edges. This is the tricky part — most likely it will require some modifications to the code, but I can see that we probably could get the required selection for the operation from the preselection highlight. Something like this (though, you're surely already know this): { string $preSelect[] = `ls -fl -psh`; string $select[] = `ls -fl -sl`; //If more components are pre-selected than selected if (`size $preSelect` > `size $select`) { select $preSelect; [perform Orient Shells to the Selected Edges] select -cl; } //If you have more selected than pre-selected (for edge loops and such) else if (`size $select` > 0) { select $select; [perform Orient Shells to the Selected Edges] select -cl; } //If nothing is selected or pre-selected else { warning "You must select some edges or UVs before performing this operation."; } } In this way if we could assign the hotkeys to all NSUV operations that make sense to have a hotkey we would be able to execute them by just hovering over the shell and clicking the button. Something like this can be seen in Headus UVLayout, and this is a hudge time-saver and in general is awesome for the workflow. For the more complex selections, like requiring to select all the UVs of the shell, we could just expand it from the preselected component and convert it to a proper type if necessary. As for the hotkeys — I can sense some sort of a problem here. If we can't use the Hotkey Editor to assign hotkeys to Python functions, we should be hard-coding it into the NSUV code, right? Most of the one-letter hotkeys in Maya are already assigned to something, so by default we are left to something like Ctrl+Alt+Shift+O available to hypothetical NSUV hotkeys, and that ruins it. Here comes the idea: what if we can work our way around it? Instead of using Hotkey Editor to assign hotkeys to the NSUV operations (and we probably can't do that), we could use it to create a special hotkey set dedicated just to the UV mapping workflow. We can delete some operations from basic one-button hotkeys and free them to the NSUV operations. This way we can have a hard-coded and simple one-button hotkeys for the NSUV, and it will not cause a conflict with default Maya hotkey set. For those who don't like to switch their Hotkey Sets we probably could just add an option to turn off hard-coded NSUV hotkeys or work around it in some other ways. What do you think? Is this seems reasonable to you?

Comments on this feature request:

  • Treidge

    Treidge said almost 9 years ago:

    Sorry, autoformatting messed up the code piece above. I'll try again. { string $preSelect[] = `ls -fl -psh`; string $select[] = `ls -fl -sl`; //If more components are pre-selected than selected if (`size $preSelect` > `size $select`) { select $preSelect; [perform Orient Shells to the Selected Edges] select -cl; } //If you have more selected than pre-selected (for edge loops and such) else if (`size $select` > 0) { select $select; [perform Orient Shells to the Selected Edges] select -cl; } //If nothing is selected or pre-selected else { warning "You must select some edges or UVs before performing this operation."; } }
  • Martin Dahlin

    Martin Dahlin said almost 9 years ago:

    Hello and thank you for the feedback. These are two good suggestions and I'll definetly consider them! And you are right about the problem here. Unlike in 3ds Max - Maya has a global set of keybinds that are not context-sensitive (In Max you can for instance, setup unique keybinds that only apply to say, the Vertex Color -modifier or the UVW -modifier - so you can have a global keybind for the "S" button, but another keybind "S" that is local to the UVW-editor). I'm not sure how to work around this other than querying for the NSUV window and have two binds under the same command (consisting of an if-else-statement). Implementing some or all NSUV-functions as user runtime-commands for the hotkey editor though is something I'll look closer at. Unfortunatly I have very limited free time atm as I'm just about to start a new job. Next bigger update for NSUV will come sometime this spring if I would take a wild guess. Sincerely, Martin
  • Treidge

    Treidge said almost 9 years ago:

    Thank you for considering it. Having some NSUV functions available as a runtime commands will be a great help already. I wish you good luck on your new job. Regards, Sergey
  • Treidge

    Treidge said almost 9 years ago:

    Hello, Martin! I thought that it would be useful to comment here that I was wrong in my first post about setting up hotkeys for Python commands in Maya. Actually, it is possible, and to my surprise quite simple in fact. To be short, I was able to achieve almost exactly what I've been requesting here. I've found a way to set up some hotkeys for NSUV functions. What's even better — I was able to use preselection highlight in a manner described in my original post above. To do so involved the following steps: 1) Create a new Runtime Command in Maya Hotkey Editor and set its language to Python. 2) Look up for NSUV function name that will be assigned a hotkey. For example, core.orientEdge() is the call for "Orient Shells to the Selected Edge(s)". 3) Enter the runtime command text that will call for a NSUV function: from NSUV import core; import maya.cmds as cmds preselection = cmds.ls( preSelectHilite=True ) if preselection == [] or preselection == None: core.orientEdge() else: cmds.select( preselection ) core.orientEdge() *Note that this command is just an example and most likely it can be made smarter than that. 4) Save the Runtime Command and assign a hotkey to it. 5) Now when you hover your mouse coursor over preselection highlighted edge inside the NSUV, assigned hotkey can be used to execute Orient Shells to the Selected Edge(s) without actually making a selection. Default procedure (with actual selection) still can be used, but preselected edges take priority. In such manner hotkeys can be assigned to almost every NSUV function — I've checked half a dozen of them and they work just as expected. Very exciting.
  • Martin Dahlin

    Martin Dahlin said almost 9 years ago:

    Hello, Sorry for the late reply - I haven't been logged in to CC for quite some time. This is a very interesting find, indeed. I will look into it and consider adding this to NSUV 2.1 which I'm currently working a lot on (it will be out in a couple weeks). There are commands for managing user keybinds in code, so there is always the possibility of setting up a custom hotkey editor. I would like to have context-sensitive keybinds like in 3ds Max - where you can have different keybinds for different modifiers/windows - but Maya sadly has no such support. But I'm sure there are other ways around this. I really appreciate you sharing this information with me. Big thanks! /Martin
  • Treidge

    Treidge said almost 9 years ago:

    Hey Martin, Speaking of... I forgot to mention that I've actually made a try with your suggestion about context-sensitive hotkeys, i.e. querying for the NSUV window and have two binds under the same command (consisting of an if-else-statement). It works. There's possibly a few quirks with such approach, but without a proper experience it's hard to tell how good it would work in practice. Anyway, here's the code snippet I've used for testing this idea. It substitutes the SetKey command that sets animation keys on all channels (the S button default hotkey) with OrientEdge function from NSUV if its window is in focus. Also works with preselection in a manner shown in my previous post. Note that I had to move NSUV core import inside the first "if" — otherwise it will open a NSUV window on the first call. Here's the Pastebin version with proper formatting (just in case): https://pastebin.com/Scqg4MWz import maya.cmds as cmds import maya.mel preselection = cmds.ls( preSelectHilite=True ) window = cmds.getPanel( withFocus=True ) if window == 'polyTexturePlacementPanel1': from NSUV import core; if preselection == []: core.orientEdge() else: cmds.select( preselection ) core.orientEdge() else: maya.mel.eval("SetKey;") I'm glad that you find this information interesting. Thanks for appreciation :) Regards, Sergey

Post a comment: