This commit is contained in:
2008-07-22 12:02:57 +00:00
parent 06f67dd531
commit aec6b78ded
98 changed files with 5733 additions and 818 deletions

View File

@@ -68,7 +68,7 @@ SG_Node* SG_Node::GetSGReplica()
SG_Node* replica = new SG_Node(*this);
if (replica == NULL) return NULL;
ProcessSGReplica(replica);
ProcessSGReplica(&replica);
return replica;
}
@@ -76,25 +76,42 @@ SG_Node* SG_Node::GetSGReplica()
void
SG_Node::
ProcessSGReplica(
SG_Node* replica
SG_Node** replica
){
// Apply the replication call back function.
ActivateReplicationCallback(replica);
if (!ActivateReplicationCallback(*replica))
{
delete (*replica);
*replica = NULL;
return;
}
// clear the replica node of it's parent.
static_cast<SG_Node*>(replica)->m_SGparent = NULL;
static_cast<SG_Node*>(*replica)->m_SGparent = NULL;
if (m_children.begin() != m_children.end())
{
// if this node has children, the replica has too, so clear and clone children
replica->ClearSGChildren();
(*replica)->ClearSGChildren();
NodeList::iterator childit;
for (childit = m_children.begin();childit!=m_children.end();++childit)
{
replica->AddChild((*childit)->GetSGReplica());
SG_Node* childnode = (*childit)->GetSGReplica();
if (childnode)
(*replica)->AddChild(childnode);
}
}
// Nodes without children and without client object are
// not worth to keep, they will just take up CPU
// This can happen in partial replication of hierarchy
// during group duplication.
if ((*replica)->m_children.empty() &&
(*replica)->GetSGClientObject() == NULL)
{
delete (*replica);
*replica = NULL;
}
}