Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r--source/blender/makesrna/intern/rna_access.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index d8c91cb2923..c5dd516d16e 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -5826,26 +5826,29 @@ ID *RNA_find_real_ID_and_path(Main *bmain, ID *id, const char **r_path)
*r_path = "";
}
- if ((id != NULL) && (id->flag & LIB_EMBEDDED_DATA)) {
+ if ((id == NULL) || (id->flag & LIB_EMBEDDED_DATA) == 0) {
+ return id;
+ }
+
+ const IDTypeInfo *id_type = BKE_idtype_get_info_from_id(id);
+ if (r_path) {
switch (GS(id->name)) {
case ID_NT:
- if (r_path) {
- *r_path = "node_tree";
- }
- return BKE_node_tree_find_owner_ID(bmain, (bNodeTree *)id);
+ *r_path = "node_tree";
+ break;
case ID_GR:
- if (r_path) {
- *r_path = "collection";
- }
- return (ID *)BKE_collection_master_scene_search(bmain, (struct Collection *)id);
-
+ *r_path = "collection";
+ break;
default:
- return NULL;
+ BLI_assert(!"Missing handling of embedded id type.");
}
}
- else {
+
+ if (id_type->owner_get == NULL) {
+ BLI_assert(!"Missing handling of embedded id type.");
return id;
}
+ return id_type->owner_get(bmain, id);
}
static char *rna_prepend_real_ID_path(Main *bmain, ID *id, char *path, ID **r_real_id)