Question. How I can get global context in modifier?

Question. How can I cause update the display of another (not self) modified object from the modifier? How I can get global context in modifier?

I want to process the update of another object. There is such code, but I don’t know how to get the context.

static Mesh *applyModifier(struct ModifierData *md,
const struct ModifierEvalContext *ctx,
struct Mesh *mesh)

DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);

WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);


Now the object is updated only when switching to edit mode and back to object mode

A modifier should only ever output a new mesh, not modify other objects or their data.

Updating another object breaks the modifier stacks design. Multiple threads may run on different objects which share the same object data.

Of course you could add a lock in this case.
All the same, this is using the applyModifier callback in a way which it’s not meant to be used.