Objects pointers brokes if undo/redo operation is used

In Blender 2.8x the undo/redo operation system (ctrl+z / ctrl+shift+z) has been completely rebuilt. One of the results of this API change is when the undo operation is performed, all objects in the scene are fully recreated – the current object is destroyed, and a completely new object is created instead. Pointers to the old objects (before the undo operation) now point to invalid objects that can no longer be used.

The official Blender Python API documentation describes this behavior.

You can check this by executing the simple code in the Blender Python Console:

Object lists also broke with undo:

What does all of this turn into practice?

Beware of using long-time living object pointers and object lists in your code. If the user has the ability to press ctrl+z during the lifetime of such a link or list – they will become broken!

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comment
Inline Feedbacks
View all comments