Fix: crash when determining RNA data path of driver F-Curve

The F-Curve RNA path function assumed that the F-Curve would be owned by
an Action, which is not the case for drivers, NLA control curves, and
potentially other "free-floating" F-Curves.

This is now checked for, and if the owner is not an Action, the function
refuses to produce a data path. In the future this could be extended to
search through the aforementioned places as well.
This commit is contained in:
Sybren A. Stüvel
2025-05-15 16:31:59 +02:00
parent b13bdcfaeb
commit 54a7b0bc61

View File

@@ -556,6 +556,13 @@ static std::optional<std::string> rna_FCurve_path(const PointerRNA *ptr)
{
using namespace blender;
FCurve *fcurve = reinterpret_cast<FCurve *>(ptr->data);
/* If the F-Curve is not owned by an Action, bail out early. It could be a driver, NLA control
* curve, or stored in some place that's yet unknown at the time of writing of this code. */
if (GS(ptr->owner_id) != ID_AC) {
return {};
}
animrig::Action &action = reinterpret_cast<bAction *>(ptr->owner_id)->wrap();
for (animrig::Layer *layer : action.layers()) {