IDMAnagement: Add owner ID pointer to embedded ones.

Add a dedicated `owner_id` pointer to ID types that can be embedded
(Collections and NodeTrees), and modify slightly come code to make
handling those more safe and consistent.

This implements first part of T69169.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15838
This commit is contained in:
Bastien Montagne
2022-09-05 15:46:00 +02:00
committed by Bastien Montagne
parent dd19d6456a
commit cd49fee741
20 changed files with 118 additions and 89 deletions

View File

@@ -1108,7 +1108,7 @@ static std::string bc_get_uvlayer_name(Mesh *me, int layer)
static bNodeTree *prepare_material_nodetree(Material *ma)
{
if (ma->nodetree == nullptr) {
ma->nodetree = ntreeAddTree(nullptr, "Shader Nodetree", "ShaderNodeTree");
ntreeAddTreeEmbedded(nullptr, &ma->id, "Shader Nodetree", "ShaderNodeTree");
ma->use_nodes = true;
}
return ma->nodetree;