Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8556

Custom drawn grips are randomly disappearing (C++)

$
0
0

@gccdragoonkain wrote:

Is there some “bounding region” mechanism or clipping behavior inside CRhinoMeshObject that causes custom grips to be clipped? I’m seeing my lines and points randomly disappear when dragged far away from the “source” object. I’m assuming there’s some bounding region I need to update?

Rendering code for my grips below:

void CRhinoMyObjectGrips::Draw(CRhinoDrawGripsSettings &dgs)
{
  UpdateMyObject();

  if(auto ccModel = controlCage.lock())
  {
	auto editInds = ccModel->getEditMeshTriangles();
	auto editIndsQuad = ccModel->getEditMeshQuads();
	uint3 *triData = (uint3 *)editInds->getData();
	uint4 *quadData = editIndsQuad ? (uint4 *)editIndsQuad->getData() : nullptr;
	int numTris = editInds->getCount()/3;
	int numQuads = editIndsQuad ? editIndsQuad->getCount()/4 : 0;

	for(int i = 0; i < numQuads; i++)
	{
	  dgs.m_dp.DrawDottedLine(m_MyObject_grips[quadData[i].x].GripLocation(), m_MyObject_grips[quadData[i].y].GripLocation());
	  dgs.m_dp.DrawDottedLine(m_MyObject_grips[quadData[i].y].GripLocation(), m_MyObject_grips[quadData[i].z].GripLocation());
	  dgs.m_dp.DrawDottedLine(m_MyObject_grips[quadData[i].z].GripLocation(), m_MyObject_grips[quadData[i].w].GripLocation());
	  dgs.m_dp.DrawDottedLine(m_MyObject_grips[quadData[i].w].GripLocation(), m_MyObject_grips[quadData[i].x].GripLocation());
	}

	for(int i = 0; i < numTris; i++)
	{
	  dgs.m_dp.DrawDottedLine(m_MyObject_grips[triData[i].x].GripLocation(), m_MyObject_grips[triData[i].y].GripLocation());
	  dgs.m_dp.DrawDottedLine(m_MyObject_grips[triData[i].y].GripLocation(), m_MyObject_grips[triData[i].z].GripLocation());
	  dgs.m_dp.DrawDottedLine(m_MyObject_grips[triData[i].z].GripLocation(), m_MyObject_grips[triData[i].x].GripLocation());
	}
  }

  CRhinoObjectGrips::Draw(dgs); //grip points are disappearing too
}

Posts: 5

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 8556

Trending Articles