hey guys... (read brent)

i am trying to cache the PickBuffer each time the user activates this
custom tool (this happens on camera navigation, which is my primary
concern) but not having much luck. the doc suggests if i pass an empty
region i will get the whole view but any subsequent calls i am making to
PickBuffer.GetObjectAtPosition() has returned an invalid reference. is this
doable in the Activate calback? the docs say..."if unavailable in the
current callback or any arguments are invalid then the resulting PickBuffer
will be invalid."

so, are my arguments incorrect or is this not valid in the this callback?

// activate callback, called each time the tool comes active again
CStatus Activate(ToolContext& in_ctxt)
{
  // get a list of selected meshes
  const CString empty;
  CStringArray families;
  families.Add(siMeshFamily);
  Application().GetSelection().GetArray().Filter(empty, families, empty,
m_targets);

  // cache a pick buffer, m_pBuffer is a class member variable where i am
caching it
  m_pBuffer = in_ctxt.GetPickBuffer(x, y, width, height, siPolygonFilter,
m_targets, siShaded);
  LONG x,y;
  in_ctxt.GetMousePosition(x, y);
  CRef l_obj = m_pBuffer.GetObjectAtPosition(x, y);
  Application().LogMessage(L"Activate : " + l_obj.GetAsText());

  return CStatus::OK;
};

any other tips on caching the PickBuffer each time the camera changes?

steven

Reply via email to