Blender Git Loki

Git Commits -> Revision 3566b81

Revision 3566b81 by Sergey Sharybin (master)
July 31, 2019, 14:55 (GMT)
Refactor access to dependency graph

This change ensures that operators which needs access to evaluated data
first makes sure there is a dependency graph.

Other accesses to the dependency graph made it more explicit about
whether they just need a valid dependency graph pointer or whether they
expect the graph to be already evaluated.

This replaces OPTYPE_USE_EVAL_DATA which is now removed.

Some general rules about usage of accessors:

- 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 dependency graph is actually evaluated.

This check is not yet done because there are some things to be taken
care about first: for example, post-update hooks might leave scene in
a state where something is still tagged for update.

- All operators which needs to access evaluated state must use
CTX_data_ensure_evaluated_depsgraph().

This function replaces OPTYPE_USE_EVAL_DATA.

The call is generally to be done in the very beginning of the
operator, prior other logic (unless this is some comprehensive
operator which might or might not need access to an evaluated state).

This call is never to be used from a loop.

If some utility function requires evaluated state of dependency graph
the graph is to be passed as an explicit argument. This way it is
clear that no evaluation happens in a loop or something like this.

- All cases which needs to know dependency graph 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 dependency graph is evaluated prior to accessing it.

- The new functions are replacing OPTYPE_USE_EVAL_DATA, so now it is
explicit and local about where dependency graph 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.

Fixes T67454: Blender crash on rapid undo and select

Speculation here is that sometimes undo and selection operators are
sometimes handled in the same event loop iteration, which leaves
non-evaluated dependency graph.

Fixes T67973: Crash on Fix Deforms operator
Fixes T67902: Crash when undo a loop cut

Reviewers: brecht

Reviewed By: brecht

Subscribers: lichtwerk

Maniphest Tasks: T67454

Differential Revision: https://developer.blender.org/D5343

Commit Details:

Full Hash: 3566b81c8bfa8c69d542a5de29ecb8d5af3ccb3d
Parent Commit: f5f3003
Lines Changed: +391, -321

Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18 MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2019