0
$\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
$\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.

| improve this answer | |
$\endgroup$
  • $\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$ – Miroslav Halfar Jan 19 '18 at 14:42

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.