mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
3D Preview - update background from submodel properties. Treats #513
This commit is contained in:
parent
28437d16f7
commit
c5426abf24
3 changed files with 32 additions and 0 deletions
|
@ -4453,6 +4453,10 @@ void lcModel::ShowPropertiesDialog()
|
|||
|
||||
UpdateBackgroundTexture();
|
||||
|
||||
lcPreferences& Preferences = lcGetPreferences();
|
||||
if (Preferences.mPreviewEnabled && Preferences.mPreviewPosition != lcPreviewPosition::Floating)
|
||||
gMainWindow->GetPreviewWidget()->UpdatePreview();
|
||||
|
||||
SaveCheckpoint(tr("Changing Properties"));
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,11 @@ bool lcPreviewDockWidget::SetCurrentPiece(const QString& PartType, int ColorCode
|
|||
return false;
|
||||
}
|
||||
|
||||
void lcPreviewDockWidget::UpdatePreview()
|
||||
{
|
||||
mPreview->UpdatePreview();
|
||||
}
|
||||
|
||||
void lcPreviewDockWidget::ClearPreview()
|
||||
{
|
||||
if (mPreview->GetActiveModel()->GetPieces().GetSize())
|
||||
|
@ -171,6 +176,27 @@ void lcPreviewWidget::ClearPreview()
|
|||
Redraw();
|
||||
}
|
||||
|
||||
void lcPreviewWidget::UpdatePreview()
|
||||
{
|
||||
QString PartType;
|
||||
int ColorCode = -1;
|
||||
lcModel* ActiveModel = GetActiveModel();
|
||||
for (lcPiece* ModelPiece : ActiveModel->GetPieces())
|
||||
{
|
||||
if (ModelPiece->mPieceInfo)
|
||||
{
|
||||
PartType = ModelPiece->mPieceInfo->mFileName;
|
||||
ColorCode = ModelPiece->mColorCode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ClearPreview();
|
||||
|
||||
if (!PartType.isEmpty() && ColorCode > -1)
|
||||
SetCurrentPiece(PartType, ColorCode);
|
||||
}
|
||||
|
||||
void lcPreviewWidget::SetDefaultCamera()
|
||||
{
|
||||
if (!mCamera || !mCamera->IsSimple())
|
||||
|
|
|
@ -24,6 +24,7 @@ public:
|
|||
explicit lcPreviewDockWidget(QMainWindow* parent = nullptr);
|
||||
bool SetCurrentPiece(const QString& PartType, int ColorCode);
|
||||
void ClearPreview();
|
||||
void UpdatePreview();
|
||||
|
||||
protected slots:
|
||||
void SetPreviewLock();
|
||||
|
@ -86,6 +87,7 @@ public:
|
|||
}
|
||||
|
||||
void ClearPreview();
|
||||
void UpdatePreview();
|
||||
bool SetCurrentPiece(const QString& PartType, int ColorCode);
|
||||
lcMatrix44 GetProjectionMatrix() const;
|
||||
lcModel* GetActiveModel() const;
|
||||
|
|
Loading…
Reference in a new issue