[Bf-blender-cvs] [994e3c6ac56] master: Clarify depsgraph API usage in the libraries code

Sergey Sharybin noreply at git.blender.org
Fri Nov 25 15:26:00 CET 2022


Commit: 994e3c6ac56cc9f4d35832805a31420344d7b9ed
Author: Sergey Sharybin
Date:   Fri Nov 25 15:19:46 2022 +0100
Branches: master
https://developer.blender.org/rB994e3c6ac56cc9f4d35832805a31420344d7b9ed

Clarify depsgraph API usage in the libraries code

Basically copy the information from the commit message of the
03e2f11d48dc directly to the code.

This makes the information easier to find when working on the
code.

===================================================================

M	source/blender/blenkernel/intern/lib_id.c

===================================================================

diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c
index f60234a684d..11ebd4c93c0 100644
--- a/source/blender/blenkernel/intern/lib_id.c
+++ b/source/blender/blenkernel/intern/lib_id.c
@@ -168,6 +168,8 @@ static int lib_id_clear_library_data_users_update_cb(LibraryIDLinkCallbackData *
 {
   ID *id = cb_data->user_data;
   if (*cb_data->id_pointer == id) {
+    /* Even though the ID itself remain the same after being made local, from depsgraph point of
+     * view this is a different ID. Hence we need to tag all of its users for COW update. */
     DEG_id_tag_update_ex(
         cb_data->bmain, cb_data->id_owner, ID_RECALC_TAG_FOR_UNDO | ID_RECALC_COPY_ON_WRITE);
     return IDWALK_RET_STOP_ITER;
@@ -232,6 +234,8 @@ void BKE_lib_id_clear_library_data(Main *bmain, ID *id, const int flags)
     BKE_lib_id_clear_library_data(bmain, &key->id, flags);
   }
 
+  /* Even though the ID itself remain the same after being made local, from depsgraph point of view
+   * this is a different ID. Hence we rebuild depsgraph relationships. */
   DEG_relations_tag_update(bmain);
 }



More information about the Bf-blender-cvs mailing list