mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-03-16 13:37:05 -04:00
UI: Allow adding scenes as scene items
Allows adding scenes as scene items. Note that you will not be able to add scenes if it detects infinite recursion (i.e. adding scene A to scene B, then adding scene B to scene A), in that case it will just fail to create the scene item.
This commit is contained in:
@@ -3050,21 +3050,24 @@ QMenu *OBSBasic::CreateAddSourcePopupMenu()
|
||||
size_t idx = 0;
|
||||
|
||||
QMenu *popup = new QMenu(QTStr("Add"), this);
|
||||
while (obs_enum_input_types(idx++, &type)) {
|
||||
const char *name = obs_source_get_display_name(type);
|
||||
|
||||
if (strcmp(type, "scene") == 0)
|
||||
continue;
|
||||
|
||||
auto addSource = [this, popup] (const char *type, const char *name) {
|
||||
QAction *popupItem = new QAction(QT_UTF8(name), this);
|
||||
popupItem->setData(QT_UTF8(type));
|
||||
connect(popupItem, SIGNAL(triggered(bool)),
|
||||
this, SLOT(AddSourceFromAction()));
|
||||
popup->addAction(popupItem);
|
||||
};
|
||||
|
||||
while (obs_enum_input_types(idx++, &type)) {
|
||||
const char *name = obs_source_get_display_name(type);
|
||||
|
||||
addSource(type, name);
|
||||
foundValues = true;
|
||||
}
|
||||
|
||||
addSource("scene", Str("Basic.Scene"));
|
||||
|
||||
if (!foundValues) {
|
||||
delete popup;
|
||||
popup = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user