Find a specific node in the graph
| 466 | CreateNodeInternal( pNode, position ); |
| 467 | return pNode; |
| 468 | } |
| 469 | |
| 470 | inline BaseNode* CreateNode( TypeSystem::TypeInfo const* pTypeInfo, Float2 const& position = Float2::Zero ) |
| 471 | { |
| 472 | EE_ASSERT( CanCreateNode( pTypeInfo ) ); |
| 473 | BaseNode* pNode = Cast<BaseNode>( pTypeInfo->CreateType() ); |
| 474 | CreateNodeInternal( pNode, position ); |
| 475 | return pNode; |
| 476 | } |
| 477 | |
| 478 | // Override this for additional control of what nodes can be deleted |
| 479 | virtual bool CanDestroyNode( BaseNode const* pNode ) const { return true; } |
| 480 | |
| 481 | // Helpers |
| 482 | //------------------------------------------------------------------------- |
| 483 | |
| 484 | // Called whenever we change the view to this graph |
| 485 | void OnShowGraph(); |
| 486 | |
| 487 | // Find a specific node in the graph |
| 488 | inline BaseNode* FindNode( UUID const& nodeID, bool checkRecursively = false ) const |
| 489 | { |
| 490 | for ( TTypeInstance<BaseNode> const& nodeInstance : m_nodes ) |
| 491 | { |
| 492 | EE_ASSERT( nodeInstance.IsSet() ); |
| 493 | |
| 494 | BaseNode* pNode = const_cast<BaseNode*>( nodeInstance.Get() ); |
| 495 | |
| 496 | if ( pNode->GetID() == nodeID ) |
| 497 | { |
| 498 | return pNode; |
| 499 | } |
| 500 | |
| 501 | if ( checkRecursively ) |
| 502 | { |
| 503 | if ( pNode->HasChildGraph() ) |
| 504 | { |
| 505 | auto pFoundNode = pNode->GetChildGraph()->FindNode( nodeID, checkRecursively ); |
| 506 | if ( pFoundNode != nullptr ) |
| 507 | { |
no test coverage detected