mirror of
https://github.com/leozide/leocad
synced 2025-01-18 22:26:44 +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();
|
UpdateBackgroundTexture();
|
||||||
|
|
||||||
|
lcPreferences& Preferences = lcGetPreferences();
|
||||||
|
if (Preferences.mPreviewEnabled && Preferences.mPreviewPosition != lcPreviewPosition::Floating)
|
||||||
|
gMainWindow->GetPreviewWidget()->UpdatePreview();
|
||||||
|
|
||||||
SaveCheckpoint(tr("Changing Properties"));
|
SaveCheckpoint(tr("Changing Properties"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,11 @@ bool lcPreviewDockWidget::SetCurrentPiece(const QString& PartType, int ColorCode
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lcPreviewDockWidget::UpdatePreview()
|
||||||
|
{
|
||||||
|
mPreview->UpdatePreview();
|
||||||
|
}
|
||||||
|
|
||||||
void lcPreviewDockWidget::ClearPreview()
|
void lcPreviewDockWidget::ClearPreview()
|
||||||
{
|
{
|
||||||
if (mPreview->GetActiveModel()->GetPieces().GetSize())
|
if (mPreview->GetActiveModel()->GetPieces().GetSize())
|
||||||
|
@ -171,6 +176,27 @@ void lcPreviewWidget::ClearPreview()
|
||||||
Redraw();
|
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()
|
void lcPreviewWidget::SetDefaultCamera()
|
||||||
{
|
{
|
||||||
if (!mCamera || !mCamera->IsSimple())
|
if (!mCamera || !mCamera->IsSimple())
|
||||||
|
|
|
@ -24,6 +24,7 @@ public:
|
||||||
explicit lcPreviewDockWidget(QMainWindow* parent = nullptr);
|
explicit lcPreviewDockWidget(QMainWindow* parent = nullptr);
|
||||||
bool SetCurrentPiece(const QString& PartType, int ColorCode);
|
bool SetCurrentPiece(const QString& PartType, int ColorCode);
|
||||||
void ClearPreview();
|
void ClearPreview();
|
||||||
|
void UpdatePreview();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void SetPreviewLock();
|
void SetPreviewLock();
|
||||||
|
@ -86,6 +87,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearPreview();
|
void ClearPreview();
|
||||||
|
void UpdatePreview();
|
||||||
bool SetCurrentPiece(const QString& PartType, int ColorCode);
|
bool SetCurrentPiece(const QString& PartType, int ColorCode);
|
||||||
lcMatrix44 GetProjectionMatrix() const;
|
lcMatrix44 GetProjectionMatrix() const;
|
||||||
lcModel* GetActiveModel() const;
|
lcModel* GetActiveModel() const;
|
||||||
|
|
Loading…
Reference in a new issue