View Rotation Style
 1-4  5-24  25-27

Previous
Next
 From:  Mike K4ICY (MAJIKMIKE)
4736.5 
Cool, I might be able to have a little more fun with this...


script: /* Set mesh angle to fine */ moi.view.meshAngle = '5';

script: /* Set mesh angle to course */ moi.view.meshAngle = '25';

Ha! - Instant Mesh Angle Resolution Changer.

Now at the touch of a button, I can now go back and forth between high and low mesh resolution! :-)

This is a process I go through EVERY model because I need to occasional go from a more speedy modeling feel to a close-up detailed edge view when I turn the edge lines off.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
4736.6 In reply to 4736.5 
Tricky ;)
---
Pilou
Is beautiful that please without concept!
My Gallery
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
4736.7 In reply to 4736.6 
ANd a single line that toggles it!!!

script: /* Set mesh angle to fine */moi.view.meshAngle = (moi.view.meshAngle == '5' ? '25' : '5');
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  coi (MARCO)
4736.8 In reply to 4736.7 
i was meaning to ask, if it's possible to toggle such things..yes it is. Is there a way to have some kind of toggle script for the circle options?




cheers,
marco
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
4736.9 In reply to 4736.8 
Hi marco - the different commands in a "command set" like that are a bit different kind of thing than options in the Options dialog.

Right now there isn't really a way to toggle between those, but I do plan on adding a mechanism in so that scripts could determine the current running command, and that would then allow for a toggle script to be created for that.

Some recent discussion on that kind of thing here:
http://moi3d.com/forum/index.php?webtag=MOI&msg=1521.89

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Mike K4ICY (MAJIKMIKE)
4736.10 In reply to 4736.7 
> ANd a single line that toggles it!!!

> script: /* Set mesh angle to fine */moi.view.meshAngle = (moi.view.meshAngle == '5' ? '25' : '5');


Awesome Burr!

So how does the "== '5' ? '25' : '5'" work? Can I go three+ state?

Not that I'd propose to add clutter to a Spartan UI layout, but could there be any way to add a visual cue or icon to that action.
It's hard to know what state the model is in until you start playing with the model...

Just an idea.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
4736.11 In reply to 4736.10 
I was going to ask Michael if it was laid out correctly.. I just used another script and copied some bits from it to get that and it does work, but I'm not sure if it is overdone somehow...I need to learn JavaScript more to be more proficient at it...
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
4736.12 In reply to 4736.10 
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;
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  shayno
4736.13 
Playing with your scripts
This works for 2 views

script: /* toggle world axis rotation style */ moi.view.rotationStyle = (moi.view.rotationStyle == 'World' ? 'free' : 'world');

another that may be useful

script: /* Toggle Grid snapsize */moi.grid.snapsize = (moi.grid.snapsize == '0.25' ? '0.1' : '0.25');

cheers
shayne
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
4736.14 In reply to 4736.12 
Hi Michael,
I'm not getting the sidepane injection? Maybe I'm missing it? Could you double check the script you posted for this?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
4736.15 In reply to 4736.14 
Hi Burr,

> I'm not getting the sidepane injection? Maybe I'm missing it?
> Could you double check the script you posted for this?

Looks like it won't work if you have scene browser mode as inside the side pane instead of "adjacent" mode.

Also it looks like I messed it up so that it replaces a button instead of adding it to the side, let me make a new version here that should work better.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
4736.16 In reply to 4736.14 
Hi Burr, try this one:

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').document; if ( !sidepane.getElementById('meshangval') ) { sidepane.body.insertAdjacentHTML( 'beforeEnd', '<div id="meshangval" style="position:absolute; right:5px; bottom:5px;"></div>' ); } sidepane.getElementById('meshangval').innerText = newang;

That one should display the number in the bottom right corner of the side pane.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Mike K4ICY (MAJIKMIKE)
4736.17 In reply to 4736.16 
Wow! Thanks Michael! :-)

A nice, quick way to juggle modeling speed vs. viewing quality.


So! On the same token - here is a script for changing view rotation style with one key:::

code:
script: /* Toggle view rotation style */ var newvrs, vrs = moi.view.rotationStyle; if ( vrs == 'World' ) newvrs = 'Free'; else if ( vrs == 'Free' ) newvrs = 'FirstPerson'; else newvrs = 'World'; moi.view.rotationStyle = newvrs; var sidepane = moi.ui.getUIPanel('moi://ui/SidePane.htm').document; if ( !sidepane.getElementById('viewrotationstyle') ) { sidepane.body.insertAdjacentHTML( 'beforeEnd', '<div id="viewrotationstyle" style=""></div>' ); } sidepane.getElementById('viewrotationstyle').innerText = newvrs;


It shows the view rotation style name in the bottom left.
Woohoo! And it can be done on the fly while adjusting the view.

EDITED: 23 Nov 2011 by MICHAEL GIBSON

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
4736.18 In reply to 4736.17 
Majik,
Your last toggle script throws an error on my end.. probably the forum juggling some text around and I cant read it good enough to catch whats wrong with it..
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
4736.19 In reply to 4736.18 
Hi Burr, yeah the forum can see HTML tags like <div> and think that they're supposed to be part of the message markup.

I've edited Mike's message above to put it all in a <code></code> block so that the contents inside there won't be processed as message markup by the forum.

It will be nice in the future when these things won't have to go all one one line.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
4736.20 In reply to 4736.18 
Ah ok, I found it... This is missing:

code:
<div id="viewrotationstyle" style=""></div>


In the null carrier just after 'beforeEnd'

[EDIT] Thanks Michael ! lol. Had to wrap code tags to show what i found was missing :o[EDIT]
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
4736.21 In reply to 4736.20 
And Just a note on the script Majik posted... The labeling for it does appear in the sidepane, although down below my current bottom bar.. A scroll bar appears to the right and I have to scroll to read the readout..

Looking forward to the adjustment for that sidepane injection with "inside browser" (Dont knock yourself out) I'll see if I can adapt it to Majiks script too.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
4736.22 In reply to 4736.21 
Hi Burr, so to switch Mike's script above to the other style labeling, go to the part
of his script where he has: moi.view.rotationStyle = newvrs;

That's the end of the part that actually toggles the setting, everything coming
after that is about pushing in some HTML for the display.

So delete everything after that and instead put in the second half of what I had
above for the other style "bottom corner" label, which would be this (just the
variable used at the very end is different from my previous script):

code:
var sidepane = moi.ui.getUIPanel('moi://ui/SidePane.htm').document; if ( !sidepane.getElementById('meshangval') ) { sidepane.body.insertAdjacentHTML( 'beforeEnd', '<div id="meshangval" style="position:absolute; right:5px; bottom:5px;"></div>' ); } sidepane.getElementById('meshangval').innerText = newvrs;


Let me know if that doesn't work right for you.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
4736.23 In reply to 4736.22 
Hi Michael,
I was able to get both the previous toggle scripts to work in Inside browser pane mode now.. Thanks! For the last post you made with the View Angle toggle, the last item was a "newang" in That script (As opposed to newvars).. It adopted to the viewpoint toggle script also!!! (Which used the "newvars" definition.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
4736.24 
Can you resume that these new scripts can make?
I am a bit losted :)
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
Show messages:  1-4  5-24  25-27