Skip to content

Commit

Permalink
#5584: LayerManager::updateNodeVisibility was altering the eLayered f…
Browse files Browse the repository at this point in the history
…lag for every visited node, even if it turns out to be unnecessary. Don't do that, this triggers massive surface-to-material re-linking.
  • Loading branch information
codereader committed Nov 20, 2021
1 parent 2268adf commit e9b256c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions radiantcore/layers/LayerManager.cpp
Expand Up @@ -393,7 +393,7 @@ bool LayerManager::updateNodeVisibility(const scene::INodePtr& node)
const auto& layers = node->getLayers();

// We start with the assumption that a node is hidden
node->enable(Node::eLayered);
bool isHidden = true;

// Cycle through the Node's layers, and show the node as soon as
// a visible layer is found.
Expand All @@ -402,13 +402,22 @@ bool LayerManager::updateNodeVisibility(const scene::INodePtr& node)
if (_layerVisibility[layerId])
{
// The layer is visible, set the visibility to true and quit
node->disable(Node::eLayered);
return true;
isHidden = false;
break;
}
}

// Node is hidden, return FALSE
return false;
if (isHidden)
{
node->enable(Node::eLayered);
}
else
{
node->disable(Node::eLayered);
}

// If node is hidden, return FALSE
return !isHidden;
}

void LayerManager::setSelected(int layerID, bool selected)
Expand Down

0 comments on commit e9b256c

Please sign in to comment.