I'm writing a script to animate tex characters morphing from one character to another. To make it look smooth, I want to sort the splines in the spline collection within curve data (sorting by key).
This is what I'd like to do, but it doesn't work on the bpy_prop_collection.
spline_collection = obj.data.splines #An instance of bpy_prop_collection spline_collection.sort(key = lambda x: get_spline_length(x), reverse = True)
If I put the spline objects in a normal python list, this works well, but then I run into issues when I try to put the splines back into a bpy_props_collection instance. (Due to the fact that I can't seem to deepcopy instances of bpy_struct subclasses, which is its own question.)
EDIT: I did what I needed to do by copying the primitive values I cared about to python lists, then sorting and assigning as needed. A bit of a pain, but it worked.