[Code] save Camera properties method
-
[ Code ] save camera properties method
#{ save_camera_properties( camera ) # # Save properties of a Sketchup;;Camera object. # # Arg; camera (an optional Sketchup;;Camera object.) # # With no argument, defaults to using the; # Sketchup.active_model.active_view.camera() # # Returns a Hash of all the camera properties. # def save_camera_properties(cam=nil) # unless cam.is_a?(Sketchup;;Camera) cam = Sketchup.active_model.active_view.camera puts("Using current view's camera.") if $VERBOSE end # verbose = $VERBOSE $VERBOSE = nil # suppress cam.height warning. h = Hash[ ;aspect_ratio, cam.aspect_ratio, ;description, cam.description, ;direction, cam.direction.to_a, ;eye, cam.eye.to_a, ;focal_length, cam.focal_length, ;fov, cam.fov, ;height, cam.height, ;image_width, cam.image_width, ;perspective, cam.perspective?, ;target, cam.target.to_a, ;up, cam.up.to_a, ;xaxis, cam.xaxis.to_a, ;yaxis, cam.yaxis.to_a, ;zaxis, cam.zaxis.to_a ] $VERBOSE = verbose # return h # end #}
-
Each camera has also following properties not available from Ruby:
bool FieldOfViewIsHeight - whether FieldOfView is measured in the y direction
bool Camera2D - whether a camera is 2D or not
Center2D - 2D Point - center of a camera in 2p perspective mode
Scale2D - double - scale (zoom-in/out) for 2p perspective view -
Hi Dan Rathbun
all this code is to work in MAC and PC?
-
@greenskp said:
all this code is to work in MAC and PC?
Yes it will work on both Mac and PC.
BUT it is meant for you to copy it INSIDE your plugin sub-module.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement