Mail magazine, April

/ April 27, 2018

One common issue that people are troubled by when working in VR is to duplicate the work done on one part of the model (for example the right side of a symmetric object) on another part (eg. the left side).

Of course you can just duplicate and transform (rotate or scale) the object,but that is often not as precise as people would wish for.

Here, Maya scripting commands can be very handy.
For example:
“Duplicate and mirror on the x-axis:”
duplicate; scale -ws -p 0 0 0 -1 1 1; performPolyNormal 0 -1 0;

or:
“Rotate 90 degrees around scene center:”
if (`upAxis -q -ax` == “y”) { rotate -r -ws -p 0 0 0 0 90deg 0; } else { rotate -r -ws -p 0 0 0 0 0 90deg; }

or:
“Align selected vertices / edges / faces to be in the same x-y plane”
$s = `ls -sl`; $i = 0; $a = 0.0; for ($c in $s) {$t = `xform -q -t $c`; $a += $t[2]; $i++; } scale -ws -p 0 0 ($a/$i) 1 1 0;

But how to use these in VR conveniently?
MARUI offers four ways:

1) Floating HotKeys:

MARUI offers floating menus of “hotkey” buttons.
You can insert the script snippets into them to have them ready at your fingertips in VR.
This video explains how to do it:

 

2) Voice Command:

Just insert the script into the MARUI Speech Command Editor dialog and decide on a keyword to trigger it.
This video explains how it is done:

(Note: an “Advanced” license is required to use voice commands)

 

3) Map to Controller Button:

Those functions that you really use a lot may be worth attaching to a controller button directly.
If you have an “Advanced” license, you can customize your button mappings freely.
The following script snippet will create a new “Command” Widget:
MARUI_Widget -create “command” -icon “C:/path/to/your_icon(optional).jpg” “myCommand”;
MARUI_Widget -event “click” -command “<INSERT COMMAND HERE>” “myCommand”;
You can then map this custom command to any controller button by using the MARUI UI layout editor:

 

4) Build your own menu

Of course, the number of buttons on your controllers is limited, so if you need several commands, it may be better to group them in a menu.
This article in the MARUI documentation explains how to build your own menus.
https://www.marui-plugin.com/community/tiki-index.php?page=Scripting#Marking_Menu_Widget


We hope this information helps you getting your work done more efficiently and conveniently.

Share this Post