On 23/08/2016 at 03:53, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R14
Platform: Windows ;
Language(s) : C++ ;
---------
Hi folks,
I've got GetCursorInfo() in a scene hook plugin, and I'm wanting to find the polygon id and object under the mouse cursor (if any!). I want to be able to do this in standard object mode. The code I have is more for the active scene object, and works only in Mpolygon mode. But I want it to work in object mode. Code as follows:
Bool My_Scene_Hook::GetCursorInfo(BaseSceneHook* node, BaseDocument* doc, BaseDraw* bd, Real x, Real y, BaseContainer& bc)
{
LONG left, top, right, bottom;
bd->GetFrame(&left, &top, &right, &bottom);
// here's where I want to get the object the cursor finds, not which object is active
BaseObject *op = doc->GetActiveObject();
if(!op || op->GetType() != Opolygon)
{
return FALSE;
}
AutoAlloc<ViewportSelect> vs;
if(vs && vs->Init(...))
{
// I test polygon index etc here
return TRUE;
}
return FALSE;
}
In short, I want to be able to find the object and polygon index under the mouse in normal object mode. So the two questions are:
1. How do I test which object is under the cursor? (not just the active object)
2. How do I test GetNearestPolygon() in Mobject mode? (doesn't seem to work unless I'm in Mpolygons mode?)
WP.