http://www.creativecrash.com/maya/downloads/scripts-plugins/texturing/c/nightshade-uv-editor
(It's for AUTODESK MAYA)
New features: Straighten UV shell, Orient to edge, Match UVs, Quick unfold, Quick unfold (U or V only), Quick relax, and more buttons to the advanced UV manipulator (store value in variable, add/subtract 10, add/subtract 0.25.
Also added buttons for cycling edge colors and activating the "Select shortest edge path" -tool
:: ABOUT ::
Nightshade UV Editor extends the default functionality of Maya's native UV Texture Editor with the following tools:
-Straighten UV shell: Straightens a shell along an edge loop or ring, and unfolds everything around it.
-Orient UV shells: Orients UV shells so that their bounding box is as small as possible. Almost always results in straight shells.
-Orient edge: Orient UV shell so that the selection runs horizontally or vertically. Great for custom orientation)
-Stack UV shells: Stack UV shells on top of each other.
-Match UV shells: Match UVs to their closest neighbors. Great to use in conjunction with "stack"
-Center UV shells: Places UV shells in the middle at 0.5u 0.5v
-Spread UV shells: Performs a UV shell layout that does not scale your shells or rotate them in a weird way.
-Rotate 90/180 degrees: Rotate shells CW or CCW 90/180 degrees.
-Tear off faces: Converts a face selection into a UV shell.
-Quick unfold: Buttons for quickly unfolding along U, V or in both directions with optimal unfold settings.
-Quick relax: Button for quickly relaxing a UV shell with optimal relax settings.
-Advanced UV manipulator: For quickly manipulating UV coords without having to type in new field values like a maniac all the time. In fact, you can do it entirely with just the mouse now - and even store manipulation values in variables for later use.
-Calculate UV utilization: Fast Python script by Guido Neumann that calculates how much space your UV shell scover (0->1 U and V).
-Measure pixel distance: Select two UVs and measure the distance in pixels between them. Excellent when you need to pack your shells tightly but want to avoid having to do a million snapshots.
-Powerful aligner: Aligns UV shells to the right, left, button, top or average U/V
-Push/Move UVs to average U or V: Maya has the tools for pushing UVs to the furthest right/left/bottom/top by default but it does not have the tool for pushing them to the average U or V. Now you have that option.
-Measure UV distance: Measure the U or V distance between two UVs.
-Retain component spacing checkbox: Now you no longer have to go into the Tool Settings window to toggle this.
-Integrated UV Set Editor: All the functionality of the default UV Set Editor is integrated. Also comes witha snapshot button.
-Texel density control: For quickly scaling UV shells so that they have the same texel resolution.
-Cycle edge colors: Change color on selected edges by switching back and forth between Maya's preset colors.
Screenshot:http://img803.imageshack.us/img803/1679/screenshotv12.jpg
Replies
I don't know where to find the Relax and Unfold sliders, which are my most used UV tool.
Where would I find that tool in the menus? I tried, but no luck.
If you need a good unwrapper that also comes with an awesome stretch shader, check out Roadkill Pro - I use it all the time at work and can't imagine using something else
It doesn't physically overwrite the default editor but yea, it will replace it. The original will always be located in installDir\Autodesk\Maya2012\scripts\others\
...while my editor will always be in the c:\Users\ USER \Documents\maya\ VERSION \scripts\ -folder
This because it's the only way to add buttons on the top bar (the UI is located in the textureWindowCreateToolBar.mel -file) - the alternative would be to have all the "new" features on the side bar and that would simply be too crowded.
The relax and unfold tools can be found under the main menu in the window - under "Polygons". You can also find it on the marking menu (shift right click when you have a UV selection). There it is called "Smooth UV tool".
EDIT: Also there was a bug with the stack UV shell tool in the initial release that causes it to not work properly (or at all). This has been now been corrected.
Performance problems: The texel density control, orient shells, unfolds and other features that builds big arrays or runs many shells thru a for-loop might cause Maya to crash if you try and run them on something really big (like all assets in a level).
When this happens it's because Maya runs out of memory. Every PC at work only has 8 GB of really slow RAM and our level designer has got a few crashes when he has been silly enough to try and run the texel density -stuff on an entire level for example (lol). Nothing I can do about it really because the texel density control runs on Maya's "unfold" -command. So yea... all the crashes I've noticed haven't been because of bad code or anything but due to the limitations of the hardware, Maya or both.
I wasn't running the command 'NightshadeUVEditor' I thought it just worked over top of the standard editor. Sorry for not reading install instructions.
Loving the other tools so far. Thanks again.
I've used the tools all day and I'm really grateful for the Unfold U and Unfold V.
2 quick things I noticed (that don't really matter that much):
1) I accidentally opened up mayas default uv editor, and when I did, the workspace for the Nightshade editor turned into my perspective camera.
2) When you calculate the uv space percentage, the workspace goes empty as if you didn't have any object selected.
I'm afraid not but this is actually very easy to implement. I will definetly add it to my "todo"-list. Thanks!
More sophisticated texel density tools will definetly be available in the future.
Picking the average TD from a couple faces - that's a really cool idea. That will go to my "todo"-list as well, thanks!
1) Yes this is a bug that I'm aware of but has been too lazy to fix. What happens is that both the native UV set editor, and my UV editor, creates and deletes the same UI-object.
So when one of them opens, they kinda reserve that object name so that the other one can't open and function properly. I'll fix this ASAP.
2) Yes this is one of many things I don't like about Neumann's python script. Since I don't know much Python I'm not really sure what to do in order to fix this.
I will replace his script though as soon as I start learning Python myself and start working on my own MEL/Python hybrid of the UV calc script. One thing that really bugs me is that you can't really perform an UV calc if you have multiple meshes selected. This is a big flaw in the script imo.
I'm not 100% sure what you are relating to so please ellaborate. Are you talking about the scale function for the advanced UV-manipulator or Maya's native scaling tool? (R button)
After a quick try, three things that I think you should do pop to mind right away :
1. Make the "NightshadeUVEditor" command a toggle, so that when you re-execute it and the window is already open it closes it. I have my UV editor (and Hypershade etc.) set up like this and it's really nice (I feel all commands that open new windows should toggle their closure as well).
2. Please don't lock the windows size, it's really annoying not being able to make it smaller. Sometimes depending on what kind of work you're doing you just need a small preview of the UVs and want to resize the window so it doesn't take up too much space.
3. Similarly, it would be nice to be able to hide the left menu somehow, not sure if this is possible (like you can hide each segment of the top menu bar).
The tools look cool otherwise, will test it more.
You suggest Roadkill Pro as a good unwrapper, but it's not publically available, and I dread the day I need to switch to 2013, as I doubt he'll update it again.
So yeah I'd love to find a free alternative, surprised there aren't even any free versions of his stretch shader.
EDIT : Oh and many of the tools aren't redoable (g key), like the unfold horizontal/vertical for example, if you want to be consistent with Maya they should be I think.
deleteUI uvTextureEditor;
(since my UV editor is embedded in the native one, they have the same name on their window: uvTextureEditor)
2) Okay, I'll hotfix that
3) This can also easily be implemented. I'll add this to my todo-list
4) This is sloppyness on my behalf and will be hotfixed coz it's like one extra line of code per custom tool lacking this
though the syntax is kinda fucked up, but it still works all the same.
its not letting me go through
What I thought I had missed is to add the "commandRepeatable" -flag to my custom buttons. Turns out I haven't - so all buttons that are supposed to have repeatable commands, currently has them.
People should keep in mind though that commandRepeatable is just a flag that tells Maya that a certain UI element will run it's command again if this "repeatLast" -command that you talk about is executed (repeatLast is bound to G by default). So if you for example, does a new selection command (such as expanding your selection to cover an entire shell) then stack, orient or whatever command you used last, is no longer the last command... The last command was a selection expansion.
But if you for some reason do find a button that does not seem to have this flag when it should, please tell me which button it is so I can have a look at it.
I'm just opening up the UV window, selecting some UVs, pressing a button, selecting some other UVs, pressing G, and it's not redoing it, while my usual UV shortcuts work fine.
Like this :
I see. Well this is very weird because it does work for me.
I unfold or align something, then select some other shells with the mouse and press G and the command is repeated.
Are you using Maya 2013? I'm on 2012 (I doubt it is this though)
Interesting. Thanks for sharing your code. I will definetly check this out!
this also uncovers something really bad when the program errors, when a operation starts you have the undo stack turned off so it dosnt get filled with small junk operations, but in the case of a error it remains off which can really fuck people over if they don't notice that.
not sure about mel, but in python you got ways of dealing with exepctions, and actions to do in case one happens such as turning the undo stack back on, and printing a better error message.
also do you plan on making any changes to the marking menus for UV's in the future, would be interesting to see that happen and i prolly will just add some of the more commonly used tools to the shift+rmb uv one too eventually.
Thank you for your reply.
Yes that issue with the stack UV shells -function was hotfixed a couple hours after I released v1.2. Download the zip again and things should be working as expected. Turns out one line of code had been deleted by mistake.
Regarding exceptions: MEL has a command called "catch" that can be used on individual snippets of code and/or on whole procedures (I think?)
catch (`myProceduren`); should afaik continue the execution even if something fail at runtime.
Marking menues: This isn't something I've really thought about before but it's entirely possible: I'm open to suggestions, so if you have any ideas on how that menu should look like then let me know.
thanks again
you can accomplish this with the optionsVar Command.
http://download.autodesk.com/us/maya/2010help/Commands/optionVar.html
edit:
some tools for making uv's for tileing textures would be cool too, such as a key to uniformly scale a island so it fits into the U or the V space, and tools to auto alig a uv elemeant to one of hte borders of the 0 to 1 space.
can kinda already do the aling bit, just need to get one island in place first than use the current tools.
http://www.youtube.com/watch?feature=player_detailpage&v=m8oC1HsjOgk#t=383s
I appreciate all your ideas/feedback - it's all very valuable.
Regarding your edit:
What you are talking about is what Maya calls "Normalize". Normalize auto-stretches your selection to cover the 0->1 perfectly. There's also "Unitize" which is exactly like "Normalize" but applies to each individual faces of your selection. These features are on my todo -list already and will be implemented in the next version.
Looks like Maya's "Transfer Maps" just a little bit better.
I won't do anything like that for my UV editor but I might end up making such a tool in the future.
havent had a chance to peek at your code yet but i find the match UV's quite slow compared to the same operation in UVdeulux, not sure if that is just due to the faster execution speed of python compared to mel or if there is somethign else going on.
also if you want to go aobut jump from mel to maya, you should prolly just use the maya.cmds and stick away from pymel, since useing maya.cmds is more similar to mel, since it allows a purely procedural scripting style like mel.
pymel will force you into learning some object oriented programming which is very powerfull but is much differnt.
also maya.cmds runs a bit faster than pymel being more direct.
I don't necessarly consider learning OO-thinking a bad thing though. One day I would like to learn C++ after all (when I'm getting time for that I have no damn idea about) since I have this crazy idea of maybe becomming a Technical Artist sometime in the future (that comes with a lot of work experience though...)
like i personally much prefer working with OOP concepts than not, which is why i have never went back to mel after moving to python for anything that isn't needed.
oh and good luck trying to get into c++, i always found it a harder language to fully understand all the concepts of, even when compared to c#.
I also noticed that the "orient uv shell with selected edge function" is not working with a border edge of a uv shell ... Wich is really needed for video games !
I noticed a problem with the "Move uv shell button icon" we don't know when it's on or off (i think you need to change the icon to give a feedback to the users when it's pressed or not.
but the maya interface does notify you of the active tool, and if no tool is active gives you qucik access to the last used tool.
@nightshade, your app should be able to check what the current active context is with the checkCtx command which is available in both mel and python, pretty simple too takes no arguments, and returns the context name as a string.
EDIT: though still would need to find a way to use that, since olny thing i can think of off the top of my head, is to just keep checking the current context against the texMoveUVShellSuperContext context on refresh, which would be ultra inefficient. unless you can find a away to get a signal from maya when a context is dropped.
I'm looking into improving this though.
Are you talking about a toggle for switching between moving entire UV shells and only moving UVs or did I completely lost you? *shrug*
I'm thinking that that could be made possible with a scriptJob that activates on event "SelectionChanged"
...but then you would also need something to make sure that scriptJob is ONLY active inside the UV texture editor.
Good idea, I'll add that to my todo -list
Currently I'm working on a new tool for Maya so there will be some time before I release v1.3 of the UV Editor. I'll probably release that new tool sometime this month though, and after that I'll work some more on the UV Editor.
up until just now when I minimized the NightShade UV Editor window and it's completely gone, nothing happens when I run "NightshadeUVEditor" in the MEL-script line or when I press the shelf-shortcut I created. Going to "Panels-Saved Layouts-Persp UV Texture Editor" shows me nothing but a blank gray page so that's no help either.
halp?
Brilliant otherwise
edit: re-installed, didn't help, still nothing :[
You can try deleting the UV Editor window with the following line of MEL-code:
deleteUI uvTextureEditor;
If that doesn't work then you need to delete the userPrefs.mel in the prefs folder in your maya user directory