tornavis/tests
Bastien Montagne 6a86dd5f34 LibOverride: Add ID pointer to operations over ID pointers.
In RNA collections storing ID references, the name of the collection
item may not always be unique, when several IDs from different libraries
are present.

While rare, this situation can become deadly to liboverride, by causing
random but exponential liboverride hierarchies corruptions.

This has already been alleviated by using preferably both name and index
in items lookup (a05419f18b) and by reducing the risk of name collision
in general between liboverrides and their linked reference (b9becc47de).

This commit goes further, by ensuring that references to items of RNA
collections of IDs stored in liboverride operations become completely
unambiguous. This is achieved by storing an extra pointer to the item's
ID itself, when relevant.

Lookup then requires a complete match `name + ID` to be successful,
which is guaranteed to match at most a single item in the whole RNA
collection (since RNA collection of IDs do not allow duplicates, and
the ID pointer is always unique).

Note that this ID pointer is implemented as an `std::optional` one
(either directly in C++ code, or using an new liboverride operation `flag`
in DNA). This allows to smoothly transition from existing data to the
added ID pointer info (when needed), without needing any dedicated
versioning. This solution also preserves forward compatibility as much
as possible.

It may also provide marginal performances improvements in some cases, as
looking up for ID items in RNA collections will first check for the
ID pointer, which should be faster than a string comparision.

Implements #110421.

Pull Request: https://projects.blender.org/blender/blender/pulls/110773
2023-08-10 12:41:20 +02:00
..
blender_as_python_module License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
gtests Cleanup: CMake: Modernize bf_guardedalloc dependencies 2023-07-10 18:44:19 +02:00
performance Cleanup: unused-imports in tests/ 2023-07-25 21:43:53 +10:00
python LibOverride: Add ID pointer to operations over ID pointers. 2023-08-10 12:41:20 +02:00
CMakeLists.txt License headers: use SPDX-FileCopyrightText for CMake files 2023-06-14 23:36:23 +10:00