sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [Question] Switch of model and Interactive Plugins on Mac

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 4 Posters 496 Views 4 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.
    • fredo6F Offline
      fredo6
      last edited by

      Here is a question I should have asked long before, as I don't have a Mac.

      On Mac, you can several SKP documents opened concurrently, each in a separate window.

      Now, when you run an interactive script (based on Sketchup::Tool class), what does happen when you switch from one model window to another one?

      Say the script is RoundCorner. I assume it displays a button palette in the viewport of the window where it is launched.

      If you switch to another model window, what happens

      • is the button palette also displayed in this model window?
      • if not, can you launch RoundCorner again in this model window?

      That may be a basic interrogation, but without a Mac to check, I realize that I don't know the answer.

      Thanks to all

      Fredo

      1 Reply Last reply Reply Quote 0
      • S Offline
        slbaumgartner
        last edited by

        On Mac, there is a bug (which I reported and filed some time ago) in the handling of things created using the various view#draw_xxx methods within a Tool. The items from the currently active_model's view are drawn to all views. As soon as you select a different model/view, it's selected Tool activates and its draw affects all the views. So, ultimately it is only a cosmetic bug because the only Tool active is the one for the active_model, but it is visually quite annoying.

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          New for SketchUp 2015 is a callback in the AppObserver:
          onActivateModel
          It only applies to Mac.

          Commands, MenuItems and Toolbars, should always act upon the active model. Or more specifically, check the active model states when deciding what to return for their validation proc, status bar text and tooltips. (Use commands for both menus and toolbars, and it becomes easier.)

          Tools should always act upon the active model, and it is best if each model gets it's own tool instances, so there will not be any cross-contamination of data. More importantly, when a model is switched, the tool in the "from" model might be deactivated, or might not. It may be left in the same state, but don't count on it. Expect it to be suspended, so implement suspend() and resume() callbacks in your Tool class.

          Each model has it's own toolstack collection, therefore each model has it's own active tool object. These objects may not be instances of the same tool class, and even if they are, they might not be at the same step state. (One may have not done anything, another may have chosen the 1st point, still another the 2nd point, etc.)

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • D Offline
            driven
            last edited by

            click to run gif, if it doesn't...
            like this...
            john

            learn from the mistakes of others, you may not live long enough to make them all yourself...

            1 Reply Last reply Reply Quote 0
            • fredo6F Offline
              fredo6
              last edited by

              Thanks to all for feedback.

              So there is a bug somewhere, because in all my scripts, all viewport drawing (i.e. view draw) are done with the <view> parameter of the Tool#draw method. And anyway, it should only draw to one viewport, not to several.

              Dan: thanks for feedback as well. If each model has its own tool stack, then we can program on Mac as if we were on Windows, that is not bothering about change of model.

              Fredo

              1 Reply Last reply Reply Quote 0
              • S Offline
                slbaumgartner
                last edited by

                As John's animation shows, it isn't a matter of each model not having its own Tool activated, it is an issue with SketchUp duplicating certain view.draw_xxx contents on all existing views. This is a bug we reported some time ago.

                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