MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / updateSelection

Method updateSelection

Engine/source/Verve/VPath/VPathEditor.cpp:414–465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412//-----------------------------------------------------------------------------
413
414bool VPathEditor::updateSelection( const Gui3DMouseEvent &pEvent )
415{
416 const Point3F pt0 = pEvent.pos;
417 const Point3F pt1 = pEvent.pos + pEvent.vec * gProjectDistance;
418
419 RayInfo ri;
420 if ( !gServerContainer.collideBox( pt0, pt1, MarkerObjectType, &ri ) )
421 {
422 // No Object.
423 return false;
424 }
425
426 VPath *path = dynamic_cast<VPath*>( ri.object );
427 if ( !path )
428 {
429 // No Path Object.
430 return false;
431 }
432
433 // No Node.
434 S32 nodeIndex = -1;
435
436 for ( VPathNodeIterator itr = path->mNodeList.begin(); itr != path->mNodeList.end(); itr++ )
437 {
438 VPathNode *node = ( *itr );
439
440 Point3F projPosition;
441 project( node->getWorldPosition(), &projPosition );
442
443 if ( projPosition.z <= 0.0f )
444 {
445 continue;
446 }
447
448 const Point2I rectHalfSize( 8, 8 );
449 const Point2I screenPosition( ( S32 )projPosition.x, ( S32 )projPosition.y );
450 const RectI screenRect( screenPosition - rectHalfSize, 2 * rectHalfSize );
451
452 // Mouse Close Enough?
453 if ( screenRect.pointInRect( pEvent.mousePoint ) )
454 {
455 // Select Node.
456 nodeIndex = ( itr - path->mNodeList.begin() );
457 }
458 }
459
460 // Set Selection.
461 updateSelection( path, nodeIndex );
462
463 // Valid Selection.
464 return true;
465}
466
467void VPathEditor::updateSelection( VPath *pPathObject, const S32 &pNodeIndex )
468{

Callers 3

VPathEditor.cppFile · 0.45
DefineEngineMethodFunction · 0.45
undoMethod · 0.45

Calls 12

dSprintfFunction · 0.85
executefFunction · 0.85
pointInRectMethod · 0.80
mulPMethod · 0.80
getIdMethod · 0.65
collideBoxMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getWorldPositionMethod · 0.45
getNodeMethod · 0.45
setMatrixMethod · 0.45
getWorldRotationMethod · 0.45

Tested by

no test coverage detected