Fixed preview axis. Fixes #571.

This commit is contained in:
Leonardo Zide 2020-12-26 11:44:41 -08:00
parent 17cada38b6
commit c26b52ea5e
2 changed files with 33 additions and 9 deletions

View file

@ -818,8 +818,7 @@ void lcMainWindow::CreatePreviewWidget()
mPreviewToolBar = new QDockWidget(tr("Preview"), this);
mPreviewToolBar->setWindowTitle(tr("Preview"));
mPreviewToolBar->setObjectName("PreviewToolBarw");
mPreviewToolBar->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
mPreviewToolBar->setObjectName("PreviewToolBar");
mPreviewToolBar->setWidget(mPreviewWidget);
addDockWidget(Qt::RightDockWidgetArea, mPreviewToolBar);
@ -830,12 +829,15 @@ void lcMainWindow::CreatePreviewWidget()
void lcMainWindow::TogglePreviewWidget(bool Visible)
{
if (mPreviewToolBar) {
if (mPreviewToolBar)
{
if (Visible)
mPreviewToolBar->show();
else
mPreviewToolBar->hide();
} else if (Visible) {
}
else if (Visible)
{
CreatePreviewWidget();
}
}

View file

@ -422,6 +422,9 @@ lcMatrix44 lcView::GetTileProjectionMatrix(int CurrentRow, int CurrentColumn, in
void lcView::ShowContextMenu() const
{
if (mViewType != lcViewType::View)
return;
QAction** Actions = gMainWindow->mActions;
QMenu* Popup = new QMenu(mWidget);
@ -746,6 +749,7 @@ void lcView::OnDraw()
return;
const lcPreferences& Preferences = lcGetPreferences();
const bool DrawOverlays = mWidget != nullptr;
const bool DrawInterface = mWidget != nullptr && mViewType == lcViewType::View;
mScene->SetAllowLOD(Preferences.mAllowLOD && mWidget != nullptr);
@ -860,13 +864,13 @@ void lcView::OnDraw()
}
if (DrawInterface)
{
mScene->DrawInterfaceObjects(mContext);
if (DrawOverlays)
{
mContext->SetLineWidth(1.0f);
if (Preferences.mDrawAxes)
DrawAxes();
DrawAxes();
lcTool Tool = gMainWindow->GetTool();
lcModel* ActiveModel = GetActiveModel();
@ -883,10 +887,9 @@ void lcView::OnDraw()
DrawRotateViewOverlay();
mViewSphere->Draw();
}
if (mWidget != nullptr)
DrawViewport();
}
mContext->ClearResources();
}
@ -985,6 +988,25 @@ void lcView::DrawViewport() const
void lcView::DrawAxes() const
{
const lcPreferences& Preferences = lcGetPreferences();
switch (mViewType)
{
case lcViewType::View:
if (!Preferences.mDrawAxes)
return;
break;
case lcViewType::Preview:
if (!Preferences.mDrawPreviewAxis)
return;
break;
case lcViewType::Minifig:
case lcViewType::Count:
return;
}
// glClear(GL_DEPTH_BUFFER_BIT);
const float Verts[28 * 3] =