Page MenuHome

Fix T77073: Objects cannot be activated after collection exclude

Authored by Nathan Craddock (Zachman) on May 30 2020, 6:00 AM.



When excluding a collection containing the active object in either
texture paint or particle edit mode, the object could not be reactivated
when the collection was re-enabled. This is because the object's mode
was left in TEXTURE_PAINT or PARTICLE_EDIT, and the activation code did
not have cases to handle these modes.

This moves the code that is run when toggling out of texture paint or
particle edit modes to functions so activation can properly toggle off
the respective interaction mode.

Diff Detail

rB Blender
temp-fix-T77073 (branched from master)
Build Status
Buildable 8299
Build 8299: arc lint + arc unit

Event Timeline

Nathan Craddock (Zachman) requested review of this revision.May 30 2020, 6:00 AM
Nathan Craddock (Zachman) created this revision.

This works, but I have a few questions about my code. Also, I needed to add bContext to the ED_object_mode_generic_exit function, so I ended up replacing Main. Not sure if that is more of a "clean up" for later.


I created the ED_object_*_mode_exit() functions here to match the convention, but they are not actually used. Should I keep the _exit or the _exit_ex or both?


Other branches here have an additional if (ob-> ... ) condition. I couldn't identify anything to check for texture paint or particle edit, but I may have missed something.

Also, this function has the only_test parameter which I don't think is ever used in the code. If it's not important I'll clean it up in a separate commit.

Remove accidental newline

Dalai Felinto (dfelinto) requested changes to this revision.Jun 2 2020, 5:09 PM
  1. I don't think you should pass bContext around to get main.
  2. I don't think you should call WM_event_add_notifier from ED_* functions. Call the WM_event from the functions that call the ED_ functions.

Adding Campbell as reviewer since he will know the answer to these 2 points, and can have a final say on the matter.

This revision now requires changes to proceed.Jun 2 2020, 5:09 PM

Relying on the context in this case is risky since we might want to operate on data that isn't active in the current context.

Updated related functions to support exiting edit-mode without relying on the context.

Committed rB30395a491f5a: Fix T77073: Objects cannot be activated after collection exclude

Dalai Felinto (dfelinto) resigned from this revision.Jun 4 2020, 3:30 PM
This revision is now accepted and ready to land.Jun 4 2020, 3:30 PM