If your functions can throw null something is already wrong with your software unless you are rapidly prototyping or doing weird multithreaded stuff which honestly you will never need for this operation.
Its legacy cruft nobody went back and fixed, basically.
I never questioned it, since I work with a slow pace within blender.
But I imagine it being annoying if you usually perform 100 model edits in a millisecond and then this stops your workflow. Must be a lot like hitting your little toe.
It’s not a huge deal, I work around some of these issues in my quickmenu addon by temporary switching to object mode before running object mode only code. But I can’t make a button for every single thing that refuses to run outside of object mode bc there are a lot of those 😅
As far as my knowledge goes this is probably because of Undo issues. Under the hood every mode has its own undo stack and is only allowed to touch data related to that mode.
So you either get these errors and greyed out buttons ... or whatever you changed will be hard to undo.
That's beyond me :D
There seem to be a lot of exceptions built into the code over the years to be able to add/remove anything in edit mode that is not object data. Maybe removing a slot was too tricky ...
Usually I think american psycho memes are kinda cringe but this is so fucking spot on. There are a million little roadblocks in the blender user experience that makes it feel like it's being exclusively designed for aliens with 50 pairs of eyes and 12 keyboards
Blender just existed long enough to accumulate a lot of UX quirks, some technical, some just by poor design. But it’s been consistently undoing those quirks and improving, the edit mode weirdness will probably be addressed too at some point
Comments
A moron used a hard object reference instead of a soft object reference.
Calling it in edit-mode would result in an empty/null/invalid reference and crash.
A thing which checks to ensure it isn't null per action would be expensive (which is why you have soft objects in the first place).
Its legacy cruft nobody went back and fixed, basically.
But I imagine it being annoying if you usually perform 100 model edits in a millisecond and then this stops your workflow. Must be a lot like hitting your little toe.
So you either get these errors and greyed out buttons ... or whatever you changed will be hard to undo.
There seem to be a lot of exceptions built into the code over the years to be able to add/remove anything in edit mode that is not object data. Maybe removing a slot was too tricky ...