Adjust quad point position and texture U/V relatively

When multiple quad points are selected, adjust the points' positions and texture U/V coordinates relatively instead of setting all points to the same value.

Closes #3359.
This commit is contained in:
Robert Müller 2022-11-27 15:15:44 +01:00
parent 8d5d0cbe83
commit d35975c9b9

View file

@ -984,13 +984,13 @@ int CEditor::PopupPoint(CEditor *pEditor, CUIRect View, void *pContext)
{ {
for(int v = 0; v < 4; v++) for(int v = 0; v < 4; v++)
if(pEditor->m_SelectedPoints & (1 << v)) if(pEditor->m_SelectedPoints & (1 << v))
pQuad->m_aPoints[v].x = i2fx(NewVal); pQuad->m_aPoints[v].x = i2fx(fx2i(pQuad->m_aPoints[v].x) + NewVal - x);
} }
if(Prop == PROP_POS_Y) if(Prop == PROP_POS_Y)
{ {
for(int v = 0; v < 4; v++) for(int v = 0; v < 4; v++)
if(pEditor->m_SelectedPoints & (1 << v)) if(pEditor->m_SelectedPoints & (1 << v))
pQuad->m_aPoints[v].y = i2fx(NewVal); pQuad->m_aPoints[v].y = i2fx(fx2i(pQuad->m_aPoints[v].y) + NewVal - y);
} }
if(Prop == PROP_COLOR) if(Prop == PROP_COLOR)
{ {
@ -1009,13 +1009,13 @@ int CEditor::PopupPoint(CEditor *pEditor, CUIRect View, void *pContext)
{ {
for(int v = 0; v < 4; v++) for(int v = 0; v < 4; v++)
if(pEditor->m_SelectedPoints & (1 << v)) if(pEditor->m_SelectedPoints & (1 << v))
pQuad->m_aTexcoords[v].x = f2fx(NewVal / 1024.0f); pQuad->m_aTexcoords[v].x = f2fx(fx2f(pQuad->m_aTexcoords[v].x) + (NewVal - tu) / 1024.0f);
} }
if(Prop == PROP_TEX_V) if(Prop == PROP_TEX_V)
{ {
for(int v = 0; v < 4; v++) for(int v = 0; v < 4; v++)
if(pEditor->m_SelectedPoints & (1 << v)) if(pEditor->m_SelectedPoints & (1 << v))
pQuad->m_aTexcoords[v].y = f2fx(NewVal / 1024.0f); pQuad->m_aTexcoords[v].y = f2fx(fx2f(pQuad->m_aTexcoords[v].y) + (NewVal - tv) / 1024.0f);
} }
} }