Share

Node Level Hit Testing

If a plug-in wants to perform hit testing of nodes in the scene it may use the following methods of the Interface class.

  • Interface::PickNode() - This method hit tests the screen position for nodes and returns a INode pointer if one is hit, NULL otherwise.
  • Interface::SubObHitTest() - This method performs a sub-object hit test. You may access the number of hits using: ViewExp::NumSubObjHits(). To return a list of the hits use ViewExp::GetCtrlHitList().

The following code demonstrates the use of this method:

BOOL GenControlSelectionProcessor::HitTest(
   ViewExp *vpt, IPoint2 *p, int type, int flags )
{
   vpt->ClearCtrlHitList();
   ip->SubObHitTest(ip-> GetTime(),type,ip->GetCrossing(),flags,p,vpt);
   if (vpt->GetCtrlHitList().First())
   {
     return TRUE;
   }
   else
   {
     return FALSE;
   }
}

Was this information helpful?