From 462014b59b4f5ad110ebfcbc17dfa1f896582110 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 8 Sep 2022 13:06:40 +0200 Subject: 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. --- source/blender/makesrna/intern/rna_path.cc | 9 ++++----- source/blender/makesrna/intern/rna_scene.c | 3 +-- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'source/blender/makesrna') 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); -- cgit v1.2.3