- on mesh loading the best rendering tab parameters (according to the mesh primitive) is set by default

This commit is contained in:
Guido Ranzuglia granzuglia 2016-10-13 09:05:59 +00:00
parent 78abc399b7
commit 16f381ee86
3 changed files with 40 additions and 2 deletions

View File

@ -781,6 +781,34 @@ void LayerDialog::reset()
_applytovis->setChecked(false);
}
void LayerDialog::setCurrentTab(const MLRenderingData& dt)
{
if ((mw == NULL) || (mw->meshDoc() == NULL) || (mw->meshDoc()->mm() == NULL))
return;
MLRenderingAction* act = NULL;
int id = mw->meshDoc()->mm()->id();
if (dt.isPrimitiveActive(MLRenderingData::PR_SOLID))
{
act = new MLRenderingSolidAction(id, NULL);
}
else
{
if (dt.isPrimitiveActive(MLRenderingData::PR_WIREFRAME_EDGES))
{
act = new MLRenderingWireAction(id, NULL);
}
else
{
if (dt.isPrimitiveActive(MLRenderingData::PR_POINTS))
{
act = new MLRenderingPointsAction(id, NULL);
}
}
}
actionActivated(act);
delete act;
}
void LayerDialog::updateRenderingParametersTab(int meshid,const MLRenderingData& dt )
{
if (_tabw != NULL)

View File

@ -117,6 +117,7 @@ public:
void updateDecoratorParsView();
void updateRenderingParametersTab(int meshid,const MLRenderingData& dt);
void reset();
void setCurrentTab(const MLRenderingData& dt);
MLRenderingParametersTab* createRenderingParametersTab();
protected:
void keyPressEvent ( QKeyEvent * event );

View File

@ -2717,8 +2717,17 @@ bool MainWindow::importMeshWithLayerManagement(QString fileName)
globrendtoolbar->setEnabled(false);
bool res = importMesh(fileName,false);
globrendtoolbar->setEnabled(true);
if (layerDialog != NULL)
showLayerDlg(layervisible || meshDoc()->meshList.size());
if (layerDialog != NULL)
{
showLayerDlg(layervisible || meshDoc()->meshList.size());
MLSceneGLSharedDataContext* cont = currentViewContainer()->sharedDataContext();
if ((cont != NULL) && (GLA() != NULL) && (meshDoc() != NULL) && (meshDoc()->mm() != NULL))
{
MLRenderingData dt;
cont->getRenderInfoPerMeshView(meshDoc()->mm()->id(), GLA()->context(), dt);
layerDialog->setCurrentTab(dt);
}
}
return res;
}