dmarx / keyframed

Simple, expressive, pythonic datatypes for manipulating curves parameterized by keyframes and interpolators.
36 stars 1 forks source link

to_cn_string (implemented in this issue) #94

Open dmarx opened 1 year ago

dmarx commented 1 year ago
def kf_to_cn_string(curve):
    return ','.join(
        [f"{kf['t']}:({kf['value']})" 
         for kf in curve.to_dict()['curve'].values()
        ])

# vktrs
kf_to_cn_string(driving_signal_kf)
dmarx commented 1 year ago

^ assumes linear interpolation, need to tweak to check if that's what's being used and iterate over intermediate keyframes if yes. also would be nice if i had a way of incorporating evaluatable math strings in this whole thing..