4
$\begingroup$

I wrote a python script that modifies an existing blender armature that I have and some of these modifications include some commands that are only possible in Edit Mode. I know that depending on what is selected, some modes are not possible to switch to. In my case Pose, Edit and Object mode are the three available modes when I select my armature. In this instance, the following three commands could be used:

bpy.ops.object.mode_set(mode='POSE')

bpy.ops.object.mode_set(mode='EDIT')

bpy.ops.object.mode_set(mode='OBJECT')

Of the above three only the second one switches to wrong mode i.e. Object Mode. I found no similar questions/forums on this kind of issue. When trying to change to Edit Mode, blender changes to Object mode and my commands that are intended for edit mode show context error messages (as expected if in Pose/Object mode..) making it not possible for my script to apply the correct changes.

Does anyone have any idea why this is happening and how I could stop this from happening?? Thanks

$\endgroup$
3
  • 3
    $\begingroup$ Could we see your script, please? It might be faulty. $\endgroup$ – Lukasz-40sth Jan 22 '19 at 9:59
  • $\begingroup$ right in the beginning, when you try to switch to edit mode it does not work. When you select the armature, the menu bar with the modes shows Pose, Edit and Object Mode and the corresponding commands work except for the Edit mode one.. its the first like of my script... $\endgroup$ – Yasmine Jan 23 '19 at 1:32
  • $\begingroup$ I just experienced this today (in Blender 2.79). In my case, I set one armature to edit mode, deselected it, selected a different armature, then tried to set the different armature to edit mode -- this was where the mode_set("EDIT") silently failed. However, if I set the first armature back to object mode before selecting the other armature, then the mode_set("EDIT") on the other armature would succeed. I could be wrong, but Blender seems to only allow 1 armature to be in edit mode, and selecting a different armature (with bpy) doesn't automatically put the first back into object mode. $\endgroup$ – TiberiumFusion Feb 9 at 7:11

Your Answer

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

Browse other questions tagged or ask your own question.