Page MenuHome

Pass context to sculpt undo functions
AbandonedPublic

Authored by Bastien Montagne (mont29) on Nov 6 2020, 5:42 PM.

Details

Summary

This essentially sanitize undo sculpt code, no context were passed there, but _end() function was then accessing G_MAIN to retrieve a window manager...

Note that there are one or two places where a context is not available, so those functions have to accept a NULL context then.

This should become also useful for fixing T82388 hopefully.

Diff Detail

Repository
rB Blender

Event Timeline

Bastien Montagne (mont29) requested review of this revision.Nov 6 2020, 5:42 PM
Bastien Montagne (mont29) created this revision.

Rebased on latest master.

All things considered, I'd rather not pass the context to sculpt mode switching functions where possible.

I'm mainly wary of this as it's hard to control what is accessed from within the context, and accessing scene/view ... etc can give odd behavior if it's assumed the object is in that context. In ED_editors_init for example where all objects mode are set, where objects may not be part of the current context.

Since this is only for wm which is effectively a global, this seemed less hassle in the long run. Allowing NULL context is also a paint IMHO as it's not obvious when it's allowed to be NULL, making missing NULL checks easy to accidentally run into. Especially since NULL context is the exception from the norm.