sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    How to test if user is currently using Photomatch?

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 741 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W Offline
      Whaat
      last edited by

      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

      SketchUp Plugins for Professionals

      1 Reply Last reply Reply Quote 0
      • R Offline
        RickW
        last edited by

        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.

        RickW
        [www.smustard.com](http://www.smustard.com)

        1 Reply Last reply Reply Quote 0
        • W Offline
          Whaat
          last edited by

          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.

          SketchUp Plugins for Professionals

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement