mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Load files from subfolders in texturepacks
Updated and rebased version of a PR by red-001
This commit is contained in:
parent
ae9b1aa177
commit
05d93c7fa1
7 changed files with 63 additions and 19 deletions
|
@ -129,11 +129,12 @@ std::string getTexturePath(const std::string &filename)
|
|||
/*
|
||||
Check from texture_path
|
||||
*/
|
||||
const std::string &texture_path = g_settings->get("texture_path");
|
||||
if (!texture_path.empty()) {
|
||||
std::string testpath = texture_path + DIR_DELIM + filename;
|
||||
for (const auto &path : getTextureDirs()) {
|
||||
std::string testpath = path + DIR_DELIM + filename;
|
||||
// Check all filename extensions. Returns "" if not found.
|
||||
fullpath = getImagePath(testpath);
|
||||
if (!fullpath.empty())
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2388,3 +2389,10 @@ video::ITexture *TextureSource::getShaderFlagsTexture(bool normalmap_present)
|
|||
return getTexture(tname);
|
||||
|
||||
}
|
||||
|
||||
const std::vector<std::string> &getTextureDirs()
|
||||
{
|
||||
static thread_local std::vector<std::string> dirs =
|
||||
fs::GetRecursiveDirs(g_settings->get("texture_path"));
|
||||
return dirs;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue