Browse Source

UI: Disallow pasting duplicates of sources with DO_NOT_DUPLICATE

This commit prevents users from being able to use the "Paste
(Duplicate)" context menu option after copying a source that has the
OBS_SOURCE_DO_NOT_DUPLICATE flag set. Though OBS would correctly paste
the source as a reference, it seems that this behavior was confusing
some users. This fixes Mantis Bug 1034.
Ryan Foster 8 years ago
parent
commit
0fe4688a34
1 changed files with 6 additions and 1 deletions
  1. 6 1
      UI/window-basic-main.cpp

+ 6 - 1
UI/window-basic-main.cpp

@@ -5757,7 +5757,12 @@ void OBSBasic::on_actionCopySource_triggered()
 	copyVisible = obs_sceneitem_visible(item);
 
 	ui->actionPasteRef->setEnabled(true);
-	ui->actionPasteDup->setEnabled(true);
+
+	uint32_t output_flags = obs_source_get_output_flags(source);
+	if ((output_flags & OBS_SOURCE_DO_NOT_DUPLICATE) == 0)
+		ui->actionPasteDup->setEnabled(true);
+	else
+		ui->actionPasteDup->setEnabled(false);
 }
 
 void OBSBasic::on_actionPasteRef_triggered()