Rhino C++ API  8.13
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
CRhinoObjectGrips Class Reference

#include <rhinoSdkGrips.h>

Public Member Functions

 CRhinoObjectGrips (CRhinoGripObject::GRIP_TYPE grips_type)
 
virtual ~CRhinoObjectGrips ()
 
virtual CRhinoObjectDeleteGrips (ON_SimpleArray< int > &deleted_grips)
 
virtual void Draw (CRhinoDrawGripsSettings &dgs)
 
int GetCaptives (ON_SimpleArray< CRhinoObject * > &captives, bool bWithGripsOn=true) const
 
virtual int GetGripStatus (ON_SimpleArray< CRhinoGripStatus > &grip_status) const
 
virtual int GetNeighborGrips (int grip_index, ON_SimpleArray< CRhinoGripObject * > &neighbor_grips, bool bWrap) const
 
virtual bool HasGripsSelected (bool bCheckAllGrips=false) const
 
bool IsCustom (ON_UUID custom_grips_id) const
 
virtual const ON_MorphControlMorphControl () const
 
virtual CRhinoGripObjectNeighborGrip (int grip_index, int dr, int ds, int dt, bool bWrap) const
 
virtual CRhinoLightNewLightObject (bool bCopy)
 
virtual CRhinoObjectNewObject ()
 
virtual const ON_NurbsCageNurbsCage () const
 
virtual CRhinoGripObjectNurbsCageGrip (int cv_i, int cv_j, int cv_k) const
 
virtual const ON_NurbsCurveNurbsCurve () const
 
virtual CRhinoGripObjectNurbsCurveGrip (int cv_i) const
 
virtual const ON_NurbsSurfaceNurbsSurface () const
 
virtual CRhinoGripObjectNurbsSurfaceGrip (int cv_i, int cv_j) const
 
virtual void Reset ()
 
virtual void ResetMeshes ()
 
virtual void SelectGrips (bool bSelect=true, bool bSynchHighlight=true, bool bPersistentSelect=true)
 
bool SetGripStatus (const ON_SimpleArray< CRhinoGripStatus > &grip_status)
 
virtual void UpdateMesh (ON::mesh_type mesh_type_hint)
 
virtual void UpdateWidgetGeometry ()
 

Static Public Member Functions

static bool IsCustom (const class CRhinoObjectGrips *grips, ON_UUID custom_grips_id)
 

Public Attributes

const CRhinoGripObject::GRIP_TYPE m__grips_type
 Type of grips. More...
 
bool m_bGripsMoved
 
bool m_bNewLocation
 
ON_UuidList m_captive_object_id
 
ON_SimpleArray< CRhinoGripDirectionsm_grip_directions
 Optional list of grip directions. More...
 
ON_SimpleArray< CRhinoGripObject * > m_grip_list
 List of all the grips. More...
 
ON_UUID m_grips_id
 
CRhinoObjectm_owner_object
 CRhinoObject owner of the grips. More...
 

Static Public Attributes

static const ON_UUID CustomCurveEditPointGripsId
 
static const ON_UUID CustomSubDEditPointGripsId
 

Constructor & Destructor Documentation

◆ CRhinoObjectGrips()

CRhinoObjectGrips::CRhinoObjectGrips ( CRhinoGripObject::GRIP_TYPE  grips_type)

◆ ~CRhinoObjectGrips()

virtual CRhinoObjectGrips::~CRhinoObjectGrips ( )
virtual

Member Function Documentation

◆ DeleteGrips()

virtual CRhinoObject* CRhinoObjectGrips::DeleteGrips ( ON_SimpleArray< int > &  deleted_grips)
virtual

Description: Rhino calls DeleteGrips() when some of the object's grips are deleted. If the object supports grip deletion, like meshes, then DeleteGrips() should create a new object by deleting the indicated grips. Returns: Pointer to the new object if successful. Rhino will take care of adding this object to the document.

◆ Draw()

virtual void CRhinoObjectGrips::Draw ( CRhinoDrawGripsSettings dgs)
virtual

Description: The default draws the grips. Override if you need to draw dynamic stuff and then call CRhinoObjectGrips::Draw() to draw the grips themselves. Parameters: dgs - [in]

◆ GetCaptives()

int CRhinoObjectGrips::GetCaptives ( ON_SimpleArray< CRhinoObject * > &  captives,
bool  bWithGripsOn = true 
) const

Description: Uses the m_captive_object_id[] list to get pointers to captive objects that are in the document. Parameters: captives -[out] Captives are appened to this array. bWithGripsOn - [in] If true, only captives with grips on are appended Returns: Number of objects appended to captives[].

◆ GetGripStatus()

virtual int CRhinoObjectGrips::GetGripStatus ( ON_SimpleArray< CRhinoGripStatus > &  grip_status) const
virtual

Description: Appends the status of the grips to the grip_status[] array. Parameters: grip_status - [out] Returns: Number of visible grips.

◆ GetNeighborGrips()

virtual int CRhinoObjectGrips::GetNeighborGrips ( int  grip_index,
ON_SimpleArray< CRhinoGripObject * > &  neighbor_grips,
bool  bWrap 
) const
virtual

Description: Get all adjacent grips. Parameters: grip_index - [in] index of grip where the search begins neighbor_grips - [out] neighbors are appended to this array bWrap - [in] If true and object is "closed", the search will wrap.
Returns: number of grips appended to neighbor_grips[] array.

◆ HasGripsSelected()

virtual bool CRhinoObjectGrips::HasGripsSelected ( bool  bCheckAllGrips = false) const
virtual

Description: Query the selection state of an object's grips. Parameters: bCheckAllGrips - [in] If false, HasGripsSelected() will return true if any grips are selected. If true, HasGripsSelected() will return true if all grips are selected.
Returns: True if all grips are selected or at least one grip is selected and bCheckAllGrips is false.

◆ IsCustom() [1/2]

static bool CRhinoObjectGrips::IsCustom ( const class CRhinoObjectGrips grips,
ON_UUID  custom_grips_id 
)
static

Parameters: grips - [in] custom_grips_id - [in]
Returns: True if grips are custom grips with the specified custom grips id.

◆ IsCustom() [2/2]

bool CRhinoObjectGrips::IsCustom ( ON_UUID  custom_grips_id) const

Parameters: custom_grips_id - [in] Returns: True if this are custom grips with the specified custom grips id.

◆ MorphControl()

virtual const ON_MorphControl* CRhinoObjectGrips::MorphControl ( ) const
virtual

Description: If the grips control a morph control, this returns a pointer to that morph controle. You can look at but you must NEVER change this cage. Returns: A pointer to a morph control or NULL.

◆ NeighborGrip()

virtual CRhinoGripObject* CRhinoObjectGrips::NeighborGrip ( int  grip_index,
int  dr,
int  ds,
int  dt,
bool  bWrap 
) const
virtual

Description: Get neighbors. Parameters: grip_index - [in] index of grip where the search begins dr - [in 1 = next grip in the first parameter direction -1 = prev grip in the first parameter direction ds - [in] 1 = next grip in the second parameter direction -1 = prev grip in the second parameter direction dt - [in] 1 = next grip in the third parameter direction -1 = prev grip in the third parameter direction bWrap - [in] If true and object is "closed", the search will wrap.
Returns: Pointer to the desired neighbor or NULL if there is no neighbor

◆ NewLightObject()

virtual CRhinoLight* CRhinoObjectGrips::NewLightObject ( bool  bCopy)
virtual

Description: Rhino calls NewLightObject() when it wants a new light that is calculated from the current grip locations. This happens once at the end of a grip drag. Parameters: bCopy - [in] If true, the light object the grips are on is left in place and a new light is added to the light table. If false, the light object is replaced. Returns: Pointer to the new light if successful. The new light is in the light table.

◆ NewObject()

virtual CRhinoObject* CRhinoObjectGrips::NewObject ( )
virtual

Description: If the grips control just one object, then override NewObject(). When NewObject() is called, return an new object calculated from the current grip locations.
This happens once at the end of a grip drag. Returns: NULL or a new object whose shape is calculated from the current grip locations. This object should not be added to the document. Remarks: This function is not used for lights.

◆ NurbsCage()

virtual const ON_NurbsCage* CRhinoObjectGrips::NurbsCage ( ) const
virtual

Description: If the grips control a NURBS cage, this returns a pointer to that cage. You can look at but you must NEVER change this cage. Returns: A pointer to a NURBS cage or NULL.

◆ NurbsCageGrip()

virtual CRhinoGripObject* CRhinoObjectGrips::NurbsCageGrip ( int  cv_i,
int  cv_j,
int  cv_k 
) const
virtual

Description: If the grips are control points of a NURBS cage, then this gets the index of the grip that controls the (i,j,k)-th cv. Parameters: cv_i - [in] cv_j - [in] cv_k - [in] Returns: A grip controlling a NURBS cage CV or NULL.

◆ NurbsCurve()

virtual const ON_NurbsCurve* CRhinoObjectGrips::NurbsCurve ( ) const
virtual

Description: If the grips control a NURBS curve, this returns a pointer to that curve. You can look at but you must NEVER change this curve. Returns: A pointer to a NURBS curve or NULL.

◆ NurbsCurveGrip()

virtual CRhinoGripObject* CRhinoObjectGrips::NurbsCurveGrip ( int  cv_i) const
virtual

Description: If the grips are control points of a NURBS curve, then this gets the index of the grip that controls the i-th cv. Parameters: cv_i - [in] Returns: A grip controlling a NURBS curve CV or NULL.

◆ NurbsSurface()

virtual const ON_NurbsSurface* CRhinoObjectGrips::NurbsSurface ( ) const
virtual

Description: If the grips control a NURBS surface, this returns a pointer to that surface. You can look at but you must NEVER change this surface. Returns: A pointer to a NURBS surface or NULL.

◆ NurbsSurfaceGrip()

virtual CRhinoGripObject* CRhinoObjectGrips::NurbsSurfaceGrip ( int  cv_i,
int  cv_j 
) const
virtual

Description: If the grips are control points of a NURBS surface, then this gets the index of the grip that controls the (i,j)-th cv. Parameters: cv_i - [in] cv_j - [in] Returns: A grip controlling a NURBS surface CV or NULL.

◆ Reset()

virtual void CRhinoObjectGrips::Reset ( )
virtual

End custom grips interface Begin all grips virtual function interface All types of grips (built-in and custom) override the following functions. Description: Resets location of all grips to original spots and cleans up stuff that was created by dynamic dragging. This is required when dragging is canceled or in the Copy command when grips are "copied". This function should not destroy the current grips and make new ones because the grips may be in a list someplace (like in the copy command).

The default CRhinoObjectGrips::Reset() takes care of the grip location issues. The override should clean up dynamic workspace stuff and can call CRhinoObjectGrips::Reset() to handle resetting grip locations.

◆ ResetMeshes()

virtual void CRhinoObjectGrips::ResetMeshes ( )
virtual

Description: Just before Rhino turns off object grips, it calls this function. If you have modified any object display information, you must override this function and restore the display information to its original state.

Remarks: This function is poorly named. It harkens back to a simpler time in the late 1990s.

◆ SelectGrips()

virtual void CRhinoObjectGrips::SelectGrips ( bool  bSelect = true,
bool  bSynchHighlight = true,
bool  bPersistentSelect = true 
)
virtual

Description: If an object has grips turned on, SelectGrips() can be used to change the selection state of the object's grips. Parameters: bSelect - [in] true to select, false to unselect bSynchHighlight - [in] if true, highlight state is synchronized with selection state. bPersistentSelect - [in] if true, grips are persitently selected. See Also: CRhinoObject::HasGripsSelected

◆ SetGripStatus()

bool CRhinoObjectGrips::SetGripStatus ( const ON_SimpleArray< CRhinoGripStatus > &  grip_status)

End all grips virtual function interface Description: Set grip status. This is useful in commands that replace and copy objects. Parameters: grip_status - [in] Returns: True if status was restored.

◆ UpdateMesh()

virtual void CRhinoObjectGrips::UpdateMesh ( ON::mesh_type  mesh_type_hint)
virtual

Description: Just before Rhino draws an object with grips on, it calls UpdateMesh() to update display information that will be used in the near future.

If "m_bNewLocation" is true, update your dynamic display information and then set m_bNewLocation to false. If "m_bNewLocation" is false, do nothing.

Parameters: mesh_type_hint - [in] Ideally, design your override so it can ignore this parameter. At best, treat the parameter as a hint for what will occur in the near future.

ON::mesh_type::analysis_mesh The grips parent object is currently in some sort of visual analsis mode (false color curvature, draft, edges, ...) and at some point in the near future the grips parent object and any dynamic display information will be shown. ON::mesh_type::render_mesh At some point in the near future the grips parent object and any dynamic display information will be used in a "shaded" viewport setting. It's common for there to be several viewports in both shaded and wireframe contexts. ON::mesh_type::any_type At some point in the near future the grips parent object and any dynamic display information will be used in a "wireframe" viewport setting. It's common for there to be several viewports in both shaded and wireframe contexts.

Remarks: This function is poorly named and the parameter is not all that useful. Both harken back to a simpler time in the late 1990s.

◆ UpdateWidgetGeometry()

virtual void CRhinoObjectGrips::UpdateWidgetGeometry ( )
virtual

Description: Updates the widget geometry based on e.g. grip dragging. Notes: Does not do drawing. See also: CRhinoObjectGrips::Draw()

Member Data Documentation

◆ CustomCurveEditPointGripsId

const ON_UUID CRhinoObjectGrips::CustomCurveEditPointGripsId
static

Begin custom grips interface NOTE: Custom grips ids do not have to appear here. They can be hidden in implementation files.

The ids here are for core Rhino grips, like edit points, and are provided so it is easy for 3rd party plug-ins to determine what type of core Rhino grips are enabled. CustomCurveEditPointGripsId makes a grip at every curve Greville point. The EditPtOn command applied to a SubD enables these grips.

◆ CustomSubDEditPointGripsId

const ON_UUID CRhinoObjectGrips::CustomSubDEditPointGripsId
static

CustomSubDEditPointGripsId makes a grip for every subd surface point. The EditPtOn command applied to a SubD enables these grips.

◆ m__grips_type

const CRhinoGripObject::GRIP_TYPE CRhinoObjectGrips::m__grips_type

Type of grips.

◆ m_bGripsMoved

bool CRhinoObjectGrips::m_bGripsMoved

If m_bGripsMoved is true if some of the grips have ever been moved CRhinoGripObject::NewLocation() sets m_bGripsMoved=true Nothting else should ever change the value of m_bGripsMoved.

◆ m_bNewLocation

bool CRhinoObjectGrips::m_bNewLocation

Returns: True if grips are currently begin dragged. true if some of the grips have been moved. CRhinoGripObject::NewLocation() sets m_bNewLocation=true Derived classes can set m_bNewLocation to false after updating temporary display information.

◆ m_captive_object_id

ON_UuidList CRhinoObjectGrips::m_captive_object_id

Optional list of captive object ids. Use when these object grips deform more than just the owner of these gripss.

◆ m_grip_directions

ON_SimpleArray<CRhinoGripDirections> CRhinoObjectGrips::m_grip_directions

Optional list of grip directions.

◆ m_grip_list

ON_SimpleArray<CRhinoGripObject*> CRhinoObjectGrips::m_grip_list

List of all the grips.

◆ m_grips_id

ON_UUID CRhinoObjectGrips::m_grips_id

This id is for distinguishing between different types of custom grips.

◆ m_owner_object

CRhinoObject* CRhinoObjectGrips::m_owner_object

CRhinoObject owner of the grips.