Use consistent positive rotation direction.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17580
This commit is contained in:
parent
42caceb799
commit
4f4311ba57
|
@ -253,6 +253,10 @@ wxString PANEL_PREVIEW_3D_MODEL::formatScaleValue( double aValue )
|
||||||
|
|
||||||
wxString PANEL_PREVIEW_3D_MODEL::formatRotationValue( double aValue )
|
wxString PANEL_PREVIEW_3D_MODEL::formatRotationValue( double aValue )
|
||||||
{
|
{
|
||||||
|
// Sigh. Did we really need differentiated +/- 0.0?
|
||||||
|
if( aValue == -0.0 )
|
||||||
|
aValue = 0.0;
|
||||||
|
|
||||||
return wxString::Format( wxT( "%.2f%s" ),
|
return wxString::Format( wxT( "%.2f%s" ),
|
||||||
aValue,
|
aValue,
|
||||||
EDA_UNIT_UTILS::GetText( EDA_UNITS::DEGREES ) );
|
EDA_UNIT_UTILS::GetText( EDA_UNITS::DEGREES ) );
|
||||||
|
@ -286,9 +290,11 @@ void PANEL_PREVIEW_3D_MODEL::SetSelectedModel( int idx )
|
||||||
yscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.y ) );
|
yscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.y ) );
|
||||||
zscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.z ) );
|
zscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.z ) );
|
||||||
|
|
||||||
xrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.x ) );
|
// Rotation is stored in the file as postive-is-CW, but we use postive-is-CCW in the GUI
|
||||||
yrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.y ) );
|
// to match the rest of KiCad
|
||||||
zrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.z ) );
|
xrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.x ) );
|
||||||
|
yrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.y ) );
|
||||||
|
zrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.z ) );
|
||||||
|
|
||||||
xoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.x ) );
|
xoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.x ) );
|
||||||
yoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.y ) );
|
yoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.y ) );
|
||||||
|
@ -331,9 +337,11 @@ void PANEL_PREVIEW_3D_MODEL::updateOrientation( wxCommandEvent &event )
|
||||||
modelInfo->m_Scale.z = EDA_UNIT_UTILS::UI::DoubleValueFromString(
|
modelInfo->m_Scale.z = EDA_UNIT_UTILS::UI::DoubleValueFromString(
|
||||||
pcbIUScale, EDA_UNITS::UNSCALED, zscale->GetValue() );
|
pcbIUScale, EDA_UNITS::UNSCALED, zscale->GetValue() );
|
||||||
|
|
||||||
modelInfo->m_Rotation.x = rotationFromString( xrot->GetValue() );
|
// Rotation is stored in the file as postive-is-CW, but we use postive-is-CCW in the GUI
|
||||||
modelInfo->m_Rotation.y = rotationFromString( yrot->GetValue() );
|
// to match the rest of KiCad
|
||||||
modelInfo->m_Rotation.z = rotationFromString( zrot->GetValue() );
|
modelInfo->m_Rotation.x = -rotationFromString( xrot->GetValue() );
|
||||||
|
modelInfo->m_Rotation.y = -rotationFromString( yrot->GetValue() );
|
||||||
|
modelInfo->m_Rotation.z = -rotationFromString( zrot->GetValue() );
|
||||||
|
|
||||||
modelInfo->m_Offset.x = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, m_userUnits,
|
modelInfo->m_Offset.x = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, m_userUnits,
|
||||||
xoff->GetValue() )
|
xoff->GetValue() )
|
||||||
|
|
Loading…
Reference in New Issue