Skip to content

Commit 3c25924

Browse files
committed
Merge pull request #800 from SCIInstitute/renderer-work
Renderer work
2 parents b33c2df + 4f2c2a6 commit 3c25924

29 files changed

+1604
-254
lines changed

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ MESSAGE(STATUS "Git version commit hash: " "${VERSION_HASHVAR}")
9797
string(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" VERSION_MAJOR "${VERSION_TAG}")
9898
string(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${VERSION_TAG}")
9999
#TODO: make generic
100-
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\-(alpha.[A-Z]+)\\-.*" "\\1" VERSION_PATCH "${VERSION_TAG}")
100+
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\-(alpha.[A-Za-z]+)\\-.*" "\\1" VERSION_PATCH "${VERSION_TAG}")
101101
#TODO: parse SHA
102102
#string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+(.*)" "\\1" VERSION_SHA1 "${VERSION}")
103103
#set(VERSION_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")

src/Core/Algorithms/Base/AlgorithmBase.cc

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,26 @@ void Variable::setValue(const Value& val)
8484
if (boost::get<std::string>(&val))
8585
{
8686
auto stringPath = toString();
87-
if (SCIRun::Core::replaceSubstring(stringPath, AlgorithmParameterHelper::dataDir().string(), AlgorithmParameterHelper::dataDirPlaceholder()))
88-
value_ = stringPath;
89-
return;
87+
{
88+
// TODO #787
89+
// loop through all paths in path list, checking if file in each dir; if one found replace and return
90+
if (SCIRun::Core::replaceSubstring(stringPath, AlgorithmParameterHelper::dataDir().string(), AlgorithmParameterHelper::dataDirPlaceholder()))
91+
{
92+
value_ = stringPath;
93+
return;
94+
}
95+
96+
for (const auto& path : AlgorithmParameterHelper::dataPath())
97+
{
98+
if (SCIRun::Core::replaceSubstring(stringPath, path.string(), AlgorithmParameterHelper::dataDirPlaceholder()))
99+
{
100+
value_ = stringPath;
101+
return;
102+
}
103+
}
104+
105+
return;
106+
}
90107
}
91108
}
92109

@@ -142,7 +159,18 @@ boost::filesystem::path AlgorithmParameter::toFilename() const
142159
{
143160
// TODO #787
144161
// loop through all paths in path list, checking if file exists each time. return first one that exists.
145-
return AlgorithmParameterHelper::dataDir() / stringPath;
162+
auto initialPath = AlgorithmParameterHelper::dataDir() / stringPath;
163+
if (boost::filesystem::exists(initialPath))
164+
return initialPath;
165+
166+
for (const auto& path : AlgorithmParameterHelper::dataPath())
167+
{
168+
auto nextPath = path / stringPath;
169+
if (boost::filesystem::exists(nextPath))
170+
return nextPath;
171+
}
172+
//nothing found, let module deal with it.
173+
return initialPath;
146174
}
147175

148176
boost::filesystem::path p(stringPath);
@@ -197,7 +225,18 @@ std::string AlgorithmParameterHelper::dataDirPlaceholder()
197225
return dataDirPlaceholder_;
198226
}
199227

228+
void AlgorithmParameterHelper::setDataPath(const std::vector<boost::filesystem::path>& paths)
229+
{
230+
paths_ = paths;
231+
}
232+
233+
std::vector<boost::filesystem::path> AlgorithmParameterHelper::dataPath()
234+
{
235+
return paths_;
236+
}
237+
200238
boost::filesystem::path AlgorithmParameterHelper::dataDir_;
239+
std::vector<boost::filesystem::path> AlgorithmParameterHelper::paths_;
201240
std::string AlgorithmParameterHelper::dataDirPlaceholder_;
202241
Mutex AlgorithmParameterHelper::lock_("fsbug");
203242

src/Core/Algorithms/Base/AlgorithmParameterHelper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@ namespace Algorithms {
4646
static boost::filesystem::path dataDir();
4747
static void setDataDirPlaceholder(const std::string& str);
4848
static std::string dataDirPlaceholder();
49+
static std::vector<boost::filesystem::path> dataPath();
50+
static void setDataPath(const std::vector<boost::filesystem::path>& paths);
4951
static Thread::Mutex lock_;
5052
private:
5153
static boost::filesystem::path dataDir_;
5254
static std::string dataDirPlaceholder_;
55+
static std::vector<boost::filesystem::path> paths_;
5356
};
5457

5558
}}}

src/Core/Application/Preferences/Preferences.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,15 @@ std::vector<boost::filesystem::path> Preferences::dataPath() const
8888
void Preferences::addToDataPath(const boost::filesystem::path& path)
8989
{
9090
dataPath_.push_back(path);
91+
AlgorithmParameterHelper::setDataPath(dataPath_);
9192
}
9293

9394
void Preferences::setDataPath(const std::string& dirs)
9495
{
9596
std::vector<std::string> paths;
9697
boost::split(paths, dirs, boost::is_any_of(";"));
9798
std::transform(paths.begin(), paths.end(), std::back_inserter(dataPath_), [](const std::string& p) { return boost::filesystem::path(p); });
99+
AlgorithmParameterHelper::setDataPath(dataPath_);
98100
}
99101

100102

src/Core/Datatypes/Geometry.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ namespace Datatypes {
161161
renderType(renType),
162162
vbo(vbo),
163163
ibo(ibo),
164-
mColorScheme(scheme)
164+
mColorScheme(scheme),
165+
scalar(1.0)
165166
{}
166167

167168
static const char* getName() { return "SpireSubPass"; }
@@ -180,6 +181,7 @@ namespace Datatypes {
180181
RenderType renderType;
181182
SpireVBO vbo;
182183
SpireIBO ibo;
184+
double scalar;
183185

184186
struct Uniform
185187
{

0 commit comments

Comments
 (0)