mirror of
https://github.com/leozide/leocad
synced 2025-01-30 20:34:56 +01:00
Merge pull request #44 from j6t/master
Fortify against random control points in imported files.
This commit is contained in:
commit
16bf9c7502
2 changed files with 7 additions and 3 deletions
|
@ -761,7 +761,11 @@ lcuint32 lcPiece::GetAllowedTransforms() const
|
|||
if (Section == LC_PIECE_SECTION_POSITION || Section == LC_PIECE_SECTION_INVALID)
|
||||
return LC_OBJECT_TRANSFORM_MOVE_X | LC_OBJECT_TRANSFORM_MOVE_Y | LC_OBJECT_TRANSFORM_MOVE_Z | LC_OBJECT_TRANSFORM_ROTATE_X | LC_OBJECT_TRANSFORM_ROTATE_Y | LC_OBJECT_TRANSFORM_ROTATE_Z;
|
||||
|
||||
if (mPieceInfo->GetSynthInfo()->IsCurve())
|
||||
lcSynthInfo* SynthInfo = mPieceInfo->GetSynthInfo();
|
||||
if (!SynthInfo)
|
||||
return 0;
|
||||
|
||||
if (SynthInfo->IsCurve())
|
||||
return LC_OBJECT_TRANSFORM_MOVE_X | LC_OBJECT_TRANSFORM_MOVE_Y | LC_OBJECT_TRANSFORM_MOVE_Z | LC_OBJECT_TRANSFORM_ROTATE_X | LC_OBJECT_TRANSFORM_ROTATE_Y | LC_OBJECT_TRANSFORM_ROTATE_Z | LC_OBJECT_TRANSFORM_SCALE_X;
|
||||
else
|
||||
return LC_OBJECT_TRANSFORM_MOVE_Z;
|
||||
|
|
|
@ -745,7 +745,7 @@ void View::DrawSelectMoveOverlay()
|
|||
lcPiece* Piece = (lcPiece*)Focus;
|
||||
lcuint32 Section = Piece->GetFocusSection();
|
||||
|
||||
if (Section >= LC_PIECE_SECTION_CONTROL_POINT_1 && Section <= LC_PIECE_SECTION_CONTROL_POINT_8 && Piece->mPieceInfo->GetSynthInfo()->IsCurve())
|
||||
if (Section >= LC_PIECE_SECTION_CONTROL_POINT_1 && Section <= LC_PIECE_SECTION_CONTROL_POINT_8 && Piece->mPieceInfo->GetSynthInfo() && Piece->mPieceInfo->GetSynthInfo()->IsCurve())
|
||||
{
|
||||
int ControlPointIndex = Section - LC_PIECE_SECTION_CONTROL_POINT_1;
|
||||
float Strength = Piece->GetControlPoints()[ControlPointIndex].Scale;
|
||||
|
@ -1796,7 +1796,7 @@ void View::UpdateTrackTool()
|
|||
|
||||
lcPiece* Piece = (lcPiece*)Focus;
|
||||
|
||||
if (ControlPointIndex != -1 && Piece->mPieceInfo->GetSynthInfo()->IsCurve())
|
||||
if (ControlPointIndex != -1 && Piece->mPieceInfo->GetSynthInfo() && Piece->mPieceInfo->GetSynthInfo()->IsCurve())
|
||||
{
|
||||
float Strength = Piece->GetControlPoints()[ControlPointIndex].Scale;
|
||||
const float ScaleStart = (2.0f - OverlayScaleRadius) * OverlayScale + Strength;
|
||||
|
|
Loading…
Add table
Reference in a new issue