Hi All,
The Python code was not working for me on Blender 4.0 as there are no layers on this version anymore, it was replaced by Bone Collections. I know this is not a Python focused course, but its still fun to mess with it and useful in animation I think. So after fighting with it a bit I got it to work, replacing the following part of the code:
#Layers
row = col.row()
row.prop(context.active_object.data, "layers", index=0, toggle=True, text="Head")
row = col.row()
row.prop(context.active_object.data, "layers", index=1, toggle=True, text="Claw")
row = col.row()
row.prop(context.active_object.data, "layers", index=16, toggle=True, text="Root")
With:
#Layers
row = col.row()
row.prop(context.active_object.data.collections["Root"], "is_visible",toggle=True, text="Root")
row = col.row()
row.prop(context.active_object.data.collections["Clamp"], "is_visible",toggle=True, text="Clamp")
row = col.row()
row.prop(context.active_object.data.collections["Base"], "is_visible",toggle=True, text="Base")
row = col.row()
row.prop(context.active_object.data.collections["MCH"], "is_visible",toggle=True, text="MCH")
For this to work, instead of having the bones in layers, the collection names need to match context.active_object.data.collections["Root"]. So the bone collection name needs to be Root in this case (or match in code whatever you are using).