I am trying to select a bone and make it active in 2.80, so I can run an operation on it (connect it to its parent), the bone gets selected, but does not get active, as shown in the picture, when active, the name of the bone appears in the interface, anyone has an idea what might be the problem here?

enter image description here

Here is the code I use…

bone.select = True;
bone.select_head = True;
bone.select_tail = True;

Thanks in advance Gilles


API properties.

Set the active bone with arm.edit_bones.active = bone. However propose there is no need to use the parenting operator, can rather set the properties, parent, use_connect

Python console code with armature arm in edit mode.

>>> arm

>>> bone = arm.edit_bones["Bone"]
>>> bone2 = arm.edit_bones["Bone.001"]
>>> # active edit bone
>>> C.active_bone.name
# set active edit bone
>>> arm.edit_bones.active = bone
>>> C.active_bone.name
>>> bone2.parent = bone
>>> bone2.parent.name
# check if connected.. nope
>>> bone2.use_connect
# connect
>>> # connect the bone
>>> bone2.use_connect = True
  • $\begingroup$ I tried arm.edit_bones.active = bone before, but not in the right context, now it works, looking at the other code as we speak ! Thanks a bunch for the reply, I really appreciate it ! $\endgroup$ – Gilles Feb 24 '19 at 14:48

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.