TL;DR: When implementing the removed Object.pose_library RNA property as a Python PointerProperty, why do .blends saved with the C++ version (2.93) of the property require re-linking actions when opened with the Python definition (4.x)?
Full context, the legacy Pose Library was removed in Blender 3.x to force users to migrate to the Asset Browser. The Asset system is not a suitable replacement for pose/animation workflows, it’s apples and oranges. Not enough people care or spoke up in time, I suppose.
I have years of old files and hundreds of poses keyed for the old system, converting them to Assets is not viable nor appealing for several reasons (several features/operators still missing, default Pose Asset thumbnail is hardcoded workbench render, no list view).
This year I ported each of the removed pose operators to Python, and set up a modern panel in the N menu. This works as intended, and should work for the foreseeable future (as long as Blender devs do not remove the bpy.types.ActionPoseMarkers
data type). I very much intend to publish it on Github once finished.
The last issue I’m running into is one of the most crucial parts: the Object.pose_library
PointerProperty used to reference the linked poselib Actions.
This registration is fine for new data/scenes saved with the new property, but old scenes drop their Actions to orphans when opened, and they must be re-linked (this can be dozens in one .blend across several separate scenes).
def register():
bpy.types.Object.pose_library = bpy.props.PointerProperty(
type=bpy.types.Action,
override={'LIBRARY_OVERRIDABLE'},
)
Documentation and preceding examples are scarce here. I’m suspecting the issue is due to the C++ definition of pose_library
possessing properties that do not to translate to Python, such as RNA_def_property_pointer_sdna
and values like PROP_ID_REFCOUNT
, or that I am missing another required parameter:
prop = RNA_def_property(srna, "pose_library", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "poselib");
RNA_def_property_struct_type(prop, "Action");
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
RNA_def_property_ui_text(prop,
"Pose Library",
"Deprecated, will be removed in Blender 3.3. "
"Action used as a pose library for armatures");
To prevent data loss while I figure this out, i’ve set an operator to run on startup that will protect any orphaned Actions that have pose markers, but this is after it’s too late and the Actions are already orphaned. I don’t know if it can be caught early enough on startup, so the goal is to prevent this from happening.
It’s more an annoyance at the moment, but the add-on will not be complete without the ability to open files saved prior to 3.x with no manual re-linking. Does anyone have knowledge on these data structures in this context?