Blender Git Commit Log

Git Commits -> Revision 176a3ad

January 2, 2020, 19:50 (GMT)
undoexp: Initial, *VERY* basic code using ID names.

This comes from the fact that we are now handling IDs from potentially
many different 'memory realms' (at the very least, two of them, those
read from memfile [new IDs], and those from previous Main [old IDs]).

The main consequence is that using pointers (aka memory addresses) as
'uids' is not working anymore: we'd need to keep some sort of 'history'
of all pointers a given data-block has had to get it working, and that
would likely lead to 'pointer collisions' [1] at some point or another.

So instead we need to use the only kind of uid we have for datablocks:
their names.

That patch is very basic, but it is enough to check undo/redo on basic
object and pose-bone-of-rigged-mesh dummies, not get it crashing, and
demonstrate huges speed-up in some artificial 'worst test case' scenario.

There are still several things to do from there:
* IDname handling:
* Obviously, use a ghash instead of dummy linear list search! Most
likely use BKE_library_idmap code to generate it.
* Check and handle pointers collisions. [1]
* Testing, testing and moar testing! These changes are highly dangerous
and can destroy a blend file completely, so we'll need to be 100% sure
they are working perfectly before puting them in master!

[1] Pointer collision: the issue here is with 'old' memory addresses
stored/used as uid in .blend file. When one read a .blend file as a
whole this is not an issue, since all old data-blocks where in a single
'memory realm' (the old Main valid at time of file writing), and all new
data-blocks are also in a single realm (the newly read file). Since we
only remap each pointer once, this is fine.

But when we start mixing those 'memory realms' by re-using IDs from old
Main in this undo project, we can end up with the same 'uuid' old
pointer value having to be remapped to two different new addresses.

Commit Details:

Full Hash: 176a3adcfdca7d33400e0117deaa723f8bcab368
Parent Commit: ec71992
Lines Changed: +13, -2

1 Modified Path:

/source/blender/blenloader/intern/readfile.c (+13, -2) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021