diff options
author | Bastien Montagne <bastien@blender.org> | 2022-09-08 14:06:40 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-09-08 17:34:31 +0300 |
commit | 462014b59b4f5ad110ebfcbc17dfa1f896582110 (patch) | |
tree | b3b809c4f718a441650b03dd8a5c1adffa20f9cd /source/blender/makesrna | |
parent | 4ac69c26db4c246dfb597411884af2a7ecc7ee66 (diff) |
IDManagement: Add new `BKE_id_owner_get` accessor.
Essentially calls `IDTypeInfo->owner_get` for now, will make more sense
once the callback is changed to return the address of the pointer
instead.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_path.cc | 9 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 3 |
2 files changed, 5 insertions, 7 deletions
diff --git a/source/blender/makesrna/intern/rna_path.cc b/source/blender/makesrna/intern/rna_path.cc index bc77ca3f7d3..6fc1eed7e23 100644 --- a/source/blender/makesrna/intern/rna_path.cc +++ b/source/blender/makesrna/intern/rna_path.cc @@ -16,6 +16,7 @@ #include "BKE_idprop.h" #include "BKE_idtype.h" +#include "BKE_lib_id.h" #include "DNA_ID.h" /* For ID properties. */ @@ -940,11 +941,9 @@ ID *RNA_find_real_ID_and_path(ID *id, const char **r_path) } } - if (id_type->owner_get == nullptr) { - BLI_assert_msg(0, "Missing handling of embedded id type."); - return id; - } - return id_type->owner_get(id); + ID *owner_id = BKE_id_owner_get(id); + BLI_assert_msg(owner_id != nullptr, "Missing handling of embedded id type."); + return (owner_id != nullptr) ? owner_id : id; } static char *rna_prepend_real_ID_path(Main * /*bmain*/, ID *id, char *path, ID **r_real_id) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 61eb2a11c02..e2b3276c45f 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1482,8 +1482,7 @@ static void rna_ImageFormatSettings_color_management_set(PointerRNA *ptr, int va ID *owner_id = ptr->owner_id; if (owner_id && GS(owner_id->name) == ID_NT) { /* For compositing nodes, find the corresponding scene. */ - const IDTypeInfo *type_info = BKE_idtype_get_info_from_id(owner_id); - owner_id = type_info->owner_get(owner_id); + owner_id = BKE_id_owner_get(owner_id); } if (owner_id && GS(owner_id->name) == ID_SCE) { BKE_image_format_color_management_copy_from_scene(imf, (Scene *)owner_id); |