[C++] Making grips unselectable, unpickable

grips

(Menno Deij - van Rijswijk) #1

For custom objects we want to be able to only show a sub set of the control points (grips). What currently works, is to override int Pick(const CRhinoPickContext& pick_context, class CRhinoObjRefArray& pick_list) const; and only allow a control point to be picked when it is pertinent to do so. So mouse-based picking of control points works.

I find, however, that the commands SelPt and SelAll do not adhere to this, and will select control points that are not supposed to be selectable (they are not drawn, because I have set CRhinoDrawGripSettings::m_grip_status[i].m_bCulled to true and ...m_bVisible to false).

None of the Select functions is virtual, however, so I am at a loss how to accomplish this. Any hints on how to do this?


#2

Hi Menno,

As a side question, do you override Pick as a method of CRhinoGripObject?
How can I allow a control point to be picked depending on its index i (selecting it only when it is under a certain threshold depending on the command)?

Many thanks,
Pablo


(Menno Deij - van Rijswijk) #3

I use custom grips, so I derive my own grip class from CRhinoGripObject. In my class, I override the Pick function like so:

int CMyGrip::Pick(const CRhinoPickContext& pc, class CRhinoObjRefArray& pl) const
{
  if (!IsActive()) return 0;
  return CRhinoGripObject::Pick(pc, pl);
}

(Dale Fugier) #4

Hi Menno,

Yea I think you’re in a tough spot. Ideally, CRhinoObject::IsSelectable should be virtual so you can decide whether or not you want your object selected or not.

https://mcneel.myjetbrains.com/youtrack/issue/RH-38156

– Dale


(Brian Gillespie) #5

RH-38156 is fixed in the latest WIP