0
$\begingroup$

I must be doing something horribly wrong, and am hoping someone can help!

I am trying to write a basic panel that allows for some access to NLA Strip params (namely use strip time and strip time) as well as some new custom properties I plan to to script, which is like a new implementation for action speed I call "smart speed".

I've gotten as far as creating the extra parameters and they show up on the panel fine. However, the "Smart Speed" property I created is not animatable, despite being a FloatProperty that I explicitly set as animatable.

import bpy
from bpy.props import FloatProperty, BoolProperty
from bpy.types import PropertyGroup, Action

class SpeedPanel(bpy.types.Panel):
    bl_idname = 'VIEW3D_PT_speed_panel'
    bl_label = 'Time Controller'
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'
    
    def draw(self, context):
        obj = context.object        
        col = self.layout.column()
        row = col.row()
                
        for t in obj.animation_data.nla_tracks:
            for s in t.strips:
                row = col.row()
                row.prop(s, 'name')
                
                row = col.row()
                row.prop(s, 'use_animated_time')
                
                row = col.row()
                row.prop(s, 'strip_time')
                row.enabled = s.use_animated_time
                
                row = col.row()
                row.prop(s.action, 'use_smart_speed')
                row = col.row()
                row.prop(s.action, 'smart_speed')
                row.enabled = s.action.use_smart_speed
                
                row = col.row()
                row.label(text='')

PROPS = [
    ('smart_speed', bpy.props.FloatProperty(name='Smart Speed', default=1.0, options={'ANIMATABLE'})),
    ('use_smart_speed', bpy.props.BoolProperty(name='Use Smart Speed', default=False)),
]

if __name__ == '__main__':
    for (prop_name, prop_value) in PROPS:
        setattr(bpy.types.Action, prop_name, prop_value)
    
    bpy.utils.register_class(SpeedPanel)

When going to keyframe the property, it simply blocks with the warning 'smart_speed property cannot be animated`.

Thank you for reading!

$\endgroup$

1 Answer 1

0
$\begingroup$

I have come to the conclusion that Property objects which are registered to the "Action" type can not be animatable.

I am not sure that I understand why, as NLA strips and other non-object data types and Blender can receive animations on properties. But for now, I have redesigned my add-on to work on scene properties instead, which accept animations.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .