Notifications
Clear all

[Closed] SDK SimpleObject2 display as markers HitTest

I have an object plugin SimpleObject2 that is displayed in a mesh or markers for vert position. When the object is in mesh mode the HitTest works fine. If I’m in display as markers like…

gw->marker(&pnt, BOX2_MRKR); for each vert, my HitTest does not highlight the markers and it is very difficult to select the plugin.

this is my HitTest() now



if ( ! vpt || ! vpt->IsAlive()){
	DbgAssert(!_T("Doing Display() on invalid viewport!"));
	return FALSE;
}

GraphicsWindow* gw = vpt->getGW();
DWORD rlim = gw->getRndLimits();

HitRegion hitRegion;
MakeHitRegion(hitRegion, type, crossing, 4, p);

Matrix3 tm = inode->GetObjectTM(t);
gw->setTransform(tm);
gw->setRndLimits(rlim);

return 0;



Any thought would really be great.

Thanks

3 Replies

Strange I’m really not sure if I’m in the correct place now. I have removed all from my HitTest() and just left the…

return 1;

and nothing has changed I’m still able to select mesh but not markers. I’m guessing I’m looking in the wrong place

Yo, put this little bit off code into the Hit test function.

GraphicsWindow *gw = vpt->getGW();
   Matrix3 ntm = inode->GetNodeTM(t);
   HitRegion hr;
   MakeHitRegion(hr,type,crossing,4,p);
   gw->setHitRegion(&hr);  
   gw->setRndLimits(((savedLimits =  
   gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
   gw->clearHitCode();  
   
   gw->setTransform(ntm);
   gw->marker(Point3, markertype) // Replace with your own drawing function
   if (gw->checkHitCode())  {
    res = TRUE;   
    vpt->CtrlLogHit(inode,gw->getHitDistance(),0,0);
    gw->clearHitCode();
   }
   gw->setRndLimits(savedLimits); 
   return res;
This is a sort of simplified version from autodesk's help which is here:
[ http://help.autodesk.com/view/3DSMAX/2015/ENU/?guid=__files_GUID_0B01E195_BCA5_4058_9502_03CBCDE23E44_htm ]( http://help.autodesk.com/view/3DSMAX/2015/ENU/?guid=__files_GUID_0B01E195_BCA5_4058_9502_03CBCDE23E44_htm) 
Hopefully that should be enough to get ya started !! :D

That works great! Nice one mate.