How to test if user is currently using Photomatch?
-
I cannot find an explicit method to test if a user's view is currently a "Photomatched" view. Right now this is what I am considering:
pages=Sketchup.active_model.pages page = pages.selected_page #gets the currently selected page page_label=page.label if page_label.slice("(2D)") #test if (2D) is in the page label cam1=page.camera cam2=Sketchup.active_model.active_view.camera #Do a series of tests to see if cam1==cam2 (eye,target,focal length,etc.) #If the two cameras have all the same properties, user is in photomatch mode end
The only potential problem I see with this code is if there is any other way for the characters (2D) to be inserted into the page label (besides manually inserting them). Is there any SketchUp function (other than photomatch) that will create a page with "(2D)" in the label?
If anyone knows of a better methods to test for this, please suggest....Thanks!
Whaat
-
You could create a Tools observer, which should tell you if the Photomatch tool is active. But beware! on Mac, the names reported by the observer are screwed up. You'll have to rely on the tool number for the script to be cross-platform.
-
Thanks, Rick, but that's not really what I am looking for. I'm not trying to test whether the user is editing their photomatch (i.e. adjusting vanishing points, origin, etc.). I just want to know if the user has selected a photomatch scene tab and has not changed the camera view (photo background is still in view). The active tool could be anything (select, linetool, pushpull, etc, I don't care).
In other words, I just want to test if the photomatch background is still in view. There doesn't seem to be anything in the RenderingOptions, Page, or Camera classes to help me here.
Advertisement