summaryrefslogtreecommitdiff
blob: a1a4f3f860ab063f8b54c6b648b81439530fb235 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
From 4780d519177021364427b44567fd9a67879435aa Mon Sep 17 00:00:00 2001
From: Sobhan Mohammadpour <www.sobhan.mohammadpour@gmail.com>
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<QAction*> 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