Hello. I'm creating a camera manipulation tool and am looking to replicate this standard SketchUp behavior:
If I am in the middle of a push/pull, and I activate the orbit tool, change the view, and then hit ESC to cancel, the original push/pull resumes operation at the state it was at. It also recovers to its previous state if from the view tool I directly reactivate push/pull using a hotkey, toolbar, or menu.
One way I've found to do this is to call
Sketchup.active_model.tools.push_tool( mynewToolObject )
instead of
Sketchup.active_model.select_tool( mynewToolObject )
Curiously, this works as desired when using drawing tools like Rect, Line, etc., but not entirely for manipulation tools like push/pull, move, etc. For manipulation tools, if they are mid operation, push_tool() will return false and my tool never gets its activate() call. The manipulation doesn't get interrupted.
If the manipulation tool is not dragging something, however, everything works as expected.
I see there's a Tool.suspend() and Tool.resume(), but these appear to be more like onSuspend() and onResume(), meant for handling that external event when called by SU. It's way cleaner and better encapsulated if an individual Tool need not be aware of the stack it's in, and that appears to be the API intent...
Does anyone have experience doing this or perhaps know of any other plugins that I should reference?
Thanks in advance,
-Y. Malaika