Builds the obs_data blob for a scene-visibility action on the current scene, matching MacroActionSceneVisibility::Save() output. sceneSelection type 3 = current scene. action 0 = SHOW, action 1 = HIDE.
| 102 | // sceneSelection type 3 = current scene. |
| 103 | // action 0 = SHOW, action 1 = HIDE. |
| 104 | static OBSDataAutoRelease buildVisibilityActionData(const QString &sourceName, |
| 105 | int action) |
| 106 | { |
| 107 | OBSDataAutoRelease seg = obs_data_create(); |
| 108 | obs_data_set_bool(seg, "enabled", true); |
| 109 | obs_data_set_int(seg, "version", 2); |
| 110 | |
| 111 | OBSDataAutoRelease sceneSel = obs_data_create(); |
| 112 | obs_data_set_int(sceneSel, "type", 3); // current scene |
| 113 | obs_data_set_string(sceneSel, "canvasSelection", "Main"); |
| 114 | |
| 115 | OBSDataAutoRelease itemSel = obs_data_create(); |
| 116 | obs_data_set_int(itemSel, "type", 0); |
| 117 | obs_data_set_int(itemSel, "idxType", 0); |
| 118 | obs_data_set_int(itemSel, "idx", 0); |
| 119 | obs_data_set_string(itemSel, "item", sourceName.toUtf8().constData()); |
| 120 | |
| 121 | OBSDataAutoRelease data = obs_data_create(); |
| 122 | obs_data_set_obj(data, "segmentSettings", seg); |
| 123 | obs_data_set_string(data, "id", "scene_visibility"); |
| 124 | obs_data_set_obj(data, "sceneSelection", sceneSel); |
| 125 | obs_data_set_obj(data, "sceneItemSelection", itemSel); |
| 126 | obs_data_set_bool(data, "updateTransition", false); |
| 127 | obs_data_set_int(data, "transitionType", 0); |
| 128 | obs_data_set_string(data, "transition", ""); |
| 129 | obs_data_set_bool(data, "updateDuration", false); |
| 130 | Duration().Save(data, "duration"); |
| 131 | obs_data_set_int(data, "action", action); |
| 132 | |
| 133 | return data; |
| 134 | } |
| 135 | |
| 136 | // =========================================================================== |
| 137 | // AudioSourcePage |
no test coverage detected