mirror of
https://github.com/leozide/leocad
synced 2025-01-29 20:34:50 +01:00
Fixed preview axis. Fixes #571.
This commit is contained in:
parent
17cada38b6
commit
c26b52ea5e
2 changed files with 33 additions and 9 deletions
|
@ -818,8 +818,7 @@ void lcMainWindow::CreatePreviewWidget()
|
||||||
|
|
||||||
mPreviewToolBar = new QDockWidget(tr("Preview"), this);
|
mPreviewToolBar = new QDockWidget(tr("Preview"), this);
|
||||||
mPreviewToolBar->setWindowTitle(tr("Preview"));
|
mPreviewToolBar->setWindowTitle(tr("Preview"));
|
||||||
mPreviewToolBar->setObjectName("PreviewToolBarw");
|
mPreviewToolBar->setObjectName("PreviewToolBar");
|
||||||
mPreviewToolBar->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
|
||||||
mPreviewToolBar->setWidget(mPreviewWidget);
|
mPreviewToolBar->setWidget(mPreviewWidget);
|
||||||
addDockWidget(Qt::RightDockWidgetArea, mPreviewToolBar);
|
addDockWidget(Qt::RightDockWidgetArea, mPreviewToolBar);
|
||||||
|
|
||||||
|
@ -830,12 +829,15 @@ void lcMainWindow::CreatePreviewWidget()
|
||||||
|
|
||||||
void lcMainWindow::TogglePreviewWidget(bool Visible)
|
void lcMainWindow::TogglePreviewWidget(bool Visible)
|
||||||
{
|
{
|
||||||
if (mPreviewToolBar) {
|
if (mPreviewToolBar)
|
||||||
|
{
|
||||||
if (Visible)
|
if (Visible)
|
||||||
mPreviewToolBar->show();
|
mPreviewToolBar->show();
|
||||||
else
|
else
|
||||||
mPreviewToolBar->hide();
|
mPreviewToolBar->hide();
|
||||||
} else if (Visible) {
|
}
|
||||||
|
else if (Visible)
|
||||||
|
{
|
||||||
CreatePreviewWidget();
|
CreatePreviewWidget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -422,6 +422,9 @@ lcMatrix44 lcView::GetTileProjectionMatrix(int CurrentRow, int CurrentColumn, in
|
||||||
|
|
||||||
void lcView::ShowContextMenu() const
|
void lcView::ShowContextMenu() const
|
||||||
{
|
{
|
||||||
|
if (mViewType != lcViewType::View)
|
||||||
|
return;
|
||||||
|
|
||||||
QAction** Actions = gMainWindow->mActions;
|
QAction** Actions = gMainWindow->mActions;
|
||||||
|
|
||||||
QMenu* Popup = new QMenu(mWidget);
|
QMenu* Popup = new QMenu(mWidget);
|
||||||
|
@ -746,6 +749,7 @@ void lcView::OnDraw()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const lcPreferences& Preferences = lcGetPreferences();
|
const lcPreferences& Preferences = lcGetPreferences();
|
||||||
|
const bool DrawOverlays = mWidget != nullptr;
|
||||||
const bool DrawInterface = mWidget != nullptr && mViewType == lcViewType::View;
|
const bool DrawInterface = mWidget != nullptr && mViewType == lcViewType::View;
|
||||||
|
|
||||||
mScene->SetAllowLOD(Preferences.mAllowLOD && mWidget != nullptr);
|
mScene->SetAllowLOD(Preferences.mAllowLOD && mWidget != nullptr);
|
||||||
|
@ -860,13 +864,13 @@ void lcView::OnDraw()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DrawInterface)
|
if (DrawInterface)
|
||||||
{
|
|
||||||
mScene->DrawInterfaceObjects(mContext);
|
mScene->DrawInterfaceObjects(mContext);
|
||||||
|
|
||||||
|
if (DrawOverlays)
|
||||||
|
{
|
||||||
mContext->SetLineWidth(1.0f);
|
mContext->SetLineWidth(1.0f);
|
||||||
|
|
||||||
if (Preferences.mDrawAxes)
|
DrawAxes();
|
||||||
DrawAxes();
|
|
||||||
|
|
||||||
lcTool Tool = gMainWindow->GetTool();
|
lcTool Tool = gMainWindow->GetTool();
|
||||||
lcModel* ActiveModel = GetActiveModel();
|
lcModel* ActiveModel = GetActiveModel();
|
||||||
|
@ -883,10 +887,9 @@ void lcView::OnDraw()
|
||||||
DrawRotateViewOverlay();
|
DrawRotateViewOverlay();
|
||||||
|
|
||||||
mViewSphere->Draw();
|
mViewSphere->Draw();
|
||||||
}
|
|
||||||
|
|
||||||
if (mWidget != nullptr)
|
|
||||||
DrawViewport();
|
DrawViewport();
|
||||||
|
}
|
||||||
|
|
||||||
mContext->ClearResources();
|
mContext->ClearResources();
|
||||||
}
|
}
|
||||||
|
@ -985,6 +988,25 @@ void lcView::DrawViewport() const
|
||||||
|
|
||||||
void lcView::DrawAxes() 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);
|
// glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
const float Verts[28 * 3] =
|
const float Verts[28 * 3] =
|
||||||
|
|
Loading…
Add table
Reference in a new issue