When character modeling I tend to use mostly Silo/Zbrush/UVlayout and avoid Maya until the very last cleanup and export stages of a model. Recently I'm doing a lot more environment work where I pretty much have to use Maya for the majority of the process. It feels horribly clunky after using Silo for so long, so I'm looking to try to replicate some of Silo's functionality into Maya via mel scripts. Unfortunately I'm no scripter, beyond cobbling together some bits from the script editor. Hopefully some of the fine Mel gurus here can help.
The main thing I'd like to do is make a bunch of Maya's tools more context-sensitive, presumably using IF/THEN/ElSE type scripts. For example :
Hotkey "M"
Context 1 : Two or more shells selected in object mode - perform polygon combine
Context 2 : Two or more vertices selected - perform merge to center
Context 3 : Two or more UVs selected - perform merge
Context 4 : Two edges selected - Bridge edges
Hopefully you get the idea. Is it possible to do this?
Replies
Basically you start with the "most likely" case (well, it doesn't really matter what order, but I do it that way since it makes more sense to me), test for it, and if the test passes then execute that part of the script.
So in your case here I'd have something like this:
Something to bear in mind is that you can sometimes have multiple conditions be true (eg. I might have 2 vertices selected, but also have a couple of whole objects selected at the same time), so you might also want to have checks in for those situations and handle appropriately.
Otherwise you might find yourself merging objects when you wanted to merge verts...