I'd like to set up a keyboard shortcut that in Object Mode will apply Smooth Shading to a mesh object, or alternately apply Flat Shading if all faces are already smooth.
This would ideally behave similarly to how pressing A will either Select All or Deselect All depending on whether anything is currently selected.
Here's my current setup with two separate shortcuts:
If this were a simple Boolean value situation, like a checkbox that is either on or off, this answer would be a solution. The challenge is that Smooth/Flat is not as simple as yes/no because a mesh can have a combination of both smooth and flat faces.
I'm guessing this will probably involve some scripting because logic will be required to first check the shading of the faces on the mesh. Or maybe (less ideal, but) just apply Smooth Shading the first time the shortcut is pressed, and then alternate between smooth and flat for all subsequent shortcut calls.
I realize it's a geeky ambition, but can anyone point me in the right direction (if this is even possible)? Thanks.