Merge pull request #7682 from furo321/clamp-volume-env

Clamp volume envelopes between 0.0f and 1.0f
This commit is contained in:
Robert Müller 2023-12-18 18:47:57 +00:00 committed by GitHub
commit a1b603a424
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -6918,7 +6918,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
s_vAccurateDragValuesY[k] -= DeltaY;
pEnvelope->m_vPoints[SelectedIndex].m_aValues[SelectedChannel] = std::round(s_vAccurateDragValuesY[k]);
if(pEnvelope->GetChannels() == 4)
if(pEnvelope->GetChannels() == 1 || pEnvelope->GetChannels() == 4)
{
pEnvelope->m_vPoints[i].m_aValues[c] = clamp(pEnvelope->m_vPoints[i].m_aValues[c], 0, 1024);
s_vAccurateDragValuesY[k] = clamp<float>(s_vAccurateDragValuesY[k], 0, 1024);
@ -7383,7 +7383,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
else
pEnvelope->m_vPoints[SelectedIndex].m_aValues[SelectedChannel] = std::round(s_vInitialPositionsY[k] * s_ScaleFactorY);
if(pEnvelope->GetChannels() == 4)
if(pEnvelope->GetChannels() == 1 || pEnvelope->GetChannels() == 4)
pEnvelope->m_vPoints[SelectedIndex].m_aValues[SelectedChannel] = clamp(pEnvelope->m_vPoints[SelectedIndex].m_aValues[SelectedChannel], 0, 1024);
}
}

View file

@ -1534,7 +1534,7 @@ void CEditorActionEditEnvelopePointValue::Apply(bool Undo)
}
else
{
if(pEnvelope->GetChannels() == 4)
if(pEnvelope->GetChannels() == 1 || pEnvelope->GetChannels() == 4)
CurrentValue = clamp(CurrentValue, 0.0f, 1.0f);
pEnvelope->m_vPoints[m_PtIndex].m_aValues[m_Channel] = f2fx(CurrentValue);