There are buttons for switching to object mode, edit mode, pose mode and others. How to make sure which of these modes is active using Blender's Python API? Any information would help! Preferably with at least a small example of two simple buttons. For example, layers I managed to do on. off. But layers are not suitable. I will be very glad to your tips. Thank you very much! enter image description here

New contributor
Алексей Неважно is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • In earlier versions, or later with developer extras checked in user prefs > interface > display, you can right click on UI elements and view source. My guess (as I don't have Avatar tools whatever addon) is they are booleans that when toggled update the mode, and unset the previous. – batFINGER Oct 11 at 11:40

You can get the current activated mode with the following:

bpy.context.active_object.mode

This will print things like OBJECT, EDIT, WEIGHT_PAINT, POSE etc

Your Answer

Алексей Неважно is a new contributor. Be nice, and check out our Code of Conduct.
 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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