OK. I think I finally have it. Not yet fully tested, but it looks good as far as Action editing goes.
Documenting here in the hope that it helps another newbie…
As it does seem that properties on the armature itself are not easily animatable. I’ve done
what DanPro suggested and moved them to my root bone (thanks again DanPro).
The associated driver ‘RNA’ paths all had to be changed of course. E.G. from something like
‘data.[“SpineRecovery”]’ to ‘pose.bones[“Root”][“SpineRecovery”]’.
I really wanted to get my sliders all set up in the UI without selecting a specific bone,
so I had to try and work out the changes needed to the UI script I had. What took
the most time here, was working out that I couldn’t use Armature.bones,
but had to use Armature.pose.bones to fetch properties. Once I’d solved that
things came together.
The UI script I started with (using Armature prop’s):
import bpy
class SpineSlider( bpy.types.Panel ):
bl_label = “Animation”
bl_space_type = “VIEW_3D”
bl_region_type = “UI”
def draw(self,context):
layout = self.layout
ob = context.object
if not ob:
return
if ob.type == 'ARMATURE':
layout.prop( ob.data, '["SpineRecovery"]' )
layout.prop( ob.data, '["LeftEyeWink"]' )
layout.prop( ob.data, '["RightEyeWink"]' )
layout.prop( ob.data, '["Snarl"]' )
@classmethod
def poll(cls, context):
return context.active_object.type == 'ARMATURE'
def register():
bpy.utils.register_class(SpineSlider)
def unregister():
bpy.utils.unregister_class(SpineSlider)
register()
This finally ended up looking like this. Which should also be cleaner
in that it won’t get confused with multiple armatures:
import bpy
class AnimationSliders( bpy.types.Panel ):
bl_label = “Animation”
bl_space_type = “VIEW_3D”
bl_region_type = “UI”
def draw(self,context):
layout = self.layout
ob = context.object
if not ob:
return
if (ob.type == 'ARMATURE') and (ob.name == 'FlorenceArmature'):
bone = ob.pose.bones['Root']
layout.prop( bone, '["SpineRecovery"]' )
layout.prop( bone, '["LeftEyeWink"]' )
layout.prop( bone, '["RightEyeWink"]' )
layout.prop( bone, '["Snarl"]' )
@classmethod
def poll(cls, context):
return (context.active_object.type == 'ARMATURE') and (context.active_object.name == 'FlorenceArmature')
def register():
bpy.utils.register_class(AnimationSliders)
def unregister():
bpy.utils.unregister_class(AnimationSliders)
register()