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

    Excluding from undo stack

    Scheduled Pinned Locked Moved Developers' Forum
    8 Posts 5 Posters 306 Views 5 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.
    • A Offline
      ArunYoganandan
      last edited by

      Hello All,

      I have been working on adapting Sketchup to Virtual Reality displays. Since regular windows and toolbars are not visible in virtual environments, I create custom floating 3D menus (pie menus) that the user can interact with to select tools, components etc. The menus are just faces and groups with textures applied on them that show up in a particular way (Please see attached image). Since these are regular geometries, their creation also ends up becoming part of the undo stack. As a result, when I continue to undo, the menu components get erased.

      Start_operation allows you to make an operation transparent, but it still is part of the stack. Is there a way to eliminate or exclude a set of operations from the undo stack? That would be of great help.

      Thanks,
      Arun


      radialMenu2.jpg

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

        Arun,

        Interesting idea!

        If you are within a tool, you can control Undo events since you receive the onCancel event.

        If not, you can trap the event with Model Observers (in particular onTransactionUndo).

        In your case, I guess the best is to

        • be notified of the event
        • if your 'pseudo' buttons have disappeared, just recreate them (this should be very fast). You can also create the wheel as a component which definition is kept in the model (and on file) and just reloaded to create an instance.

        Fredo

        1 Reply Last reply Reply Quote 0
        • A Offline
          ArunYoganandan
          last edited by

          Thanks Fredo. I will try that.

          Pardon my ignorance, but could you please explain what you mean by trapping? I'm able to attach a modelobserver and receive a call during transactionUndo. I assume you mean some way of prematurely exiting so the Undo would not happen, but since this is just an observer and not a subclass, I'm not sure how that could be done. Any explanation would be of great help.

          Thanks again for your help
          Arun

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

            @arunyoganandan said:

            Thanks Fredo. I will try that.

            Pardon my ignorance, but could you please explain what you mean by trapping? I'm able to attach a modelobserver and receive a call during transactionUndo. I assume you mean some way of prematurely exiting so the Undo would not happen, but since this is just an observer and not a subclass, I'm not sure how that could be done. Any explanation would be of great help.

            Thanks again for your help
            Arun

            I would need to know more on what you do in Ruby.
            Simply, with a Sketchup Tool, you can prevent the Undo to happen, or let it go and then rebuild your button Wheel.

            Fredo

            1 Reply Last reply Reply Quote 0
            • tt_suT Offline
              tt_su
              last edited by

              No way to omit operations form the undo stack. The API wasn't designed for geometry to act as UI elements.

              Only way to remove an operation would be to abort it. If you start an operation before you display your geometry and then abort it before they trigger their command it should be gone from the undo stack. But it's prone to being interfered with by other operation thee user might trigger or other extensions that have observers active.

              1 Reply Last reply Reply Quote 0
              • AdamBA Offline
                AdamB
                last edited by

                Arun,

                Menus are transient elements so it doesn't make sense to use a persistent SU representation. And you'll start rubbing up against stuff like Undo because its kinda abusing the intended use.

                You should be simply generating draw commands as needed.

                Developer of LightUp Click for website

                1 Reply Last reply Reply Quote 0
                • A Offline
                  ArunYoganandan
                  last edited by

                  Hi Everyone,

                  Thanks for your replies and suggestions. Yes, I do agree that I'm twisting the application in a manner that the architecture does not intend to support. I just wanted to see if there were ways to get around the issue I am facing. I will try aborting operations to see if that does what I need.

                  Thanks again!
                  Arun

                  1 Reply Last reply Reply Quote 0
                  • Chris FullmerC Offline
                    Chris Fullmer
                    last edited by

                    If this system is entirely under your control, it would be easy to include all the geometry in the template model. Then when the user opens a new model, all those components are there without any possibility of being undone.

                    Lately you've been tan, suspicious for the winter.
                    All my Plugins I've written

                    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