2
$\begingroup$

I´m trying to add custom shortcut "E" in Object mode to toggle between Maximum Draw Types (wire, solid, textured, bounds) for selected object, but my attempts were not successful. I read some similar topics from this forum, but unfortunately I do not understand enough to be able to solve it myself.

$\endgroup$

2 Answers 2

4
$\begingroup$

You can define shortcut for list of properties as there are 4 of them in the dropdown list you want shortcut for.

To do that you need to create new shortcut, in this case in 3D View (Global) section so it's accessible in the viewport in all available modes.

Then, instead of "none" in the operator field write there wm.context_menu_enum. This will mean that you are transferring enumeration to the operator. You can steal this setup from any default Blender command, e.g. Snap Element menu which is called via Ctrl+Shift+Tab. You will see there how and where is written command shown above.

Once you confirmed, there will appear 2 fields - RNA and Context Attributes. The last one is what is needed, put there command for the dropdown list, you can get it hovering your mouse over it in Blender interface > Properties editor > Object tab > Display rollout > Maximum Draw Type. The Python command is object.draw_type.
Final settings are shown in the screenshot below.

screenshot-unclear-fields-and-buttons-in-user-preferences

After setting up desired shortcut (Alt+E used in the gif below) you will get dropdown list appearing below your mouse in the viewport. To make it work on several objects do the same as in other cases of changing one property for multiple objects - press Alt before pressing element in the list.

gif-custom-dropdown-list-popping-out-for-some-reason

It will change the property for only one object if Alt isn't pressed.

$\endgroup$
1
  • $\begingroup$ Well, I was pretty close to the solution, but I made a mistake somewhere. But now, I understand how it works much better, thanks a lot $\endgroup$ Commented Jan 19, 2018 at 14:42
2
$\begingroup$

Further more, if anyone is interested in toggling between WIRE and SOLID display type you can use wm.context_toggle_enum instead of wm.context_menu_enum, which then lets you provide the two toggle values. (or pick any two from the available types: TEXTURED, SOLID, WIRE, BOUNDS you want to toggle between).

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .