From 4780d519177021364427b44567fd9a67879435aa Mon Sep 17 00:00:00 2001 From: Sobhan Mohammadpour Date: Fri, 24 Nov 2017 18:20:11 +0330 Subject: [PATCH] set shader and texture paths --- meshlabplugins/render_gdp/meshrender.cpp | 6 +++++- meshlabplugins/render_gdp/shaderDialog.cpp | 6 +++++- plugins_experimental/render_splatpyramid/dialog.cpp | 7 +++++-- plugins_experimental/render_splatpyramid/splat_pyramid.cc | 6 +++++- plugins_unsupported/render_rm/glstateholder.cpp | 12 ++++++++++-- plugins_unsupported/render_rm/rmmeshrender.cpp | 6 +++++- plugins_unsupported/render_rm/rmshaderdialog.cpp | 10 +++++++++- 7 files changed, 44 insertions(+), 9 deletions(-) diff --git a/meshlabplugins/render_gdp/meshrender.cpp b/meshlabplugins/render_gdp/meshrender.cpp index 5841ce6..28e66b3 100644 --- a/meshlabplugins/render_gdp/meshrender.cpp +++ b/meshlabplugins/render_gdp/meshrender.cpp @@ -38,7 +38,11 @@ void MeshShaderRenderPlugin::initActionList() { qaNone->setCheckable(false); actionList << qaNone;*/ - QDir shadersDir = QDir(qApp->applicationDirPath()); +#if defined(Q_OS_LINUX) + QDir shadersDir("/usr/share/meshlab"); +#else + QDir shadersDir = QDir(qApp->applicationDirPath()); +#endif #if defined(Q_OS_WIN) if (shadersDir.dirName() == "debug" || shadersDir.dirName() == "release" || shadersDir.dirName() == "plugins") shadersDir.cdUp(); diff --git a/meshlabplugins/render_gdp/shaderDialog.cpp b/meshlabplugins/render_gdp/shaderDialog.cpp index 1315757..168c0f8 100644 --- a/meshlabplugins/render_gdp/shaderDialog.cpp +++ b/meshlabplugins/render_gdp/shaderDialog.cpp @@ -317,7 +317,11 @@ void ShaderDialog::changeTexturePath(int i) { void ShaderDialog::browseTexturePath(int i) { QFileDialog fd(0,"Choose new texture"); - QDir shadersDir = QDir(qApp->applicationDirPath()); +#if defined(Q_OS_LINUX) + QDir shadersDir("/usr/share/meshlab"); +#else + QDir shadersDir = QDir(qApp->applicationDirPath()); +#endif #if defined(Q_OS_WIN) if (shadersDir.dirName() == "debug" || shadersDir.dirName() == "release") shadersDir.cdUp(); diff --git a/plugins_experimental/render_splatpyramid/dialog.cpp b/plugins_experimental/render_splatpyramid/dialog.cpp index 589ba48..11cf3fe 100644 --- a/plugins_experimental/render_splatpyramid/dialog.cpp +++ b/plugins_experimental/render_splatpyramid/dialog.cpp @@ -122,8 +122,11 @@ void Dialog::changeTexturePath(int i) { void Dialog::browseTexturePath(int i) { QFileDialog fd(0,"Choose new texture"); - - QDir shadersDir = QDir(qApp->applicationDirPath()); +#if defined(Q_OS_LINUX) + QDir shadersDir("/usr/share/meshlab"); +#else + QDir shadersDir = QDir(qApp->applicationDirPath()); +#endif #if defined(Q_OS_WIN) if (shadersDir.dirName() == "debug" || shadersDir.dirName() == "release") shadersDir.cdUp(); diff --git a/plugins_experimental/render_splatpyramid/splat_pyramid.cc b/plugins_experimental/render_splatpyramid/splat_pyramid.cc index a4915d1..75074a6 100644 --- a/plugins_experimental/render_splatpyramid/splat_pyramid.cc +++ b/plugins_experimental/render_splatpyramid/splat_pyramid.cc @@ -85,7 +85,11 @@ void PyramidPointRendererPlugin::Init(QAction *, MeshDocument &md, RenderMode &, objects[i].setRendererType( render_mode ); /// Sets the path to the meshlab's shaders directory - QDir shadersDir = QDir(qApp->applicationDirPath()); +#if defined(Q_OS_LINUX) + QDir shadersDir("/usr/share/meshlab"); +#else + QDir shadersDir = QDir(qApp->applicationDirPath()); +#endif #if defined(Q_OS_WIN) if (shadersDir.dirName() == "debug" || shadersDir.dirName() == "release" || shadersDir.dirName() == "plugins" ) shadersDir.cdUp(); diff --git a/plugins_unsupported/render_rm/glstateholder.cpp b/plugins_unsupported/render_rm/glstateholder.cpp index fa7cdd9..544c6b3 100644 --- a/plugins_unsupported/render_rm/glstateholder.cpp +++ b/plugins_unsupported/render_rm/glstateholder.cpp @@ -75,8 +75,12 @@ UniformValue::UniformValue(UniformVar &v) // if it's a texture, try to load it from the standard path if (!textureFilename.isEmpty()) { +#if defined(Q_OS_LINUX) + QDir textureDir("/usr/share/meshlab"); +#else QDir textureDir = QDir(qApp->applicationDirPath()); - +#endif + #if defined(Q_OS_WIN) if (textureDir.dirName() == "debug" || textureDir.dirName() == "release" || @@ -158,7 +162,11 @@ void UniformValue::updateUniformVariableValuesFromDialog(int rowIdx, int colIdx, // * choose the filename with a dialog (55 by convention) if (rowIdx == 5 && colIdx == 5) { QFileDialog fd(0, "Choose new texture"); - QDir texturesDir = QDir(qApp->applicationDirPath()); +#if defined(Q_OS_LINUX) + QDir textureDir("/usr/share/meshlab"); +#else + QDir textureDir = QDir(qApp->applicationDirPath()); +#endif #if defined(Q_OS_WIN) if (texturesDir.dirName() == "debug" || diff --git a/plugins_unsupported/render_rm/rmmeshrender.cpp b/plugins_unsupported/render_rm/rmmeshrender.cpp index 9e516d2..f367842 100644 --- a/plugins_unsupported/render_rm/rmmeshrender.cpp +++ b/plugins_unsupported/render_rm/rmmeshrender.cpp @@ -63,7 +63,11 @@ QList RmMeshShaderRenderPlugin::actions() void RmMeshShaderRenderPlugin::initActionList() { - QDir shadersDir = QDir(qApp->applicationDirPath()); +#if defined(Q_OS_LINUX) + QDir shadersDir("/usr/share/meshlab/shaders"); +#else + QDir shadersDir = QDir(qApp->applicationDirPath()); +#endif #if defined(Q_OS_WIN) if (shadersDir.dirName() == "debug" || shadersDir.dirName() == "release" || diff --git a/plugins_unsupported/render_rm/rmshaderdialog.cpp b/plugins_unsupported/render_rm/rmshaderdialog.cpp index 1f6c02b..6c8af80 100644 --- a/plugins_unsupported/render_rm/rmshaderdialog.cpp +++ b/plugins_unsupported/render_rm/rmshaderdialog.cpp @@ -332,7 +332,11 @@ void RmShaderDialog::fillTabsWithPass(int index) QFileInfo finfo(v.textureFilename); + #if defined(Q_OS_LINUX) + QDir textureDir("/usr/share/meshlab"); + #else QDir textureDir = QDir(qApp->applicationDirPath()); + #endif #if defined(Q_OS_WIN) if (textureDir.dirName() == "debug" || textureDir.dirName() == "release" || textureDir.dirName() == "plugins" ) textureDir.cdUp(); #elif defined(Q_OS_MAC) @@ -444,7 +448,11 @@ void RmShaderDialog::valuesChanged(const QString & varNameAndIndex ) // choose the filename with a dialog QFileDialog fd(0,"Choose new texture"); - QDir texturesDir = QDir(qApp->applicationDirPath()); +#if defined(Q_OS_LINUX) + QDir textureDir("/usr/share/meshlab"); +#else + QDir textureDir = QDir(qApp->applicationDirPath()); +#endif #if defined(Q_OS_WIN) if (texturesDir.dirName() == "debug" || texturesDir.dirName() == "release") texturesDir.cdUp(); #elif defined(Q_OS_MAC) -- 2.15.0