diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-07-30 13:23:37 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-07-31 12:44:59 +0300 |
commit | cc63897c2275dc78af7a82684dde37282b3aa876 (patch) | |
tree | 7d05964e741a7a46a40cccae1969888b75ee96be /source/blender/blenkernel | |
parent | 3305a94fa1d80259651c776e088ec9c6a6f64e44 (diff) |
Sequencer: Add session UUID check function
Is aimed for use during development and debug, to help
verifying that operations do not leave sequences with
invalid UUIDs.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_sequencer.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 29 |
2 files changed, 33 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 6997ea94786..60a0bee801d 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -629,6 +629,10 @@ void BKE_sequencer_all_free_anim_ibufs(struct Scene *scene, int cfra); bool BKE_sequencer_check_scene_recursion(struct Scene *scene, struct ReportList *reports); bool BKE_sequencer_render_loop_check(struct Sequence *seq_main, struct Sequence *seq); +/* A debug and development function which checks whether sequences have unique UUIDs. + * Errors will be reported to the console. */ +void BKE_sequencer_check_uuids_unique_and_report(const struct Scene *scene); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 57295805e97..1be330ee2ef 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -6081,3 +6081,32 @@ bool BKE_sequencer_render_loop_check(Sequence *seq_main, Sequence *seq) return false; } + +void BKE_sequencer_check_uuids_unique_and_report(const Scene *scene) +{ + if (scene->ed == NULL) { + return; + } + + struct GSet *used_uuids = BLI_gset_new( + BLI_session_uuid_ghash_hash, BLI_session_uuid_ghash_compare, "sequencer used uuids"); + + const Sequence *sequence; + SEQ_BEGIN (scene->ed, sequence) { + const SessionUUID *session_uuid = &sequence->runtime.session_uuid; + if (!BLI_session_uuid_is_generated(session_uuid)) { + printf("Sequence %s does not have UUID generated.\n", sequence->name); + continue; + } + + if (BLI_gset_lookup(used_uuids, session_uuid) != NULL) { + printf("Sequence %s has duplicate UUID generated.\n", sequence->name); + continue; + } + + BLI_gset_insert(used_uuids, (void *)session_uuid); + } + SEQ_END; + + BLI_gset_free(used_uuids, NULL); +} |