From c21b60b0388f1b3c98064556ae73f80e69eb3c55 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 23 Jul 2013 10:24:28 +0000 Subject: [PATCH] Added lazy setting of the UserDataContainer to avoid unncessarily create a UserDataContain when an empty description list is passed to Node::setDescriptions(..) --- src/osg/Node.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/osg/Node.cpp b/src/osg/Node.cpp index b45dc016c..bf0637338 100644 --- a/src/osg/Node.cpp +++ b/src/osg/Node.cpp @@ -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()