Depsgraph: Avoid creating ID nodes for objects which are coming from collections and not layers
If object is only listed in collection but not added to any of layers we shouldn't create placeholder for it, because otherwise we'll leave lots of placeholder ID nodes. Question: can we make this exception to be more reliable?
This commit is contained in:
@@ -368,7 +368,7 @@ struct RemapCallbackUserData {
|
||||
};
|
||||
|
||||
int foreach_libblock_remap_callback(void *user_data_v,
|
||||
ID * /*id_self*/,
|
||||
ID *id_self,
|
||||
ID **id_p,
|
||||
int /*cb_flag*/)
|
||||
{
|
||||
@@ -384,7 +384,28 @@ int foreach_libblock_remap_callback(void *user_data_v,
|
||||
else if (check_datablocks_copy_on_writable(id_orig)) {
|
||||
ID *id_cow;
|
||||
if (user_data->create_placeholders) {
|
||||
id_cow = depsgraph->ensure_cow_id(id_orig);
|
||||
/* Special workaround to stop creating temp datablocks for
|
||||
* objects which are coming from scene's collection and which
|
||||
* are never linked to any of layers.
|
||||
*
|
||||
* TODO(sergey): Ideally we need to tell ID looper to ignore
|
||||
* those or at least make it more reliable check where the
|
||||
* pointer is coming from.
|
||||
*/
|
||||
const short id_type = GS(id_orig->name);
|
||||
const short id_type_self = GS(id_self->name);
|
||||
if (id_type == ID_OB && id_type_self == ID_SCE) {
|
||||
IDDepsNode *id_node = depsgraph->find_id_node(id_orig);
|
||||
if (id_node == NULL) {
|
||||
id_cow = id_orig;
|
||||
}
|
||||
else {
|
||||
id_cow = id_node->id_cow;
|
||||
}
|
||||
}
|
||||
else {
|
||||
id_cow = depsgraph->ensure_cow_id(id_orig);
|
||||
}
|
||||
}
|
||||
else {
|
||||
id_cow = depsgraph->get_cow_id(id_orig);
|
||||
|
||||
Reference in New Issue
Block a user