Permalink
Browse files

Added lazy setting of the UserDataContainer to avoid unncessarily cre…

…ate a UserDataContain when an empty description list is passed to Node::setDescriptions(..)
  • Loading branch information...
1 parent 5bf3233 commit 6836633de92b5c85988548415462a7b4da3be76b @osg-training-guest osg-training-guest committed Jul 23, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/osg/Node.cpp
View
@@ -475,7 +475,11 @@ bool Node::containsOccluderNodes() const
void Node::setDescriptions(const DescriptionList& descriptions)
{
- getOrCreateUserDataContainer()->setDescriptions(descriptions);
+ // only assign a description list (and associated UseDataContainer) if we need to.
+ if (!descriptions.empty() || getUserDataContainer())
+ {
+ getOrCreateUserDataContainer()->setDescriptions(descriptions);
+ }
}
Node::DescriptionList& Node::getDescriptions()

0 comments on commit 6836633

Please sign in to comment.