本文整理汇总了C++中BaseNode::parent方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseNode::parent方法的具体用法?C++ BaseNode::parent怎么用?C++ BaseNode::parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseNode
的用法示例。
在下文中一共展示了BaseNode::parent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setWorldFrame
void Noun::setWorldFrame( const Matrix33 & frame )
{
m_WorldFrame = frame;
Matrix33 localFrame( frame );
BaseNode * pBaseNode = parent();
while( pBaseNode != NULL )
{
NodeTransform * pNode = WidgetCast<NodeTransform>( pBaseNode );
if ( pNode != NULL )
localFrame = pNode->frame() * localFrame;
pBaseNode = pBaseNode->parent();
}
setFrame( localFrame );
}
示例2: setWorldPosition
void Noun::setWorldPosition( const Vector3 & position )
{
// convert the world position into a local position by enumerating all parent nodes
m_WorldPosition = position;
Vector3 localPosition( position );
BaseNode * pBaseNode = parent();
while( pBaseNode != NULL )
{
NodeTransform * pNode = WidgetCast<NodeTransform>( pBaseNode );
if ( pNode != NULL )
localPosition = pNode->frame() * (localPosition - pNode->position());
pBaseNode = pBaseNode->parent();
}
setPosition( localPosition );
}
示例3: onAttached
void Noun::onAttached()
{
// call the base class
NodeTransform::onAttached();
// clear the detach flag, just in case a detached noun is re-attached
m_bDetach = false;
// get our zone
BaseNode * pParent = parent();
m_pZone = NULL;
while( pParent != NULL && m_pZone == NULL )
{
m_pZone = WidgetCast<NodeZone>( pParent );
pParent = pParent->parent();
}
// inform our zone that we are attached
if ( m_pZone != NULL )
m_pZone->onAttachNoun( this );
}
示例4: OnCameraZoomextents
void CSceneRender::OnCameraZoomextents()
{
ScenePort * pDoc = dynamic_cast<ScenePort *>( GetDocument() );
ASSERT( pDoc );
m_TargetPosition = Vector3(0,0,0);
m_TargetDistance = 50.0f;
if ( pDoc->m_pSelectedNode )
{
// find the world position of the selected node
BaseNode * pBaseNode = pDoc->m_pSelectedNode->getCachedNode();
if ( pBaseNode )
{
// get the hull of the selected node
BoxHull hull( pBaseNode->hull() );
Vector3 position( 0.0f );
while( pBaseNode )
{
if ( dynamic_cast< NodeTransform * >( pBaseNode ) )
{
NodeTransform * pNode = (NodeTransform *)pBaseNode;
position = (~pNode->frame() * position) + pNode->position();
}
pBaseNode = pBaseNode->parent();
}
m_TargetPosition = position;
m_TargetDistance = hull.radius() * 2.0f;
}
}
// redraw the scene
OnUpdate(this,true,NULL);
OnDraw(NULL);
}
示例5: onButtonUp
void WindowButton::onButtonUp()
{
m_ButtonDown = false;
m_Flags &= ~DEPRESSED;
// play select sound
selectSound();
// post message to listeners
postMessage( WB_BUTTONUP, StringHash( name() ), 0 );
// abort any ButtonPopup parents
BaseNode * pParent = parent();
while( pParent != NULL )
{
ButtonPopup * pPopup = WidgetCast<ButtonPopup>( pParent );
if ( pPopup != NULL )
{
pPopup->onButtonAbort();
break;
}
// next parent object
pParent = pParent->parent();
}
}