mirror of
https://github.com/leozide/leocad
synced 2025-01-18 22:26:44 +01:00
Cleanup.
This commit is contained in:
parent
e86ec2300a
commit
00f3f0588f
5 changed files with 36 additions and 26 deletions
|
@ -2495,10 +2495,10 @@ void lcModel::InlineSelectedModels()
|
|||
|
||||
// todo: recreate in groups in the current model
|
||||
|
||||
int ColorIndex = ModelPiece->mColorIndex;
|
||||
int ColorIndex = ModelPiece->GetColorIndex();
|
||||
|
||||
if (ColorIndex == gDefaultColor)
|
||||
ColorIndex = Piece->mColorIndex;
|
||||
ColorIndex = Piece->GetColorIndex();
|
||||
|
||||
NewPiece->SetPieceInfo(ModelPiece->mPieceInfo, ModelPiece->GetID(), true);
|
||||
NewPiece->Initialize(lcMul(ModelPiece->mModelWorld, Piece->mModelWorld), Piece->GetStepShow());
|
||||
|
@ -2819,7 +2819,7 @@ void lcModel::SetSelectedPiecesColorIndex(int ColorIndex)
|
|||
|
||||
for (lcPiece* Piece : mPieces)
|
||||
{
|
||||
if (Piece->IsSelected() && Piece->mColorIndex != ColorIndex)
|
||||
if (Piece->IsSelected() && Piece->GetColorIndex() != ColorIndex)
|
||||
{
|
||||
Piece->SetColorIndex(ColorIndex);
|
||||
Modified = true;
|
||||
|
@ -3270,7 +3270,7 @@ void lcModel::GetPartsList(int DefaultColorIndex, bool ScanSubModels, bool AddSu
|
|||
if (!Piece->IsVisibleInSubModel())
|
||||
continue;
|
||||
|
||||
int ColorIndex = Piece->mColorIndex;
|
||||
int ColorIndex = Piece->GetColorIndex();
|
||||
|
||||
if (ColorIndex == gDefaultColor)
|
||||
ColorIndex = DefaultColorIndex;
|
||||
|
@ -3286,7 +3286,7 @@ void lcModel::GetPartsListForStep(lcStep Step, int DefaultColorIndex, lcPartsLis
|
|||
if (Piece->GetStepShow() != Step || Piece->IsHidden())
|
||||
continue;
|
||||
|
||||
int ColorIndex = Piece->mColorIndex;
|
||||
int ColorIndex = Piece->GetColorIndex();
|
||||
|
||||
if (ColorIndex == gDefaultColor)
|
||||
ColorIndex = DefaultColorIndex;
|
||||
|
@ -3397,7 +3397,7 @@ void lcModel::GetSelectionInformation(int* Flags, lcArray<lcObject*>& Selection,
|
|||
lcArray<lcObject*> lcModel::GetSelectionModePieces(lcPiece* SelectedPiece) const
|
||||
{
|
||||
PieceInfo* Info = SelectedPiece->mPieceInfo;
|
||||
int ColorIndex = SelectedPiece->mColorIndex;
|
||||
int ColorIndex = SelectedPiece->GetColorIndex();
|
||||
lcArray<lcObject*> Pieces;
|
||||
|
||||
switch (gMainWindow->GetSelectionMode())
|
||||
|
@ -3413,13 +3413,13 @@ lcArray<lcObject*> lcModel::GetSelectionModePieces(lcPiece* SelectedPiece) const
|
|||
|
||||
case lcSelectionMode::Color:
|
||||
for (lcPiece* Piece : mPieces)
|
||||
if (Piece->IsVisible(mCurrentStep) && Piece->mColorIndex == ColorIndex && Piece != SelectedPiece)
|
||||
if (Piece->IsVisible(mCurrentStep) && Piece->GetColorIndex() == ColorIndex && Piece != SelectedPiece)
|
||||
Pieces.Add(Piece);
|
||||
break;
|
||||
|
||||
case lcSelectionMode::PieceColor:
|
||||
for (lcPiece* Piece : mPieces)
|
||||
if (Piece->IsVisible(mCurrentStep) && Piece->mPieceInfo == Info && Piece->mColorIndex == ColorIndex && Piece != SelectedPiece)
|
||||
if (Piece->IsVisible(mCurrentStep) && Piece->mPieceInfo == Info && Piece->GetColorIndex() == ColorIndex && Piece != SelectedPiece)
|
||||
Pieces.Add(Piece);
|
||||
break;
|
||||
}
|
||||
|
@ -3811,7 +3811,7 @@ void lcModel::FindPiece(bool FindFirst, bool SearchForward)
|
|||
continue;
|
||||
|
||||
if ((!SearchOptions.MatchInfo || Current->mPieceInfo == SearchOptions.Info) &&
|
||||
(!SearchOptions.MatchColor || Current->mColorIndex == SearchOptions.ColorIndex) &&
|
||||
(!SearchOptions.MatchColor || Current->GetColorIndex() == SearchOptions.ColorIndex) &&
|
||||
(!SearchOptions.MatchName || (Current->GetName().indexOf(SearchOptions.Name, 0, Qt::CaseInsensitive) != -1)))
|
||||
{
|
||||
Focus = Current;
|
||||
|
@ -4075,7 +4075,7 @@ void lcModel::PaintToolClicked(lcObject* Object)
|
|||
|
||||
lcPiece* Piece = (lcPiece*)Object;
|
||||
|
||||
if (Piece->mColorIndex != gMainWindow->mColorIndex)
|
||||
if (Piece->GetColorIndex() != gMainWindow->mColorIndex)
|
||||
{
|
||||
Piece->SetColorIndex(gMainWindow->mColorIndex);
|
||||
|
||||
|
@ -4093,7 +4093,7 @@ void lcModel::ColorPickerToolClicked(lcObject* Object)
|
|||
|
||||
lcPiece* Piece = (lcPiece*)Object;
|
||||
|
||||
gMainWindow->SetColorIndex(Piece->mColorIndex);
|
||||
gMainWindow->SetColorIndex(Piece->GetColorIndex());
|
||||
}
|
||||
|
||||
void lcModel::UpdateZoomTool(lcCamera* Camera, float Mouse)
|
||||
|
@ -4266,7 +4266,7 @@ void lcModel::ShowSelectByColorDialog()
|
|||
lcObject* Focus = GetFocusObject();
|
||||
|
||||
if (Focus && Focus->IsPiece())
|
||||
ColorIndex = ((lcPiece*)Focus)->mColorIndex;
|
||||
ColorIndex = ((lcPiece*)Focus)->GetColorIndex();
|
||||
|
||||
lcSelectByColorDialog Dialog(gMainWindow, ColorIndex);
|
||||
|
||||
|
@ -4277,7 +4277,7 @@ void lcModel::ShowSelectByColorDialog()
|
|||
lcArray<lcObject*> Selection;
|
||||
|
||||
for (lcPiece* Piece : mPieces)
|
||||
if (Piece->IsVisible(mCurrentStep) && Piece->mColorIndex == ColorIndex)
|
||||
if (Piece->IsVisible(mCurrentStep) && Piece->GetColorIndex() == ColorIndex)
|
||||
Selection.Add(Piece);
|
||||
|
||||
SetSelectionAndFocus(Selection, nullptr, 0, false);
|
||||
|
@ -4337,7 +4337,7 @@ void lcModel::ShowArrayDialog()
|
|||
lcPiece* NewPiece = new lcPiece(nullptr);
|
||||
NewPiece->SetPieceInfo(Piece->mPieceInfo, Piece->GetID(), true);
|
||||
NewPiece->Initialize(ModelWorld, mCurrentStep);
|
||||
NewPiece->SetColorIndex(Piece->mColorIndex);
|
||||
NewPiece->SetColorIndex(Piece->GetColorIndex());
|
||||
|
||||
NewPieces.Add(NewPiece);
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ bool lcPreview::SetCurrentPiece(const QString& PartType, int ColorCode)
|
|||
{
|
||||
if (Info == ModelPiece->mPieceInfo)
|
||||
{
|
||||
int ModelColorCode = ModelPiece->mColorCode;
|
||||
int ModelColorCode = ModelPiece->GetColorCode();
|
||||
if (ModelColorCode == ColorCode)
|
||||
return true;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ void lcPreview::UpdatePreview()
|
|||
if (ModelPiece->mPieceInfo)
|
||||
{
|
||||
PartType = ModelPiece->mPieceInfo->mFileName;
|
||||
ColorCode = ModelPiece->mColorCode;
|
||||
ColorCode = ModelPiece->GetColorCode();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ void lcTimelineWidget::Update(bool Clear, bool UpdateItems)
|
|||
{
|
||||
PieceItem->setText(0, Piece->mPieceInfo->m_strDescription);
|
||||
|
||||
int ColorIndex = Piece->mColorIndex;
|
||||
int ColorIndex = Piece->GetColorIndex();
|
||||
if (!mIcons.contains(ColorIndex))
|
||||
{
|
||||
int Size = rowHeight(indexFromItem(PieceItem));
|
||||
|
@ -535,7 +535,7 @@ void lcTimelineWidget::PreviewSelection(QTreeWidgetItem* CurrentItem)
|
|||
if (!Info)
|
||||
return;
|
||||
|
||||
gMainWindow->PreviewPiece(Info->mFileName, Piece->mColorCode, false);
|
||||
gMainWindow->PreviewPiece(Info->mFileName, Piece->GetColorCode(), false);
|
||||
}
|
||||
|
||||
void lcTimelineWidget::UpdateModel()
|
||||
|
|
|
@ -525,12 +525,22 @@ public:
|
|||
mStepHide = mStepShow + 1;
|
||||
}
|
||||
|
||||
quint32 GetColorCode() const
|
||||
{
|
||||
return mColorCode;
|
||||
}
|
||||
|
||||
void SetColorCode(quint32 ColorCode)
|
||||
{
|
||||
mColorCode = ColorCode;
|
||||
mColorIndex = lcGetColorIndex(ColorCode);
|
||||
}
|
||||
|
||||
int GetColorIndex() const
|
||||
{
|
||||
return mColorIndex;
|
||||
}
|
||||
|
||||
void SetColorIndex(int ColorIndex)
|
||||
{
|
||||
mColorIndex = ColorIndex;
|
||||
|
@ -606,9 +616,6 @@ public:
|
|||
public:
|
||||
PieceInfo* mPieceInfo;
|
||||
|
||||
int mColorIndex;
|
||||
quint32 mColorCode;
|
||||
|
||||
lcMatrix44 mModelWorld;
|
||||
lcMatrix44 mPivotMatrix;
|
||||
|
||||
|
@ -633,6 +640,9 @@ protected:
|
|||
|
||||
lcGroup* mGroup;
|
||||
|
||||
int mColorIndex;
|
||||
quint32 mColorCode;
|
||||
|
||||
lcStep mStepShow;
|
||||
lcStep mStepHide;
|
||||
|
||||
|
|
|
@ -764,7 +764,7 @@ void lcQPropertiesTree::slotSetValue(int Value)
|
|||
int ColorIndex = gDefaultColor;
|
||||
lcObject* Focus = gMainWindow->GetActiveModel()->GetFocusObject();
|
||||
if (Focus && Focus->IsPiece())
|
||||
ColorIndex = ((lcPiece*)Focus)->mColorIndex;
|
||||
ColorIndex = ((lcPiece*)Focus)->GetColorIndex();
|
||||
quint32 ColorCode = lcGetColorCode(ColorIndex);
|
||||
gMainWindow->PreviewPiece(Info->mFileName, ColorCode, false);
|
||||
}
|
||||
|
@ -777,7 +777,7 @@ void lcQPropertiesTree::slotColorButtonClicked()
|
|||
lcObject* Focus = gMainWindow->GetActiveModel()->GetFocusObject();
|
||||
|
||||
if (Focus && Focus->IsPiece())
|
||||
ColorIndex = ((lcPiece*)Focus)->mColorIndex;
|
||||
ColorIndex = ((lcPiece*)Focus)->GetColorIndex();
|
||||
|
||||
QWidget* Button = (QWidget*)sender();
|
||||
|
||||
|
@ -939,7 +939,7 @@ void lcQPropertiesTree::SetPiece(const lcArray<lcObject*>& Selection, lcObject*
|
|||
{
|
||||
Show = Piece->GetStepShow();
|
||||
Hide = Piece->GetStepHide();
|
||||
ColorIndex = Piece->mColorIndex;
|
||||
ColorIndex = Piece->GetColorIndex();
|
||||
Info = Piece->mPieceInfo;
|
||||
quint32 ColorCode = lcGetColorCode(ColorIndex);
|
||||
gMainWindow->PreviewPiece(Info->mFileName, ColorCode, false);
|
||||
|
@ -961,7 +961,7 @@ void lcQPropertiesTree::SetPiece(const lcArray<lcObject*>& Selection, lcObject*
|
|||
{
|
||||
Show = SelectedPiece->GetStepShow();
|
||||
Hide = SelectedPiece->GetStepHide();
|
||||
ColorIndex = SelectedPiece->mColorIndex;
|
||||
ColorIndex = SelectedPiece->GetColorIndex();
|
||||
Info = SelectedPiece->mPieceInfo;
|
||||
|
||||
FirstPiece = false;
|
||||
|
@ -974,7 +974,7 @@ void lcQPropertiesTree::SetPiece(const lcArray<lcObject*>& Selection, lcObject*
|
|||
if (SelectedPiece->GetStepHide() != Hide)
|
||||
Hide = 0;
|
||||
|
||||
if (SelectedPiece->mColorIndex != ColorIndex)
|
||||
if (SelectedPiece->GetColorIndex() != ColorIndex)
|
||||
ColorIndex = gDefaultColor;
|
||||
|
||||
if (SelectedPiece->mPieceInfo != Info)
|
||||
|
|
Loading…
Reference in a new issue