0
$\begingroup$

Basically this, but with bones instead of objects.

Bones seem to be way more complex than objects. This is what I tried to do but it doesn't work and I have no idea why.

import bpy

def bone_callback():
    print('Bone "{}" was selected'.format(bpy.context.object.data.bones.active))


def subscribe_to_bone(selected_bone):
    subscribe_to = bpy.types.ArmatureBones, "active"

    bpy.msgbus.subscribe_rna(
        key = subscribe_to,
        owner = selected_bone,
        args = (selected_bone,),
        notify = bone_callback,
        )

subscribe_to_bone(bpy.context.object.data.bones.active)
$\endgroup$

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.