UI: Fix locked sources being transformed

This commit is contained in:
Clayton Groeneveld
2020-02-17 13:22:00 -06:00
parent fd244a6896
commit d6969d7732
+23
View File
@@ -4536,6 +4536,7 @@ void OBSBasic::CreateSourcePopupMenu(int idx, bool preview)
popup.addSeparator();
OBSSceneItem sceneItem = ui->sources->Get(idx);
bool lock = obs_sceneitem_locked(sceneItem);
obs_source_t *source = obs_sceneitem_get_source(sceneItem);
uint32_t flags = obs_source_get_output_flags(source);
bool isAsyncVideo = (flags & OBS_SOURCE_ASYNC_VIDEO) ==
@@ -4556,6 +4557,18 @@ void OBSBasic::CreateSourcePopupMenu(int idx, bool preview)
popup.addMenu(ui->orderMenu);
popup.addMenu(ui->transformMenu);
ui->actionResetTransform->setEnabled(!lock);
ui->actionRotate90CW->setEnabled(!lock);
ui->actionRotate90CCW->setEnabled(!lock);
ui->actionRotate180->setEnabled(!lock);
ui->actionFlipHorizontal->setEnabled(!lock);
ui->actionFlipVertical->setEnabled(!lock);
ui->actionFitToScreen->setEnabled(!lock);
ui->actionStretchToScreen->setEnabled(!lock);
ui->actionCenterToScreen->setEnabled(!lock);
ui->actionVerticalCenter->setEnabled(!lock);
ui->actionHorizontalCenter->setEnabled(!lock);
sourceProjector = new QMenu(QTStr("SourceProjector"));
AddProjectorMenuMonitors(sourceProjector, this,
SLOT(OpenSourceProjector()));
@@ -6154,6 +6167,8 @@ static bool reset_tr(obs_scene_t *scene, obs_sceneitem_t *item, void *param)
obs_sceneitem_group_enum_items(item, reset_tr, nullptr);
if (!obs_sceneitem_selected(item))
return true;
if (obs_sceneitem_locked(item))
return true;
obs_sceneitem_defer_update_begin(item);
@@ -6231,6 +6246,8 @@ static bool RotateSelectedSources(obs_scene_t *scene, obs_sceneitem_t *item,
param);
if (!obs_sceneitem_selected(item))
return true;
if (obs_sceneitem_locked(item))
return true;
float rot = *reinterpret_cast<float *>(param);
@@ -6279,6 +6296,8 @@ static bool MultiplySelectedItemScale(obs_scene_t *scene, obs_sceneitem_t *item,
param);
if (!obs_sceneitem_selected(item))
return true;
if (obs_sceneitem_locked(item))
return true;
vec3 tl = GetItemTL(item);
@@ -6322,6 +6341,8 @@ static bool CenterAlignSelectedItems(obs_scene_t *scene, obs_sceneitem_t *item,
param);
if (!obs_sceneitem_selected(item))
return true;
if (obs_sceneitem_locked(item))
return true;
obs_video_info ovi;
obs_get_video_info(&ovi);
@@ -6376,6 +6397,8 @@ static bool center_to_scene(obs_scene_t *, obs_sceneitem_t *item, void *param)
&centerType);
if (!obs_sceneitem_selected(item))
return true;
if (obs_sceneitem_locked(item))
return true;
obs_get_video_info(&ovi);
obs_sceneitem_get_info(item, &oti);