Speculation here is that sometimes undo and selection operators are sometimes handled in the same event loop iteration, which leaves non-evaluated dependency graph.
This sounds like a deeper problem, so this change is going over all access to the dependency graph and ensures graph is fully evaluated prior to using it (unless access is generic, where actual evaluation might happen later).
Some general rules:
- Drawing is expected to happen from a fully evaluated dependency graph. There is now a function to access it, which will in the future control that depsgraph is actually evaluated.
- All operators which needs to access evaluated state must use CTX_data_ensure_evaluated_depsgraph(), since it is not known at which state the operator is called and whether the data in it is safe to be read.
- All cases which needs to know depsgraph pointer, but which doesn't want to actually evaluate it can use old-style function CTX_data_depsgraph_pointer(), assuming that underlying code will ensure depsgraph is evaluated prior to accessing it.
- The new functions are replacing OPTYPE_USE_EVAL_DATA, so now it is explicit and local about where depsgraph is being ensured. This commit also contains some fixes of wrong usage of evaluation functions on original objects. Ideally should be split out, but in reality with all the APIs being renamed is quite tricky.