The main challenge is to avoid dangling pointers. Currently, the lifetime of socket declarations is somewhat unbounded (at least we didn't restrict it explicitly yet). Therefore, storing non-owning pointers in it tricky. For ID pointers one could potentially use the foreach-id iterator to update pointers in declarations as well, but that's a bit out of scope and might not be the right solution anyway, since it's not obvious that all node declarations are reachable from IDs stored in `bmain`. The solution now is to use a callback that retrieves the right ID pointer when it is used. The important thing is that the callback does not capture any potentially dangling pointer either. Pull Request: blender/blender#107179
19 KiB
19 KiB