I’m trying to be notified when part of a mesh change. For that I’m using a depsgraph_update_post handler, in which I call bpy.context.evaluated_depsgraph_get() to get the evaluated depsgraph and its list of updates, that contain the information that the Mesh has changed (and I also get an update for its shape keys).
However I cannot figure out how to know what exactly have changed in the mesh: If the only thing I’m changing is the value of one of its shape keys, the updates I receive seems to be the same as if I change the geometry in edit mode.
This is a problem because the processing I’m doing is quite expensive and I would like to do the expensive part only when the geometry of the mesh changes, not when shapes keys values, or vertex groups names, or uv maps names, etc are changed. The worst part is that the updates seem to be the same even if I just select another shape key (it changes the active state of them so my handler is called, but I don’t really know that it was “just” a click in the interface).
I tried some experiments with msgbus, but there is no documentation for this module and it seems quite limited.
If you figure it out please share. I’m in a similar situation, and I’ve noticed that the depsgraph callback is triggered on virtually every change, no matter how insignificant (selection change triggers it for example)
This information is not tracked by Blender, so it’s also not available in the Python API.
As part of the mesh edit mode performance project there is an idea to start tracking for example if only vertex coordinates and not topology were modified, and if that’s implemented it can also be exposed in the Python API.
For something like the active shape key changing, that has a visible effect in edit mode so it’s tagged as an update. For object mode it could be avoided though.