[Plugin] Camera Stats

[Plugin] Camera Stats

Postby MartinRinehart » Thu Apr 22, 2010 7:39 pm

I built this as part of another project. Looking at it I wondered if there wouldn't be uses for it on its own. For example, being able to view two different models from exactly the same camera position or to focus exactly on the origin or some other point.

cam_stats.jpg


To install, extract to your Plugins directory. To use, restart SketchUP and click "Camera Statistics" in your Plugins menu. Continuous mode updates constantly as you zoom, pan, orbit, etc. The "Continuous" button becomes the "On Command" button in continuous mode.

Mac: my guess is that it will work but be ugly. Screen shots appreciated.
0
Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

MartinRinehart 
 

Re: [Plugin] Camera Stats

Postby thomthom » Thu Apr 22, 2010 7:46 pm

MartinRinehart wrote:[...] For example, being able to view two different models from exactly the same camera position [...]

This is in particular useful.

Will have a look at it.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Camera Stats

Postby JClements » Thu Apr 22, 2010 9:07 pm

Martin, so does this just report the camera parameters or can it be used to controll the camera as well?
0
John
Illustrator
Beaverton, Oregon
User avatar
JClements 
Premium Member
Premium Member
 

Re: [Plugin] Camera Stats

Postby Jim » Thu Apr 22, 2010 9:33 pm

Windows users can try this for feedback:

Code: Select all
Sketchup.send_action(10624)


It will accept input, although it doesn't export/import.

319.png
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] Camera Stats

Postby thomthom » Thu Apr 22, 2010 10:04 pm

Jim wrote:It will accept input, although it doesn't export/import.


... it accepts input?? *facepalm!*
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Camera Stats

Postby Chris Fullmer » Thu Apr 22, 2010 10:16 pm

:lol:
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: [Plugin] Camera Stats

Postby MartinRinehart » Fri Apr 23, 2010 1:09 pm

JClements wrote:Martin, so does this just report the camera parameters or can it be used to controll the camera as well?


Both.
0
Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

MartinRinehart 
 

Re: [Plugin] Camera Stats

Postby MartinRinehart » Fri Apr 23, 2010 1:12 pm

Jim wrote:Windows users can try this for feedback:

Code: Select all
Sketchup.send_action(10624)




Wish I'd known that!

Frustum? Adjusted or not?

Edit: I looked it up. Make a pyramid. Make a horizontal slice and discard the top. What's left is a frustum. What this has to do with a camera is a mystery.
0
Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

MartinRinehart 
 

Re: [Plugin] Camera Stats

Postby Fletch » Fri Apr 23, 2010 10:17 pm

Sorry Martin, haven't tried it yet, but can you, in your initial post, please explain the "send data" "get data" buttons?
0

Fletch 
Twilight Render
 

Re: [Plugin] Camera Stats

Postby MartinRinehart » Sat Apr 24, 2010 2:05 pm

Fletch wrote:Sorry Martin, haven't tried it yet, but can you, in your initial post, please explain the "send data" "get data" buttons?


Try it. If these are not immediately meaningful, tell me and I'll add some words.
0
Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

MartinRinehart 
 

Re: [Plugin] Camera Stats

Postby TIG » Sat Apr 24, 2010 2:09 pm

A frustum is explained here... http://en.wikipedia.org/wiki/Viewing_frustum
It's the truncated pyramid, the camera's "view-box", in which there are objects that you will see...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Camera Stats

Postby MartinRinehart » Mon Apr 26, 2010 2:34 pm

Edit: 58 downloads and zero bugs? Hard to believe.

Mac folks: any problems?
0
Last edited by MartinRinehart on Wed Apr 28, 2010 8:44 pm, edited 1 time in total.
Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

MartinRinehart 
 

Re: [Plugin] Camera Stats

Postby Stinkie » Tue Apr 27, 2010 8:27 am

Oooh, a most useful plugin. Thank you, Martin.
0
'Nobody knew health care could be so complicated.' -D. Trump
User avatar
Stinkie 
 

Re: [Plugin] Camera Stats

Postby cmeed » Tue May 04, 2010 12:43 pm

This looks really great!

Works fine on my Mac so far.
Can you tell me about imputing the aspect ratio? i use sketchup to design tv sets so 16:9.
Also does the statistics window always disappear behind the main skp window? so we have to re-size our windows when its opened?

Is it possible with this plugin to show a true camera zoom from a certain location? so i place my camera i can show what it looks like from this position and and THEN from that position what a zoom looks like?
0
User avatar
cmeed 
Premium Member
Premium Member
 

Re: [Plugin] Camera Stats

Postby MartinRinehart » Fri May 07, 2010 9:04 pm

cmeed wrote:Can you tell me about imputing the aspect ratio? i use sketchup to design tv sets so 16:9. Also does the statistics window always disappear behind the main skp window? so we have to re-size our windows when its opened?

Is it possible with this plugin to show a true camera zoom from a certain location? so i place my camera i can show what it looks like from this position and and THEN from that position what a zoom looks like?


Sorry to be so long. Somehow I missed your post.

On my PC, my stats window pops up in front of SketchUp. Stays in front until I click the SketchUp window.

For zoom, use two scenes. Use the Cam Stats plugin to set both scenes' cameras to identical eye, target and up values, but different field of view values. The SketchUp animation should give you a proper zoom.
0
Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

MartinRinehart 
 

Re: [Plugin] Camera Stats

Postby August » Fri May 07, 2010 10:07 pm

TIG wrote:A frustum is ... the camera's "view-box", in which there are objects that you will see...


What most newbies don't know about are the near and far Clipping Planes. Anything closer than the Near Clipping Plane or farther than the Far Clipping Plane will not be displayed. If you could show things that were arbitrarily near or arbitrarily far, the math would require too many decimal places (or bits in the CPU).
0
“An idea, like a ghost, must be spoken to a little before it will explain itself.”
-- Charles Dickens

August 
 

Re: [Plugin] Camera Stats

Postby Jim » Fri May 07, 2010 11:34 pm

MartinRinehart wrote:On my PC, my stats window pops up in front of SketchUp. Stays in front until I click the SketchUp window.


Need to open it modal on the Mac to make it stay on top. There is not a true modal WebDialog on a Mac as there is on Windows.
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] Camera Stats

Postby MartinRinehart » Sat May 08, 2010 8:01 pm

Jim wrote:Need to open it modal on the Mac to make it stay on top.


Thanks, Jim.

I changed it to "show_modal" but it turned the friendly little guy into a huge pain. Almost useless. Certainly no fun.

Mac users: edit the code. It's ...Plugins/camera_stats/camera_stats.rb. Change the line at the bottom that now reads "wd.show()" to "wd.show_modal()". Is that better?
0
Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

MartinRinehart 
 

Re: [Plugin] Camera Stats

Postby thomthom » Sat May 08, 2010 8:18 pm

MartinRinehart wrote:I changed it to "show_modal" but it turned the friendly little guy into a huge pain. Almost useless. Certainly no fun.

What happened?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Camera Stats

Postby cmeed » Mon May 10, 2010 9:59 pm

very good idea about the camera 'zoom'. I'll test your code for the mac users when i have the chance.... Work!!!
0
User avatar
cmeed 
Premium Member
Premium Member
 

Re: [Plugin] Camera Stats

Postby RunnerPack » Thu Sep 23, 2010 7:13 pm

Thanks, Martin. Another in a long line of very handy plugins! :D

Just a couple of bugs to report, and one feature request:

First, I'm running XP SP3, SU 7.1.6860 (free version), and my IE is version 8.0.6001.18702. It seems to have problems when I use it, (which is rarely :P ) so it could be IE's fault, not yours... Anyway, I get the JavaScript error dialog shown in the attached image when I start the plugin (that is, when I open the window, not when SU starts).

Also, the "close" button on the Camera Stats window doesn't do anything (possibly related to the JavaScript error?).

Finally, the feature request:

It would be very handy if I could "pan" the camera left and right, relative to the viewport, by a specified value. For example, if I panned it right by about 2.5", it would be like I closed my left eye and opened my right (do you see where I'm going with this? ;) ). I know (for me, anyway) the math would be pretty rough, but if you have the time, (you obviously have the grey-matter ;) ) I would use this feature ALL OF THE TIME! :D

Anyway, thanks again for the cool plugin!

EDIT: I just had another look at the Camera object API, and I think I know how to do this... Take the cross product of Camera#up and Camera#direction, use the resulting vector (or its negative) to transform Camera#target and Camera#eye, and use Camera#set to put it all back together. Am I close?

EDIT 2: :enlight: Success! After just a bit of tinkering, I got it working! :o :shock: :D

It's pretty much as I said above, but I had to experiment to find out how the API wants things done (plus I was a bit rusty at Ruby :oops:)

I'm going to clean this up and make a new thread for it, just in case someone can use it, but here it is if you, Martin, want to incorporate it (not that you need my amateurish code ;) ) or if someone wants to see what I'm blathering about ;).
0
You might have noticed... I'm a bit of a ferpectionist.
User avatar
RunnerPack 
 

Re: [Plugin] Camera Stats

Postby wwwyoose » Wed Dec 29, 2010 11:27 pm

Hi

I try this nice plugin but I dont get i work to export the camera position ...
or I do some wrong

some help who to...:-)

Best Achim
0

wwwyoose 
 

Re: [Plugin] Camera Stats

Postby rombout » Fri Jan 07, 2011 3:16 am

MartinRinehart wrote:
Jim wrote:Need to open it modal on the Mac to make it stay on top.


Thanks, Jim.

I changed it to "show_modal" but it turned the friendly little guy into a huge pain. Almost useless. Certainly no fun.

Mac users: edit the code. It's ...Plugins/camera_stats/camera_stats.rb. Change the line at the bottom that now reads "wd.show()" to "wd.show_modal()". Is that better?



ii got this error

Error: #<SyntaxError: /Library/Application Support/Google SketchUp 6/SketchUp/Plugins/camera_stats/camera_stats.rb:104: parse error, unexpected tIDENTIFIER, expecting kEND
target = make_arr( val )wd.show
^>
/Library/Application Support/Google SketchUp 6/SketchUp/Plugins/camera_stats_menu.rb:10:in `load'
/Library/Application Support/Google SketchUp 6/SketchUp/Plugins/camera_stats_menu.rb:10
/Library/Application Support/Google SketchUp 6/SketchUp/Plugins/camera_stats_menu.rb:10:in `call'
/Library/Application Support/Google SketchUp 6/SketchUp/Plugins/camera_stats_menu.rb:10


im working on mac su 6
before that line change it dint do any thing either
0
User avatar
rombout 
 

Re: [Plugin] Camera Stats

Postby thomthom » Fri Jan 07, 2011 7:44 am

Looks like target = make_arr( val )wd.show should be
target = make_arr( val )
wd.show
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Camera Stats

Postby TIG » Fri Jan 07, 2011 10:14 am

There's a whole chunk of code lines between the two...
Did you do the edit in a plain-text editor like Notepad.exe ? [or MAC equivalent - perhaps BBedit??]
If you used a wordprocessor then it's added formating and messed up.
Start again with a new file download... :?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Camera Stats

Postby manamana » Fri Jan 21, 2011 4:15 am

This has been very useful - Thank you.

what do the three values of the "up" field represent?
0

manamana 
 

Re: [Plugin] Camera Stats

Postby TIG » Fri Jan 21, 2011 5:59 pm

manamana wrote:This has been very useful - Thank you.

what do the three values of the "up" field represent?

The camera's 'up' is a vector [x,y,z]
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Camera Stats

Postby luismoreno » Tue Jun 19, 2012 7:41 am

This is a good plugin but it appears to work in inches only.
I've positioning a cámera at 2.00 meters height and Camera_Stats reports 78.74 units to Z eye and target coordinates.
It's possible ad all of the other units options (feet, milimeters, centimeters and meters) to plugin?
I don't know how to do due to my poor knowledge to ruby.
Thanks in advance.
0

luismoreno 
 

Re: [Plugin] Camera Stats

Postby TIG » Tue Jun 19, 2012 11:50 am

luismoreno wrote:This is a good plugin but it appears to work in inches only.
I've positioning a cámera at 2.00 meters height and Camera_Stats reports 78.74 units to Z eye and target coordinates.
It's possible ad all of the other units options (feet, milimeters, centimeters and meters) to plugin?
I don't know how to do due to my poor knowledge to ruby.
Thanks in advance.
Eye and Target are Point3d x/y/z values in base-units [inches], Up and Direction are Vector3d x/y/z values.
To make them into say 'mm' edit the main .rb file in the subfolder using Notepad.exe or a similar plain-text editor...
Find the line that includes the text:
... $cam.eye().x() ...
there are x/y/z versions for each of the 4 'types' of $cam methods... between lines #29 and #44 - 12 in all to change...
Add to each as follows:
... $cam.eye().x().to_m ...
etc
The additional '.to_m' converts the passed value from inches into 'm'
There are other converters too - '.to_mm', '.to_cm', '.to_ft' etc ...
So now at least you can convert your report to your desired units...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Camera Stats

Postby luismoreno » Mon Jun 25, 2012 1:07 pm

Thanks, TIG.
It appears running correctly.
You are a champion.
0

luismoreno 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: Google Bot, samdowley and 18 guests

Visit our sponsors: