[Bf-blender-cvs] [1a1341c3877] blender-v3.4-release: Fix T101326: Missing updates when updating ID file paths.

Bastien Montagne noreply at git.blender.org
Wed Nov 16 18:00:37 CET 2022


Commit: 1a1341c38779311ad315c6cd48a62279c7667887
Author: Bastien Montagne
Date:   Wed Nov 16 17:05:12 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB1a1341c38779311ad315c6cd48a62279c7667887

Fix T101326: Missing updates when updating ID file paths.

This code mainly tags IDs with `ID_RECALC_SOURCE` when one of their file
paths is modified by `BKE_bpath_foreach_path_id`.

In addition, a check is added to `BKE_sound_evaluate` to call similar
code as when `ID_RECALC_AUDIO` is used.

Finally, Sergey added some changes to relations buildings between
components for Sound IDs in the depsgraph, linking `PARAMETER` to
`AUDIO`.

Maniphest Tasks: T101326

Differential Revision: https://developer.blender.org/D16528

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

M	source/blender/blenkernel/BKE_bpath.h
M	source/blender/blenkernel/intern/bpath.c
M	source/blender/blenkernel/intern/sound.c
M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc

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

diff --git a/source/blender/blenkernel/BKE_bpath.h b/source/blender/blenkernel/BKE_bpath.h
index 5b1dea0833a..555cddd34bd 100644
--- a/source/blender/blenkernel/BKE_bpath.h
+++ b/source/blender/blenkernel/BKE_bpath.h
@@ -90,6 +90,13 @@ typedef struct BPathForeachPathData {
   /** The root to use as base for relative paths. Only set if `BKE_BPATH_FOREACH_PATH_ABSOLUTE`
    * flag is set, NULL otherwise. */
   const char *absolute_base_path;
+
+  /** ID owning the path being processed. */
+  struct ID *owner_id;
+
+  /** IDTypeInfo callbacks are responsible to set this boolean if they modified one or more  paths.
+   */
+  bool is_path_modified;
 } BPathForeachPathData;
 
 /** Run `bpath_data.callback_function` on all paths contained in `id`. */
diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c
index 6bf121675bc..61893ca25ed 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -52,6 +52,8 @@
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 
+#include "DEG_depsgraph.h"
+
 #include "BKE_idtype.h"
 #include "BKE_image.h"
 #include "BKE_lib_id.h"
@@ -84,6 +86,8 @@ void BKE_bpath_foreach_path_id(BPathForeachPathData *bpath_data, ID *id)
                             ID_BLEND_PATH(bpath_data->bmain, id) :
                             NULL;
   bpath_data->absolute_base_path = absbase;
+  bpath_data->owner_id = id;
+  bpath_data->is_path_modified = false;
 
   if ((flag & BKE_BPATH_FOREACH_PATH_SKIP_LINKED) && ID_IS_LINKED(id)) {
     return;
@@ -107,6 +111,10 @@ void BKE_bpath_foreach_path_id(BPathForeachPathData *bpath_data, ID *id)
   }
 
   id_type->foreach_path(id, bpath_data);
+
+  if (bpath_data->is_path_modified) {
+    DEG_id_tag_update(id, ID_RECALC_SOURCE | ID_RECALC_COPY_ON_WRITE);
+  }
 }
 
 void BKE_bpath_foreach_path_main(BPathForeachPathData *bpath_data)
@@ -140,6 +148,7 @@ bool BKE_bpath_foreach_path_fixed_process(BPathForeachPathData *bpath_data, char
 
   if (bpath_data->callback_function(bpath_data, path_dst, path_src)) {
     BLI_strncpy(path, path_dst, FILE_MAX);
+    bpath_data->is_path_modified = true;
     return true;
   }
 
@@ -166,6 +175,7 @@ bool BKE_bpath_foreach_path_dirfile_fixed_process(BPathForeachPathData *bpath_da
 
   if (bpath_data->callback_function(bpath_data, path_dst, (const char *)path_src)) {
     BLI_split_dirfile(path_dst, path_dir, path_file, FILE_MAXDIR, FILE_MAXFILE);
+    bpath_data->is_path_modified = true;
     return true;
   }
 
@@ -192,6 +202,7 @@ bool BKE_bpath_foreach_path_allocated_process(BPathForeachPathData *bpath_data,
   if (bpath_data->callback_function(bpath_data, path_dst, path_src)) {
     MEM_freeN(*path);
     (*path) = BLI_strdup(path_dst);
+    bpath_data->is_path_modified = true;
     return true;
   }
 
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 1aef42ef037..86f558474cb 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -1519,6 +1519,12 @@ void BKE_sound_jack_scene_update(Scene *scene, int mode, double time)
 void BKE_sound_evaluate(Depsgraph *depsgraph, Main *bmain, bSound *sound)
 {
   DEG_debug_print_eval(depsgraph, __func__, sound->id.name, sound);
+  if (sound->id.recalc & ID_RECALC_SOURCE) {
+    /* Sequencer checks this flag to see if the strip sound is to be updated from the Audaspace
+     * side. */
+    sound->id.recalc |= ID_RECALC_AUDIO;
+  }
+
   if (sound->id.recalc & ID_RECALC_AUDIO) {
     BKE_sound_load(bmain, sound);
     return;
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index b657d39df69..0e5bcd349c8 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -2970,6 +2970,11 @@ void DepsgraphRelationBuilder::build_sound(bSound *sound)
   build_idproperties(sound->id.properties);
   build_animdata(&sound->id);
   build_parameters(&sound->id);
+
+  const ComponentKey parameters_key(&sound->id, NodeType::PARAMETERS);
+  const ComponentKey audio_key(&sound->id, NodeType::AUDIO);
+
+  add_relation(parameters_key, audio_key, "Parameters -> Audio");
 }
 
 void DepsgraphRelationBuilder::build_simulation(Simulation *simulation)



More information about the Bf-blender-cvs mailing list