π‘ LightUp 7.1 | SketchUp's only real-time renderer that uses object-based rendering
Download Trial
[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.
Advertisement