diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-04-04 14:02:28 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-04-04 14:02:28 +0300 |
commit | 7db4b935e15c5fbf2810cbb222fd1ff51745a826 (patch) | |
tree | ed0d19cf543a60478c1663542db4b2daf32b2054 /source | |
parent | ef22b837e8e22fd1d6f566edeef9d090032e0996 (diff) |
Depsgraph: Cleanup, reduce indentation level
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc | 69 |
1 files changed, 35 insertions, 34 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index 5be95543801..6cbd6b62851 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -373,49 +373,50 @@ int foreach_libblock_remap_callback(void *user_data_v, ID **id_p, int /*cb_flag*/) { + if (*id_p == NULL) { + return IDWALK_RET_NOP; + } RemapCallbackUserData *user_data = (RemapCallbackUserData *)user_data_v; const Depsgraph *depsgraph = user_data->depsgraph; - if (*id_p != NULL) { - ID *id_orig = *id_p; - if (id_orig == user_data->temp_id) { - DEG_COW_PRINT(" Remapping datablock for %s: id_temp=%p id_cow=%p\n", - id_orig->name, id_orig, user_data->real_id); - *id_p = user_data->real_id; - } - else if (check_datablocks_copy_on_writable(id_orig)) { - ID *id_cow; - if (user_data->create_placeholders) { - /* 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 ID_Type id_type = GS(id_orig->name); - const ID_Type 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; - } + ID *id_orig = *id_p; + if (id_orig == user_data->temp_id) { + DEG_COW_PRINT(" Remapping datablock for %s: id_temp=%p id_cow=%p\n", + id_orig->name, id_orig, user_data->real_id); + *id_p = user_data->real_id; + } + else if (check_datablocks_copy_on_writable(id_orig)) { + ID *id_cow; + if (user_data->create_placeholders) { + /* 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 ID_Type id_type = GS(id_orig->name); + const ID_Type 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 = user_data->node_builder->ensure_cow_id(id_orig); + id_cow = id_node->id_cow; } } else { - id_cow = depsgraph->get_cow_id(id_orig); + id_cow = user_data->node_builder->ensure_cow_id(id_orig); } - BLI_assert(id_cow != NULL); - DEG_COW_PRINT(" Remapping datablock for %s: id_orig=%p id_cow=%p\n", - id_orig->name, id_orig, id_cow); - *id_p = id_cow; } + else { + id_cow = depsgraph->get_cow_id(id_orig); + } + BLI_assert(id_cow != NULL); + DEG_COW_PRINT(" Remapping datablock for %s: id_orig=%p id_cow=%p\n", + id_orig->name, id_orig, id_cow); + *id_p = id_cow; } return IDWALK_RET_NOP; } |