Skip to content

Commit

Permalink
foreachShaderName() only visits visible shaders
Browse files Browse the repository at this point in the history
assets.lst handling now working for materials. Shader names returned by
foreachShaderName() will no longer include shaders in MTR files listed as
"hidden" in an assets.lst. Although this works at a file level, not an
individual shader level, the required flexibility can still be achieved by
moving all hidden shaders into a single MTR file (e.g. "tdm_hidden.mtr").

Just as with models, hidden shaders are not listed in the tree but still
function correctly in the map itself. They will also still appear on the
Textures tab, which lists materials in use not materials from the mod tree.
  • Loading branch information
Matthew Mott committed Apr 17, 2019
1 parent 235786c commit 2eddbc8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions radiant/shaders/ShaderLibrary.cpp
Expand Up @@ -117,9 +117,10 @@ std::size_t ShaderLibrary::getNumDefinitions()

void ShaderLibrary::foreachShaderName(const ShaderNameCallback& callback)
{
for (const ShaderDefinitionMap::value_type& pair : _definitions)
for (const auto& pair : _definitions)
{
callback(pair.first);
if (pair.second.file.visibility == vfs::Visibility::NORMAL)
callback(pair.first);
}
}

Expand Down

0 comments on commit 2eddbc8

Please sign in to comment.