Fix (unreported) RNA_pointer_is_null returning true on no-ID pointers.

This behavior seems to have been there since initial implementation of
this function in aed1320b24, 8 years ago.

However, it is clearly wrong, and would return wrong positives in many
cases (the Main RNA pointer itself is generated with a nullptr ID by
`RNA_main_pointer_create`, and a _lot_ of code generates RNA pointers
without any ID owner, as shown by a search e.g. on
`RNA_pointer_create_discrete(nullptr`).

WARNING: While logically correct, there is no real way to tell if this
change is not going to break some weird corner case based on wrong
assumption. in addition to unittests, this has also been checked against
several production files.
This commit is contained in:
Bastien Montagne
2025-10-07 12:21:01 +02:00
parent 20a65fd7f4
commit 854db34385

View File

@@ -241,7 +241,7 @@ PointerRNA RNA_pointer_create_from_ancestor(const PointerRNA &ptr, const int anc
bool RNA_pointer_is_null(const PointerRNA *ptr)
{
return (ptr->data == nullptr) || (ptr->owner_id == nullptr) || (ptr->type == nullptr);
return (ptr->data == nullptr) || (ptr->type == nullptr);
}
PointerRNA RNA_blender_rna_pointer_create()