[Plugin Update] Ruby Console Pro with SketchTalk in Motion++
-
11:50 AM, Saturday morning.
There's a new file attached to the original post. You definitely want it. It adds rotation and scale.
Put this in your RCP and Exec it with the new version:
n box o, [20,20,0], 10 box1 = g 'box1' m box1, [20,20,30], 2, 20 s box1, [0,0,0], 2, 2, 2, 5, 20 q box1, [0,0,0], 'gb', 360, 5, 20 m box1, [-20,-20,-30], 20, 30 s box1, [0,0,0], 0.5, 0.5, 0.5, 20, 32 none box o, [-20,-20,0], 10 box2 = g 'box2' m box2, [-20,-20,30], 4, 20 q box2, [0,0,0], 'rb', 360, 5, 18 m box2, [40,40,-20], 25, 30 none box o, [-20,20,0], 10 box3 = g 'box3' m box3, [-20,20,30], 8, 20 m box3, [40,-20,-10], 23, 27 q box3, [0,0,0], 'rb', 360, 20, 23 none box o, [20,-20,0], 10 box4 = g 'box4' m box4, [20,-20,30], 12, 20 m box4, [-20,40,0], 20, 23 q box4, [0,0,0], 'gb', 360, 20, 25 all go
-
OK, John. Got my rotate/scale done. Now back to multi-platform coding.
@driven said:
%(#0040BF)[style type='text/css'
body {
background: #f0ecd8;
height: 100%;
overflow: hidden;]
padding:10pxOn a PC, that gives you this:
It's supposed to look like this:
I can write a little JavaScript that goes something like this:
// not real code! if ( platform === 'Mac' ) { body.style.padding = '10px' }
What about the output and setup windows? Do they need help, too?
-
Martin,
I basically get the exact opposite to your images without the padding, so I add it to all three html's...
and the new script,
SU is hardly working at all when running this (8% of cpu) and it doesn't even slow down if I turn on transparency, shadows and fog...
It's run time comes in at 31.4sec on the mac, how does that compare?
john
-
@driven said:
It's run time comes in at 31.4sec on the mac, how does that compare?
There's a Conductor singleton at the center of the animation.
Every second the conductor looks at his watch. He speeds up or slows down based on what he sees. That means fast and slow machines will all run at the same speed. This animation is scripted for 30 sec. so 31.4 means the conductor is doing a pretty good job.
That 8% number is happy-making! (Edit: I got 0 to 6%.) Boxes are low-poly. 8% means you have room for animating much bigger things. An old-fashioned steam engine, anyone?
-
New SketchTalk for controlling and animating the camera!
There are six new methods, each with two forms but they are very regular. (Before you can use this you have to go buy a folding chair with the word "Director" stenciled in very large letters on the back.)
Now, the things you need to know about the new functions. First, they all start with "c" for camera.
Second, they continue with "e" for camera eye, "f" for camera field of view or "t" for camera target. Now you know four things: start with "c" and then specify "e" for eye, "f" for field of view or "t" for target.
The fifth thing you need to know is that they each have an optional third letter "m" for movement. The
cem()
andctm()
functions move eye and target by a vector from their current location. Thecfm()
function adds the specified number of degrees to the current field of view. (Higher degrees==zoom out.)You set the eye with
ce()
, just once. From then on usecem()
. Similarly, you set the field of view once withcf()
. From then on you change it withcfm()
.The sixth, and last, thing you need to know is that they are like the move, scale and rotate methods. You provide a single value if you just want the thing to happen immediately. You append start and stop second specifications if you want it to be animated. (My personal most common mistake: forget to put 'go' in the script and wonder why nothing happens.)
The first value for
ce()
is aGeom::Point3d
object. That is too much trouble to type, however. Just use a[r,g,b]
array. Ditto forct()
. Ditto for theGeom::Vector3d
you want forcem()
andctm()
.Here's a sample. Yes, its way over the top, but it's still a sample.
n ct [0,0,0] cf 35 cfm 35, 2, 14 cfm -35, 14, 30 ce [ 100, 100, 0] cem [ 0, 0, 50], 0, 2 # 100, 100 cem [ 0, -100, 0 ], 2, 5 # 100, 0 cem [ 0, -100, 0 ], 5, 8 # 100, -100 cem [ -100, 0, 0 ], 8, 11 # 0, -100 cem [ -100, 0, 0 ], 11, 14 # -100, -100 cem [ 0, 100, 0 ], 14, 17 # -100, 0 cem [ 0, 100, 0 ], 17, 20 # -100, 100 cem [ 100, 0, 0 ], 20, 23 # 0, 100 cem [ 100, 0, 0 ], 23, 30 # 100, 100 box o, [20,20,0], 10 box1 = g 'box1' m box1, [20,20,30], 2, 20 s box1, [0,0,0], 2, 2, 2, 5, 20 q box1, [0,0,0], 'gb', 360, 5, 20 m box1, [-20,-20,-30], 20, 30 s box1, [0,0,0], 0.5, 0.5, 0.5, 20, 32 none box o, [-20,-20,0], 10 box2 = g 'box2' m box2, [-20,-20,30], 4, 20 q box2, [0,0,0], 'rb', 360, 5, 18 m box2, [40,40,-20], 25, 30 none box o, [-20,20,0], 10 box3 = g 'box3' m box3, [-20,20,30], 8, 20 m box3, [40,-20,-10], 23, 27 q box3, [0,0,0], 'rb', 360, 20, 23 none box o, [20,-20,0], 10 box4 = g 'box4' m box4, [20,-20,30], 12, 20 m box4, [-20,40,0], 20, 23 q box4, [0,0,0], 'gb', 360, 20, 25 all go
We start with a 35 degree (default if you haven't changed it) field of view. We zoom out to 70, then back in to 35.
The eye takes a clockwise tour around the origin in a big square, from 100,100 to -100,-100. If you think this is easy, try it without copying my code.
Good luck!
-
EDIT: this is what happens when you DON"T swap out the NEW version at top of page, it's all working now
%(#FF0080)[n # nil
ct [0,0,0] # #<NoMethodError: undefined method `ct' for Ruby_Console_Pro:Module>cf 35 # #<NoMethodError: undefined method
cf' for Ruby_Console_Pro:Module> cfm 35, 2, 14 # #<NoMethodError: undefined method
cfm' for Ruby_Console_Pro:Module>
cfm -35, 14, 30 # #<NoMethodError: undefined method `cfm' for Ruby_Console_Pro:Module>ce [ 100, 100, 0] # #<NoMethodError: undefined method
ce' for Ruby_Console_Pro:Module> cem [ 0, 0, 50], 0, 2 # 100, 100 # #<NoMethodError: undefined method
cem' for Ruby_Console_Pro:Module>
cem [ 0, -100, 0 ], 2, 5 # 100, 0 # #<NoMethodError: undefined methodcem' for Ruby_Console_Pro:Module> cem [ 0, -100, 0 ], 5, 8 # 100, -100 # #<NoMethodError: undefined method
cem' for Ruby_Console_Pro:Module>
cem [ -100, 0, 0 ], 8, 11 # 0, -100 # #<NoMethodError: undefined methodcem' for Ruby_Console_Pro:Module> cem [ -100, 0, 0 ], 11, 14 # -100, -100 # #<NoMethodError: undefined method
cem' for Ruby_Console_Pro:Module>
cem [ 0, 100, 0 ], 14, 17 # -100, 0 # #<NoMethodError: undefined methodcem' for Ruby_Console_Pro:Module> cem [ 0, 100, 0 ], 17, 20 # -100, 100 # #<NoMethodError: undefined method
cem' for Ruby_Console_Pro:Module>
cem [ 100, 0, 0 ], 20, 23 # 0, 100 # #<NoMethodError: undefined methodcem' for Ruby_Console_Pro:Module> cem [ 100, 0, 0 ], 23, 30 # 100, 100 # #<NoMethodError: undefined method
cem' for Ruby_Console_Pro:Module>]I'll look closer later, but for now... yesterday's bit ran, but no new camera moves, do I need to require SketchTalk?
john
-
Hi Martin,
I did a quick[ish] hi-poly test 1.5 million edges and it slowed down to 01:27.8 min and was pulling 92-96% on single core of CPU, but ran quite smoothly after the component switch settled down. It certainly looks cool animating grassy blocks...
I know should do it in code, but it's just quick trick to test hi-poly performance
john
-
I so love what you are doing!!!!! How do we get this into the hands of kids so they concurrently learn both their math and animation...Perhaps so they can control undersea vehicles and tophats under the ocean!
-
@driven said:
I did a quick[ish] hi-poly test 1.5 million edges and it slowed down to 01:27.8 min
Take it easy! Your conductor's probably becoming neurotic because he can't get the job done.
Seriously, its good to find the limits. We could actually model the lawn, showing it grow. Would have to do something more clever than modeling each blade separately.
@mptak said:
I so love what you are doing!!!!! How do we get this into the hands of kids ...
Hmmm. Good thought. First, though, a little controller thingie and we've got a really nice walk-through capability for the architects.
-
Video Player now included in very early stage. It pauses and resumes play.
It seems to argue with the timing software. I'll look into that tomorrow. I think what's needed now is a tutorial for creating walkthroughs.
-
@martinrinehart said:
Video Player now included in very early stage. It pauses and resumes play.
It seems to argue with the timing software. I'll look into that tomorrow. I think what's needed now is a tutorial for creating walkthroughs.
pause and resume work, no < << ; >> > [but you didn't say there was..]
the padding 'trick' doesn't work, had to redo as simply padding: 10px
great work, keep it coming
john
-
@driven said:
@martinrinehart said:
Video Player now included in very early stage. It pauses and resumes play.
pause and resume work, no < << ; >> > [but you didn't say there was..]
johnStart/End should be cake. Back, For'd? Hmmm. Timing tho is more worrisome. Did three tests, none of them using pause/resume: 22, 32 and 40 sec. (All should have been 32.)
Does Video Player look OK on Mac? Had to play tricks to get it to look right in MSIE.
-
@martinrinehart said:
Did three tests, none of them using pause/resume: 22, 32 and 40 sec. (All should have been 32.)
the current, 'select all' file is running at 13.5 sec from pressing play until end without using pause, what are you timing?
EDIT: Sometimes, I get 35>37 sec if I re-run 'without' (me) deleting the existing 4 boxes (from a previous run) other times the same thing still runs fast... It is the camera move file, but the non cam version runs at 13.5ish as well@unknownuser said:
Does Video Player look OK on Mac? Had to play tricks to get it to look right in MSIE.
Where is the WD container generated/sized? I was going to see if I could restrict it to the button block size or add some Mac only features as an experiment, but I can't find where you hid it...
-
Timing: 3 tests ranging from 31+ to just under 33 for a 32 second model. (Stupid me: was setting start time at go. Now setting it, correctly, when you click to start.)
@driven said:
Where is the WD container generated/sized?
In the Conductor
initialize()
method,sketch_talk_motion_classes.rb
, line 217. Then position fiddled invideo_player.html
in the <body> tag. This is what I want: -
@martinrinehart said:
This is what I want:
although this probably isn't what you want, I've been using it to try making a MSIE/Safari controller just using text (no images)
I think it looks quite good, but when trying to load from RCPro in PC SU, I kept getting bugsplats, which I put down to me and windows or the ruby,,,
however, when I returned to OSX SU and tried to load from RCPro it also crashed...
after a restart I loaded it with Ruby Console Editor (which I partly wrote it in) and it works fine.
I then went back to PC SU and ran it from Ruby Console...
There are other PC issues with the file , but it does load from Ruby Console and not RCPro...
might be good for bug testing... if you want to have a look, I'll PM the file...
EDIT: Similar but different, not as nice in IE, now to try PC/SU again....ahhhhh
john
-
Cool!
<body scroll=no> MSIE only and should never be used (unless you are locked into MSIE, as we are).
{overflow: hidden;} This is another one you almost never want to use, but, in the case at hand ...
-
@martinrinehart said:Cool!
<body scroll=no> MSIE only and should never be used (unless you are locked into MSIE, as we are).
{overflow: hidden;} This is another one you almost never want to use, but, in the case at hand ...
Hi Martin, I finally got it to work, still not functioning, just the WD bit using shadowed/glow fonts, which you can change colours around in code (not done yet), i.e on action, on hover, etc... I'll PM the file...
-
UL'd minor bug fix version, 6/14.
-
Hello Martin,
This seems to be very interesting but somehow i don't really understand what it is for.
I suppose en environment in which you can easily code animations in Sketchup?Thx for helping me out here
(btw the airshow is great)
-
@martinrinehart said:
Ruby Console Pro
Magnificent Martin! simply Magnificent!
This console is exactly what i have been lamenting about since i first used SketchUp! Had SketchUp included a GUI kit i would of created something like this myself! However i bow to you!
Any who, i had a few questions/suggestions for improvement...
-
Can you combine the input and output windows into one window. Preferably with the output window at the bottom. I have no idea if things like "sizable panes" are available for user customization of the sizes? However even with no customization it would be a nice alternative to have both in one window.
-
I noticed pressing tab does not insert a tab char into the text area, it just does the usual "tabbing" of focus though the widgets. Can this be overridden to insert a tab? I don't care about losing the "tabbing" ability!
PS: oh and i did also have a problem with the buttons being cut off at the top (like a previous poster had mentioned). However I played around with the padding values and was able to rectify it. I am using Vista+SU7+Chrome. So just an FYI.
Thanks again Martin!
-
Advertisement