0
$\begingroup$

I would like to make Edit Mode and Object Mode more visually distinct, especially when I have no object selected.

Currently, I scan my screen for little GUI details once in a while to figure out which mode I'm in. I usually have to do this after looking something up with a search engine, for example. If I could change the theme of Edit Mode, I could always know which mode I'm in without thinking about it.

Below is an example of how similar the two modes can look. Sometimes I'll hit a hotkey that doesn't work in a particular mode because I remembered incorrectly which mode I was in when I left.

Object Mode Edit Mode

$\endgroup$
1
2
$\begingroup$

There is a way to (sort of) accomplish this with python scripting, but it's probably not as clean as you would hope and personally I would not recommend it.

You can change between preset themes in a python script by loading in the presets directly from your install path, something like this:

bpy.ops.script.execute_preset(
   filepath="C:\\Program Files\\Blender Foundation\\Blender 2.91\\2.91\\scripts\\presets\\interface_theme\\blender_dark.xml",
   menu_idname="USERPREF_MT_interface_theme_presets")

And you can check which mode you're currently in with the read-only bpy.context.mode property. This will be 'OBJECT' for object mode and one of several 'EDIT_*' values for edit mode. You can check the Python API Docs for a full list of these values.

The hard part is then determining when to execute this script. As far as I'm aware, Blender does not provide a way to register callbacks for modal changes. This essentially leaves two options:

  1. Change your keyboard shortcut(s) (the Tab key by default) to execute your script rather than change modes, and have your script change modes with:

    bpy.ops.object.mode_set(mode='EDIT') # or 'OBJECT' for object mode

    There are several downsides to this, such as that your script still won't execute when you change modes with the interface (dropdown in the top left or the pie menu), and you lose Blender's prediction of what mode you want to enter (based on what mode you're in, previous mode changes, etc.)

  2. You can leave your script always running in the background, searching for mode changes in a loop and changing the theme when it detects one. This is not only incredibly ugly and inefficient, but will also make you lose the respect of any reputable programmer.


Personally, my recommendation would be to just develop the habit of either checking what mode you're in by glancing in the top left, or guaranteeing it using the pie menu (Ctrl+Tab). The latter takes a fraction of a second once you get the hang of it.

$\endgroup$
1
  • 1
    $\begingroup$ I'm taking your recommendation and committing to the habit. The toolbar doubling in size when in Edit Mode seems to be the biggest reliable visual change. It's good to know that one can squirm into the Python API if a problem has not already been solved. Thanks for your thoroughness. $\endgroup$ Dec 4 '20 at 0:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.