diff options
author | Bastien Montagne <mont29> | 2022-09-05 16:46:00 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-09-05 17:12:54 +0300 |
commit | cd49fee741148dc9dcc0cbefce0b70ea0f2d55c6 (patch) | |
tree | e8dc62543d0706f127a4e80683ab18dc72ec0494 /source/blender/blenkernel/intern/material.c | |
parent | dd19d6456abf9ee230bcce62fd67f6ab7ab91f16 (diff) |
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
Diffstat (limited to 'source/blender/blenkernel/intern/material.c')
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 248d292664a..442b31ff21e 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1962,8 +1962,8 @@ static void material_default_surface_init(Material *ma) { strcpy(ma->id.name, "MADefault Surface"); - bNodeTree *ntree = ntreeAddTree(NULL, "Shader Nodetree", ntreeType_Shader->idname); - ma->nodetree = ntree; + bNodeTree *ntree = ntreeAddTreeEmbedded( + NULL, &ma->id, "Shader Nodetree", ntreeType_Shader->idname); ma->use_nodes = true; bNode *principled = nodeAddStaticNode(NULL, ntree, SH_NODE_BSDF_PRINCIPLED); @@ -1990,8 +1990,8 @@ static void material_default_volume_init(Material *ma) { strcpy(ma->id.name, "MADefault Volume"); - bNodeTree *ntree = ntreeAddTree(NULL, "Shader Nodetree", ntreeType_Shader->idname); - ma->nodetree = ntree; + bNodeTree *ntree = ntreeAddTreeEmbedded( + NULL, &ma->id, "Shader Nodetree", ntreeType_Shader->idname); ma->use_nodes = true; bNode *principled = nodeAddStaticNode(NULL, ntree, SH_NODE_VOLUME_PRINCIPLED); @@ -2015,8 +2015,8 @@ static void material_default_holdout_init(Material *ma) { strcpy(ma->id.name, "MADefault Holdout"); - bNodeTree *ntree = ntreeAddTree(NULL, "Shader Nodetree", ntreeType_Shader->idname); - ma->nodetree = ntree; + bNodeTree *ntree = ntreeAddTreeEmbedded( + NULL, &ma->id, "Shader Nodetree", ntreeType_Shader->idname); ma->use_nodes = true; bNode *holdout = nodeAddStaticNode(NULL, ntree, SH_NODE_HOLDOUT); |