From 12b36168957dd27c253251555c29e8523b94fbe8 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 12 Aug 2022 10:39:03 +0200 Subject: IDType `get_owner`: add an optional hint about owner ID. In some cases, there is a chance code already knows who might be the owner of the given ID, in which case it can be more efficient to check it first (especially in cases like embedded node trees or scene collections, where the only other way is to loop over all possible owners currently). Will be used in next commit in some Outliner fix. --- source/blender/blenkernel/BKE_idtype.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/BKE_idtype.h') diff --git a/source/blender/blenkernel/BKE_idtype.h b/source/blender/blenkernel/BKE_idtype.h index 30f7ed45859..04ea94cbfb4 100644 --- a/source/blender/blenkernel/BKE_idtype.h +++ b/source/blender/blenkernel/BKE_idtype.h @@ -85,7 +85,11 @@ typedef void (*IDTypeForeachCacheFunction)(struct ID *id, typedef void (*IDTypeForeachPathFunction)(struct ID *id, struct BPathForeachPathData *bpath_data); -typedef struct ID *(*IDTypeEmbeddedOwnerGetFunction)(struct Main *bmain, struct ID *id); +/** \param owner_id_hint: If non-NULL, a potential owner of the given embedded ID. Can speed up + * look-up of the owner ID in some cases. */ +typedef struct ID *(*IDTypeEmbeddedOwnerGetFunction)(struct Main *bmain, + struct ID *id, + struct ID *owner_id_hint); typedef void (*IDTypeBlendWriteFunction)(struct BlendWriter *writer, struct ID *id, -- cgit v1.2.3