Cmb Posted July 18, 2019 Share Posted July 18, 2019 Hi, I am struggling with a specific case that was working fine in VectorScript, but not with the SDK. Basically, I have a PIO which is creating multiple objects as kids with CreateCustomObject(), + changing one of its parameter with setParamString. This is triggered from a button in its pane. The expected behavior is to undo all of this with CTRL+Z. But I have to press CTRL+Z a first time and that will cancel the objects creation, and then CTRL+Z a second time to get the changed parameter back. It's not the case in VectorScript with pretty much the same code. I tried to use the Undo Events primitives of the SDK but don't achieved what I wanted, maybe I was doing it wrong. Is there a way to group these undo 'events' together ? Thanks, Quote Link to comment
JBenghiat Posted July 18, 2019 Share Posted July 18, 2019 SetUndoMethod() begins an undo event and EndUndo() ends it. Many VW actions already have associated undo events, for example the reset event or a widget change will already start and end undo. In those cases, you only need to add objects to the undo table (the various add swap commands) of any action that modifies the drawing outside of the object being edited. Quote Link to comment
Cmb Posted July 19, 2019 Author Share Posted July 19, 2019 So regarding this specific case, my problem was relative to VCOMImpl<IProviderShapePane> ::OnWidgetChange(SShapePaneWidgetOnWidgetChange& data, bool& outNeedReset) I realised that outNeedReset beeing "true" was the cause of a second separated Undo event. Setting this boolean to "false" and doing the reset of the object myself permitted to Undo all I wanted with only one CTRL+Z. For other cases I used the various swap commands as you told me and it worked. Thank you Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.