ezQtMeshAssetDocumentWindow::ezQtMeshAssetDocumentWindow(ezMeshAssetDocument* pDocument) : ezQtEngineDocumentWindow(pDocument) { // Menu Bar { ezQtMenuBarActionMapView* pMenuBar = static_cast<ezQtMenuBarActionMapView*>(menuBar()); ezActionContext context; context.m_sMapping = "MeshAssetMenuBar"; context.m_pDocument = pDocument; context.m_pWindow = this; pMenuBar->SetActionContext(context); } // Tool Bar { ezQtToolBarActionMapView* pToolBar = new ezQtToolBarActionMapView("Toolbar", this); ezActionContext context; context.m_sMapping = "MeshAssetToolBar"; context.m_pDocument = pDocument; context.m_pWindow = this; pToolBar->SetActionContext(context); pToolBar->setObjectName("MeshAssetWindowToolBar"); addToolBar(pToolBar); } // 3D View ezQtViewWidgetContainer* pContainer = nullptr; { SetTargetFramerate(25); m_ViewConfig.m_Camera.LookAt(ezVec3(-1.6, 0, 0), ezVec3(0, 0, 0), ezVec3(0, 0, 1)); m_ViewConfig.ApplyPerspectiveSetting(90); m_pViewWidget = new ezQtOrbitCamViewWidget(this, &m_ViewConfig); m_pViewWidget->ConfigureOrbitCameraVolume(ezVec3(0, 0, 1), ezVec3(10.0f), ezVec3(-5, 1, 2)); AddViewWidget(m_pViewWidget); pContainer = new ezQtViewWidgetContainer(this, m_pViewWidget, "MeshAssetViewToolBar"); setCentralWidget(pContainer); } // Property Grid { ezQtDocumentPanel* pPropertyPanel = new ezQtDocumentPanel(this); pPropertyPanel->setObjectName("MeshAssetDockWidget"); pPropertyPanel->setWindowTitle("Mesh Properties"); pPropertyPanel->show(); ezQtPropertyGridWidget* pPropertyGrid = new ezQtPropertyGridWidget(pPropertyPanel, pDocument); pPropertyPanel->setWidget(pPropertyGrid); addDockWidget(Qt::DockWidgetArea::RightDockWidgetArea, pPropertyPanel); pDocument->GetSelectionManager()->SetSelection(pDocument->GetObjectManager()->GetRootObject()->GetChildren()[0]); } FinishWindowCreation(); QueryObjectBBox(0); }
void ezQtKrautTreeAssetDocumentWindow::SendRedrawMsg() { // do not try to redraw while the process is crashed, it is obviously futile if (ezEditorEngineProcessConnection::GetSingleton()->IsProcessCrashed()) return; for (auto pView : m_ViewWidgets) { pView->SetEnablePicking(false); pView->UpdateCameraInterpolation(); pView->SyncToEngine(); } QueryObjectBBox(1); }
void ezQtKrautTreeAssetDocumentWindow::ProcessMessageEventHandler(const ezEditorEngineDocumentMsg* pMsg) { if (pMsg->GetDynamicRTTI()->IsDerivedFrom<ezQuerySelectionBBoxResultMsgToEditor>()) { const ezQuerySelectionBBoxResultMsgToEditor* pMessage = static_cast<const ezQuerySelectionBBoxResultMsgToEditor*>(pMsg); if (pMessage->m_vCenter.IsValid() && pMessage->m_vHalfExtents.IsValid() && pMessage->m_vHalfExtents.x >= 0 && pMessage->m_vHalfExtents.y >= 0 && pMessage->m_vHalfExtents.z >= 0) { m_pViewWidget->GetOrbitCamera()->SetOrbitVolume(pMessage->m_vCenter, pMessage->m_vHalfExtents * 2.0f, pMessage->m_vCenter + ezVec3(5, -2, 3) * pMessage->m_vHalfExtents.GetLength() * 0.3f, pMessage->m_iPurpose == 0); } else if (pMessage->m_iPurpose == 0) { // try again QueryObjectBBox(pMessage->m_iPurpose); } return; } ezQtEngineDocumentWindow::ProcessMessageEventHandler(pMsg); }