From 45c383771a7bee5c7a8bf373c16967cb444d312c Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 9 Jul 2007 19:15:18 +0000 Subject: [PATCH] second addNode() replaces first --- panda/src/pgraph/attribNodeRegistry.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/panda/src/pgraph/attribNodeRegistry.cxx b/panda/src/pgraph/attribNodeRegistry.cxx index fcf94fa6fe..2b1695c6c9 100644 --- a/panda/src/pgraph/attribNodeRegistry.cxx +++ b/panda/src/pgraph/attribNodeRegistry.cxx @@ -43,12 +43,20 @@ AttribNodeRegistry() { // files that reference an attribute node of the same // type and the same name are loaded, they will quietly // be redirected to reference this NodePath. +// +// If there is already a node matching the indicated +// name and type, it will be replaced. //////////////////////////////////////////////////////////////////// void AttribNodeRegistry:: add_node(const NodePath &attrib_node) { nassertv(!attrib_node.is_empty()); MutexHolder holder(_lock); - _entries.insert(Entry(attrib_node)); + + pair result = _entries.insert(Entry(attrib_node)); + if (!result.second) { + // Replace an existing node. + (*result.first)._node = attrib_node; + } } ////////////////////////////////////////////////////////////////////