Added back-pointers to referenced entities
This commit is contained in:
parent
b7a8661a03
commit
f52744b29c
|
@ -460,6 +460,7 @@ bool WRL1NODE::AddRefNode( WRL1NODE* aNode )
|
||||||
// the same level; for example a Coordinate3 node can be recalled
|
// the same level; for example a Coordinate3 node can be recalled
|
||||||
// at any time to set the current coordinate set.
|
// at any time to set the current coordinate set.
|
||||||
m_Refs.push_back( aNode );
|
m_Refs.push_back( aNode );
|
||||||
|
aNode->addNodeRef( this );
|
||||||
addItem( aNode );
|
addItem( aNode );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -140,9 +140,18 @@ WRL2NODE::~WRL2NODE()
|
||||||
++sBP;
|
++sBP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::list< WRL2NODE* >::iterator sC = m_Refs.begin();
|
||||||
|
std::list< WRL2NODE* >::iterator eC = m_Refs.end();
|
||||||
|
|
||||||
|
while( sC != eC )
|
||||||
|
{
|
||||||
|
(*sC)->delNodeRef( this );
|
||||||
|
++sC;
|
||||||
|
}
|
||||||
|
|
||||||
m_Refs.clear();
|
m_Refs.clear();
|
||||||
std::list< WRL2NODE* >::iterator sC = m_Children.begin();
|
sC = m_Children.begin();
|
||||||
std::list< WRL2NODE* >::iterator eC = m_Children.end();
|
eC = m_Children.end();
|
||||||
|
|
||||||
while( sC != eC )
|
while( sC != eC )
|
||||||
{
|
{
|
||||||
|
@ -416,6 +425,7 @@ bool WRL2NODE::AddRefNode( WRL2NODE* aNode )
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Refs.push_back( aNode );
|
m_Refs.push_back( aNode );
|
||||||
|
aNode->addNodeRef( this );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,19 +195,24 @@ bool WRL2SWITCH::AddRefNode( WRL2NODE* aNode )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !WRL2NODE::AddRefNode( aNode ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// take possession if the node is dangling WRL2_SHAPE
|
// take possession if the node is dangling WRL2_SHAPE
|
||||||
|
|
||||||
if( WRL2_SHAPE == aNode->GetNodeType() && aNode->isDangling() )
|
if( WRL2_SHAPE == aNode->GetNodeType() && aNode->isDangling() )
|
||||||
{
|
{
|
||||||
WRL2NODE* np = aNode->GetParent();
|
WRL2NODE* np = aNode->GetParent();
|
||||||
|
|
||||||
if( NULL != np )
|
if( NULL != np )
|
||||||
aNode->SetParent( this );
|
aNode->SetParent( this );
|
||||||
|
|
||||||
|
if( !WRL2NODE::AddChildNode( aNode ) )
|
||||||
|
{
|
||||||
|
aNode->SetParent( NULL );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !WRL2NODE::AddRefNode( aNode ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -293,9 +293,6 @@ bool WRL2TRANSFORM::AddRefNode( WRL2NODE* aNode )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !WRL2NODE::AddRefNode( aNode ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// take possession if the node is dangling WRL2_SHAPE
|
// take possession if the node is dangling WRL2_SHAPE
|
||||||
|
|
||||||
if( WRL2_SHAPE == aNode->GetNodeType() && aNode->isDangling() )
|
if( WRL2_SHAPE == aNode->GetNodeType() && aNode->isDangling() )
|
||||||
|
@ -304,8 +301,18 @@ bool WRL2TRANSFORM::AddRefNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( NULL != np )
|
if( NULL != np )
|
||||||
aNode->SetParent( this );
|
aNode->SetParent( this );
|
||||||
|
|
||||||
|
|
||||||
|
if( !WRL2NODE::AddChildNode( aNode ) )
|
||||||
|
{
|
||||||
|
aNode->SetParent( NULL );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !WRL2NODE::AddRefNode( aNode ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -228,6 +228,7 @@ bool X3DIFACESET::AddRefNode( X3DNODE* aNode )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_Refs.push_back( aNode );
|
m_Refs.push_back( aNode );
|
||||||
|
aNode->addNodeRef( this );
|
||||||
coord = aNode;
|
coord = aNode;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,6 +219,7 @@ bool X3DSHAPE::AddRefNode( X3DNODE* aNode )
|
||||||
if( NULL == appearance )
|
if( NULL == appearance )
|
||||||
{
|
{
|
||||||
m_Refs.push_back( aNode );
|
m_Refs.push_back( aNode );
|
||||||
|
aNode->addNodeRef( this );
|
||||||
appearance = aNode;
|
appearance = aNode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -229,6 +230,7 @@ bool X3DSHAPE::AddRefNode( X3DNODE* aNode )
|
||||||
if( NULL == geometry )
|
if( NULL == geometry )
|
||||||
{
|
{
|
||||||
m_Refs.push_back( aNode );
|
m_Refs.push_back( aNode );
|
||||||
|
aNode->addNodeRef( this );
|
||||||
geometry = aNode;
|
geometry = aNode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -247,6 +247,7 @@ bool X3DTRANSFORM::AddRefNode( X3DNODE* aNode )
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Refs.push_back( aNode );
|
m_Refs.push_back( aNode );
|
||||||
|
aNode->addNodeRef( this );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue