Page 1 of 1

Delete object without passing by RAddObjectsOperation

Posted: Mon Jun 18, 2018 12:44 pm
by sarlaa
Hi,

Please, is there a way to delete an object without passing by RAddObjectsOperation as setCustomProperty.
We want this in purpose that when we delete an object, it doesn't register as operation, and undo/redo won't take it in consideration.

Thanks.

Re: Delete object without passing by RAddObjectsOperation

Posted: Mon Jun 18, 2018 3:37 pm
by andrew
No, you should never change or delete objects directly, bypassing transactions and the undo / redo mechanism.
(Unless, perhaps when you are operating on an off-screen document without any user interaction).

Imagine this simple use case:
Step 1: line added (recorded as transaction, can be undone)
Step 2: line deleted (not recorded, cannot be undone)
Step 3: user hits undo

This would lead to a crash when trying to undo step 1, since the line referenced in step 1 has vanished and its deletion was not recorded. Normally, that line would have been restored when undoing step 2.

Re: Delete object without passing by RAddObjectsOperation

Posted: Mon Jun 18, 2018 7:29 pm
by sarlaa
I see. Thanks for your example.