MoI discussion forum
MoI discussion forum

Full Version: AutoRotate script final

Show messages:  0-19  20-24

From: Paul (AIRGLASS)
8 Oct 2007   [#1]
Hi all,
Here's the final version of the AutoRotate script I posted last week --
This one has a small gui to manipulate the model rotation :
a slider to change rotation speed, direction buttons, and start/stop buttons.
There are no command line parameters, so to set it up, stick the files in the moi/commands directory,
open MoI, go to Options/Hotkeys, add a new entry:
R AutoRotate2
and that should do it!

Paul

Attachments:
AutoRotate2.zip


From: Michael Gibson
8 Oct 2007   [#2] In reply to [#1]
Very cool that you're able to leverage different UI controls now!

I hope you are having fun tinkering with this, it can be fun thinking of how you want something to work and making it do exactly what you want.

Hopefully when I get some more time to work on it I can make it possible to hook up a debugger to the script, right now when you are developing a script it can be hard to debug it.

Let's see a couple of comments - in this case I think you can leave off the display:none on the parts of the UI, and just skip the beginUIUpdate() / showUI() / endUIUpdate() stuff. That stuff is meant for commands that have different stages in the command and show different prompts and different UI controls at each stage. That beginUIUpdate() / endUIUpdate() thing is there to batch up a bunch of shows and hides into one atomic operation to avoid flickering. Because the command script runs on its own thread independent of the main program it is possible for there to be stuff like redraws between each line of script being run.

The only other thing other than that, is I think that the speed of rotation for this may be machine dependent, on a fast machine where the script is able to loop faster and the redraw is faster, it may whiz around pretty rapidly... One thing that might alleviate that would be to run the actual rotate in the .htm <script> instead of the actual command .js file - maybe something like a Start() and Stop() function in the .htm file, and have Start() call the HTML window.setInterval() to call a Rotate() function at periodic timed intervals, with Stop() calling window.clearInterval(). Being based off of a timer interval would make for more consistent speed on different machines. But you already have the slider to change the speed so that may not be necessary.

- Michael
From: Paul (AIRGLASS)
8 Oct 2007   [#3] In reply to [#2]
Yes, it is fun playing with MoI's scripting once in a while - this little script has turned into a good learning tool for figuring out how to customize MoI. The way you've got it all designed, the possibilities are pretty wide ranging - it wouldn't surprise me to see someone at some point in the future implement a completely different, customized, gui and function set for MoI, (not me tho :) )
Thanks for the comments, Michael, I think I'll play around a bit with your suggestions this evening.
I was kind of wondering about the effect of machine speed on the rotation loop, my current machine is an old PIII 866 and the rotation goes plenty fast on it, but like you say, a faster machine would probably spin a model like a top!
One sort of interesting side effect of auto rotating a model is that the model rotates in one direction if it's centered in the middle of the viewport, but if you pan it off to the side, the perceived rotation reverses, because the whole viewport is actually rotating - sort of a fool-the-eye effect!

Paul
From: Frenchy Pilou (PILOU)
8 Oct 2007   [#4]
Terrific!
The magic of this new thing is that works fine! :)
Even with the another function enable during the process like "full screen" or zoom with the wmouse wheel !
Bravo!
A new modular system of adding function script is born :)
From: Paul (AIRGLASS)
8 Oct 2007   [#5] In reply to [#4]
Hi Pilou,
Yea I noticed that too. It appears that while at least some scripts are running, other functions continue to work, like reset, zoom ,pan, etc. Pretty cool, eh!

Paul
From: Michael T. (MICTU_UTCIM)
8 Oct 2007   [#6]
Hello to all!
I have a lot of modeling time logged in alot of CAD/Modeling programs (MoI ROCKS! by the way) but zero knowledge for scripting, programming etc. Are ther tutorials or stuff "For Dummies" to get started in these areas?

Any help is appreciated.
From: Paul (AIRGLASS)
8 Oct 2007   [#7] In reply to [#6]
Hi Michael,
Here's what appears to be a decent beginning tutorial/reference in Javascript :
http://www.webreference.com/programming/javascript/diaries/
with more links on this page:
http://www.webreference.com/programming/javascript/
This is the first time I've used javascript and it seems fairly easy to pick up (tho I've done some programming years ago in C and bash shell, so that helps). It looks like there's no memory management stuff to deal with, variables don't need to be typed, so javascript is probably a good place to start and it applies to MoI.
Hope that helps a little ---

Paul
From: Frenchy Pilou (PILOU)
8 Oct 2007   [#8] In reply to [#6]
< but zero knowledge for scripting, programming
it's a hard way and very consuming time learning curve from zero ;)

You must learn syntax, mechanism, algorithmic...

Scripting is more easy than programming

In any case make that only for the pleasure ;)

Only kids who have begun precociously are like fishes in water with this area of science :)
From: Michael T. (MICTU_UTCIM)
9 Oct 2007   [#9]
Thanks Paul & Pilou!

How about MoI specific scripting?
From: Michael Gibson
9 Oct 2007   [#10] In reply to [#9]
Hi Michael - there aren't yet any tutorials about scripting in MoI.... I haven't even finished the tutorials for how to just use it regularly yet! :)

Petr and Paul have learned how to do it just by looking through the scripts that come with MoI. Every command in MoI has a script that controls it, you can find them under the \commands subfolder under MoI's main folder in \Program Files.

At some point in the future I would like to work on some documentation for doing scripting inside of MoI, but it takes quite a bit of time to do this type of documentation and if I focused on that it would mean that I would have to postpone working on some modeling features. For now I have put working on new modeling features at a higher priority.

I think it might not be until version 3.0 that I really get a chance to do some more work on stuff for customizing MoI.

- Michael
From: Paul (AIRGLASS)
9 Oct 2007   [#11] In reply to [#10]
Michael explains it better than I can! :)

Paul
From: Michael T. (MICTU_UTCIM)
9 Oct 2007   [#12]
Okay. Thanks again everyone!
From: Michael (ORION20036)
1 Feb 2013   [#13] In reply to [#1]
Hello Michael, is it possible to get the script to loop for more than one revolution, as it would be very handy to do a screen video capture with some of my sculptures, not really that savvy with javascript.
From: coi (MARCO)
1 Feb 2013   [#14] In reply to [#13]
hey michael..

that's already the case, at least on my system(win7 64). did you use the autorotate2 script?



~ marco

Image Attachments:
autor.gif 


From: Michael (ORION20036)
1 Feb 2013   [#15] In reply to [#14]
Sorry, I should have said more than one revolution without the slight pause. I am using the AutoRotate2 script.
From: Michael (ORION20036)
26 Feb 2013   [#16] In reply to [#15]
I posted a few weeks ago relating to being able to modify the AutoRotate2 script to loop more than one time so I can do a screen video capture. The script does turn indefinitely, but has a slight pause with every revolution. Any information on how to modify the script so I can set the number of continuous revolutions without a pause would be appreciated.

I use animation lab with Turbocad, but like the moi rendered version for a quick visual look around of my model, as it is so simple and also fast, plus great for YouTube.

Any help appreciated.


Thank You!.
From: mcramblet
26 Feb 2013   [#17]
Paul-

Thanks for posting this, it works great. I'll have to find a decent Mac OS screen capture program so I can use the script and capture quick animations right out of MoI. Very useful!
From: Michael Gibson
26 Feb 2013   [#18] In reply to [#16]
Hi Michael (ORION20036) - you wrote:

> The script does turn indefinitely, but has a slight pause with every revolution. Any information
> on how to modify the script so I can set the number of continuous revolutions without a pause
> would be appreciated.

It looks like the script currently runs on a "busy loop" where the script is going in a really tight loop kind of continuously churning away. I'll try to modify it to use a timer instead and move more processing over into the main host process. I think that could make for some more consistent motion.

- Michael
From: Michael (ORION20036)
26 Feb 2013   [#19] In reply to [#18]
Many thanks Michael, It has great potential for viewing my Cad Sculptures, especially as it is so simple to capture, and your rendering settings are just perfect.


Many thanks for posting the script also Paul!.
From: Michael Gibson
26 Feb 2013   [#20] In reply to [#19]
Hi Michael, try the attached updated version, this one is kind of "lighter weight" since it doesn't make the script run in a continuous busy loop and that should likely help it have a more consistent motion.

This version will only run on v3 (or v2.5 on the Mac should be ok too).

Hope this helps!

- Michael

Attachments:
AutoRotate2_new.zip


Show messages:  0-19  20-24