Hello everyone, I'm trying to learn MEL scripting coming from a background of Unity C#. Currently I'm working on a script that moves all selected vertices to 0 on the x-axis. I borrowed this script from another forum but it doesn't seem to work when the object has moved: string $verts[] = `ls -sl -fl`;<br> for($vert in…
I know you're trying to learn Mel script but if someone is looking to do this quickly and without a script, you could just use the input bar at the top in the status line. It's in a little fly-open menu between your render settings and your account login. Select the icon and click Absolute Transform then type 0 in the…
Thanks for your reply. I am deliberately trying to do this by script as I want to use this in a virtual reality plug-in I'm currently using ( https://www.marui-plugin.com/ ) . I am trying to create my own scripts that I can easily access and use from within VR .
Thank you very much for your detailed answer, Klaidio2U!That is very educating for me. Your workaround for toggling between the selection modes also seems to work well. Maybe it's me, but I'm still wondering why the selectMode -object<span>;</span> doesn't seem to work properly. Is this just a limitation/bug of the Mel…
I don't get any errors when i do as your example of objects having the same name in the separate groups. The only change that could be done is to use "$getObjectName" instead of "$getObjectName[0]" so that not only the first object is affected but all in the array or which objects are highlighted...which may or may not be…
What Axi5 said that one little line will do. If, however, you still want to know how to select move pivot to the origin and freeze transformation you really don't have to switch selection mode back and forward from Object to Component. The trick is that all you need is somehow to get the name of the object while you still…
Something to be aware of: If you use the -hilite flag with the ls command, you can potentially get more objects returned than just the object on which you have vertices selected. For example, make two cylinders, select both objects, press F9, then select vertices on just one of the cylinders. If you perform:…
This will only change if you used selectMode -component first, hotkeys or marking menus use a different method to enter component mode. (I forget what, offhand toggleSelSomething?)
Rather than doing all of the freeze transformation stuff have you tried using the World Space flag on the move command? http://help.autodesk.com/cloudhelp/2017/CHS/Maya-Tech-Docs/Commands/move.html In one line: move -ws -x 0 Quick demo https://www.dropbox.com/s/7xnp6er47na8l3p/2017-12-01_19-37-29.mp4?dl=0