From dfc7fbfdc9b71f376138f2de60313e2f9da669e4 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Fri, 5 Aug 2016 17:43:30 -0700 Subject: [PATCH] UI: Log scenes more cleanly when loading from file --- obs/window-basic-main.cpp | 47 +++++++++++++++++++++++++++++++++++++++ obs/window-basic-main.hpp | 1 + 2 files changed, 48 insertions(+) diff --git a/obs/window-basic-main.cpp b/obs/window-basic-main.cpp index 22182e802..18dc2b6da 100644 --- a/obs/window-basic-main.cpp +++ b/obs/window-basic-main.cpp @@ -482,6 +482,51 @@ void OBSBasic::LoadSceneListOrder(obs_data_array_t *array) } } +static void LogFilter(obs_source_t*, obs_source_t *filter, void *v_val) +{ + const char *name = obs_source_get_name(filter); + const char *id = obs_source_get_id(filter); + int val = (int)(intptr_t)v_val; + string indent; + + for (int i = 0; i < val; i++) + indent += " "; + + blog(LOG_INFO, "%s- filter: '%s' (%s)", indent.c_str(), name, id); +} + +static bool LogSceneItem(obs_scene_t*, obs_sceneitem_t *item, void*) +{ + obs_source_t *source = obs_sceneitem_get_source(item); + const char *name = obs_source_get_name(source); + const char *id = obs_source_get_id(source); + + blog(LOG_INFO, " - source: '%s' (%s)", name, id); + + obs_source_enum_filters(source, LogFilter, (void*)(intptr_t)2); + return true; +} + +void OBSBasic::LogScenes() +{ + blog(LOG_INFO, "------------------------------------------------"); + blog(LOG_INFO, "Loaded scenes:"); + + for (int i = 0; i < ui->scenes->count(); i++) { + QListWidgetItem *item = ui->scenes->item(i); + OBSScene scene = GetOBSRef(item); + + obs_source_t *source = obs_scene_get_source(scene); + const char *name = obs_source_get_name(source); + + blog(LOG_INFO, "- scene '%s':", name); + obs_scene_enum_items(scene, LogSceneItem, nullptr); + obs_source_enum_filters(source, LogFilter, (void*)(intptr_t)1); + } + + blog(LOG_INFO, "------------------------------------------------"); +} + void OBSBasic::Load(const char *file) { if (!file || !os_file_exists(file)) { @@ -630,6 +675,8 @@ retryScene: opt_start_recording = false; } + LogScenes(); + disableSaving--; } diff --git a/obs/window-basic-main.hpp b/obs/window-basic-main.hpp index 0fe477e88..c8d6febea 100644 --- a/obs/window-basic-main.hpp +++ b/obs/window-basic-main.hpp @@ -204,6 +204,7 @@ private: void AddSceneCollection(bool create_new); void RefreshSceneCollections(); void ChangeSceneCollection(); + void LogScenes(); void LoadProfile(); void ResetProfileData();