Hi Mike & Burr - so that statement with the ? : in it is shorthand notation for a conditional statement.
If you wanted to do a 3 state switch it may be easier to have it as if statements. That would be like this:
code:
var newang, ang = moi.view.meshAngle;
if ( ang == 5 )
newang = 10;
else if ( ang == 10 )
newang = 25;
else
newang = 5;
moi.view.meshAngle = newang;
That then needs to go down to a single line to paste into the command field in the shortcut key editor.
Then for an indicator it is possible for a script to inject some UI into the side pane. Here's a version that will do the toggle and put the new value into into the side pane at the bottom of it. This one will only work in v3 since it looks for UI containers that are part of the V3 UI.
script: /* Toggle mesh angle */ var newang, ang = moi.view.meshAngle; if ( ang == 5 ) newang = 10; else if ( ang == 10 ) newang = 25; else newang = 5; moi.view.meshAngle = newang; var sidepane = moi.ui.getUIPanel( 'moi://ui/SidePane.htm' ); var endsection = sidepane.document.getElementById('MiddleBody').nextSibling; if ( endsection.lastChild.id != 'angval' ) endsection.insertAdjacentHTML( 'beforeEnd', ' ' ); endsection.lastChild.innerText = newang;
|