Page MenuHome

IDMAnagement: Add owner ID pointer to embedded ones.
ClosedPublic

Authored by Bastien Montagne (mont29) on Sep 1 2022, 5:45 PM.

Details

Summary

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.

Diff Detail

Repository
rB Blender

Event Timeline

Bastien Montagne (mont29) requested review of this revision.Sep 1 2022, 5:45 PM
Bastien Montagne (mont29) created this revision.
Brecht Van Lommel (brecht) added inline comments.
source/blender/blenkernel/intern/collection.c
168

This owner_id_hint parameter can now be eliminated from IDTypeEmbeddedOwnerGetFunction?

source/blender/blenkernel/intern/node.cc
415–416

Personally I would not these kinds of slow loops in debug builds, but rather:

BLI_assert(ntreeFromID(ntree->owner_id) == ntree)
This revision is now accepted and ready to land.Sep 5 2022, 3:32 PM
Bastien Montagne (mont29) marked 2 inline comments as done.

Updated from comments.

source/blender/blenkernel/intern/collection.c
168

Indeed, but will do in a separate 'cleanup' commit.

source/blender/blenkernel/intern/node.cc
415–416

On second thought, agree this full check is overkill here, your proposed assert seems indeed enough here.