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