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.
This commit is contained in:
Sergey Sharybin 2020-07-30 12:23:37 +02:00
parent 3305a94fa1
commit cc63897c22
2 changed files with 33 additions and 0 deletions

View File

@ -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

View File

@ -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);
}