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
This commit is contained in:
parent
1a4a96a9d1
commit
1a1341c387
Notes:
blender-bot
2023-02-14 10:11:54 +01:00
Referenced by commit 52c3214776
, Fix distortion regression test after recent commit
Referenced by issue #101326, Find Missing Files operator corrects the sound file path but the sound strip doesn't work until it is updated
|
@ -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`. */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue